added some endpoints

This commit is contained in:
vextrixes committed 2026-10-28 22:37:05 +01:00
1 parent fedbf019b4
commit 2adf27dbed
18 files changed
+254 -9

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
use std::marker::PhantomData;
use crate::{ContentType, Endpoint, LoginSuccess, OpenIdDiscovery, auth::login::LoginRequest};
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,
};
+9
View File
@@ -15,6 +15,15 @@ pub struct LoginSuccess {
pub app_version: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct LoginRequest {
client_id: String,
grant_type: String,
username: String,
password: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum TokenType {
+5 -3
View File
@@ -1,7 +1,9 @@
mod endpoints;
mod login;
mod open_id_discovery;
mod user_jwt_claim;
pub use login::{LoginSuccess, TokenType};
pub use open_id_discovery::OpenIdDiscovery;
pub use user_jwt_claim::UserJwtClaim;
pub use endpoints::*;
pub use login::*;
pub use open_id_discovery::*;
pub use user_jwt_claim::*;
+20
View File
@@ -0,0 +1,20 @@
use std::marker::PhantomData;
pub enum Endpoint<Response, Request> {
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)>,
},
}
pub enum ContentType {
Urlencoded,
Json,
}
+2
View File
@@ -2,6 +2,8 @@ use crate::{Room, RoomSet, SchoolClass, SchoolClassSet, StdType, Student, Teache
use chrono::{DateTime, FixedOffset};
use serde::{Deserialize, Serialize};
/// /api/3/events GET body response
/// Get /api/3/events/my GET body response
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Events {
+25
View File
@@ -0,0 +1,25 @@
use std::marker::PhantomData;
use crate::{Endpoint, HomeworkList};
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<(), HomeworkList> = Endpoint::Get {
url: "api/3/homeworks",
auth: true,
_types: PhantomData,
};
File renamed without changes.
+5
View File
@@ -0,0 +1,5 @@
mod endpoints;
mod homework;
pub use endpoints::*;
pub use homework::*;
+6 -4
View File
@@ -4,11 +4,12 @@ mod attachment;
//campaign
mod auth;
mod campaign;
mod endpoints;
mod error;
mod events;
mod gdpr;
//komens
mod homework; //TDOS
mod homeworks; //TDOS
//marking
mod marks;
mod payments;
@@ -27,14 +28,15 @@ pub use api_info::ApiInfo;
pub use attachment::AttachmentInfo;
pub use auth::*;
pub use campaign::Campaign;
pub use endpoints::*;
pub use error::{Error, ModelState, StringArray};
pub use events::{Event, EventTime, EventType, Events};
pub use gdpr::{
GdprCommissioner, GdprCommissioners, GdprConsent, GdprConsentRights, GdprConsentState,
GdprValidity,
};
pub use homework::{HomeworkList, HomeworkListItem};
pub use marks::{Mark, MarkConfirmationStatus, Marks, SubjectMarks};
pub use homeworks::*;
pub use marks::*;
pub use payments::*;
pub use semester::{
CertificateTerm, CertificateTerms, FinalMark, PedagogicalMeasure, PedagogicalMeasures,
@@ -43,7 +45,7 @@ pub use stdtype::{
Room, RoomSet, SchoolClass, SchoolClassSet, StdClassGroup, StdType, StdTypeNullable, Student,
Teacher, TeacherSet, TimetableStudent,
};
pub use subjects::{Subject, Subjects};
pub use subjects::*;
pub use substitutions::{
ChangeDisplayType, ChangeLessonInfo, SubstitutionChange, SubstitutionChangeType, Substitutions,
};
+22
View File
@@ -0,0 +1,22 @@
use std::marker::PhantomData;
use crate::{ContentType, Endpoint, Marks};
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,
};
+5
View File
@@ -0,0 +1,5 @@
mod endpoints;
mod subject_marks;
pub use endpoints::*;
pub use subject_marks::*;
+1 -1
View File
@@ -27,7 +27,7 @@ pub struct SubjectMarks {
pub struct Mark {
pub mark_date: DateTime<FixedOffset>,
pub edit_date: DateTime<FixedOffset>,
pub is_invalid_date: Option<bool>,
pub is_invalid_date: bool,
pub teacher_id: Option<String>,
pub subject_id: String,
pub is_new: bool,
+9
View File
@@ -0,0 +1,9 @@
use std::marker::PhantomData;
use crate::{Endpoint, Subjects};
pub const SUBJECTS_ENDPOINT: Endpoint<(), Subjects> = Endpoint::Get {
url: "/api/3/subjects",
auth: true,
_types: PhantomData,
};
+5
View File
@@ -0,0 +1,5 @@
mod endpoints;
mod subject_types;
pub use endpoints::*;
pub use subject_types::*;
File renamed without changes.
+15
View File
@@ -0,0 +1,15 @@
use std::marker::PhantomData;
use crate::{Endpoint, UserInfo};
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,
};
+2
View File
@@ -1,7 +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::*;
+101 -1
View File
@@ -24,4 +24,104 @@
- [ ] OpenApi schema generation
- [ ] documentation
- [ ] tests
- [ ] constructors
- [ ] constructors
# Endpoints
- [ ] /api/3/komens/message/:messageId/mark-as-read
- [x] /api/3/marks
- [x] /api/3/homeworks/:id/student-done/:finished
- [ ] /api/3/marking/atoms/:atomId/headers
- [ ] /api/3/payments/classfund/teacher/students/:classId
- [ ] /api/3/classbook/lessonTags
- [ ] /api/3/komens/messages/rating/:messageId
- [ ] /api/3/absence/student
- [ ] /api/3/webmodule
- [ ] /api/3/timetable/actual
- [ ] /api/3/payments/classfund/teacher/document/detail/:documentId
- [ ] /api/3
- [ ] /api/3/komens/attachment/:id
- [ ] /api/3/subjects/themes/:subjectId
- [ ] /api/3/payments/classfund
- [ ] /api/3/gdpr/consents/person/child
- [ ] /api/3/komens/concept/:conceptId
- [ ] /api/3/marks/measures
- [ ] /api/3/unregister-user-notification
- [ ] /api/3/gdpr/consent/:id/agree
- [x] /api/3/marks/count-new
- [ ] /api/3/komens/concept
- [ ] /api/3/timetable/permanent
- [ ] /api/3/komens/messages/noticeboard
- [ ] /api/3/komens/messages/apology/:messageId
- [ ] /api/3/komens/messages/received/:messageId
- [x] /api/3/user
- [ ] /api/3/payments/regularpayments/detail/:paymentId
- [ ] /api/3/substitutions
- [ ] /api/3/marks/what-if
- [ ] /api/3/gdpr/commissioner/send-objection
- [ ] /api/3/gdpr/consents/person/new
- [ ] /api/3/lesson/:lessonId/absence
- [ ] /api/3/payments/regularpayments/summary
- [ ] /api/3/emergency/startemergency
- [ ] /api/3/timetable/permanent/class/:classId
- [ ] /api/3/gdpr/commissioner/send-report
- [ ] /api/3/komens/message/:messageId/mark-as-unhidden
- [ ] /api/3/lesson/:lessonId/studentsTimetable
- [ ] /api/3/marks/final
- [ ] /api/3/timetable/student/:studentId
- [ ] /api/3/marking/atom/:atomId/headerOptions
- [ ] /api/3/gdpr/consent/:id/disagree
- [ ] /api/3/komens/messages/sent
- [ ] /api/3/emergency/configuration
- [ ] /api/3/komens/message
- [ ] /api/3/komens/message/:messageId/mark-as-hidden
- [ ] /api/3/lesson/:lessonId/past
- [ ] /api/3/komens/attachment
- [ ] /api/3/komens/messages/received
- [ ] /api/3/login/:token
- [ ] /api/3/komens/concepts
- [ ] /api/3/komens/messages/received/unread
- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId
- [ ] /api/3/timetable/actual/class/:classId
- [ ] /api/3/gdpr/consents/person
- [ ] /api/3/komens/messages/unread
- [ ] /api/3/absence
- [ ] /api/3/komens/message/:messageId/mark-as-confirmed
- [ ] /api/3/komens/messages/apology
- [ ] /api/3/events
- [ ] /api/3/komens/concepts/count
- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students
- [ ] /api/3/payments/regularpayments
- [ ] /api/3/komens/messages/noticeboard/:messageId&
- [ ] /api/3/komens/message-types/reply/:messageId
- [ ] /api/3/payments/regularpayments/teacher/prescriptions
- [x] /api/3/marks/SetClassificationConfirmation
- [x] /api/3/homeworks/count-actual
- [ ] /api/3/gdpr/consent/:id/revoke-request
- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students/:studentId
- [ ] /api/3/marking/atoms
- [ ] /api/3/absence/canexcuse/:studentId
- [ ] /api/3/komens/rating-templates
- [ ] /api/3/emergency/participantsselection
- [ ] /api/3/komens/messages/noticeboard/unread
- [ ] /api/3/komens/message-types
- [ ] /api/3/events/my
- [ ] /api/3/gdpr/commissioners
- [ ] /api/3/classbook/:recordId
- [ ] /api/3/marking/marks/:atomId
- [ ] /api/3/substitutions/cycles
- [x] /api/3/logintoken
- [ ] /api/3/komens/message-types/edit/:messageId
- [ ] /api/3/payments/classfund/teacher/documents/:classId
- [ ] /api/3/payments/classfund/summary
- [ ] /api/3/register-notification
- [ ] /api/3/payments/classfund/paymentsinfo
- [ ] /api/3/komens/messages/rating
- [ ] /api/3/komens/message/:messageId
- [x] /api/3/homeworks
- [x] /api/3/subjects
- [ ] /api/3/classbook
- [x] /api/3/user/student-at-school
- [ ] /api/3/payments/classfund/teacher/summary
- [ ] /api/3/komens/messages/sent/:messageId
- [x] /api/login
- [x] /.well-known/openid-configuration