added gdpr endpoints

This commit is contained in:
vextrixes committed 2026-10-31 14:48:24 +01:00
1 parent 48fde73a73
commit 3a0aa1e117
4 files changed
+75 -4

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
use std::marker::PhantomData;
use crate::{ContentType, Endpoint, GdprCommissioners, GdprConsents};
pub const SEND_GDPR_OBJECTION_ENDPOINT: Endpoint<(), String> = Endpoint::Post {
url: "/api/3/payments/classfund/paymentsinfo",
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,
};
+78
View File
@@ -0,0 +1,78 @@
use chrono::{DateTime, FixedOffset};
use serde::{Deserialize, Serialize};
use crate::UserType;
#[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 id: String,
pub name: String,
pub mobile: String,
pub phone: String,
pub email: String,
pub web: Option<String>,
pub data_box: Option<String>,
}
#[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 = "camelCase")]
pub enum GdprValidity {
EndOfStudy,
EndOfStudyPlusYears,
ToAppeal,
Unknown,
Validity,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GdprConsentState {
Agreed,
Cancelled,
Disagreed,
Expired,
NewConsent,
RevokeRequested,
Revoked,
Unknown,
}
#[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,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GdprConsents {
pub person_consents: Vec<GdprConsent>,
}
+5
View File
@@ -0,0 +1,5 @@
mod endpoints;
mod gdpr;
pub use endpoints::*;
pub use gdpr::*;