skolengojs
Version:
A wrapper around Skolengo internal API.
815 lines (775 loc) • 32 kB
TypeScript
/**
* Represents an attachment that can be include in news, assignment or message.
*/
declare class Attachment {
protected accessToken: string;
id: string;
url: string;
fileName?: string | undefined;
type?: string | undefined;
typeLabel?: string | undefined;
size?: number | undefined;
/**
*
* @param accessToken - Used to download the protected attachment.
* @param id - Unique ID for each attachment.
* @param fileName - Name of the file attached.
* @param type - MIME Type of the attachment (https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types).
* @param typeLabel - Label of the MIME Type (e.g., 'Document Word')
* @param size - Size of the document in bytes
* @param url - URL used to download this attachment.
*/
constructor(accessToken: string, id: string, url: string, fileName?: string | undefined, type?: string | undefined, typeLabel?: string | undefined, size?: number | undefined);
/**
* Downloads the attachment and returns its raw binary content.
* @returns Raw binary content.
*/
fetchAttachmentBuffer(): Promise<Buffer>;
}
interface AgendaAttributes {
date: string;
}
type lessonIncluded = BaseIncluded<"lesson", {
startDateTime: string;
endDateTime: string;
title: string;
location: string;
canceled: boolean;
anyHomeworkToDoForTheLesson: boolean;
anyHomeworkToDoAfterTheLesson: boolean;
anyContent: boolean;
}, {
teachers: RelationshipData<"teacher">;
subject: RelationshipData<"subject">;
}>;
declare const OIDC_CLIENT_ID = "SkoApp.Prod.0d349217-9a4e-41ec-9af9-df9e69e09494";
declare const OIDC_CLIENT_SECRET = "7cb4d9a8-2580-4041-9ae8-d5803869183f";
declare const REDIRECT_URI = "skoapp-prod://sign-in-callback";
declare enum Permissions {
READ_EVALUATIONS = "READ_EVALUATIONS",
READ_ABSENCE_FILES = "READ_ABSENCE_FILES",
READ_MESSAGES = "READ_MESSAGES",
WRITE_MESSAGES = "WRITE_MESSAGES",
READ_LESSONS = "READ_LESSONS",
READ_ASSIGNMENTS = "READ_HOMEWORK_ASSIGNMENTS",
MARK_ASSIGNMENT_AS_DONE = "MARK_HOMEWORK_ASSIGNMENT_AS_DONE"
}
declare enum Services {
MESSAGES = "MSG",
TIMETABLE = "CDT",
APP = "SKOAPP",
ABSENCES = "ABS",
ARTICLES = "ART",
HOMEWORK = "TAF",
EVALUATIONS = "EVAL",
COMMUNICATION = "COMC"
}
declare enum ChallengeMethod {
PLAIN = "plain",
S256 = "S256"
}
declare enum AttendanceItemType {
LATENESS = "LATENESS",
ABSENCE = "ABSENCE"
}
declare enum AttendanceItemState {
LOCKED = "LOCKED",
OPEN = "OPEN"
}
declare enum SkillLevels {
NONE = "NONE",
INSUFFICIENT_MASTERY = "INSUFFICIENT_MASTERY",
LOW_MASTERY = "LOW_MASTERY",
SATISFACTORY_MASTERY = "SATISFACTORY_MASTERY",
VERY_GOOD_MASTERY = "VERY_GOOD_MASTERY"
}
declare enum MailFolderType {
INBOX = "INBOX",
SENT = "SENT",
PERSONAL = "PERSONAL",
TRASH = "TRASH"
}
declare enum Kind {
STUDENT = 0,
PARENT = 1
}
type absenceFileStateIncluded = BaseIncluded<"absenceFileState", {
creationDateTime: string;
absenceStartDateTime: string;
absenceEndDateTime: string;
absenceType: AttendanceItemType;
absenceFileStatus: AttendanceItemState;
}, {
absenceReason: RelationshipData<"absenceReason">;
}>;
type absenceReasonIncluded = BaseIncluded<"absenceReason", {
code: string;
longLabel: string;
}>;
declare class Period {
id: string;
label: string;
startDate: Date;
endDate: Date;
constructor(id: string, label: string, startDate: Date, endDate: Date);
}
declare class SkillLevel {
label: string;
shortLabel: string;
level: SkillLevels;
color?: string | undefined;
constructor(label: string, shortLabel: string, level: SkillLevels, color?: string | undefined);
}
interface GradesAttributes {
mark: number;
nonEvaluationReason: string | null;
}
interface GradesSettingsAttributes {
periodicReportsEnabled: boolean;
skillsEnabled: boolean;
evaluationsDetailsAvailable: boolean;
}
type gradesIncluded = BaseIncluded<"evaluation", {
dateTime: string;
scale: number;
coefficient: number;
topic: string;
title: string;
}, {
subSubject: RelationshipData<"subSubject">;
evaluationService: RelationshipData<"evaluationService">;
evaluationResult: RelationshipData<"evaluationResult">;
}>;
type gradesServiceIncluded = BaseIncluded<"evaluationService", undefined, {
subject: RelationshipData<"subject">;
}>;
interface GradesSettings extends GradesSettingsAttributes {
periods: Array<Period>;
skillLevels: Array<SkillLevel>;
}
type periodIncluded = BaseIncluded<"period", {
label: string;
startDate: string;
endDate: string;
}, undefined>;
type skillColorsIncluded = BaseIncluded<"skillAcquisitionColors", {
colorLevelMappings: Array<{
level: string;
color: string;
}>;
}, undefined>;
type skillsIncluded = BaseIncluded<"skillsSetting", {
skillAcquisitionLevels: Array<{
label: string;
shortLabel: string;
level: SkillLevels;
}>;
}, {
skillAcquisitionColors: RelationshipData<"skillAcquisitionColors">;
}>;
interface GradesServiceAttribute {
coefficient: number;
average: number;
scale: number;
studentAverage: number;
}
type gradeResultIncluded = BaseIncluded<"evaluationResult", {
mark: number;
nonEvaluationReason: string | null;
}, {
subSkillsEvaluationResults: RelationshipData<"subSkillsEvaluationResults">;
}>;
interface Author {
id: string;
name: string;
}
type schoolInfoTechnicalUser = BaseIncluded<"schoolInfoTechnicalUser", {
label: string;
logoUrl: string;
}>;
type schoolInfoAuthorIncluded = BaseIncluded<"schoolInfoAuthor", undefined, {
technicalUser: {
data: {
id: string;
type: "schoolInfoTechnicalUser";
};
};
}>;
interface NewsAttributes {
title: string;
publicationDateTime: string;
shortContent: string;
content: string;
linkedWebSiteUrl: string | null;
}
declare class Message {
id: string;
date: Date;
content: string;
read: boolean;
attachments: Array<Attachment>;
author: Author;
constructor(id: string, date: Date, content: string, read: boolean, attachments: Array<Attachment>, author: Author);
}
declare class Mail {
private emsCode;
private accessToken;
id: string;
subject: string;
messages: number;
participants: Array<string>;
read: boolean;
date: Date;
content: string;
sender?: Author | undefined;
replyToAllAllowed?: boolean | undefined;
replyToSenderAllowed?: boolean | undefined;
readTrackingEnabled?: boolean | undefined;
constructor(emsCode: string, accessToken: string, id: string, subject: string, messages: number, participants: Array<string>, read: boolean, date: Date, content: string, sender?: Author | undefined, replyToAllAllowed?: boolean | undefined, replyToSenderAllowed?: boolean | undefined, readTrackingEnabled?: boolean | undefined);
getMessages(): Promise<Array<Message>>;
}
declare class MailFolder {
id: string;
name: string;
position: number;
type: MailFolderType;
mails?: Array<Mail> | undefined;
constructor(id: string, name: string, position: number, type: MailFolderType, mails?: Array<Mail> | undefined);
}
interface CommunicationAttributes {
subject: string;
participationsNumber: number;
recipientsSummary: string;
read: boolean;
replyToAllAllowed: boolean;
replyToSenderAllowed: boolean;
readTrackingEnabled: boolean | null;
}
interface ParticipationAttributes {
dateTime: string;
content: string;
read: boolean;
}
type participationIncluded = BaseIncluded<"participation", {
dateTime: string;
content: string;
}, {
sender: RelationshipData<"personParticipant">;
}>;
type personParticipantIncluded = BaseIncluded<"personParticipant", undefined, {
technicalUser: RelationshipData<"technicalUser">;
person: RelationshipData<"teacher"> | RelationshipData<"nonTeachingStaff"> | RelationshipData<"personInContactWithStudent">;
}>;
type folderIncluded = BaseIncluded<"folder", {
name: string;
position: number;
type: MailFolderType;
}>;
type signatureIncluded = BaseIncluded<"signature", {
content: string;
}>;
interface userMailSettingAttributes {
maxCharsInParticipationContent: number;
maxCharsInCommunicationSubject: number;
}
interface MailSettings extends userMailSettingAttributes {
signature: string;
folders: Array<MailFolder>;
recipients: Array<Recipients>;
}
interface Recipients {
id: string;
type: "personContact" | "groupContact";
}
/**
* Represents the physical location details of a school.
*/
interface Location {
/** City where the school is located. (e.g., 'Paris')*/
city: string;
/** Country where the school is located (e.g., 'France'). */
country?: string;
/** Full address line (e.g., '123 Avenue de la République'). */
addressLine?: string | null;
/** Postal or ZIP code. */
zipCode?: string;
}
interface SchoolAttributes {
homePageUrl: string;
city: string;
country: string;
addressLine1: string | null;
addressLine2: string | null;
addressLine3: string | null;
emsCode: string;
emsOIDCWellKnownUrl: string;
name: string;
zipCode: string;
}
type schoolIncluded = BaseIncluded<"school", {
name: string;
city?: string;
timeZone: string;
subscribedServices: Array<Services>;
administrativeId: string;
schoolAudience: SchoolAudience;
}>;
interface SchoolAudience {
enabled: boolean;
audienceId: string;
projectId: string;
}
interface UserAttributes {
regime: string;
audienceId: string;
firstName: string;
lastName: string;
className: string;
dateOfBirth: string;
externalMail: string;
photoUrl: string | null;
mobilePhone: string;
permissions: Array<Permission>;
}
interface Permission {
service: string;
schoolId: string;
permittedOperations: Array<Permissions>;
}
type studentIncluded = BaseIncluded<"student", {
lastName: string;
firstName: string;
photoUrl: string | null;
className: string;
dateOfBirth: string;
regime: string;
}, {
school: RelationshipData<"school">;
}>;
interface KidData {
id: string;
lastName: string;
firstName: string;
photoUrl: string | null;
className: string;
dateOfBirth: Date;
regime: string;
}
interface RequestOptions {
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
path?: string;
body?: unknown;
headers?: Record<string, string>;
}
interface BaseResponse {
data: Array<BaseDataResponse<"news", NewsAttributes> | BaseDataResponse<"school", SchoolAttributes> | BaseDataResponse<"homework", HomeworkAttributes> | BaseDataResponse<"absenceFile"> | BaseDataResponse<"agenda", AgendaAttributes> | BaseDataResponse<"evaluationResult", GradesAttributes> | BaseDataResponse<"evaluationsSetting", GradesSettings> | BaseDataResponse<"evaluationService", GradesServiceAttribute> | BaseDataResponse<"communication", CommunicationAttributes> | BaseDataResponse<"participation", ParticipationAttributes>> | BaseDataResponse<"studentUserInfo", UserAttributes> | BaseDataResponse<"legalRepresentativeUserInfo", UserAttributes> | BaseDataResponse<"homework", HomeworkAttributes> | BaseDataResponse<"userMailSetting", userMailSettingAttributes>;
included: Array<nonTeachingStaffIncluded | schoolIncluded | fileIncluded | schoolInfoAuthorIncluded | schoolInfoTechnicalUser | absenceFileStateIncluded | homeworkIncluded | gradesIncluded | gradesServiceIncluded | skillColorsIncluded | skillsIncluded | gradeResultIncluded | participationIncluded | personParticipantIncluded | signatureIncluded | folderIncluded | studentIncluded>;
}
interface BaseDataResponse<T extends string, A = unknown> {
id: string;
type: T;
relationships: Relationships;
attributes?: A;
}
interface BaseIncluded<T extends string, A = unknown, R = unknown> {
id: string;
type: T;
attributes?: A;
relationships?: R;
}
type nonTeachingStaffIncluded = BaseIncluded<"nonTeachingStaff", {
firstName: string;
lastName: string;
title: string;
photoUrl: string | null;
}>;
type fileIncluded = BaseIncluded<"schoolInfoFile", {
url: string;
alternativeText: string;
}>;
interface RelationshipData<T extends string> {
data: {
id: string;
type: T;
} | Array<{
id: string;
type: T;
}>;
}
interface Relationships {
school?: RelationshipData<"school">;
author?: RelationshipData<"schoolInfoAuthor">;
illustration?: RelationshipData<"schoolInfoFile">;
teacher?: RelationshipData<"teacher">;
subject?: RelationshipData<"subject">;
currentState?: RelationshipData<"absenceFileState">;
homeworkAssignments?: RelationshipData<"absenceFileState">;
lessons?: RelationshipData<"lesson">;
evaluation?: RelationshipData<"evaluation">;
evaluations?: RelationshipData<"evaluation">;
subSkillsEvaluationResults?: RelationshipData<"subSkillsEvaluationResults">;
periods?: RelationshipData<"periods">;
skillsSetting?: RelationshipData<"skillsSetting">;
evaluationService?: RelationshipData<"evaluationService">;
teachers?: RelationshipData<"teacher">;
folders?: RelationshipData<"folder">;
signature?: RelationshipData<"signature">;
lastParticipation?: RelationshipData<"participation">;
attachments?: RelationshipData<"attachments">;
sender?: RelationshipData<"sender">;
students?: RelationshipData<"student">;
contacts?: RelationshipData<"personContact" | "groupContact">;
}
interface HomeworkAttributes {
done: boolean;
title: string;
html: string;
dueDateTime: string;
deliverWorkOnline: boolean;
onlineDeliverUrl: string | null;
}
type homeworkIncluded = BaseIncluded<"homework", HomeworkAttributes, {
subject: RelationshipData<"subject">;
}>;
interface Teacher {
id: string;
title: string;
firstName: string;
lastName: string;
photoUrl: string;
}
interface Subject$1 {
id: string;
label: string;
color: string;
}
/**
* Represents a school assignment given to a student, including metadata, subject, teacher, and completion status.
*/
declare class Assignment {
protected accessToken: string;
userId: string;
schoolId: string;
emsCode: string;
id: string;
done: boolean;
title: string;
html: string;
dueDateTime: Date;
deliverWorkOnline: boolean;
onlineDeliverUrl: string | null;
subject: Subject$1;
teacher?: Teacher | undefined;
/**
* @param accessToken - Token required to fetch attachments or update completion status.
* @param userId - Unique student identifier (usually prefixed with "ESKO-").
* @param schoolId - Unique school identifier (usually prefixed with "SKO-").
* @param emsCode - EMS (Education Management Software) code for the school (e.g., 'gdest', 'rra').
* @param id - Unique assignment identifier.
* @param done - Whether the student has completed the assignment.
* @param title - Title of the assignment (e.g., "Exercises", "Autres").
* @param html - HTML-formatted content of the assignment.
* @param dueDateTime - Deadline for submitting the assignment.
* @param deliverWorkOnline - Whether the student must submit work through an online platform.
* @param onlineDeliverUrl - URL where the student can upload their work, if applicable.
* @param teacher optional - The teacher who assigned the work.
* @param subject - The school subject associated with this assignment.
*/
constructor(accessToken: string, userId: string, schoolId: string, emsCode: string, id: string, done: boolean, title: string, html: string, dueDateTime: Date, deliverWorkOnline: boolean, onlineDeliverUrl: string | null, subject: Subject$1, teacher?: Teacher | undefined);
/**
* Fetches the list of attachments associated with this assignment.
* @returns A promise resolving to an array of attachments.
*/
getAttachments(): Promise<Array<Attachment>>;
/**
* Updates the assignment's completion status for this student.
* @param completed - Optional. Whether the assignment is completed. Defaults to toggling the current value.
* @returns A promise resolving to the updated Assignment instance.
*/
setCompletion(completed?: boolean): Promise<Assignment>;
}
declare class Lesson {
id: string;
startDateTime: Date;
endDateTime: Date;
room: string;
canceled: boolean;
hasContent: boolean;
hasHomeworkToDoForTheLesson: boolean;
hasHomeworkToDoAfterTheLesson: boolean;
subject: Subject$1;
teacher: Array<Teacher>;
constructor(id: string, startDateTime: Date, endDateTime: Date, room: string, canceled: boolean, hasContent: boolean, hasHomeworkToDoForTheLesson: boolean, hasHomeworkToDoAfterTheLesson: boolean, subject: Subject$1, teacher: Array<Teacher>);
}
declare class TimetableDay {
date: Date;
lessons: Array<Lesson>;
assignments: Array<Assignment>;
constructor(date: Date, lessons: Array<Lesson>, assignments: Array<Assignment>);
}
declare const getTimetableForPeriods: (userId: string, schoolId: string, emsCode: string, accessToken: string, periodStart?: Date, periodEnd?: Date, limit?: number) => Promise<Array<TimetableDay>>;
declare const GetAssignments: (userId: string, accessToken: string, emsCode: string, schoolId: string, periodStart?: Date, periodEnd?: Date) => Promise<Array<Assignment>>;
declare const GetAssignmentAttachments: (assignmentId: string, userId: string, schoolId: string, accessToken: string, emsCode: string) => Promise<Array<Attachment>>;
declare const SetAssignmentCompletion: (assignmentId: string, userId: string, completed: boolean, schoolId: string, accessToken: string, emsCode: string) => Promise<Assignment>;
declare const downloadAttachment: (url: string, accessToken?: string) => Promise<Buffer>;
declare class AttendanceItem {
id: string;
creationDate: Date;
startDate: Date;
endDate: Date;
type: AttendanceItemType;
state: AttendanceItemState;
reason: string;
constructor(id: string, creationDate: Date, startDate: Date, endDate: Date, type: AttendanceItemType, state: AttendanceItemState, reason: string);
}
declare const GetAttendanceItems: (userId: string, schoolId: string, emsCode: string, accessToken: string) => Promise<Array<AttendanceItem>>;
declare class Grade {
id: string;
isGraded: boolean;
value: number;
outOf: number;
date: Date;
coefficient: number;
title?: string | undefined;
topic?: string | undefined;
subject?: Subject$1 | undefined;
notGradedReason?: string | undefined;
constructor(id: string, isGraded: boolean, value: number, outOf: number, date: Date, coefficient: number, title?: string | undefined, topic?: string | undefined, subject?: Subject$1 | undefined, notGradedReason?: string | undefined);
}
declare class Subject {
id: string;
name: string;
coefficient: number;
value: number;
outOf: number;
average: number;
grades: Array<Grade>;
teachers: Array<Teacher>;
constructor(id: string, name: string, coefficient: number, value: number, outOf: number, average: number, grades: Array<Grade>, teachers: Array<Teacher>);
}
declare const GetGradesSettings: (userId: string, accessToken: string, emsCode: string, schoolId: string) => Promise<GradesSettings>;
declare const GetLastGrades: (userId: string, accessToken: string, emsCode: string, schoolId: string, limit?: number, offset?: number) => Promise<Array<Grade>>;
declare const GetGradesForPeriod: (userId: string, accessToken: string, emsCode: string, schoolId: string, period: string) => Promise<Array<Subject>>;
declare const GetMailSettings: (userId: string, emsCode: string, accessToken: string) => Promise<MailSettings>;
declare const GetMailsFromFolder: (folderId: string, limit: number, offset: number, emsCode: string, accessToken: string) => Promise<Array<Mail>>;
declare const GetMessagesFromMail: (mailId: string, emsCode: string, accessToken: string) => Promise<Array<Message>>;
declare const SendMail: (subject: string, content: string, recipients: Array<Recipients> | undefined, cc: Array<Recipients> | undefined, bcc: Array<Recipients> | undefined, accessToken: string, emsCode: string) => Promise<Mail>;
interface OIDCProviderMetadata {
issuer: string;
scopes_supported: Array<string>;
response_types_supported: Array<string>;
response_modes_supported: Array<string>;
subject_types_supported: Array<string>;
claim_types_supported: Array<string>;
claims_supported: Array<string>;
grant_types_supported: Array<string>;
id_token_signing_alg_values_supported: Array<string>;
dpop_signing_alg_values_supported: Array<string>;
id_token_encryption_alg_values_supported: Array<string>;
id_token_encryption_enc_values_supported: Array<string>;
userinfo_signing_alg_values_supported: Array<string>;
userinfo_encryption_alg_values_supported: Array<string>;
userinfo_encryption_enc_values_supported: Array<string>;
request_object_signing_alg_values_supported: Array<string>;
request_object_encryption_alg_values_supported: Array<string>;
request_object_encryption_enc_values_supported: Array<string>;
introspection_endpoint_auth_methods_supported: Array<string>;
token_endpoint_auth_methods_supported: Array<string>;
code_challenge_methods_supported: Array<string>;
prompt_values_supported: Array<string>;
claims_parameter_supported: boolean;
request_uri_parameter_supported: boolean;
request_parameter_supported: boolean;
backchannel_logout_supported: boolean;
frontchannel_logout_supported: boolean;
backchannel_logout_session_supported: boolean;
frontchannel_logout_session_supported: boolean;
authorization_endpoint: string;
token_endpoint: string;
userinfo_endpoint: string;
registration_endpoint: string;
end_session_endpoint: string;
introspection_endpoint: string;
revocation_endpoint: string;
pushed_authorization_request_endpoint: string;
jwks_uri: string;
}
interface JWK {
kty: string;
kid: string;
use: string;
alg: string;
n: string;
e: string;
}
interface JWKS {
keys: Array<JWK>;
}
interface Endpoints {
wellKnown: string;
authorizationEndpoint: string;
tokenEndpoint: string;
revokeEndpoint: string;
}
interface OIDCAccessToken {
access_token: string;
id_token: string;
refresh_token: string;
token_type: string;
expires_in: number;
scope: string;
}
interface JWTPayload {
aud: string;
sub: string;
profile: "Eleve" | string;
iss: string;
given_name: string;
exp: number;
iat: number;
family_name: string;
jti: string;
email: string;
}
declare const GetOIDCWellKnown: (url: string) => Promise<OIDCProviderMetadata>;
declare const GetOIDCJWKS: (url: string) => Promise<JWKS>;
declare const GetOIDCAccessTokens: (url: string, code: string, verifier: string) => Promise<OIDCAccessToken>;
declare const OIDCRefresh: (url: string, refreshToken: string) => Promise<OIDCAccessToken>;
/**
* Represents a news article or announcement.
*/
declare class News {
id: string;
publicationDateTime: Date;
title: string;
shortContent: string;
content: string;
author: Author;
linkedWebSiteUrl: string | null;
illustration: Attachment;
/**
* @param id - Unique identifier for the news article.
* @param publicationDateTime - The publication date and time.
* @param title - Title of the news.
* @param shortContent - Short preview of the content (summary or excerpt).
* @param content - Full content of the news.
* @param author - Author who created or published the news.
* @param illustrationURL - Optional image or media URL for illustration.
* @param linkedWebSiteUrl - Optional external website URL related to the news.
*/
constructor(id: string, publicationDateTime: Date, title: string, shortContent: string, content: string, author: Author, linkedWebSiteUrl: string | null, illustration: Attachment);
}
declare class Skolengo {
protected accessToken: string;
protected refreshToken: string;
protected refreshURL: string;
protected accessTokenTTL: number;
userId: string;
firstName: string;
lastName: string;
className: string;
mobilePhone: string;
dateOfBirth: Date;
regime: string;
kind: Kind;
permissions: Array<Permissions>;
school: School;
kids?: Array<Skolengo> | undefined;
constructor(accessToken: string, refreshToken: string, refreshURL: string, accessTokenTTL: number, userId: string, firstName: string, lastName: string, className: string, mobilePhone: string, dateOfBirth: Date, regime: string, kind: Kind, permissions: Array<Permissions>, school: School, kids?: Array<Skolengo> | undefined);
GetAllMails(limitPerFolder?: number, offset?: number): Promise<Array<MailFolder>>;
GetAssignments(periodStart?: Date, periodEnd?: Date): Promise<Array<Assignment>>;
GetAttendanceItems(): Promise<Array<AttendanceItem>>;
GetGradesForPeriod(period?: string): Promise<Array<Subject>>;
GetGradesSettings(): Promise<GradesSettings>;
GetLastGrades(limit?: number, offset?: number): Promise<Array<Grade>>;
GetMailFromFolder(folderId: string, limit: number, offset: number): Promise<Array<Mail>>;
GetMailSettings(): Promise<MailSettings>;
GetNews(): Promise<Array<News>>;
GetTimetable(periodStart?: Date, periodEnd?: Date): Promise<Array<TimetableDay>>;
initKids(kids: Array<KidData>): Promise<void>;
refreshAccessToken(): Promise<boolean>;
SendMail(subject: string, content: string, recipients?: Array<Recipients>, cc?: Array<Recipients>, bcc?: Array<Recipients>): Promise<Mail>;
}
/**
* Handles the OpenID Connect authentication flow for a given school.
*/
declare class AuthFlow {
challengeMethod: ChallengeMethod;
endpoints: Endpoints;
schoolId: string;
jwks: JWKS;
school: School;
private verifier;
private state;
private challenge;
/**
* Constructs a new instance of the AuthFlow.
* @param challengeMethod - The PKCE challenge method (e.g., 'S256' or 'plain'), SHA256 is recommended for security purpose.
* @param endpoints - The OIDC endpoints (authorization, token, well-known).
* @param schoolId - The unique identifier for the school (Provided by Skolengo).
* @param jwks - The JSON Web Key Set used to validate OIDC tokens.
* @param school - The School object with metadata such as EMS code.
*/
constructor(challengeMethod: ChallengeMethod, endpoints: Endpoints, schoolId: string, jwks: JWKS, school: School);
/**
* Generates a PKCE code challenge based on the provided method.
* @param verifier - The random verifier string.
* @param method - The challenge method (S256 or plain).
* @returns The resulting challenge string.
*/
private generateChallenge;
/**
* Returns the login URL that the user should be redirected to in order to authenticate.
*/
get loginURL(): string;
/**
* Finalizes the login process by exchanging the code for tokens
* and retrieving user information.
* @param code - The authorization code received from the provider.
* @param state - The state returned from the provider (must match the one we generated).
* @returns A promise resolving to the authenticated Skolengo user.
*/
finalizeLogin(code: string, state: string): Promise<Skolengo>;
}
/**
* Represents a school entity with identity, location, and authentication details.
*/
declare class School {
id: string;
name: string;
emsCode: string;
OIDCWellKnown: string;
location: Location;
homepage?: string | undefined;
UAI?: string | undefined;
subscribedServices?: Array<Services> | undefined;
/**
* @param id - Unique ID for each school, starting with "SKO-E-".
* @param name - Display name of the school.
* @param emsCode - EMS code used for internal identification.
* @param OIDCWellKnown - URL to the school's OIDC `.well-known` configuration.
* @param location - Geographical and postal location of the school.
* @param homepage - Optional CAS homepage (not for login initiation).
* @param UAI - Administrative identifier (Unité Administrative Immatriculée).
* @param subscribedServices - List of services the school is subscribed to.
*/
constructor(id: string, name: string, emsCode: string, OIDCWellKnown: string, location: Location, homepage?: string | undefined, UAI?: string | undefined, subscribedServices?: Array<Services> | undefined);
/**
* Initializes the OIDC authentication flow for this school.
* @param challengeMethod - PKCE challenge method to use (default: S256).
* @returns An initialized AuthFlow ready to start the login process.
*/
initializeLogin(challengeMethod?: ChallengeMethod): Promise<AuthFlow>;
}
declare const SearchSchools: (query: string, limit?: number, offset?: number) => Promise<Array<School>>;
declare const GetSchoolNews: (accessToken: string, emsCode: string) => Promise<Array<News>>;
declare const GetUserInfo: (accessToken: string, refreshToken: string, wellKnownURL: string, refreshURL: string, emsCode: string) => Promise<Skolengo>;
declare const DecodePayload: (token: string) => Record<string, unknown>;
interface SingleRelation<T extends string> {
id: string;
type: T;
}
declare function getSingleRelation<T extends string>(rel?: RelationshipData<T>): SingleRelation<T> | undefined;
declare const getMultipleRelations: <T extends string>(rel?: RelationshipData<T>) => Array<SingleRelation<T>>;
declare const extractBaseUrl: (url: string) => [string, string];
export { type AgendaAttributes, Assignment, Attachment, AttendanceItem, AttendanceItemState, AttendanceItemType, AuthFlow, type Author, type BaseDataResponse, type BaseIncluded, type BaseResponse, ChallengeMethod, type CommunicationAttributes, DecodePayload, type Endpoints, GetAssignmentAttachments, GetAssignments, GetAttendanceItems, GetGradesForPeriod, GetGradesSettings, GetLastGrades, GetMailSettings, GetMailsFromFolder, GetMessagesFromMail, GetOIDCAccessTokens, GetOIDCJWKS, GetOIDCWellKnown, GetSchoolNews, GetUserInfo, Grade, type GradesAttributes, type GradesServiceAttribute, type GradesSettings, type GradesSettingsAttributes, type JWK, type JWKS, type JWTPayload, type KidData, Kind, Lesson, type Location, Mail, MailFolder, MailFolderType, type MailSettings, Message, News, type NewsAttributes, type OIDCAccessToken, type OIDCProviderMetadata, OIDCRefresh, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, type ParticipationAttributes, Period, type Permission, Permissions, REDIRECT_URI, type Recipients, type RelationshipData, type Relationships, type RequestOptions, School, type SchoolAttributes, type SchoolAudience, SearchSchools, SendMail, Services, SetAssignmentCompletion, SkillLevel, SkillLevels, Skolengo, Subject, TimetableDay, type UserAttributes, type absenceFileStateIncluded, type absenceReasonIncluded, downloadAttachment, extractBaseUrl, type fileIncluded, type folderIncluded, getMultipleRelations, getSingleRelation, getTimetableForPeriods, type gradeResultIncluded, type gradesIncluded, type gradesServiceIncluded, type lessonIncluded, type nonTeachingStaffIncluded, type participationIncluded, type periodIncluded, type personParticipantIncluded, type schoolIncluded, type schoolInfoAuthorIncluded, type schoolInfoTechnicalUser, type signatureIncluded, type skillColorsIncluded, type skillsIncluded, type studentIncluded, type userMailSettingAttributes };