Compare commits
46
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5430902782
|
||
|
|
1f79570c70 | ||
|
|
4ff2abd485 | ||
|
|
b4e4b03e67
|
||
|
|
7b53c2db88
|
||
|
|
35536247db
|
||
|
|
df592e30f4
|
||
|
|
1b632b8a4c
|
||
|
|
2f86b90cda
|
||
|
|
16cc34d2a7
|
||
|
|
4433026595
|
||
|
|
945497e83d
|
||
|
|
5b002084fb
|
||
|
|
3a0aa1e117
|
||
|
|
48fde73a73
|
||
|
|
b3e6c145a3
|
||
|
|
1d1b7a30f3
|
||
|
|
6236099ae1
|
||
|
|
32b2d69a43
|
||
|
|
01607db3e4
|
||
|
|
dd48a53be9
|
||
|
|
2adf27dbed
|
||
|
|
fedbf019b4
|
||
|
|
e020e52f0f
|
||
|
|
4f50e7abd5
|
||
|
|
4ab89c0666
|
||
|
|
3280306dc0
|
||
|
|
4a83f16a8b
|
||
|
|
442816aa1f
|
||
|
|
9560daf027
|
||
|
|
092fd94abf
|
||
|
|
263568baa4 | ||
|
|
586a259946 | ||
|
|
db527c3056 | ||
|
|
b7e1494ee2
|
||
|
|
5beaf906dd
|
||
|
|
9ac32dd398 | ||
|
|
700b2d1a7d
|
||
|
|
6982bde65a
|
||
|
|
ce4ceac712
|
||
|
|
a49f95b0f9
|
||
|
|
e6f0e329b1
|
||
|
|
21a091a8cd
|
||
|
|
f8b027225f | ||
|
|
e1ae168898
|
||
|
|
64ae0a3821 |
No files matched your search
@@ -7,6 +7,9 @@ on:
|
||||
branches: [ "master" ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
use chrono::Utc;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Absence {
|
||||
pub percentage_threshold: f64, //TODO: cutom type (u8)
|
||||
pub absences: Vec<AbsenceListItem>,
|
||||
pub absences_per_subject: Vec<SubjectAbsence>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsenceListItem {
|
||||
pub date: chrono::DateTime<Utc>,
|
||||
pub unsolved: u16,
|
||||
pub ok: u16,
|
||||
pub missed: u16,
|
||||
pub late: u16,
|
||||
pub soon: u16,
|
||||
pub school: u16,
|
||||
pub distance_teaching: u16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubjectAbsence {
|
||||
pub subject_name: String,
|
||||
pub lessons_count: u16,
|
||||
pub base: u16,
|
||||
pub late: u16,
|
||||
pub soon: u16,
|
||||
pub school: u16,
|
||||
pub distance_teaching: u16,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
use crate::{AbsentType, StdTypeAbbrevNullable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Absence {
|
||||
pub minutes: i64,
|
||||
pub absent_type: AbsentType,
|
||||
pub hour_id: String,
|
||||
pub start: i64,
|
||||
pub duration: i64,
|
||||
pub hour_index: Option<i64>,
|
||||
pub absent_kind_id: Option<String>,
|
||||
pub notice: Option<String>,
|
||||
pub student_id: Option<String>,
|
||||
pub subject: Option<StdTypeAbbrevNullable>,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsenceDay {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub unsolved: u16,
|
||||
pub ok: u16,
|
||||
pub missed: u16,
|
||||
pub late: u16,
|
||||
pub soon: u16,
|
||||
pub school: u16,
|
||||
pub distance_teaching: u16,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
use crate::Absence;
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsenceDayResponse {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub absences: Vec<Absence>,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
use crate::{AbsenceDay, SubjectAbsence};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsenceOverviewResponse {
|
||||
pub percentage_threshold: f64, //TODO: cutom type (u8)
|
||||
pub absences: Vec<AbsenceDay>,
|
||||
pub absences_per_subject: Option<Vec<SubjectAbsence>>,
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use crate::AbsentType;
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsenceRecord {
|
||||
pub minutes: i64,
|
||||
pub absent_type: AbsentType,
|
||||
pub hour_id: Option<String>,
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub start: i64,
|
||||
pub duration: i64,
|
||||
pub absent_kind_id: Option<String>,
|
||||
pub notice: Option<String>,
|
||||
pub student_id: Option<String>,
|
||||
pub apology_id: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
use crate::{AbsentType, StdType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsenceTypeOption {
|
||||
pub absent_type: AbsentType,
|
||||
pub absent_kind_enabled: bool,
|
||||
pub absent_kind_required: bool,
|
||||
pub absent_note_enabled: bool,
|
||||
pub next_absent_type: AbsentType,
|
||||
pub absent_kinds: Vec<StdType>,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum AbsentType {
|
||||
Absent,
|
||||
AbsentLate,
|
||||
AbsentMiss,
|
||||
AbsentOk,
|
||||
AbsentSchool,
|
||||
AbsentSoon,
|
||||
DistanceTeaching,
|
||||
NoAbsent,
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
use crate::{
|
||||
AbsenceOverviewResponse, ContentType, Endpoint, ExcuseAbsenceResponse,
|
||||
StudentTimetableAbsenceResponse,
|
||||
};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const CAN_STUDENT_EXCUSE_ABSENCE_ENDPOINT: Endpoint<bool, ()> = Endpoint::Get {
|
||||
url: "/api/3/absence/canexcuse/{studentId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GET_STUDENT_ABSENCE_ENDPOINT: Endpoint<AbsenceOverviewResponse, ()> = Endpoint::Get {
|
||||
url: "/api/3/absence/student",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GET_STUDENT_TIMETABLE_WITH_ABSENCES_ENDPOINT: Endpoint<
|
||||
StudentTimetableAbsenceResponse,
|
||||
(),
|
||||
> = Endpoint::Get {
|
||||
url: "/api/3/timetable/student/{studentId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const EXCUSE_KOMENS_ABSENCE_ENDPOINT: Endpoint<ExcuseAbsenceResponse, ()> = Endpoint::Put {
|
||||
//TODO unknown behaviour (and request type) // probably absenceRecord or AbsenceRecordWithSubject
|
||||
url: "/api/3/absence",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
use crate::{AbsenceRecord, Hour};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ExcuseAbsenceResponse {
|
||||
pub absences: Vec<AbsenceRecord>,
|
||||
pub hours: Vec<Hour>,
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
mod absence;
|
||||
mod absence_day;
|
||||
mod absence_day_response;
|
||||
mod absence_overview_response;
|
||||
mod absence_record;
|
||||
mod absence_type_option;
|
||||
mod absent_type;
|
||||
mod endpoints;
|
||||
mod excuse_absence_response;
|
||||
mod student_timetable_absence_response;
|
||||
mod subject_absence;
|
||||
|
||||
pub use absence::*;
|
||||
pub use absence_day::*;
|
||||
pub use absence_day_response::*;
|
||||
pub use absence_overview_response::*;
|
||||
pub use absence_record::*;
|
||||
pub use absence_type_option::*;
|
||||
pub use absent_type::*;
|
||||
pub use endpoints::*;
|
||||
pub use excuse_absence_response::*;
|
||||
pub use student_timetable_absence_response::*;
|
||||
pub use subject_absence::*;
|
||||
@@ -0,0 +1,10 @@
|
||||
use crate::{AbsenceDayResponse, AbsenceTypeOption, StdTypeNullable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StudentTimetableAbsenceResponse {
|
||||
pub student: Option<StdTypeNullable>,
|
||||
pub days: Vec<AbsenceDayResponse>,
|
||||
pub absent_type_options: Vec<AbsenceTypeOption>,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubjectAbsence {
|
||||
pub subject_name: String,
|
||||
pub lessons_count: u16,
|
||||
pub base: u16,
|
||||
pub late: u16,
|
||||
pub soon: u16,
|
||||
pub school: u16,
|
||||
pub distance_teaching: u16,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use crate::{ContentType, Endpoint, LoginSuccess, OpenIdDiscovery, auth::login::LoginRequest};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const LOGIN_ENDPOINT: Endpoint<LoginSuccess, LoginRequest> = Endpoint::Post {
|
||||
url: "/api/login",
|
||||
auth: false,
|
||||
content_type: ContentType::Urlencoded,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const OPEN_ID_DISCOVERY_ENDPOINT: Endpoint<OpenIdDiscovery, ()> = Endpoint::Get {
|
||||
url: "/.well-known/openid-configuration",
|
||||
auth: false,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const LOGIN_TOKEN_ENDPOINT: Endpoint<String, ()> = Endpoint::Get {
|
||||
url: "/api/3/logintoken",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct LoginSuccess {
|
||||
#[serde(rename = "bak:UserId")]
|
||||
pub user_id: String,
|
||||
pub access_token: String,
|
||||
pub token_type: TokenType,
|
||||
pub expires_in: i64,
|
||||
pub refresh_token: String,
|
||||
#[serde(rename = "bak:ApiVersion")]
|
||||
pub api_version: String,
|
||||
#[serde(rename = "bak:AppVersion")]
|
||||
pub app_version: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)] // TODO: evaluate removing or changing debug here
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct LoginRequest {
|
||||
pub client_id: String,
|
||||
pub grant_type: String,
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TokenType {
|
||||
Bearer,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
mod endpoints;
|
||||
mod login;
|
||||
mod open_id_discovery;
|
||||
mod user_jwt_claim;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use login::*;
|
||||
pub use open_id_discovery::*;
|
||||
pub use user_jwt_claim::*;
|
||||
@@ -0,0 +1,24 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct OpenIdDiscovery {
|
||||
pub issuer: String,
|
||||
pub authorization_endpoint: String,
|
||||
pub token_endpoint: String,
|
||||
pub userinfo_endpoint: String,
|
||||
pub jwks_uri: String,
|
||||
pub grant_types_supported: Vec<String>,
|
||||
pub response_types_supported: Vec<String>,
|
||||
pub response_modes_supported: Vec<String>,
|
||||
pub scopes_supported: Vec<String>,
|
||||
pub claims_supported: Vec<String>,
|
||||
pub id_token_signing_alg_values_supported: Vec<String>,
|
||||
pub code_challenge_methods_supported: Vec<String>,
|
||||
pub subject_types_supported: Vec<String>,
|
||||
pub token_endpoint_auth_methods_supported: Vec<String>,
|
||||
pub claims_parameter_supported: bool,
|
||||
pub request_parameter_supported: bool,
|
||||
pub request_uri_parameter_supported: bool,
|
||||
pub authorization_response_iss_parameter_supported: bool,
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UserJwtClaim {
|
||||
#[serde(rename = "Bakalari.AccountType")]
|
||||
pub account_type: String,
|
||||
#[serde(rename = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")]
|
||||
pub xmlnameidentifier: Option<String>,
|
||||
#[serde(rename = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")]
|
||||
pub xmlname: Option<String>,
|
||||
#[serde(rename = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn")]
|
||||
pub xmlupn: Option<String>,
|
||||
#[serde(rename = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/gender")]
|
||||
pub xmlgender: Option<String>,
|
||||
#[serde(rename = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth")]
|
||||
pub xmldateofbirth: Option<String>,
|
||||
#[serde(rename = "Bakalari.UserType")]
|
||||
pub user_type: String,
|
||||
#[serde(rename = "Bakalari.SessionId")]
|
||||
pub session_id: String,
|
||||
#[serde(rename = "Bakalari.TimeStamp")]
|
||||
pub time_stamp: String,
|
||||
#[serde(rename = "Bakalari.PersonIdWithType")]
|
||||
pub person_id_with_type: String,
|
||||
#[serde(rename = "Bakalari.EvidNumber")]
|
||||
pub evid_number: String,
|
||||
#[serde(rename = "Bakalari.MachineName")]
|
||||
pub machine_name: String,
|
||||
pub sub: String,
|
||||
pub name: String,
|
||||
pub oi_prst: String,
|
||||
pub oi_au_id: String,
|
||||
pub client_id: String,
|
||||
pub oi_tkn_id: String,
|
||||
pub aud: String,
|
||||
pub scope: String,
|
||||
pub jti: String,
|
||||
pub exp: i64,
|
||||
pub iss: String,
|
||||
pub iat: i64,
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub enum Endpoint<Response, Request> {
|
||||
//TODO: better url handling. (defining api version/is base url used/query/url params)
|
||||
Get {
|
||||
url: &'static str,
|
||||
auth: bool,
|
||||
_types: PhantomData<fn() -> (Response, Request)>,
|
||||
},
|
||||
Post {
|
||||
url: &'static str,
|
||||
auth: bool,
|
||||
content_type: ContentType,
|
||||
_types: PhantomData<fn() -> (Response, Request)>,
|
||||
},
|
||||
Put {
|
||||
url: &'static str,
|
||||
auth: bool,
|
||||
content_type: ContentType,
|
||||
_types: PhantomData<fn() -> (Response, Request)>,
|
||||
},
|
||||
}
|
||||
|
||||
pub enum ContentType {
|
||||
Urlencoded,
|
||||
Json,
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Error {
|
||||
pub message: String,
|
||||
pub model_state: ModelState,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ModelState {
|
||||
#[serde(rename = "$type")]
|
||||
pub type_name: String,
|
||||
#[serde(rename = "from")]
|
||||
pub from: StringArray,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct StringArray {
|
||||
#[serde(rename = "$type")]
|
||||
pub type_name: String,
|
||||
#[serde(rename = "$values")]
|
||||
pub values: Vec<String>,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use crate::{Endpoint, Events};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
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,
|
||||
};
|
||||
@@ -1,36 +1,28 @@
|
||||
use crate::StdType;
|
||||
use chrono::{DateTime, Utc};
|
||||
use crate::{EventTime, StdType};
|
||||
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 times: Vec<Time>,
|
||||
pub event_type: StdType,
|
||||
pub times: Vec<EventTime>,
|
||||
pub classes: Vec<StdType>,
|
||||
//class_sets: unknown
|
||||
pub class_sets: Vec<StdType>,
|
||||
pub teachers: Vec<StdType>,
|
||||
//teacher_sets: unknown
|
||||
pub teacher_sets: Vec<StdType>,
|
||||
pub rooms: Vec<StdType>,
|
||||
//room_sets: unknown
|
||||
pub room_sets: Vec<StdType>,
|
||||
pub students: Vec<StdType>,
|
||||
pub note: Option<String>,
|
||||
pub date_changed: DateTime<Utc>,
|
||||
pub date_changed: DateTime<FixedOffset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Time {
|
||||
pub whole_day: bool,
|
||||
pub start_time: DateTime<Utc>,
|
||||
pub end_time: DateTime<Utc>,
|
||||
pub struct Events {
|
||||
pub events: Vec<Event>,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[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>>,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
mod endpoints;
|
||||
mod event;
|
||||
mod event_time;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use event::*;
|
||||
pub use event_time::*;
|
||||
@@ -0,0 +1,62 @@
|
||||
use crate::{ContentType, Endpoint, GdprCommissioners, GdprConsents};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const SEND_GDPR_OBJECTION_ENDPOINT: Endpoint<(), String> = Endpoint::Post {
|
||||
url: "/api/3/gdpr/commissioner/send-objection",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GDPR_CONSENT_REVOKE_ENDPOINT: Endpoint<(), ()> = Endpoint::Put {
|
||||
url: "/api/3/gdpr/consent/{id}/revoke-request",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GDPR_CONSENT_AGREE_ENDPOINT: Endpoint<(), ()> = Endpoint::Put {
|
||||
url: "/api/3/gdpr/consent/{id}/agree",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GDPR_CONSENT_DISAGREE_ENDPOINT: Endpoint<(), ()> = Endpoint::Put {
|
||||
url: "/api/3/gdpr/consent/{id}/disagree",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GDPR_CONSENTS_COUNT_ENDPOINT: Endpoint<i64, ()> = Endpoint::Get {
|
||||
url: "/api/3/gdpr/consents/person/new",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const SEND_GDPR_REPORT_ENDPOINT: Endpoint<(), ()> = Endpoint::Post {
|
||||
// unknown request type
|
||||
url: "/api/3/gdpr/commissioner/send-report",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GET_GDPR_COMMISSIONERS_ENDPOINT: Endpoint<GdprCommissioners, ()> = Endpoint::Get {
|
||||
url: "/api/3/gdpr/commissioners",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GET_GDPR_CHILD_CONSENTS_ENDPOINT: Endpoint<GdprConsents, ()> = Endpoint::Get {
|
||||
url: "/api/3/gdpr/consents/person/child",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GET_GDPR_CONSENTS_ENDPOINT: Endpoint<GdprConsents, ()> = Endpoint::Get {
|
||||
url: "/api/3/gdpr/consents/person",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -2,18 +2,18 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct GDPRcommissioners {
|
||||
pub commissioners: Vec<GDPRcommissioner>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct GDPRcommissioner {
|
||||
pub struct GdprCommissioner {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub mobile: String,
|
||||
pub phone: String,
|
||||
pub email: String,
|
||||
pub web: String,
|
||||
pub data_box: String,
|
||||
pub web: Option<String>,
|
||||
pub data_box: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct GdprCommissioners {
|
||||
pub commissioners: Vec<GdprCommissioner>,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
use crate::{GdprConsentRights, GdprConsentState, GdprValidity, UserType};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct GdprConsent {
|
||||
pub id: i64,
|
||||
pub person_type: UserType,
|
||||
pub person_id: String,
|
||||
pub created: DateTime<FixedOffset>,
|
||||
pub validity: GdprValidity,
|
||||
pub valid_from: DateTime<FixedOffset>,
|
||||
pub state: GdprConsentState,
|
||||
pub title: Option<String>,
|
||||
pub personal_data: Option<String>,
|
||||
pub usage_purpose: Option<String>,
|
||||
pub valid_to: Option<DateTime<FixedOffset>>,
|
||||
pub valid_years: Option<i64>,
|
||||
pub rights: Option<GdprConsentRights>,
|
||||
pub body: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct GdprConsents {
|
||||
pub person_consents: Vec<GdprConsent>,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct GdprConsentRights {
|
||||
pub can_agree: bool,
|
||||
pub can_disagree: bool,
|
||||
pub can_revoke_request: bool,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum GdprConsentState {
|
||||
Agreed,
|
||||
Cancelled,
|
||||
Disagreed,
|
||||
Expired,
|
||||
NewConsent,
|
||||
RevokeRequested,
|
||||
Revoked,
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum GdprValidity {
|
||||
EndOfStudy,
|
||||
EndOfStudyPlusYears,
|
||||
ToAppeal,
|
||||
Unknown,
|
||||
Validity,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
mod endpoints;
|
||||
mod gdpr_commissioner;
|
||||
mod gdpr_consent;
|
||||
mod gdpr_consent_rights;
|
||||
mod gdpr_consent_state;
|
||||
mod gdpr_validity;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use gdpr_commissioner::*;
|
||||
pub use gdpr_consent::*;
|
||||
pub use gdpr_consent_rights::*;
|
||||
pub use gdpr_consent_state::*;
|
||||
pub use gdpr_validity::*;
|
||||
@@ -0,0 +1,23 @@
|
||||
use crate::{Endpoint, Homeworks};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<i64, ()> = Endpoint::Get {
|
||||
url: "/api/3/homeworks/count-actual",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
/// ID = homework ID (String)
|
||||
/// finished = homework state (bool)
|
||||
pub const HOMEWORK_DONE_ENDPOINT: Endpoint<bool, ()> = Endpoint::Get {
|
||||
url: "/api/3/homeworks/{id}/student-done/{finished}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
/// Query 'from' and 'to' (Datetime)
|
||||
pub const HOMEWORKS_ENDPOINT: Endpoint<Homeworks, ()> = Endpoint::Get {
|
||||
url: "/api/3/homeworks",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -1,31 +1,30 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use crate::{AttachmentInfo, StdType};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{Attachment, StdType};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Homework {
|
||||
pub homeworks: Vec<HomeworkListItem>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct HomeworkListItem {
|
||||
#[serde(rename = "ID")]
|
||||
pub id: String,
|
||||
pub date_start: DateTime<Utc>,
|
||||
pub date_end: DateTime<Utc>,
|
||||
pub date_start: DateTime<FixedOffset>,
|
||||
pub date_end: DateTime<FixedOffset>,
|
||||
pub content: String,
|
||||
pub notice: String,
|
||||
pub notice: Option<String>,
|
||||
pub done: bool,
|
||||
pub closed: bool,
|
||||
pub electronic: bool,
|
||||
pub hour: u8,
|
||||
pub electronic: bool, //check existance
|
||||
pub hour: i64,
|
||||
pub class: StdType,
|
||||
pub group: StdType,
|
||||
pub subject: StdType,
|
||||
pub teacher: StdType,
|
||||
pub attachments: Vec<Attachment>,
|
||||
pub attachments: Vec<AttachmentInfo>,
|
||||
pub finished: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Homeworks {
|
||||
pub homeworks: Vec<Homework>,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
mod endpoints;
|
||||
mod homeworks;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use homeworks::*;
|
||||
@@ -1,70 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct LessonAbsence {
|
||||
pub lesson_id: String,
|
||||
//ClassBookRecordId: unknown probably Option<String>,
|
||||
pub absences_groups: Vec<AbsencesGroup>,
|
||||
pub hour_id: u8,
|
||||
pub start: u16,
|
||||
pub duration: u8,
|
||||
pub hours: Vec<LessonHour>,
|
||||
// "SchoolEvents": []
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct LessonHour {
|
||||
pub id: u8,
|
||||
pub caption: String,
|
||||
pub begin_time: String,
|
||||
pub end_time: String,
|
||||
pub start: u16,
|
||||
pub duration: u8,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsencesGroup {
|
||||
pub students_absences: Vec<LessonStudentAbsence>,
|
||||
pub absent_type_options: Vec<AbsentTypeOption>,
|
||||
// "Group": {"ClassId": "1A", "Id": "AA", "Abbrev": "1.A", "Name": "1.A"}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct LessonStudentAbsence {
|
||||
pub student: LessonStudentInfo,
|
||||
// "Absences": [], unknown
|
||||
pub student_released: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct LessonStudentInfo {
|
||||
pub is_adult: bool,
|
||||
pub registration_number: u32,
|
||||
pub id: String,
|
||||
pub abbrev: String,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AbsentTypeOption {
|
||||
pub absent_type: String,
|
||||
pub absent_kind_enabled: bool,
|
||||
pub absent_kind_required: bool,
|
||||
pub absent_note_enabled: bool,
|
||||
// AbsentKinds: [], unknown
|
||||
pub next_absent_type: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct LessonLastTheme {
|
||||
pub lesson_id: String,
|
||||
pub last_theme: String,
|
||||
pub next_label: String,
|
||||
}
|
||||
+27
-32
@@ -1,43 +1,38 @@
|
||||
mod absence;
|
||||
mod api_info;
|
||||
mod attachment;
|
||||
mod error;
|
||||
mod others;
|
||||
//campaign
|
||||
mod auth;
|
||||
mod endpoints;
|
||||
mod events;
|
||||
mod gdpr;
|
||||
mod homework;
|
||||
mod lesson;
|
||||
//komens
|
||||
mod homework; //TDOS
|
||||
//marking
|
||||
mod marks;
|
||||
mod payments;
|
||||
mod semester;
|
||||
mod stdtype;
|
||||
mod subjects;
|
||||
mod substitutions;
|
||||
mod themes;
|
||||
mod teaching;
|
||||
mod timetable;
|
||||
mod user;
|
||||
mod webmodules;
|
||||
mod what_if;
|
||||
//webmodules
|
||||
//predictor
|
||||
|
||||
pub use absence::{Absence, AbsenceListItem, SubjectAbsence};
|
||||
pub use api_info::ApiInfo;
|
||||
pub use attachment::Attachment;
|
||||
pub use error::Error;
|
||||
pub use events::{Event, Events, Time};
|
||||
pub use gdpr::{GDPRcommissioner, GDPRcommissioners};
|
||||
pub use homework::{Homework, HomeworkListItem};
|
||||
pub use lesson::{
|
||||
AbsencesGroup, AbsentTypeOption, LessonAbsence, LessonHour, LessonLastTheme,
|
||||
LessonStudentAbsence, LessonStudentInfo,
|
||||
};
|
||||
pub use marks::{Mark, Marks, SubjectMarks};
|
||||
pub use payments::{AddBalance, ClassfundPayments, ClassfundSummary, Payment, PaymentMonthlyData};
|
||||
pub use stdtype::StdType;
|
||||
pub use subjects::{Subject, Subjects};
|
||||
pub use substitutions::{SubstitutionChange, Substitutions};
|
||||
pub use themes::{Theme, Themes};
|
||||
pub use timetable::{
|
||||
Timetable, TimetableAtom, TimetableChange, TimetableDay, TimetableGroup,
|
||||
TimetableHour,
|
||||
};
|
||||
pub use user::{Module, User};
|
||||
pub use webmodules::{Webmodule, Webmodules};
|
||||
pub use what_if::{WhatIfResult, WhatIfResultMark, WhatIfStartingEnviromentMark};
|
||||
pub use absence::*;
|
||||
pub use auth::*;
|
||||
pub use endpoints::*;
|
||||
pub use events::*;
|
||||
pub use gdpr::*;
|
||||
pub use homework::*;
|
||||
pub use marks::*;
|
||||
pub use others::*;
|
||||
pub use payments::*;
|
||||
pub use semester::*;
|
||||
pub use stdtype::*;
|
||||
pub use subjects::*;
|
||||
pub use substitutions::*;
|
||||
pub use teaching::*;
|
||||
pub use timetable::*;
|
||||
pub use user::*;
|
||||
@@ -1,48 +0,0 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StdType;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Marks {
|
||||
pub subjects: Vec<SubjectMarks>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubjectMarks {
|
||||
pub marks: Vec<Mark>,
|
||||
pub subject: StdType,
|
||||
pub average_text: String,
|
||||
pub temporary_mark: String,
|
||||
pub subject_note: String,
|
||||
pub temporary_mark_note: String,
|
||||
pub points_only: bool,
|
||||
pub mark_prediction_enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Mark {
|
||||
pub mark_date: DateTime<Utc>,
|
||||
pub edit_date: DateTime<Utc>,
|
||||
pub caption: String,
|
||||
pub theme: String,
|
||||
pub mark_text: String,
|
||||
pub teacher_id: String,
|
||||
pub r#type: String,
|
||||
pub type_note: String,
|
||||
pub weight: u8,
|
||||
pub subject_id: String,
|
||||
pub is_new: bool,
|
||||
pub is_points: bool,
|
||||
pub calculated_mark_text: String,
|
||||
//ClassRankText:null,
|
||||
pub id: String,
|
||||
pub points_text: String,
|
||||
pub max_points: u16,
|
||||
pub confirmed_when: Option<DateTime<Utc>>,
|
||||
pub confirmed_by: Option<String>,
|
||||
pub mark_confirmation_state: String,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use crate::{ContentType, Endpoint, Marks};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const CONFIRM_MARKS_ENDPOINT: Endpoint<(), Vec<String>> = Endpoint::Post {
|
||||
url: "/api/3/marks/SetClassificationConfirmation",
|
||||
auth: true,
|
||||
content_type: ContentType::Json,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const COUNT_NEW_MARKS_ENDPOINT: Endpoint<i64, ()> = Endpoint::Get {
|
||||
url: "/api/3/marks/count-new",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const MARKS_ENDPOINT: Endpoint<Marks, ()> = Endpoint::Get {
|
||||
url: "/api/3/marks",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
use crate::MarkConfirmationStatus;
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Mark {
|
||||
pub mark_date: DateTime<FixedOffset>,
|
||||
pub edit_date: DateTime<FixedOffset>,
|
||||
pub is_invalid_date: bool,
|
||||
pub teacher_id: Option<String>,
|
||||
pub subject_id: String,
|
||||
pub is_new: bool,
|
||||
pub is_points: bool,
|
||||
pub calculated_mark_text: String,
|
||||
pub max_points: i64,
|
||||
pub is_predictor_mark: bool,
|
||||
pub mark_confirmation_state: MarkConfirmationStatus,
|
||||
pub caption: Option<String>,
|
||||
pub theme: Option<String>,
|
||||
pub mark_text: Option<String>,
|
||||
pub r#type: Option<String>,
|
||||
pub type_note: Option<String>,
|
||||
pub weight: Option<i64>,
|
||||
pub class_rank_text: Option<String>,
|
||||
pub id: Option<String>,
|
||||
pub points_text: Option<String>,
|
||||
pub confirmed_when: Option<DateTime<FixedOffset>>,
|
||||
pub confirmed_by: Option<String>,
|
||||
pub verbal_evaluation: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum MarkConfirmationStatus {
|
||||
Confirmed,
|
||||
DoesNotRequireConfirmation,
|
||||
Unconfirmed,
|
||||
UnconfirmedAfterChange,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
mod endpoints;
|
||||
mod mark;
|
||||
mod mark_confirmation_status;
|
||||
mod subject_marks;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use mark::*;
|
||||
pub use mark_confirmation_status::*;
|
||||
pub use subject_marks::*;
|
||||
@@ -0,0 +1,21 @@
|
||||
use crate::{Mark, StdType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubjectMarks {
|
||||
pub marks: Vec<Mark>,
|
||||
pub points_only: bool,
|
||||
pub mark_prediction_enabled: bool,
|
||||
pub subject: StdType,
|
||||
pub average_text: Option<String>,
|
||||
pub temporary_mark: Option<String>,
|
||||
pub subject_note: Option<String>,
|
||||
pub temporary_mark_note: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Marks {
|
||||
pub subjects: Vec<SubjectMarks>,
|
||||
}
|
||||
File renamed without changes.
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Attachment {
|
||||
pub struct AttachmentInfo {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub r#type: String,
|
||||
@@ -0,0 +1,14 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Campaign {
|
||||
pub message_id: i64,
|
||||
pub priority: i64,
|
||||
pub authorized: bool,
|
||||
pub consent_required: bool,
|
||||
pub delayed_show: i64,
|
||||
pub image_url: String,
|
||||
pub link_url: Option<String>,
|
||||
pub salt: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use crate::{ApiInfo, Endpoint};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const API_V3_INFO_ENDPOINT: Endpoint<ApiInfo, ()> = Endpoint::Get {
|
||||
url: "/api/3",
|
||||
auth: false,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const APIS_INFO_ENDPOINT: Endpoint<Vec<ApiInfo>, ()> = Endpoint::Get {
|
||||
url: "/api",
|
||||
auth: false,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
mod api_info;
|
||||
mod attachment;
|
||||
mod campaign;
|
||||
mod endpoints;
|
||||
|
||||
pub use api_info::*;
|
||||
pub use attachment::*;
|
||||
pub use campaign::*;
|
||||
pub use endpoints::*;
|
||||
@@ -1,43 +0,0 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassfundSummary {
|
||||
pub student_name_with_class: String,
|
||||
pub balance: f64,
|
||||
pub spent: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassfundPayments {
|
||||
pub monthly_data: Vec<PaymentMonthlyData>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PaymentMonthlyData {
|
||||
pub date: DateTime<Utc>,
|
||||
pub monthly_balance: i64,
|
||||
pub items: Vec<Payment>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Payment {
|
||||
pub description: String,
|
||||
pub date: DateTime<Utc>,
|
||||
pub amount: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AddBalance {
|
||||
pub instructions: String,
|
||||
pub bank_account: String,
|
||||
pub variable_symbol: u32,
|
||||
pub specific_symbol: u32,
|
||||
pub amount: i64,
|
||||
pub message: String,
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::PaymentsTeacherStudentStatus;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassfundSummary {
|
||||
pub student_name_with_class: Option<String>,
|
||||
pub balance: f64,
|
||||
pub spent: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundPaymentInfo {
|
||||
pub instructions: Option<String>,
|
||||
pub bank_account: Option<String>,
|
||||
pub variable_symbol: Option<i64>,
|
||||
pub specific_symbol: i64,
|
||||
pub amount: f64,
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundMonthly {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub monthly_balance: f64,
|
||||
pub items: Vec<ClassFundRecord>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundRecord {
|
||||
pub description: Option<String>,
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub amount: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundSummary {
|
||||
pub student_name_with_class: Option<String>,
|
||||
pub balance: f64,
|
||||
pub spent: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherDocumentDetailStudent {
|
||||
pub full_name_with_class: Option<String>,
|
||||
pub amount: f64,
|
||||
pub status: Option<PaymentsTeacherStudentStatus>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherDocumentDetail {
|
||||
pub title: Option<String>,
|
||||
pub amount: f64,
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub student_count: i64,
|
||||
pub students: Option<Vec<ClassFundTeacherDocumentDetailStudent>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherDocumentsItem {
|
||||
pub id: i64,
|
||||
pub title: Option<String>,
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub total_amount: f64,
|
||||
pub amount_per_student: f64,
|
||||
pub student_count: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherDocumentsMonthly {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub monthly_balance: f64,
|
||||
pub items: Vec<ClassFundTeacherDocumentsItem>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherStudentsItem {
|
||||
pub variable_symbol: i64,
|
||||
pub name: Option<String>,
|
||||
pub registration_number: Option<i64>,
|
||||
pub balance: f64,
|
||||
pub status: PaymentsTeacherStudentStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherSummaryClass {
|
||||
pub abbrev: Option<String>,
|
||||
pub class_id: Option<String>,
|
||||
pub balance: f64,
|
||||
pub amount_to_pay: f64,
|
||||
pub debtors: i64,
|
||||
pub spent: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassFundTeacherSummary {
|
||||
pub teacher_name: Option<String>,
|
||||
pub allowed_classes: Option<Vec<ClassFundTeacherSummaryClass>>,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum PaymentsTeacherStudentStatus {
|
||||
Active,
|
||||
Canceled,
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
use crate::{
|
||||
ClassFundMonthly, ClassFundPaymentInfo, ClassFundSummary, ClassFundTeacherDocumentDetail,
|
||||
ClassFundTeacherDocumentsMonthly, ClassFundTeacherStudentsItem, ClassFundTeacherSummary,
|
||||
Endpoint, RegularPayment, RegularPaymentDetail, RegularPaymentsSummary, RegularPrescription,
|
||||
RegularPrescriptionDetail, RegularPrescriptionStudent, RegularPrescriptionStudentDetail,
|
||||
};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const CLASS_FUND_PAYMENT_INFO_ENDPOINT: Endpoint<ClassFundPaymentInfo, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/classfund/paymentsinfo",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PAYMENTS_INFO_ENDPOINT: Endpoint<Vec<RegularPayment>, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PAYMENTS_SUMMARY_ENDPOINT: Endpoint<RegularPaymentsSummary, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments/summary",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const CLASS_FUND_INFO_ENDPOINT: Endpoint<Vec<ClassFundMonthly>, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/classfund",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const CLASS_FUND_SUMMARY_ENDPOINT: Endpoint<ClassFundSummary, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/classfund/summary",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PAYMENT_DETAIL_ENDPOINT: Endpoint<RegularPaymentDetail, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments/detail/{paymentId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const CLASS_FUND_TEACHER_DOCUMENT_DETAIL_ENDPOINT: Endpoint<
|
||||
ClassFundTeacherDocumentDetail,
|
||||
(),
|
||||
> = Endpoint::Get {
|
||||
url: "/api/3/payments/classfund/teacher/document/detail/{documentId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PRESCRIPTIONS_ENDPOINT: Endpoint<Vec<RegularPrescription>, ()> = Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments/teacher/prescriptions",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const CLASS_FUND_TEACHER_STUDENTS_ENDPOINT: Endpoint<Vec<ClassFundTeacherStudentsItem>, ()> =
|
||||
Endpoint::Get {
|
||||
url: "/api/3/payments/classfund/teacher/students/{classId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const CLASS_FUND_TEACHER_DOCUMENTS_ENDPOINT: Endpoint<
|
||||
Vec<ClassFundTeacherDocumentsMonthly>,
|
||||
(),
|
||||
> = Endpoint::Get {
|
||||
url: "/api/3/payments/classfund/teacher/documents/{classId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const CLASS_FUND_TEACHER_SUMMARY_ENDPOINT: Endpoint<ClassFundTeacherSummary, ()> =
|
||||
Endpoint::Get {
|
||||
url: "/api/3/payments/classfund/teacher/summary",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PRESCRIPTION_DETAIL_ENDPOINT: Endpoint<RegularPrescriptionDetail, ()> =
|
||||
Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PRESCRIPTION_STUDENT_DETAIL_ENDPOINT: Endpoint<
|
||||
RegularPrescriptionStudentDetail,
|
||||
(),
|
||||
> = Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}/students/{studentId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const REGULAR_PRESCRIPTION_STUDENTS_ENDPOINT: Endpoint<Vec<RegularPrescriptionStudent>, ()> =
|
||||
Endpoint::Get {
|
||||
url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}/students",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
mod class_fund;
|
||||
mod common;
|
||||
mod endpoints;
|
||||
mod regular_payments;
|
||||
|
||||
pub use class_fund::*;
|
||||
pub use common::*;
|
||||
pub use endpoints::*;
|
||||
pub use regular_payments::*;
|
||||
@@ -0,0 +1,137 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::PaymentsTeacherStudentStatus;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPaymentDetail {
|
||||
pub title: Option<String>,
|
||||
pub due_date: DateTime<FixedOffset>,
|
||||
pub amount: f64,
|
||||
pub original_amount: f64,
|
||||
pub status: RegularPaymentStatus,
|
||||
pub bank_account: Option<String>,
|
||||
pub variable_symbol: Option<i64>,
|
||||
pub specific_symbol: Option<i64>,
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPayment {
|
||||
pub payment_id: i64,
|
||||
pub title: Option<String>,
|
||||
pub due_date: DateTime<FixedOffset>,
|
||||
pub amount: f64,
|
||||
pub status: RegularPaymentStatus,
|
||||
pub original_amount: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPaymentsSummary {
|
||||
pub balance: f64,
|
||||
pub paid: f64,
|
||||
pub amount_scheduled: f64,
|
||||
pub student_name_with_class: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescriptionDetailItem {
|
||||
pub due_date: DateTime<FixedOffset>,
|
||||
pub title: Option<String>,
|
||||
pub amount: f64,
|
||||
pub advance_notice_date: DateTime<FixedOffset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescriptionDetail {
|
||||
pub id: i64,
|
||||
pub title: Option<String>,
|
||||
pub payment_type_id: i64,
|
||||
pub payment_type_name: Option<String>,
|
||||
pub amount: f64,
|
||||
pub state: RegularPrescriptionState,
|
||||
pub due_date_max: DateTime<FixedOffset>,
|
||||
pub bank_account: Option<String>,
|
||||
pub specific_symbol: Option<i64>,
|
||||
pub items: Option<Vec<RegularPrescriptionDetailItem>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescriptionDocumentLine {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub title: Option<String>,
|
||||
pub amount: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescriptionRegulationLine {
|
||||
pub due_date: DateTime<FixedOffset>,
|
||||
pub title: Option<String>,
|
||||
pub amount: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescriptionStudentDetail {
|
||||
pub id: i64,
|
||||
pub last_name: Option<String>,
|
||||
pub first_name: Option<String>,
|
||||
pub full_name: Option<String>,
|
||||
pub title: Option<String>,
|
||||
pub balance: f64,
|
||||
pub total_regulation_amount: f64,
|
||||
pub status: PaymentsTeacherStudentStatus,
|
||||
pub document_lines: Option<Vec<RegularPrescriptionDocumentLine>>,
|
||||
pub regulation_lines: Option<Vec<RegularPrescriptionRegulationLine>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescriptionStudent {
|
||||
pub id: i64,
|
||||
pub last_name: Option<String>,
|
||||
pub first_name: Option<String>,
|
||||
pub full_name: Option<String>,
|
||||
pub balance: f64,
|
||||
pub status: PaymentsTeacherStudentStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RegularPrescription {
|
||||
pub id: i64,
|
||||
pub title: Option<String>,
|
||||
pub payment_type_id: i64,
|
||||
pub payment_type_name: Option<String>,
|
||||
pub amount: f64,
|
||||
pub state: PaymentsTeacherStudentStatus,
|
||||
pub due_date_max: Option<DateTime<FixedOffset>>,
|
||||
pub students_count: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum RegularPaymentStatus {
|
||||
BeforeDueDate,
|
||||
NotPaid,
|
||||
Paid,
|
||||
PartiallyPaid,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum RegularPrescriptionState {
|
||||
Paid,
|
||||
PaidNotActive,
|
||||
#[serde(rename = "unknown")]
|
||||
Unknown,
|
||||
Unpaid,
|
||||
UnpaidNotActive,
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
use crate::{FinalMark, StdTypeNullable};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct CertificateTerm {
|
||||
pub final_marks: Option<Vec<FinalMark>>,
|
||||
pub subjects: Option<Vec<StdTypeNullable>>,
|
||||
pub grade_name: String,
|
||||
pub grade: i64,
|
||||
pub year_in_school: i64,
|
||||
pub school_year: String,
|
||||
pub semester: String,
|
||||
pub semester_name: String,
|
||||
pub repeated: bool,
|
||||
pub closed: bool,
|
||||
pub achievement_text: Option<String>,
|
||||
pub absent_hours: Option<i64>,
|
||||
pub not_excused_hours: Option<i64>,
|
||||
pub marks_average: Option<f64>,
|
||||
pub certificate_date: Option<DateTime<FixedOffset>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct CertificateTerms {
|
||||
pub certificate_terms: Vec<CertificateTerm>,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use crate::{CertificateTerms, Endpoint, PedagogicalMeasures};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const GET_CERTIFICATE_TERMS_ENDPOINT: Endpoint<CertificateTerms, ()> = Endpoint::Get {
|
||||
url: "/api/3/marks/final",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const GET_PEDAGOGICAL_MEASURES_ENDPOINT: Endpoint<PedagogicalMeasures, ()> = Endpoint::Get {
|
||||
url: "/api/3/marks/measures",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct FinalMark {
|
||||
pub mark_date: DateTime<FixedOffset>,
|
||||
pub edit_date: DateTime<FixedOffset>,
|
||||
pub mark_text: String,
|
||||
pub subject_id: String,
|
||||
pub id: String,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
mod certificate_term;
|
||||
mod endpoints;
|
||||
mod final_mark;
|
||||
mod pedagogical_measure;
|
||||
|
||||
pub use certificate_term::*;
|
||||
pub use endpoints::*;
|
||||
pub use final_mark::*;
|
||||
pub use pedagogical_measure::*;
|
||||
@@ -0,0 +1,21 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PedagogicalMeasures {
|
||||
pub pedagogical_measures: Vec<PedagogicalMeasure>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PedagogicalMeasure {
|
||||
pub school_year: String,
|
||||
pub semester: String,
|
||||
pub type_label: String,
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub type_id: String,
|
||||
pub text: String,
|
||||
pub actual_grade: Option<i64>,
|
||||
pub actual_grade_name: Option<String>,
|
||||
}
|
||||
@@ -7,3 +7,19 @@ pub struct StdType {
|
||||
pub abbrev: String,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StdTypeNullable {
|
||||
pub id: Option<String>,
|
||||
pub abbrev: Option<String>,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StdTypeAbbrevNullable {
|
||||
pub id: String,
|
||||
pub abbrev: Option<String>,
|
||||
pub name: String,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use crate::{Endpoint, Subjects};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const SUBJECTS_ENDPOINT: Endpoint<Subjects, ()> = Endpoint::Get {
|
||||
url: "/api/3/subjects",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
mod endpoints;
|
||||
mod subject;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use subject::*;
|
||||
@@ -1,11 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Subjects {
|
||||
pub subjects: Vec<Subject>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Subject {
|
||||
@@ -15,9 +9,15 @@ pub struct Subject {
|
||||
pub teacher_id: String,
|
||||
pub teacher_name: String,
|
||||
pub teacher_abbrev: String,
|
||||
pub teacher_email: String,
|
||||
pub teacher_web: String,
|
||||
// TeacherSchoolPhone:option<>,
|
||||
// TeacherHomePhone:option<>,
|
||||
// TeacherMobilePhone:option<>
|
||||
pub teacher_email: Option<String>,
|
||||
pub teacher_web: Option<String>,
|
||||
pub teacher_school_phone: Option<String>,
|
||||
pub teacher_home_phone: Option<String>,
|
||||
pub teacher_mobile_phone: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Subjects {
|
||||
pub subjects: Vec<Subject>,
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Substitutions {
|
||||
pub from: DateTime<Utc>,
|
||||
pub to: DateTime<Utc>,
|
||||
pub changes: Vec<SubstitutionChange>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubstitutionChange {
|
||||
pub change_subject: Option<String>, //Unknown if string is the right type
|
||||
pub day: DateTime<Utc>,
|
||||
pub hours: String,
|
||||
pub change_type: String,
|
||||
pub description: String,
|
||||
pub time: String,
|
||||
pub type_abbrev: Option<String>, //Unknown if string is the right type,
|
||||
pub type_name: Option<String>, //Unknown if string is the right type
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum ChangeDisplayType {
|
||||
OriginalTeacher,
|
||||
SubstituteTeacher,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ChangeLessonInfo {
|
||||
pub class_abbrev: Option<String>,
|
||||
pub group_abbrev: Option<String>,
|
||||
pub is_class_group: Option<bool>,
|
||||
pub subject_abbrev: Option<String>,
|
||||
pub room_abbrev: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubstitutionCycles {
|
||||
pub cycles_info: Option<Vec<DayCycleInfo>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct DayCycleInfo {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub code: Option<String>,
|
||||
pub abbrev: Option<String>,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use crate::{Endpoint, SubstitutionCycles, Substitutions};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const SUBSTITUTIONS_ENDPOINT: Endpoint<Substitutions, ()> = Endpoint::Get {
|
||||
url: "/api/3/substitutions",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const SUBSTITUTION_CYCLES_ENDPOINT: Endpoint<SubstitutionCycles, ()> = Endpoint::Get {
|
||||
url: "/api/3/substitutions/cycles",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
mod change_display_type;
|
||||
mod change_lesson_info;
|
||||
mod day_cycle_info;
|
||||
mod endpoints;
|
||||
mod substitution_change;
|
||||
mod substitution_change_type;
|
||||
mod substitutions;
|
||||
|
||||
pub use change_display_type::*;
|
||||
pub use change_lesson_info::*;
|
||||
pub use day_cycle_info::*;
|
||||
pub use endpoints::*;
|
||||
pub use substitution_change::*;
|
||||
pub use substitution_change_type::*;
|
||||
pub use substitutions::*;
|
||||
@@ -0,0 +1,17 @@
|
||||
use crate::{AtomType, ChangeDisplayType, ChangeLessonInfo, Subject, SubstitutionChangeType};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SubstitutionChange {
|
||||
pub change_subject: Option<Subject>,
|
||||
pub day: DateTime<FixedOffset>,
|
||||
pub hours: String,
|
||||
pub change_type: SubstitutionChangeType,
|
||||
pub description: String,
|
||||
pub time: String,
|
||||
pub change_lesson_info: Option<ChangeLessonInfo>,
|
||||
pub change_display_type: Option<ChangeDisplayType>,
|
||||
pub atom_type: Option<AtomType>,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum SubstitutionChangeType {
|
||||
Absence,
|
||||
Added,
|
||||
Canceled,
|
||||
NoChange,
|
||||
Removed,
|
||||
RoomChanged,
|
||||
Substitution,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
use crate::SubstitutionChange;
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Substitutions {
|
||||
pub from: DateTime<FixedOffset>,
|
||||
pub to: DateTime<FixedOffset>,
|
||||
pub changes: Vec<SubstitutionChange>,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use crate::{Endpoint, Teaching};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// Subject ID = String
|
||||
pub const TEACHING_ENDPOINT: Endpoint<Teaching, ()> = Endpoint::Get {
|
||||
url: "/api/3/subjects/themes/{subjectId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
mod endpoints;
|
||||
mod teaching;
|
||||
mod teaching_theme;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use teaching::*;
|
||||
pub use teaching_theme::*;
|
||||
@@ -0,0 +1,9 @@
|
||||
use crate::{Subject, TeachingTheme};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Teaching {
|
||||
pub subject: Subject,
|
||||
pub themes: Vec<TeachingTheme>,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TeachingTheme {
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub theme: String,
|
||||
pub note: String,
|
||||
pub lesson_label: String,
|
||||
pub hour_caption: Option<String>,
|
||||
pub start: Option<u16>,
|
||||
pub duration: Option<u16>,
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
use crate::StdType;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Themes {
|
||||
pub subject: StdType,
|
||||
pub themes: Vec<Theme>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Theme {
|
||||
pub date: DateTime<Utc>,
|
||||
pub theme: String,
|
||||
pub note: String,
|
||||
pub hour_caption: String,
|
||||
pub lesson_label: String,
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StdType;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Timetable {
|
||||
pub hours: Vec<TimetableHour>,
|
||||
pub days: Vec<TimetableDay>,
|
||||
pub classes: Vec<StdType>,
|
||||
pub groups: Vec<TimetableGroup>,
|
||||
pub subjects: Vec<StdType>,
|
||||
pub teachers: Vec<StdType>,
|
||||
pub rooms: Vec<StdType>,
|
||||
pub cycles: Vec<StdType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableHour {
|
||||
pub id: u8,
|
||||
pub caption: String,
|
||||
pub begin_time: String,
|
||||
pub end_time: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableDay {
|
||||
pub atoms: Vec<TimetableAtom>,
|
||||
pub day_of_week: u8,
|
||||
pub date: DateTime<Utc>,
|
||||
pub day_description: String,
|
||||
pub day_type: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableAtom {
|
||||
pub hour_id: u8,
|
||||
pub group_ids: Vec<String>,
|
||||
pub subject_id: Option<String>,
|
||||
pub teacher_id: Option<String>,
|
||||
pub room_id: Option<String>,
|
||||
pub cycle_ids: Vec<String>,
|
||||
pub change: Option<TimetableChange>,
|
||||
pub homework_ids: Vec<String>,
|
||||
pub theme: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableChange {
|
||||
pub change_subject: Option<String>,
|
||||
pub day: DateTime<Utc>,
|
||||
pub hours: String,
|
||||
pub change_type: String,
|
||||
pub description: String,
|
||||
pub time: String,
|
||||
pub type_abbrev: Option<String>,
|
||||
pub type_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableGroup {
|
||||
pub class_id: String,
|
||||
pub id: String,
|
||||
pub abbrev: String,
|
||||
pub name: String,
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::TimetableChange;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct AssistanceAtom {
|
||||
pub hour_id: i64,
|
||||
pub start: i64,
|
||||
pub duration: i64,
|
||||
pub class_id: Option<String>,
|
||||
pub group_id: Option<String>,
|
||||
pub subject_id: Option<String>,
|
||||
pub teacher_id: Option<String>,
|
||||
pub room_id: Option<String>,
|
||||
pub student_id: Option<String>,
|
||||
pub change: Option<TimetableChange>,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Assistant {
|
||||
pub id: String,
|
||||
pub is_present: bool,
|
||||
pub student_id: String,
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{Assistant, HomeworkInfo, LessonRelease, PlannedClassification, TimetableChange};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Atom {
|
||||
pub hour_id: i64,
|
||||
pub group_ids: Vec<String>,
|
||||
pub subject_id: Option<String>,
|
||||
pub teacher_id: Option<String>,
|
||||
pub room_id: Option<String>,
|
||||
pub is_last_room_lesson: bool,
|
||||
pub cycle_ids: Vec<String>,
|
||||
pub homeworks: Vec<HomeworkInfo>,
|
||||
pub homework_ids: Vec<String>,
|
||||
pub change: Option<TimetableChange>,
|
||||
pub theme: Option<String>,
|
||||
pub assistants: Vec<Assistant>,
|
||||
pub notice: Option<String>,
|
||||
#[serde(rename = "PlannedClasification")]
|
||||
pub planned_classification: Option<PlannedClassification>,
|
||||
pub week_theme: Option<String>,
|
||||
pub lesson_release: LessonRelease,
|
||||
pub start: Option<i64>,
|
||||
pub duration: Option<i64>,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum AtomType {
|
||||
Hour,
|
||||
Pause,
|
||||
TimeBlock,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum Changetype {
|
||||
Absence,
|
||||
Added,
|
||||
Canceled,
|
||||
NoChange,
|
||||
Removed,
|
||||
RoomChanged,
|
||||
Substitution,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{AssistanceAtom, Atom};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Day {
|
||||
pub atoms: Vec<Atom>,
|
||||
pub day_of_week: i64,
|
||||
pub date: DateTime<FixedOffset>,
|
||||
pub day_description: String,
|
||||
pub day_type: DateTime<FixedOffset>,
|
||||
pub assistance_atoms: Vec<AssistanceAtom>,
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
use crate::{Endpoint, Timetable};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const PERMAMENT_TIMETABLE_ENDPOINT: Endpoint<Timetable, ()> = Endpoint::Get {
|
||||
url: "/api/3/timetable/permanent",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const PERMAMENT_TIMETABLE_CLASS_ENDPOINT: Endpoint<Timetable, ()> = Endpoint::Get {
|
||||
url: "/api/3/timetable/permanent/class/{classId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const WEEK_TIMETABLE_ENDPOINT: Endpoint<Timetable, ()> = Endpoint::Get {
|
||||
url: "/api/3/timetable/actual",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const WEEK_TIMETABLE_CLASS_ENDPOINT: Endpoint<Timetable, ()> = Endpoint::Get {
|
||||
url: "/api/3/timetable/actual/class/{classId}",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct HomeworkInfo {
|
||||
pub id: String,
|
||||
pub text: String,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Hour {
|
||||
pub id: i64,
|
||||
pub caption: String,
|
||||
pub begin_time: String,
|
||||
pub end_time: String,
|
||||
pub start: Option<i64>,
|
||||
pub duration: Option<i64>,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum LessonRelease {
|
||||
NoChange,
|
||||
Released,
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
mod assistance_atom;
|
||||
mod assistant;
|
||||
mod atom;
|
||||
mod atom_type;
|
||||
mod change_type;
|
||||
mod day;
|
||||
mod endpoints;
|
||||
mod homework_info;
|
||||
mod hour;
|
||||
mod lesson_release;
|
||||
mod planned_classification;
|
||||
mod timetable;
|
||||
mod timetable_change;
|
||||
mod timetable_group;
|
||||
|
||||
pub use assistance_atom::*;
|
||||
pub use assistant::*;
|
||||
pub use atom::*;
|
||||
pub use atom_type::*;
|
||||
pub use change_type::*;
|
||||
pub use day::*;
|
||||
pub use endpoints::*;
|
||||
pub use homework_info::*;
|
||||
pub use hour::*;
|
||||
pub use lesson_release::*;
|
||||
pub use planned_classification::*;
|
||||
pub use timetable::*;
|
||||
pub use timetable_change::*;
|
||||
pub use timetable_group::*;
|
||||
@@ -0,0 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PlannedClassification {
|
||||
pub description: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
use crate::{Day, Group, Hour, StdType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Timetable {
|
||||
pub hours: Vec<Hour>,
|
||||
pub days: Vec<Day>,
|
||||
pub classes: Vec<StdType>,
|
||||
pub groups: Vec<Group>,
|
||||
pub subjects: Vec<StdType>,
|
||||
pub rooms: Vec<StdType>,
|
||||
pub teachers: Vec<StdType>,
|
||||
pub cycles: Vec<StdType>,
|
||||
pub students: Vec<StdType>,
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{AtomType, Changetype, StdType};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableChange {
|
||||
pub day: DateTime<FixedOffset>,
|
||||
pub hours: String,
|
||||
pub changetype: Changetype,
|
||||
pub description: String,
|
||||
pub time: String,
|
||||
pub change_subject: Option<StdType>,
|
||||
pub type_abbrev: Option<String>,
|
||||
pub type_name: Option<String>,
|
||||
pub atom_type: Option<AtomType>,
|
||||
pub start: Option<i64>,
|
||||
pub duration: Option<i64>,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Group {
|
||||
pub class_id: Option<String>,
|
||||
pub id: String,
|
||||
pub abbre: Option<String>,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::StdType;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct User {
|
||||
#[serde(rename = "UserUID")]
|
||||
pub user_uid: String,
|
||||
pub campaign_category_code: String,
|
||||
pub class: StdType,
|
||||
// TeacherClasses: Option TODO
|
||||
pub full_name: String,
|
||||
pub school_organization_name: String,
|
||||
pub school_type: Option<String>,
|
||||
pub user_type: String,
|
||||
pub user_type_text: String,
|
||||
pub study_year: u8,
|
||||
pub enabled_modules: Vec<Module>,
|
||||
pub setting_modules: HashMap<String, Value>,
|
||||
pub full_user_name: String,
|
||||
pub students: Vec<Student>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Module {
|
||||
pub module: String,
|
||||
pub rights: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Student {
|
||||
pub full_name: String,
|
||||
pub class: Vec<StdType>,
|
||||
pub school_type: String,
|
||||
pub study_year: u8,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
use crate::{Endpoint, UserInfo};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const USER_INFO_ENDPOINT: Endpoint<UserInfo, ()> = Endpoint::Get {
|
||||
url: "/api/3/user",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
|
||||
pub const STUDENT_AT_SCHOOL_ENDPOINT: Endpoint<bool, ()> = Endpoint::Get {
|
||||
url: "/api/3/user/student-at-school",
|
||||
auth: true,
|
||||
_types: PhantomData,
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
mod endpoints;
|
||||
mod modules;
|
||||
mod setting_modules;
|
||||
mod user_info;
|
||||
|
||||
pub use endpoints::*;
|
||||
pub use modules::*;
|
||||
pub use setting_modules::*;
|
||||
pub use user_info::*;
|
||||
@@ -0,0 +1,213 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "Module")]
|
||||
pub enum Module {
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Absence { rights: Vec<AbsenceRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
AccessSystem { rights: Vec<AccessSystemRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Application { rights: Vec<ApplicationRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Campaign { rights: Vec<CampaignRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Classbook { rights: Vec<ClassbookRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Emergency { rights: Vec<EmergencyRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Events { rights: Vec<EventsRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Gdpr { rights: Vec<GdprRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Homeworks { rights: Vec<HomeworksRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Komens { rights: Vec<KomensRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Marking { rights: Vec<MarkingRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Marks { rights: Vec<MarksRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Payments { rights: Vec<PaymentsRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Semester { rights: Vec<SemesterRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Subjects { rights: Vec<SubjectsRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Substitutions { rights: Vec<SubstitutionsRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Teaching { rights: Vec<TeachingRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Timetable { rights: Vec<TimetableRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
Unknown { rights: Vec<UnknownRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
UserAccount { rights: Vec<UserAccountRights> },
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
WebBased { rights: Vec<WebBasedRights> },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum AbsenceRights {
|
||||
ShowAbsence,
|
||||
ShowAbsencePercentage,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum AccessSystemRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum ApplicationRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum CampaignRights {
|
||||
ShowCampaign,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum ClassbookRights {
|
||||
CanExcuseAbsence,
|
||||
EditClassBook,
|
||||
ShowClassBook,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum EmergencyRights {
|
||||
CanAccessEmergency,
|
||||
CanBeEmergencyParticipant,
|
||||
CanManageEmergencies,
|
||||
CanOverseeEmergencyParticipants,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum EventsRights {
|
||||
ShowEvents,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum GdprRights {
|
||||
ShowChildConsents,
|
||||
ShowCommissioners,
|
||||
ShowOwnConsents,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum HomeworksRights {
|
||||
ShowHomeworks,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum KomensRights {
|
||||
SendAttachments,
|
||||
SendMessageAsDirector,
|
||||
SendMessages,
|
||||
ShowApologyMessages,
|
||||
ShowNoticeBoardMessages,
|
||||
ShowRatingDetails,
|
||||
ShowRatingMessage,
|
||||
ShowReceivedMessages,
|
||||
ShowSentMessages,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum MarkingRights {
|
||||
EditMarks,
|
||||
ShowMarking,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum MarksRights {
|
||||
CanConfirmClassification,
|
||||
PredictMarks,
|
||||
ShowFinalMarks,
|
||||
ShowManners,
|
||||
ShowMarks,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum PaymentsRights {
|
||||
ClassFundEnabled,
|
||||
ClassFundPaymentsEnabled,
|
||||
RegularPaymentsEnabled,
|
||||
ShowClassFundDetails,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum SemesterRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum SubjectsRights {
|
||||
ShowSubjectThemes,
|
||||
ShowSubjects,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum SubstitutionsRights {
|
||||
ShowSubstitutions,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum TeachingRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum TimetableRights {
|
||||
ShowTimetable,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum UnknownRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum UserAccountRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum WebBasedRights {
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ModulesSetting {
|
||||
pub common: CommonModuleSettings,
|
||||
pub komens: Option<KomensModuleSettings>,
|
||||
pub marking: Option<MarkinModuleSettings>,
|
||||
pub timetable: Option<TimetableModuleSettings>,
|
||||
pub class_book: Option<ClassbookModuleSettings>,
|
||||
pub emergency: EmergencyModuleSettings,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct CommonModuleSettings {
|
||||
#[serde(rename = "$type")]
|
||||
pub r#type: ModulesSettingType,
|
||||
pub actual_semester: ActualSemester,
|
||||
pub actual_school_year: Option<ActualSchoolYear>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ActualSemester {
|
||||
pub semester_id: Option<String>,
|
||||
pub from: DateTime<FixedOffset>,
|
||||
pub to: DateTime<FixedOffset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ActualSchoolYear {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub effective_start_date: DateTime<FixedOffset>,
|
||||
pub effective_end_date: DateTime<FixedOffset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct KomensModuleSettings {
|
||||
#[serde(rename = "$type")]
|
||||
pub r#type: ModulesSettingType,
|
||||
pub upload_folder_verified: bool,
|
||||
pub current_school_year_start_date: DateTime<FixedOffset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct MarkinModuleSettings {
|
||||
#[serde(rename = "$type")]
|
||||
pub r#type: ModulesSettingType,
|
||||
pub required_classification_confirmation: bool,
|
||||
pub classification_confirmation_classes_list: Vec<String>,
|
||||
pub classification_confirmation_notification: bool,
|
||||
pub number_of_days_classification_confirmation_notifications: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableModuleSettings {
|
||||
#[serde(rename = "$type")]
|
||||
pub r#type: ModulesSettingType,
|
||||
pub display_type: TimetableDisplayType,
|
||||
pub header_type: TimetableHeaderType,
|
||||
pub days_definition: Vec<TimetableSettingsDayDefinition>,
|
||||
pub hours_definition: Vec<TimetableSettingsHourDefinition>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum TimetableDisplayType {
|
||||
Classic,
|
||||
Flexi,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum TimetableHeaderType {
|
||||
HourIndex,
|
||||
TimeLine,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableSettingsDayDefinition {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub caption: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct TimetableSettingsHourDefinition {
|
||||
pub id: i64,
|
||||
pub caption: String,
|
||||
pub start: i64,
|
||||
pub duration: i64,
|
||||
pub is_visible: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ClassbookModuleSettings {
|
||||
#[serde(rename = "$type")]
|
||||
pub r#type: ModulesSettingType,
|
||||
pub absence_calculation_type: AbsenceCalculationType,
|
||||
pub absence_calculation_period: ActualSemester,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum AbsenceCalculationType {
|
||||
Duration,
|
||||
Lessons,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct EmergencyModuleSettings {
|
||||
#[serde(rename = "$type")]
|
||||
pub r#type: ModulesSettingType,
|
||||
pub firestore_db_name: String,
|
||||
pub emergency_server_url: String,
|
||||
pub is_sms_licensed: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum ModulesSettingType {
|
||||
KomensModuleSettings,
|
||||
MarksModuleSettings,
|
||||
TimetableModuleSettings,
|
||||
HomeworksModuleSettings,
|
||||
ClassBookModuleSettings,
|
||||
CommonModuleSettings,
|
||||
EmergencyModuleSettings,
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
use crate::{Module, StdType, user::ModulesSetting};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct UserInfo {
|
||||
#[serde(rename = "UserUID")]
|
||||
pub user_uid: String,
|
||||
pub campaign_category_code: String,
|
||||
pub class: Option<StdType>,
|
||||
pub teacher_classes: Option<Vec<StdType>>,
|
||||
pub full_name: Option<String>,
|
||||
pub school_organization_name: Option<String>,
|
||||
pub school_type: Option<SchoolType>,
|
||||
pub user_type: UserType,
|
||||
pub user_type_text: String,
|
||||
pub study_year: Option<i64>,
|
||||
pub enabled_modules: Vec<Module>,
|
||||
pub setting_modules: ModulesSetting,
|
||||
pub full_user_name: Option<String>,
|
||||
pub students: Vec<UserInfoStudent>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum UserType {
|
||||
Controller,
|
||||
Parents,
|
||||
Student,
|
||||
Teacher,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct UserInfoStudent {
|
||||
pub full_name: String,
|
||||
pub class: StdType,
|
||||
pub school_type: SchoolType,
|
||||
pub study_year: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub enum SchoolType {
|
||||
BasicArtSchool,
|
||||
BasicPracticalSchool,
|
||||
BasicSchool,
|
||||
BasicSpecialSchool,
|
||||
BoardingHouse,
|
||||
ChildrensHome,
|
||||
Club,
|
||||
Conservatory,
|
||||
EconomicSection,
|
||||
Gymnasium,
|
||||
HigerProfessionalSchool,
|
||||
Kindergarten,
|
||||
OtherSchool,
|
||||
OtherType,
|
||||
PracticalSchool,
|
||||
SchoolCanteen,
|
||||
SchoolClub,
|
||||
SchoolService,
|
||||
SecondarySchool,
|
||||
SecondaryVocationalSchool,
|
||||
SportGymnasium,
|
||||
SuperiorOrganization,
|
||||
TechnicalSchool,
|
||||
University,
|
||||
Unknown,
|
||||
VocationalSchool,
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Webmodules {
|
||||
web_modules: Vec<Webmodule>,
|
||||
dashboard: Webmodule,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Webmodule {
|
||||
pub icon_id: Option<String>,
|
||||
// "SubMenu":null, unknown type
|
||||
pub url: Option<String>,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user