added event endpoints
This commit is contained in:
8 files changed
+37
-12
No files matched your search
@@ -0,0 +1,15 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::{Endpoint, Events};
|
||||
|
||||
pub const EVENTS_ENDPOINT: Endpoint<Events, ()> = Endpoint::Get {
|
||||
url: "/api/3/events",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const MY_EVENTS_ENDPOINT: Endpoint<Events, ()> = Endpoint::Get {
|
||||
url: "/api/3/events/my",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
use crate::{Room, RoomSet, SchoolClass, SchoolClassSet, StdType, Student, Teacher, TeacherSet};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Events {
|
||||
pub events: Vec<Event>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Event {
|
||||
pub id: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub event_type: EventType,
|
||||
pub times: Vec<EventTime>,
|
||||
pub classes: Vec<SchoolClass>,
|
||||
pub class_sets: Vec<SchoolClassSet>,
|
||||
pub teachers: Vec<Teacher>,
|
||||
pub teacher_sets: Vec<TeacherSet>,
|
||||
pub rooms: Vec<Room>,
|
||||
pub room_sets: Vec<RoomSet>,
|
||||
pub students: Vec<Student>,
|
||||
pub note: Option<String>,
|
||||
pub date_changed: DateTime<FixedOffset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct EventTime {
|
||||
pub whole_day: bool,
|
||||
pub start_time: Option<DateTime<FixedOffset>>,
|
||||
pub end_time: Option<DateTime<FixedOffset>>,
|
||||
}
|
||||
|
||||
pub type EventType = StdType;
|
||||
@@ -0,0 +1,5 @@
|
||||
mod endpoints;
|
||||
mod event;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use event::*;
|
||||
Reference in new issue
Block a user