diff --git a/.gitignore b/.gitignore index d4ff916..c2658d7 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ node_modules/ -dist/ -types diff --git a/dist/Kdecole.js b/dist/Kdecole.js new file mode 100644 index 0000000..ddc0bc6 --- /dev/null +++ b/dist/Kdecole.js @@ -0,0 +1,492 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ApiUrl = exports.BASE_URL = exports.APP_VERSION = void 0; +const axios_1 = require("axios"); +const Desactivation_1 = require("./entities/Authentication/Desactivation"); +const Activation_1 = require("./entities/Authentication/Activation"); +const Releve_1 = require("./entities/Note/Releve"); +const TravailAFaire_1 = require("./entities/Travail/TravailAFaire"); +const Actualite_1 = require("./entities/News/Actualite"); +const AbsencesList_1 = require("./entities/VieScolaire/AbsencesList"); +const Utilisateur_1 = require("./entities/User/Utilisateur"); +const Calendrier_1 = require("./entities/Calendar/Calendrier"); +const NotesList_1 = require("./entities/Note/NotesList"); +const MessageInfo_1 = require("./entities/Messagerie/MessageInfo"); +const MessageBoiteReception_1 = require("./entities/Messagerie/MessageBoiteReception"); +const ContenuActivite_1 = require("./entities/Travail/ContenuActivite"); +const ContenuArticle_1 = require("./entities/News/ContenuArticle"); +const Communication_1 = require("./entities/Messagerie/Communication"); +const GestionAppels_1 = require("./entities/Prof/GestionAppels"); +exports.APP_VERSION = '3.4.14'; +exports.BASE_URL = 'https://mobilite.monbureaunumerique.fr/mobilite'; +var ApiUrl; +(function (ApiUrl) { + ApiUrl["PROD_MON_BUREAU_NUMERIQUE"] = "https://mobilite.monbureaunumerique.fr/mobilite"; + ApiUrl["PREPROD_MON_BUREAU_NUMERIQUE"] = "https://mobilite.preprod.monbureaunumerique.fr/mobilite"; + ApiUrl["PROD_MON_ENT_OCCITANIE"] = "https://mobilite.mon-ent-occitanie.fr/mobilite"; + ApiUrl["PROD_ARSENE76"] = "https://mobilite.arsene76.fr/mobilite"; + ApiUrl["PROD_ENT27"] = "https://mobilite.ent27.fr/mobilite"; + ApiUrl["PROD_ENDCREUSE"] = "https://mobilite.entcreuse.fr/mobilite"; + ApiUrl["PROD_AUVERGNERHONEALPES"] = "https://mobilite.ent.auvergnerhonealpes.fr/mobilite"; + ApiUrl["PROD_SAVOIRSNUMERIQUES62"] = "https://mobilite.savoirsnumeriques62.fr/mobilite"; +})(ApiUrl = exports.ApiUrl || (exports.ApiUrl = {})); +/** + * Support non-officiel de l'API Kdecole (Mon Bureau Numérique, Skolengo, etc.) + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(Kdecole.login(USERNAME, PASSWORD)) + * // ou encore: + * const user = new Kdecole(AUTH_TOKEN) + * ``` + */ +class Kdecole { + /** + * @param {string} authToken Le jeton d'accès + * @param {string} appVersion La version de l'application mobile autorisée par l'API + * @param {number} idEtablissement L'identifiant de l'établissement + * @param {ApiUrl|string} apiURL L'URL de l'API Kdecole + */ + constructor(authToken, appVersion = exports.APP_VERSION, idEtablissement = 0, apiURL = ApiUrl.PROD_MON_BUREAU_NUMERIQUE) { + if (authToken === undefined) { + throw Error("Un jeton d'accès doit être renseigné"); + } + this.authToken = authToken; + this.appVersion = appVersion; + this.idEtablissement = idEtablissement; + this.apiURL = apiURL; + } + /** + * Retourne le jeton d'accès de l'utilisateur + * @param {string} username Le nom d'utilisateur + * @param {string} password Le mot de passe à usage unique + * @param {string} appVersion La version de l'application mobile autorisée par l'API + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const authToken = Kdecole.login(username, password) + * console.log(authToken) //Afficher son token d'authentification + * ``` + */ + static async login(username, password, appVersion = exports.APP_VERSION) { + const activation = new Activation_1.default(await Kdecole.kdecole(new Kdecole('', appVersion, 0), { + service: 'activation', + parameters: `${username}/${password}` + })); + if (activation.authtoken && activation.success) { + return activation.authtoken; + } + else { + throw Error('Erreur de connexion'); + } + } + /** + * Invalide le jeton d'accès + * @example ```js + * const Kdecole = require('kdecole-api').default + * const user = new Kdecole(authToken) + * user.logout() + * ``` + * @return {Promise} + */ + async logout() { + const desactivation = new Desactivation_1.default(await Kdecole.kdecole(this, { service: 'desactivation' })); + if (desactivation.success) + return desactivation; + throw Error('Une erreur est survenue dans le traitement des données de déconnexion'); + } + /** + * Retourne le relevé de notes de l'élève + * @example ```js + * kdecole.getReleve() //Retourne le relevé de l'élève + * kdecole.getReleve(idEleve) //Retourne le relevé d'un élève précis + * ``` + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getReleve(idEleve).then((releve)=>{ + * // Votre code + * }) + * ``` + */ + async getReleve(idEleve) { + return new Releve_1.default(await Kdecole.kdecole(this, { + service: 'consulterReleves', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })); + } + /** + * Retourne un tableau des actualités de l'établissement de l'utilisateur + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getActualites(idEleve).then((actualites)=>{ + * // Votre code + * }) + * ``` + */ + async getActualites(idEleve) { + const actualites = []; + for (const JSONactualite of await Kdecole.kdecole(this, { + service: 'actualites', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })) { + actualites.push(new Actualite_1.default(JSONactualite)); + } + return actualites; + } + /** + * Retourne le contenu d'un article + * @param {string} uid Identifiant unique de l'article + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getContenuArticle(uid).then((contenuArticle)=>{ + * // Votre code + * }) + * ``` + */ + async getContenuArticle(uid) { + return new ContenuArticle_1.default(await Kdecole.kdecole(this, { service: 'contenuArticle', parameters: `article/${uid}` })); + } + /** + * Retourne la liste des devoirs de l'élève + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getTravailAFaire(idEleve).then((taf)=>{ + * // Votre code + * }) + * ``` + */ + async getTravailAFaire(idEleve) { + return new TravailAFaire_1.default(await Kdecole.kdecole(this, { + service: 'travailAFaire', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })); + } + /** + * Retourne les détails d'un devoir à faire + * @param {number} uidSeance Identifiant de la séance + * @param {number} uid Identifiant du devoir à faire + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getContenuActivite(uidSeance, uid, idEleve).then((contenuActivite)=>{ + * // Votre code + * }) + * ``` + */ + async getContenuActivite(uidSeance, uid, idEleve) { + return new ContenuActivite_1.default(await Kdecole.kdecole(this, { + service: 'contenuActivite', + parameters: `${idEleve ? 'ideleve/' + idEleve : 'idetablissement/' + this.idEtablissement}/${uidSeance}/${uid}` + })); + } + /** + * Permet de marquer un devoir comme étant fait + * @param uidSeance {number} Identifiant de la séance + * @param uid {number} Identifiant du devoir + * @param flagRealise {boolean} Statut du devoir + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.setActiviteFinished(uidSeance, uid, flagRealise) + * ``` + */ + async setActiviteFinished(uidSeance, uid, flagRealise) { + await Kdecole.kdecole(this, { + service: 'contenuActivite', + parameters: `idetablissement/${this.idEtablissement}/${uidSeance}/${uid}`, + type: 'put', + data: { + flagRealise: flagRealise + } + }); + } + /** + * Retourne la liste des absences d'un élève + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getAbsences(idEleve).then((absences)=>{ + * // Votre code + * }) + * ``` + */ + async getAbsences(idEleve) { + return new AbsencesList_1.default(await Kdecole.kdecole(this, { + service: 'consulterAbsences', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })); + } + /** + * Retourne les informations d'un utilisateur (type de compte, nom complet, numéro de l'établiissement, etc.) + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getInfoUtilisateur(idEleve).then((infoUtilisateur)=>{ + * // Votre code + * }) + * ``` + */ + async getInfoUtilisateur(idEleve) { + return new Utilisateur_1.default(await Kdecole.kdecole(this, { + service: 'infoutilisateur', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })); + } + /** + * Retourne l'emploi du temps de l'élève à J-7 et J+7 + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getCalendrier(idEleve).then((calendrier)=>{ + * // Votre code + * }) + * ``` + */ + async getCalendrier(idEleve) { + return new Calendrier_1.default(await Kdecole.kdecole(this, { + service: 'calendrier', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })); + } + /** + * Retourne la liste des récentes notes de l'élève + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getNotes(idEleve).then((notes)=>{ + * // Votre code + * }) + * ``` + */ + async getNotes(idEleve) { + return new NotesList_1.default(await Kdecole.kdecole(this, { + service: 'consulterNotes', + parameters: idEleve ? `ideleve/${idEleve}` : undefined + })); + } + /** + * Retourne l'état de la messagerie de l'utilisateur (nombre de mails non lus) + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getMessagerieInfo().then((messagerieInfo)=>{ + * // Votre code + * }) + * ``` + */ + async getMessagerieInfo() { + return new MessageInfo_1.default(await Kdecole.kdecole(this, { service: 'messagerie/info' })); + } + /** + * Retourne les mails présents dans la boîte mail + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getMessagerieBoiteReception().then((messagerieBoiteReception)=>{ + * // Votre code + * }) + * ``` + */ + async getMessagerieBoiteReception() { + return new MessageBoiteReception_1.default(await Kdecole.kdecole(this, { service: 'messagerie/boiteReception' })); + } + /** + * Retourne les détails d'un fil de discussion + * @param {number} id Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getCommunication(id).then((communication)=>{ + * // Votre code + * }) + * ``` + */ + async getCommunication(id) { + return new Communication_1.default(await Kdecole.kdecole(this, { + service: 'messagerie/communication', + type: 'get', + parameters: `${id}` + })); + } + /** + * Permet de signaler une communication + * @param {number} id Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.reportCommunication(id) + * ``` + */ + async reportCommunication(id) { + await Kdecole.kdecole(this, { + service: 'messagerie/communication/signaler', + type: 'put', + parameters: `${id}` + }); + } + /** + * Supprime la communication + * @param {number} id Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.deleteCommunication(id) + * ``` + */ + async deleteCommunication(id) { + await Kdecole.kdecole(this, { + service: 'messagerie/communication/supprimer', + parameters: `${id}`, + type: 'delete' + }); + } + /** + * Marquer une communication lue + * @param id {number} Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.setCommunicationLu(id) + * ``` + */ + async setCommunicationLu(id) { + await Kdecole.kdecole(this, { + service: 'messagerie/communication/lu', + parameters: `${id}`, + type: 'put', + data: { + action: 'lu' + } + }); + } + /** + * Envoyer un message sur un fil de discussion + * @param id {number} Identifiant d'un fil de discussion + * @param corpsMessage {string} Corps du message HTML + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.sendMessage(id, corpsMessage) + * ``` + */ + async sendMessage(id, corpsMessage) { + await Kdecole.kdecole(this, { + service: 'messagerie/communication/nouvelleParticipation', + parameters: `${id}`, + type: 'put', + data: { + dateEnvoi: (new Date()).getTime(), + corpsMessage: corpsMessage + } + }); + } + /** + * Retourne les feuilles d'appel. + * @return {Promise} Les feuilles d'appel. + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.gestionAppels().then((gestionAppels)=>{ + * // Votre code + * }) + * ``` + */ + async gestionAppels() { + return new GestionAppels_1.default(await Kdecole.kdecole(this, { service: 'gestionAppels' })); + } + /** + * Valide l'appel de la classe. + * @return {Promise} + * @param appel L'appel à valider + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * const appel = { + * "idEtab": 10485, + * "idAppel": 534552, + * "listeAbsencesAppel": [ + * { + * "idEleve": "AAP05567", + * "type": "absence", + * "dateDebut": 1609259443000, + * "dateFin": 1609263043000, + * "modifiable": true + * } + * ] + * } + * user.validerAppel(appel) + * ``` + */ + async validerAppel(appel) { + await Kdecole.kdecole(this, { + service: 'gestionAppels', + parameters: `idetablissement/${this.idEtablissement}/valider`, + type: 'put', + data: appel + }); + } + static async kdecole(ctx, { service, parameters, type = 'get', data }) { + if (parameters === undefined && service !== 'desactivation' && service !== 'messagerie/info' && service !== 'messagerie/communication' && service !== 'messagerie/boiteReception') + parameters = `idetablissement/${ctx.idEtablissement}`; + return (await axios_1.default.request({ + baseURL: ctx.apiURL, + headers: { + 'X-Kdecole-Vers': ctx.appVersion, + 'X-Kdecole-Auth': ctx.authToken + }, + responseType: 'json', + method: type, + url: parameters ? `/${service}/${parameters}/` : `/${service}/`, + data: data + })).data; + } +} +exports.default = Kdecole; diff --git a/dist/entities/Authentication/Activation.js b/dist/entities/Authentication/Activation.js new file mode 100644 index 0000000..fcfa06c --- /dev/null +++ b/dist/entities/Authentication/Activation.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Activation { + constructor(activation) { + this.errmsg = activation.errmsg; + this.success = activation.success; + this.authtoken = activation.authtoken; + } +} +exports.default = Activation; diff --git a/dist/entities/Authentication/Desactivation.js b/dist/entities/Authentication/Desactivation.js new file mode 100644 index 0000000..520ce38 --- /dev/null +++ b/dist/entities/Authentication/Desactivation.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Desactivation { + constructor(desactivation) { + this.errmsg = desactivation.errmsg; + this.success = desactivation.success; + this.authtoken = desactivation.authtoken; + } +} +exports.default = Desactivation; diff --git a/dist/entities/Calendar/Calendrier.js b/dist/entities/Calendar/Calendrier.js new file mode 100644 index 0000000..589cca9 --- /dev/null +++ b/dist/entities/Calendar/Calendrier.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ListeJourCdt_1 = require("./ListeJourCdt"); +class Calendrier { + constructor(calendrier) { + this.listeJourCdt = []; + this.errmsg = calendrier.errmsg; + this.currentDate = new Date(calendrier.currentDate); + this.cdtOuvert = calendrier.cdtOuvert; + calendrier.listeJourCdt.forEach(listeJourCdt => this.listeJourCdt.push(new ListeJourCdt_1.default(listeJourCdt))); + } +} +exports.default = Calendrier; diff --git a/dist/entities/Calendar/Exercice.js b/dist/entities/Calendar/Exercice.js new file mode 100644 index 0000000..6af93c3 --- /dev/null +++ b/dist/entities/Calendar/Exercice.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Exercice { + constructor(enSeance) { + this.type = enSeance.type; + this.uid = enSeance.uid; + this.date = new Date(enSeance.date); + this.titre = enSeance.titre; + } +} +exports.default = Exercice; diff --git a/dist/entities/Calendar/ListeJourCdt.js b/dist/entities/Calendar/ListeJourCdt.js new file mode 100644 index 0000000..0ff9309 --- /dev/null +++ b/dist/entities/Calendar/ListeJourCdt.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Seance_1 = require("./Seance"); +class ListeJourCdt { + constructor(listeJourCdt) { + this.listeSeances = []; + listeJourCdt.listeSeances.forEach(seance => this.listeSeances.push(new Seance_1.default(seance))); + this.date = new Date(listeJourCdt.date); + } +} +exports.default = ListeJourCdt; diff --git a/dist/entities/Calendar/Seance.js b/dist/entities/Calendar/Seance.js new file mode 100644 index 0000000..8f05075 --- /dev/null +++ b/dist/entities/Calendar/Seance.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Exercice_1 = require("./Exercice"); +class Seance { + constructor(seance) { + this.enSeance = []; + this.aFaire = []; + this.aRendre = []; + this.hdeb = new Date(seance.hdeb); + seance.enSeance?.forEach(enSeance => this.enSeance?.push(new Exercice_1.default(enSeance))); + this.matiere = seance.matiere; + seance.aFaire?.forEach(aFaire => this.aFaire?.push(new Exercice_1.default(aFaire))); + this.heureFin = seance.heureFin; + this.flagModif = seance.flagModif; + this.titre = seance.titre; + this.flagActif = seance.flagActif; + this.heureDebut = seance.heureDebut; + this.hfin = new Date(seance.hfin); + seance.aRendre?.forEach(aRendre => this.aRendre?.push(new Exercice_1.default(aRendre))); + this.motifModif = seance.motifModif; + this.idSeance = seance.idSeance; + this.salle = seance.salle; + } +} +exports.default = Seance; diff --git a/dist/entities/Messagerie/Attachment.js b/dist/entities/Messagerie/Attachment.js new file mode 100644 index 0000000..3a3d835 --- /dev/null +++ b/dist/entities/Messagerie/Attachment.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Attachment { + constructor(attachment) { + this.idRessource = attachment.idRessource; + this.url = attachment.url; + this.name = attachment.name; + this.typeMIME = attachment.typeMIME; + } +} +exports.default = Attachment; diff --git a/dist/entities/Messagerie/Communication.js b/dist/entities/Messagerie/Communication.js new file mode 100644 index 0000000..1fccf6d --- /dev/null +++ b/dist/entities/Messagerie/Communication.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Participant_1 = require("./Participant"); +const Participation_1 = require("./Participation"); +class Communication { + constructor(communication) { + this.participants = []; + this.participations = []; + communication.participants?.forEach(participant => this.participants.push(new Participant_1.default(participant))); + this.expediteurActuel = new Participant_1.default(communication.expediteurActuel); + this.signalable = communication.signalable; + this.expediteurInitial = new Participant_1.default(communication.expediteurInitial); + this.id = communication.id; + this.dateDernierMessage = new Date(communication.dateDernierMessage); + this.nbParticipations = communication.nbParticipations; + this.isExpediteurInitial = communication.isExpediteurInitial; + this.pieceJointe = communication.pieceJointe; + communication.participations?.forEach(participation => this.participations.push(new Participation_1.default(participation))); + this.objet = communication.objet; + this.type = communication.type; + this.etat = communication.etat; + this.premieresLignes = communication.premieresLignes; + this.etatLecure = communication.etatLecture; + } +} +exports.default = Communication; diff --git a/dist/entities/Messagerie/MessageBoiteReception.js b/dist/entities/Messagerie/MessageBoiteReception.js new file mode 100644 index 0000000..42a4ad0 --- /dev/null +++ b/dist/entities/Messagerie/MessageBoiteReception.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Communication_1 = require("./Communication"); +class MessageBoiteReception { + constructor(messageBoiteReception) { + this.communications = []; + this.nbMaxCommunicationRecues = messageBoiteReception.nbMaxCommunicationRecues; + messageBoiteReception.communications.forEach(communication => this.communications.push(new Communication_1.default(communication))); + this.nbMaxCaracteresMessage = messageBoiteReception.nbMaxCaracteresMessage; + this.nbMaxCommunicationBoiteReception = messageBoiteReception.nbMaxCommunicationBoiteReception; + } +} +exports.default = MessageBoiteReception; diff --git a/dist/entities/Messagerie/MessageInfo.js b/dist/entities/Messagerie/MessageInfo.js new file mode 100644 index 0000000..0739dc3 --- /dev/null +++ b/dist/entities/Messagerie/MessageInfo.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class MessageInfo { + constructor(messageInfo) { + this.nbMessagesNonLus = messageInfo.nbMessagesNonLus; + } +} +exports.default = MessageInfo; diff --git a/dist/entities/Messagerie/Participant.js b/dist/entities/Messagerie/Participant.js new file mode 100644 index 0000000..bc2f850 --- /dev/null +++ b/dist/entities/Messagerie/Participant.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Participant { + constructor(participant) { + this.id = participant.id; + this.libelle = participant.libelle; + } +} +exports.default = Participant; diff --git a/dist/entities/Messagerie/Participation.js b/dist/entities/Messagerie/Participation.js new file mode 100644 index 0000000..4ed54ca --- /dev/null +++ b/dist/entities/Messagerie/Participation.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Attachment_1 = require("./Attachment"); +const Participant_1 = require("./Participant"); +class Participation { + constructor(participation) { + this.pjs = []; + this.dateEnvoi = new Date(participation.dateEnvoi); + this.corpsMessage = participation.corpsMessage; + participation.pjs.forEach(pj => this.pjs.push(new Attachment_1.default(pj))); + this.id = participation.id; + this.libelleObjet = participation.libelleObjet; + this.redacteur = new Participant_1.default(participation.redacteur); + this.premieresLignes = participation.premieresLignes; + this.typeMessage = participation.typeMessage; + } +} +exports.default = Participation; diff --git a/dist/entities/News/Actualite.js b/dist/entities/News/Actualite.js new file mode 100644 index 0000000..a97e569 --- /dev/null +++ b/dist/entities/News/Actualite.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Actualite { + constructor(article) { + this.errmsg = article.errmsg; + this.type = article.type; + this.auteur = article.auteur; + this.codeEmetteur = parseInt(article.codeEmetteur); + this.titre = article.titre; + this.date = new Date(article.date); + this.uid = article.uid; + } +} +exports.default = Actualite; diff --git a/dist/entities/News/ContenuArticle.js b/dist/entities/News/ContenuArticle.js new file mode 100644 index 0000000..26dc4a9 --- /dev/null +++ b/dist/entities/News/ContenuArticle.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Attachment_1 = require("../Messagerie/Attachment"); +class ContenuArticle { + constructor(contenuArticle) { + this.pjs = []; + this.errmsg = contenuArticle.errmsg; + this.titre = contenuArticle.titre; + this.codeHTML = contenuArticle.codeHTML; + this.date = new Date(contenuArticle.date); + this.url = contenuArticle.url; + this.auteur = contenuArticle.auteur; + this.type = contenuArticle.type; + contenuArticle.pjs.forEach(pj => this.pjs.push(new Attachment_1.default(pj))); + } +} +exports.default = ContenuArticle; diff --git a/dist/entities/Note/Matiere.js b/dist/entities/Note/Matiere.js new file mode 100644 index 0000000..8c346c0 --- /dev/null +++ b/dist/entities/Note/Matiere.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Note_1 = require("./Note"); +class Matiere { + constructor(matiere) { + this.devoirs = []; + this.bareme = parseInt(matiere.bareme); + this.moyenneEleve = Note_1.default.stringNoteToNumber(matiere.moyenneEleve); + matiere.devoirs.forEach((devoir) => this.devoirs.push(new Note_1.default(devoir))); + this.enseignants = matiere.enseignants; + this.matiereLibelle = matiere.matiereLibelle; + this.moyenneClasse = Note_1.default.stringNoteToNumber(matiere.moyenneClasse); + } +} +exports.default = Matiere; diff --git a/dist/entities/Note/Note.js b/dist/entities/Note/Note.js new file mode 100644 index 0000000..20aedd9 --- /dev/null +++ b/dist/entities/Note/Note.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Note { + constructor(note) { + this.note = Note.stringNoteToNumber(note.note); + this.date = new Date(note.date); + this.medianeClasse = Note.stringNoteToNumber(note.medianeClasse); + this.noteMin = Note.stringNoteToNumber(note.noteMin); + this.appreciation = note.appreciation; + this.bareme = note.bareme; + this.coefficient = note.coefficient; + this.id = note.id; + this.titreDevoir = note.titreDevoir; + this.noteMax = Note.stringNoteToNumber(note.noteMax); + this.facultatif = note.facultatif; + this.moyenne = Note.stringNoteToNumber(note.moyenne); + this.comptabilise = note.comptabilise; + this.commentaireDevoir = note.commentaireDevoir; + this.matiere = note.matiere; + this.sousMatiere = note.sousMatiere; + } + static stringNoteToNumber(note) { + return note !== null ? parseFloat(note.replace(',', '.')) : null; + } +} +exports.default = Note; diff --git a/dist/entities/Note/NotesList.js b/dist/entities/Note/NotesList.js new file mode 100644 index 0000000..e919344 --- /dev/null +++ b/dist/entities/Note/NotesList.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Note_1 = require("./Note"); +class NotesList { + constructor(notesList) { + this.listeNotes = []; + this.errmsg = notesList.errmsg; + this.codeEleve = notesList.codeEleve; + this.moduleNotesActif = notesList.moduleNotesActif; + this.nbNotesMax = notesList.nbNotesMax; + notesList.listeNotes.forEach(note => this.listeNotes.push(new Note_1.default(note))); + } +} +exports.default = NotesList; diff --git a/dist/entities/Note/Releve.js b/dist/entities/Note/Releve.js new file mode 100644 index 0000000..51789fc --- /dev/null +++ b/dist/entities/Note/Releve.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Trimestre_1 = require("./Trimestre"); +class Releve { + constructor(releve) { + this.trimestres = []; + releve.forEach(trimestre => this.trimestres.push(new Trimestre_1.default(trimestre))); + } +} +exports.default = Releve; diff --git a/dist/entities/Note/Trimestre.js b/dist/entities/Note/Trimestre.js new file mode 100644 index 0000000..70b79cb --- /dev/null +++ b/dist/entities/Note/Trimestre.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Matiere_1 = require("./Matiere"); +class Trimestre { + constructor(trimestre) { + this.matieres = []; + trimestre.matieres.forEach(matiere => this.matieres.push(new Matiere_1.default(matiere))); + this.idPeriode = trimestre.idPeriode; + this.libelleClasse = trimestre.libelleClasse; + this.periodeLibelle = trimestre.periodeLibelle; + this.periodeEnCours = trimestre.periodeEnCours; + this.bareme = parseInt(trimestre.bareme); + } + /** + * Retourne la moyenne générale de l'élève + * @return {number} + */ + getMoyenneGenerale() { + const moyennes = this.getTableauMoyennes(); + if (moyennes.length === 0) + return false; + let moyenneGenerale = 0; + for (const moyenne of moyennes) { + moyenneGenerale += moyenne / moyennes.length; + } + return moyenneGenerale; + } + /** + * Retourne la médiane des moyennes des matières de l'élève + * @return {number} + */ + getMedianeGenerale() { + let moyennes = this.getTableauMoyennes(); + if (moyennes.length === 0) + return false; + moyennes = moyennes.slice(0).sort(function (x, y) { + return x - y; + }); + const b = (moyennes.length + 1) / 2; + return (moyennes.length % 2) ? moyennes[b - 1] : (moyennes[b - 1.5] + moyennes[b - 0.5]) / 2; + } + /** + * Retourne un tableau contenant les moyennes des matières de l'élève + * @return {number[]} + */ + getTableauMoyennes() { + const moyennes = []; + for (const matiere of this.matieres) { + if (typeof matiere.moyenneEleve === 'number') { + moyennes.push(matiere.moyenneEleve); + } + } + return moyennes; + } +} +exports.default = Trimestre; diff --git a/dist/entities/Prof/AbsenceEleveAppel.js b/dist/entities/Prof/AbsenceEleveAppel.js new file mode 100644 index 0000000..e14c84a --- /dev/null +++ b/dist/entities/Prof/AbsenceEleveAppel.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class AbsenceEleveAppel { + constructor(absenceEleveAppel) { + this.idAbsence = absenceEleveAppel.idAbsence; + this.type = absenceEleveAppel.type; + this.dateDebut = new Date(absenceEleveAppel.dateDebut); + this.dateFin = new Date(absenceEleveAppel.dateFin); + this.idMotif = absenceEleveAppel.idMotif; + this.modifiable = absenceEleveAppel.modifiable; + this.idEleve = absenceEleveAppel.idEleve; + } +} +exports.default = AbsenceEleveAppel; diff --git a/dist/entities/Prof/Appel.js b/dist/entities/Prof/Appel.js new file mode 100644 index 0000000..a820dad --- /dev/null +++ b/dist/entities/Prof/Appel.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const EleveAppel_1 = require("./EleveAppel"); +class Appel { + constructor(appel) { + this.listeElevesAppel = []; + this.isEnCours = appel.isEnCours; + this.dateDebut = new Date(appel.dateDebut); + this.dateFin = new Date(appel.dateFin); + this.idAppel = appel.idAppel; + this.libelleGroupe = appel.libelleGroupe; + appel.listeElevesAppel.forEach(eleveAppel => this.listeElevesAppel.push(new EleveAppel_1.default(eleveAppel))); + } +} +exports.default = Appel; diff --git a/dist/entities/Prof/EleveAppel.js b/dist/entities/Prof/EleveAppel.js new file mode 100644 index 0000000..a66d1a6 --- /dev/null +++ b/dist/entities/Prof/EleveAppel.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const AbsenceEleveAppel_1 = require("./AbsenceEleveAppel"); +class EleveAppel { + constructor(eleveAppel) { + this.nomEleve = eleveAppel.nomEleve; + this.prenomEleve = eleveAppel.prenomEleve; + this.idEleve = eleveAppel.idEleve; + if (eleveAppel.absenceEleveAppel) + this.absenceEleveAppel = new AbsenceEleveAppel_1.default(eleveAppel.absenceEleveAppel); + } +} +exports.default = EleveAppel; diff --git a/dist/entities/Prof/GestionAppels.js b/dist/entities/Prof/GestionAppels.js new file mode 100644 index 0000000..a88c254 --- /dev/null +++ b/dist/entities/Prof/GestionAppels.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Appel_1 = require("./Appel"); +class GestionAppels { + constructor(gestionAppels) { + this.listeAppels = []; + this.dateDuJour = new Date(gestionAppels.dateDuJour); + gestionAppels.listeAppels.forEach(appel => this.listeAppels.push(new Appel_1.default(appel))); + } +} +exports.default = GestionAppels; diff --git a/dist/entities/Travail/ContenuActivite.js b/dist/entities/Travail/ContenuActivite.js new file mode 100644 index 0000000..e08f54f --- /dev/null +++ b/dist/entities/Travail/ContenuActivite.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Attachment_1 = require("../Messagerie/Attachment"); +class ContenuActivite { + constructor(contenuActivite) { + this.pjs = []; + this.errmsg = contenuActivite.errmsg; + this.codeHTML = contenuActivite.codeHTML; + this.flagRealise = contenuActivite.flagRealise; + this.flagTravailAfaire = contenuActivite.flagTravailAFaire; + this.titre = contenuActivite.titre; + this.date = new Date(contenuActivite.date); + this.isFaitModifiable = contenuActivite.isFaitModifiable; + this.type = contenuActivite.type; + this.matiere = contenuActivite.matiere; + contenuActivite.pjs.forEach(pj => this.pjs.push(new Attachment_1.default(pj))); + } +} +exports.default = ContenuActivite; diff --git a/dist/entities/Travail/ListeTravaux.js b/dist/entities/Travail/ListeTravaux.js new file mode 100644 index 0000000..811d00d --- /dev/null +++ b/dist/entities/Travail/ListeTravaux.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Travail_1 = require("./Travail"); +class ListeTravaux { + constructor(listTravaux) { + this.listTravail = []; + this.date = new Date(listTravaux.date); + listTravaux.listTravail.forEach(travail => this.listTravail.push(new Travail_1.default(travail))); + } +} +exports.default = ListeTravaux; diff --git a/dist/entities/Travail/Travail.js b/dist/entities/Travail/Travail.js new file mode 100644 index 0000000..4be65b8 --- /dev/null +++ b/dist/entities/Travail/Travail.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Travail { + constructor(travailAFaire) { + this.type = travailAFaire.type; + this.temps = travailAFaire.temps; + this.matiere = travailAFaire.matiere; + this.flagRealise = travailAFaire.flagRealise; + this.titre = travailAFaire.titre; + this.date = new Date(travailAFaire.date); + this.uid = parseInt(travailAFaire.uid); + this.uidSeance = parseInt(travailAFaire.uidSeance); + } +} +exports.default = Travail; diff --git a/dist/entities/Travail/TravailAFaire.js b/dist/entities/Travail/TravailAFaire.js new file mode 100644 index 0000000..9df792d --- /dev/null +++ b/dist/entities/Travail/TravailAFaire.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ListeTravaux_1 = require("./ListeTravaux"); +class TravailAFaire { + constructor(travailAFaire) { + this.listeTravaux = []; + this.errmsg = travailAFaire.errmsg; + this.tafOuvert = travailAFaire.tafOuvert; + travailAFaire.listeTravaux.forEach(listeTravaux => this.listeTravaux.push(new ListeTravaux_1.default(listeTravaux))); + } +} +exports.default = TravailAFaire; diff --git a/dist/entities/User/Eleve.js b/dist/entities/User/Eleve.js new file mode 100644 index 0000000..453b469 --- /dev/null +++ b/dist/entities/User/Eleve.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Eleve { + constructor(eleve) { + this.active = eleve.active; + this.nom = eleve.nom; + this.uid = eleve.uid; + this.permissions = eleve.permissions; + } +} +exports.default = Eleve; diff --git a/dist/entities/User/Etablissement.js b/dist/entities/User/Etablissement.js new file mode 100644 index 0000000..cdd02b0 --- /dev/null +++ b/dist/entities/User/Etablissement.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Etablissement { + constructor(etablissement) { + this.permissions = etablissement.permissions; + this.uid = etablissement.uid; + this.nom = etablissement.nom; + this.active = etablissement.active; + } +} +exports.default = Etablissement; diff --git a/dist/entities/User/Utilisateur.js b/dist/entities/User/Utilisateur.js new file mode 100644 index 0000000..666e0f3 --- /dev/null +++ b/dist/entities/User/Utilisateur.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Eleve_1 = require("./Eleve"); +const Etablissement_1 = require("./Etablissement"); +class Utilisateur { + constructor(utilisateur) { + this.eleves = []; + this.etabs = []; + this.errmsg = utilisateur.errmsg; + this.type = utilisateur.type; + this.nom = utilisateur.nom; + utilisateur.eleves?.forEach(eleve => this.eleves.push(new Eleve_1.default(eleve))); + utilisateur.etabs?.forEach(etab => this.etabs.push(new Etablissement_1.default(etab))); + this.xiti = utilisateur.xiti; + this.idEtablissementSelectionne = utilisateur.idEtablissementSelectionne; + this.idEleveSelectionne = utilisateur.idEleveSelectionne; + this.protection = utilisateur.protection; + this.timezone = utilisateur.timezone; + } +} +exports.default = Utilisateur; diff --git a/dist/entities/VieScolaire/Absence.js b/dist/entities/VieScolaire/Absence.js new file mode 100644 index 0000000..a14aa8c --- /dev/null +++ b/dist/entities/VieScolaire/Absence.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Absence { + constructor(absence) { + this.dateFin = new Date(absence.dateFin); + this.motif = absence.motif; + this.type = absence.type; + this.matiere = absence.matiere === '' ? null : absence.matiere; + this.justifiee = absence.justifiee; + this.dateDebut = new Date(absence.dateDebut); + } +} +exports.default = Absence; diff --git a/dist/entities/VieScolaire/AbsencesList.js b/dist/entities/VieScolaire/AbsencesList.js new file mode 100644 index 0000000..9a959b8 --- /dev/null +++ b/dist/entities/VieScolaire/AbsencesList.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Absence_1 = require("./Absence"); +class AbsencesList { + constructor(absenceList) { + this.listeAbsences = []; + this.errmsg = absenceList.errmsg; + this.codeEleve = absenceList.codeEleve; + this.nbAbsencesMax = absenceList.nbAbsencesMax; + absenceList.listeAbsences.forEach(absence => this.listeAbsences.push(new Absence_1.default(absence))); + } +} +exports.default = AbsencesList; diff --git a/types/Kdecole.d.ts b/types/Kdecole.d.ts new file mode 100644 index 0000000..062f7a7 --- /dev/null +++ b/types/Kdecole.d.ts @@ -0,0 +1,356 @@ +import Desactivation from './entities/Authentication/Desactivation'; +import Releve from './entities/Note/Releve'; +import TravailAFaire from './entities/Travail/TravailAFaire'; +import Actualite from './entities/News/Actualite'; +import AbsencesList from './entities/VieScolaire/AbsencesList'; +import Utilisateur from './entities/User/Utilisateur'; +import Calendrier from './entities/Calendar/Calendrier'; +import NotesList from './entities/Note/NotesList'; +import MessageInfo from './entities/Messagerie/MessageInfo'; +import MessageBoiteReception from './entities/Messagerie/MessageBoiteReception'; +import ContenuActivite from './entities/Travail/ContenuActivite'; +import ContenuArticle from './entities/News/ContenuArticle'; +import Communication from './entities/Messagerie/Communication'; +import GestionAppels from './entities/Prof/GestionAppels'; +export declare const APP_VERSION = "3.4.14"; +export declare const BASE_URL = "https://mobilite.monbureaunumerique.fr/mobilite"; +export declare enum ApiUrl { + PROD_MON_BUREAU_NUMERIQUE = "https://mobilite.monbureaunumerique.fr/mobilite", + PREPROD_MON_BUREAU_NUMERIQUE = "https://mobilite.preprod.monbureaunumerique.fr/mobilite", + PROD_MON_ENT_OCCITANIE = "https://mobilite.mon-ent-occitanie.fr/mobilite", + PROD_ARSENE76 = "https://mobilite.arsene76.fr/mobilite", + PROD_ENT27 = "https://mobilite.ent27.fr/mobilite", + PROD_ENDCREUSE = "https://mobilite.entcreuse.fr/mobilite", + PROD_AUVERGNERHONEALPES = "https://mobilite.ent.auvergnerhonealpes.fr/mobilite", + PROD_SAVOIRSNUMERIQUES62 = "https://mobilite.savoirsnumeriques62.fr/mobilite" +} +/** + * Support non-officiel de l'API Kdecole (Mon Bureau Numérique, Skolengo, etc.) + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(Kdecole.login(USERNAME, PASSWORD)) + * // ou encore: + * const user = new Kdecole(AUTH_TOKEN) + * ``` + */ +export default class Kdecole { + private readonly authToken; + private readonly appVersion; + private readonly idEtablissement; + private readonly apiURL; + /** + * @param {string} authToken Le jeton d'accès + * @param {string} appVersion La version de l'application mobile autorisée par l'API + * @param {number} idEtablissement L'identifiant de l'établissement + * @param {ApiUrl|string} apiURL L'URL de l'API Kdecole + */ + constructor(authToken: string, appVersion?: string, idEtablissement?: number, apiURL?: ApiUrl | string); + /** + * Retourne le jeton d'accès de l'utilisateur + * @param {string} username Le nom d'utilisateur + * @param {string} password Le mot de passe à usage unique + * @param {string} appVersion La version de l'application mobile autorisée par l'API + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const authToken = Kdecole.login(username, password) + * console.log(authToken) //Afficher son token d'authentification + * ``` + */ + static login(username: string, password: string, appVersion?: string): Promise; + /** + * Invalide le jeton d'accès + * @example ```js + * const Kdecole = require('kdecole-api').default + * const user = new Kdecole(authToken) + * user.logout() + * ``` + * @return {Promise} + */ + logout(): Promise; + /** + * Retourne le relevé de notes de l'élève + * @example ```js + * kdecole.getReleve() //Retourne le relevé de l'élève + * kdecole.getReleve(idEleve) //Retourne le relevé d'un élève précis + * ``` + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getReleve(idEleve).then((releve)=>{ + * // Votre code + * }) + * ``` + */ + getReleve(idEleve?: string): Promise; + /** + * Retourne un tableau des actualités de l'établissement de l'utilisateur + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getActualites(idEleve).then((actualites)=>{ + * // Votre code + * }) + * ``` + */ + getActualites(idEleve?: string): Promise; + /** + * Retourne le contenu d'un article + * @param {string} uid Identifiant unique de l'article + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getContenuArticle(uid).then((contenuArticle)=>{ + * // Votre code + * }) + * ``` + */ + getContenuArticle(uid: string): Promise; + /** + * Retourne la liste des devoirs de l'élève + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getTravailAFaire(idEleve).then((taf)=>{ + * // Votre code + * }) + * ``` + */ + getTravailAFaire(idEleve?: string): Promise; + /** + * Retourne les détails d'un devoir à faire + * @param {number} uidSeance Identifiant de la séance + * @param {number} uid Identifiant du devoir à faire + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getContenuActivite(uidSeance, uid, idEleve).then((contenuActivite)=>{ + * // Votre code + * }) + * ``` + */ + getContenuActivite(uidSeance: number, uid: number, idEleve?: string): Promise; + /** + * Permet de marquer un devoir comme étant fait + * @param uidSeance {number} Identifiant de la séance + * @param uid {number} Identifiant du devoir + * @param flagRealise {boolean} Statut du devoir + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.setActiviteFinished(uidSeance, uid, flagRealise) + * ``` + */ + setActiviteFinished(uidSeance: number, uid: number, flagRealise: boolean): Promise; + /** + * Retourne la liste des absences d'un élève + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getAbsences(idEleve).then((absences)=>{ + * // Votre code + * }) + * ``` + */ + getAbsences(idEleve?: string): Promise; + /** + * Retourne les informations d'un utilisateur (type de compte, nom complet, numéro de l'établiissement, etc.) + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getInfoUtilisateur(idEleve).then((infoUtilisateur)=>{ + * // Votre code + * }) + * ``` + */ + getInfoUtilisateur(idEleve?: string): Promise; + /** + * Retourne l'emploi du temps de l'élève à J-7 et J+7 + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getCalendrier(idEleve).then((calendrier)=>{ + * // Votre code + * }) + * ``` + */ + getCalendrier(idEleve?: string): Promise; + /** + * Retourne la liste des récentes notes de l'élève + * @param {string} idEleve Identifiant d'un élève + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getNotes(idEleve).then((notes)=>{ + * // Votre code + * }) + * ``` + */ + getNotes(idEleve?: string): Promise; + /** + * Retourne l'état de la messagerie de l'utilisateur (nombre de mails non lus) + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getMessagerieInfo().then((messagerieInfo)=>{ + * // Votre code + * }) + * ``` + */ + getMessagerieInfo(): Promise; + /** + * Retourne les mails présents dans la boîte mail + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getMessagerieBoiteReception().then((messagerieBoiteReception)=>{ + * // Votre code + * }) + * ``` + */ + getMessagerieBoiteReception(): Promise; + /** + * Retourne les détails d'un fil de discussion + * @param {number} id Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.getCommunication(id).then((communication)=>{ + * // Votre code + * }) + * ``` + */ + getCommunication(id: number): Promise; + /** + * Permet de signaler une communication + * @param {number} id Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.reportCommunication(id) + * ``` + */ + reportCommunication(id: number): Promise; + /** + * Supprime la communication + * @param {number} id Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.deleteCommunication(id) + * ``` + */ + deleteCommunication(id: number): Promise; + /** + * Marquer une communication lue + * @param id {number} Identifiant d'un fil de discussion + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.setCommunicationLu(id) + * ``` + */ + setCommunicationLu(id: number): Promise; + /** + * Envoyer un message sur un fil de discussion + * @param id {number} Identifiant d'un fil de discussion + * @param corpsMessage {string} Corps du message HTML + * @return {Promise} + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.sendMessage(id, corpsMessage) + * ``` + */ + sendMessage(id: number, corpsMessage: string): Promise; + /** + * Retourne les feuilles d'appel. + * @return {Promise} Les feuilles d'appel. + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * user.gestionAppels().then((gestionAppels)=>{ + * // Votre code + * }) + * ``` + */ + gestionAppels(): Promise; + /** + * Valide l'appel de la classe. + * @return {Promise} + * @param appel L'appel à valider + * @example ```js + * const Kdecole = require('kdecole-api').default + * + * const user = new Kdecole(AUTH_TOKEN) + * const appel = { + * "idEtab": 10485, + * "idAppel": 534552, + * "listeAbsencesAppel": [ + * { + * "idEleve": "AAP05567", + * "type": "absence", + * "dateDebut": 1609259443000, + * "dateFin": 1609263043000, + * "modifiable": true + * } + * ] + * } + * user.validerAppel(appel) + * ``` + */ + validerAppel(appel: { + idEtab: number; + idAppel: number; + listeAbsencesAppel: { + idEleve: string; + type: string; + dateDebut: number; + dateFin: number; + modifiable: boolean; + }[]; + }): Promise; + private static kdecole; +} diff --git a/types/entities/Authentication/Activation.d.ts b/types/entities/Authentication/Activation.d.ts new file mode 100644 index 0000000..ea19df0 --- /dev/null +++ b/types/entities/Authentication/Activation.d.ts @@ -0,0 +1,10 @@ +export default class Activation { + success: boolean; + authtoken: string | null; + private errmsg; + constructor(activation: { + errmsg: string | null; + success: boolean; + authtoken: string | null; + }); +} diff --git a/types/entities/Authentication/Desactivation.d.ts b/types/entities/Authentication/Desactivation.d.ts new file mode 100644 index 0000000..a9c52b7 --- /dev/null +++ b/types/entities/Authentication/Desactivation.d.ts @@ -0,0 +1,10 @@ +export default class Desactivation { + success: boolean; + authtoken: string | null; + private errmsg; + constructor(desactivation: { + errmsg: string | null; + success: boolean; + authtoken: string | null; + }); +} diff --git a/types/entities/Calendar/Calendrier.d.ts b/types/entities/Calendar/Calendrier.d.ts new file mode 100644 index 0000000..84d5579 --- /dev/null +++ b/types/entities/Calendar/Calendrier.d.ts @@ -0,0 +1,46 @@ +import ListeJourCdt from './ListeJourCdt'; +export default class Calendrier { + currentDate: Date; + listeJourCdt: ListeJourCdt[]; + cdtOuvert: boolean; + private errmsg; + constructor(calendrier: { + errmsg: string | null; + currentDate: number; + listeJourCdt: { + listeSeances: { + hdeb: number; + enSeance: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + matiere: string; + aFaire: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + heureFin: string; + flagModif: boolean; + titre: string; + flagActif: boolean; + heureDebut: string; + hfin: number; + aRendre: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + motifModif: string | null; + idSeance: number; + salle: string; + }[]; + date: number; + }[]; + cdtOuvert: boolean; + }); +} diff --git a/types/entities/Calendar/Exercice.d.ts b/types/entities/Calendar/Exercice.d.ts new file mode 100644 index 0000000..30851e2 --- /dev/null +++ b/types/entities/Calendar/Exercice.d.ts @@ -0,0 +1,12 @@ +export default class Exercice { + type: string; + uid: number; + date: Date; + titre: string; + constructor(enSeance: { + type: string; + uid: number; + date: number; + titre: string; + }); +} diff --git a/types/entities/Calendar/ListeJourCdt.d.ts b/types/entities/Calendar/ListeJourCdt.d.ts new file mode 100644 index 0000000..2bb4371 --- /dev/null +++ b/types/entities/Calendar/ListeJourCdt.d.ts @@ -0,0 +1,39 @@ +import Seance from './Seance'; +export default class ListeJourCdt { + listeSeances: Seance[]; + date: Date; + constructor(listeJourCdt: { + listeSeances: { + hdeb: number; + enSeance: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + matiere: string; + aFaire: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + heureFin: string; + flagModif: boolean; + titre: string; + flagActif: boolean; + heureDebut: string; + hfin: number; + aRendre: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + motifModif: string | null; + idSeance: number; + salle: string; + }[]; + date: number; + }); +} diff --git a/types/entities/Calendar/Seance.d.ts b/types/entities/Calendar/Seance.d.ts new file mode 100644 index 0000000..fe0e0ae --- /dev/null +++ b/types/entities/Calendar/Seance.d.ts @@ -0,0 +1,48 @@ +import Exercice from './Exercice'; +export default class Seance { + hdeb: Date; + enSeance: Array | null; + matiere: string; + aFaire: Array | null; + heureFin: string; + flagModif: boolean; + flagActif: boolean; + heureDebut: string; + hfin: Date; + aRendre: Array | null; + motifModif: string | null; + idSeance: number; + salle: string; + titre: string; + constructor(seance: { + hdeb: number; + enSeance: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + matiere: string; + aFaire: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + heureFin: string; + flagModif: boolean; + titre: string; + flagActif: boolean; + heureDebut: string; + hfin: number; + aRendre: { + type: string; + uid: number; + date: number; + titre: string; + }[] | null; + motifModif: string | null; + idSeance: number; + salle: string; + }); +} diff --git a/types/entities/Messagerie/Attachment.d.ts b/types/entities/Messagerie/Attachment.d.ts new file mode 100644 index 0000000..a167024 --- /dev/null +++ b/types/entities/Messagerie/Attachment.d.ts @@ -0,0 +1,12 @@ +export default class Attachment { + idRessource: number | null; + url: string | null; + name: string; + typeMIME: string | null; + constructor(attachment: { + idRessource: number | null; + url: string | null; + name: string; + typeMIME: string | null; + }); +} diff --git a/types/entities/Messagerie/Communication.d.ts b/types/entities/Messagerie/Communication.d.ts new file mode 100644 index 0000000..1d5fa78 --- /dev/null +++ b/types/entities/Messagerie/Communication.d.ts @@ -0,0 +1,62 @@ +import Participant from './Participant'; +import Participation from './Participation'; +export default class Communication { + participants: Array; + expediteurActuel: Participant; + signalable: boolean; + expediteurInitial: Participant; + id: number; + dateDernierMessage: Date; + nbParticipations: number; + isExpediteurInitial: boolean; + pieceJointe: boolean; + participations: Array; + objet: string; + type: string; + etat: string; + premieresLignes: string; + etatLecure: boolean; + constructor(communication: { + participants: Array<{ + id: string; + libelle: string; + }> | null; + expediteurActuel: { + id: string; + libelle: string; + }; + signalable: boolean; + expediteurInitial: { + id: string; + libelle: string; + }; + id: number; + dateDernierMessage: number; + nbParticipations: number; + isExpediteurInitial: boolean; + pieceJointe: boolean; + participations: Array<{ + dateEnvoi: number; + corpsMessage: string; + pjs: { + idRessource: number | null; + url: string | null; + name: string; + typeMIME: string | null; + }[]; + id: number; + libelleObjet: string | null; + redacteur: { + id: string; + libelle: string; + }; + premieresLignes: string; + typeMessage: string; + }> | null; + objet: string; + type: string; + etat: string; + premieresLignes: string; + etatLecture: boolean; + }); +} diff --git a/types/entities/Messagerie/MessageBoiteReception.d.ts b/types/entities/Messagerie/MessageBoiteReception.d.ts new file mode 100644 index 0000000..d8c3dcf --- /dev/null +++ b/types/entities/Messagerie/MessageBoiteReception.d.ts @@ -0,0 +1,55 @@ +import Communication from './Communication'; +export default class MessageBoiteReception { + nbMaxCommunicationRecues: number; + communications: Array; + nbMaxCaracteresMessage: number; + nbMaxCommunicationBoiteReception: number; + constructor(messageBoiteReception: { + nbMaxCommunicationRecues: number; + communications: Array<{ + participants: Array<{ + id: string; + libelle: string; + }> | null; + expediteurActuel: { + id: string; + libelle: string; + }; + signalable: boolean; + expediteurInitial: { + id: string; + libelle: string; + }; + id: number; + dateDernierMessage: number; + nbParticipations: number; + isExpediteurInitial: boolean; + pieceJointe: boolean; + participations: Array<{ + dateEnvoi: number; + corpsMessage: string; + pjs: Array<{ + idRessource: number; + url: string | null; + name: string; + typeMIME: string; + }>; + id: number; + libelleObjet: string | null; + redacteur: { + id: string; + libelle: string; + }; + premieresLignes: string; + typeMessage: string; + }> | null; + objet: string; + type: string; + etat: string; + premieresLignes: string; + etatLecture: boolean; + }>; + nbMaxCaracteresMessage: number; + nbMaxCommunicationBoiteReception: number; + }); +} diff --git a/types/entities/Messagerie/MessageInfo.d.ts b/types/entities/Messagerie/MessageInfo.d.ts new file mode 100644 index 0000000..88f1149 --- /dev/null +++ b/types/entities/Messagerie/MessageInfo.d.ts @@ -0,0 +1,6 @@ +export default class MessageInfo { + nbMessagesNonLus: number; + constructor(messageInfo: { + nbMessagesNonLus: number; + }); +} diff --git a/types/entities/Messagerie/Participant.d.ts b/types/entities/Messagerie/Participant.d.ts new file mode 100644 index 0000000..773c3fd --- /dev/null +++ b/types/entities/Messagerie/Participant.d.ts @@ -0,0 +1,8 @@ +export default class Participant { + id: string; + libelle: string; + constructor(participant: { + id: string; + libelle: string; + }); +} diff --git a/types/entities/Messagerie/Participation.d.ts b/types/entities/Messagerie/Participation.d.ts new file mode 100644 index 0000000..0bf880c --- /dev/null +++ b/types/entities/Messagerie/Participation.d.ts @@ -0,0 +1,30 @@ +import Attachment from './Attachment'; +import Participant from './Participant'; +export default class Participation { + dateEnvoi: Date; + corpsMessage: string; + pjs: Attachment[]; + id: number; + libelleObjet: string | null; + redacteur: Participant; + premieresLignes: string; + typeMessage: string; + constructor(participation: { + dateEnvoi: number; + corpsMessage: string; + pjs: { + idRessource: number | null; + url: string | null; + name: string; + typeMIME: string | null; + }[]; + id: number; + libelleObjet: string | null; + redacteur: { + id: string; + libelle: string; + }; + premieresLignes: string; + typeMessage: string; + }); +} diff --git a/types/entities/News/Actualite.d.ts b/types/entities/News/Actualite.d.ts new file mode 100644 index 0000000..a2f6ad0 --- /dev/null +++ b/types/entities/News/Actualite.d.ts @@ -0,0 +1,18 @@ +export default class Actualite { + type: string; + auteur: string; + codeEmetteur: number; + date: Date; + uid: string; + titre: string; + private errmsg; + constructor(article: { + errmsg: string | null; + type: string; + auteur: string; + codeEmetteur: string; + titre: string; + date: number; + uid: string; + }); +} diff --git a/types/entities/News/ContenuArticle.d.ts b/types/entities/News/ContenuArticle.d.ts new file mode 100644 index 0000000..1b4fae2 --- /dev/null +++ b/types/entities/News/ContenuArticle.d.ts @@ -0,0 +1,26 @@ +import Attachment from '../Messagerie/Attachment'; +export default class ContenuArticle { + titre: string; + codeHTML: string; + date: Date; + url: string; + auteur: string; + type: string; + pjs: Attachment[]; + private errmsg; + constructor(contenuArticle: { + errmsg: string | null; + titre: string; + codeHTML: string; + date: number; + url: string; + auteur: string; + type: string; + pjs: { + idRessource: number | null; + url: string | null; + name: string; + typeMIME: string | null; + }[]; + }); +} diff --git a/types/entities/Note/Matiere.d.ts b/types/entities/Note/Matiere.d.ts new file mode 100644 index 0000000..5f435e3 --- /dev/null +++ b/types/entities/Note/Matiere.d.ts @@ -0,0 +1,35 @@ +import Note from './Note'; +export default class Matiere { + moyenneEleve: number | null; + bareme: number; + devoirs: Array; + enseignants: Array; + matiereLibelle: string; + moyenneClasse: number | null; + constructor(matiere: { + bareme: string; + moyenneEleve: string; + devoirs: Array<{ + note: string | null; + date: number; + medianeClasse: string | null; + sousMatiere: string | null; + noteMin: string | null; + appreciation: string | null; + bareme: number; + coefficient: number; + pjs: Array; + id: number; + titreDevoir: string; + noteMax: string | null; + facultatif: boolean; + moyenne: string | null; + matiere?: string; + comptabilise: boolean; + commentaireDevoir: string; + }>; + enseignants: Array; + matiereLibelle: string; + moyenneClasse: string; + }); +} diff --git a/types/entities/Note/Note.d.ts b/types/entities/Note/Note.d.ts new file mode 100644 index 0000000..3448eee --- /dev/null +++ b/types/entities/Note/Note.d.ts @@ -0,0 +1,38 @@ +export default class Note { + note: number | null; + date: Date; + medianeClasse: number | null; + noteMin: number | null; + appreciation: string | null; + bareme: number; + coefficient: number; + id: number; + titreDevoir: string; + noteMax: number | null; + facultatif: boolean; + moyenne: number | null; + comptabilise: boolean; + commentaireDevoir: string | null; + matiere?: string; + sousMatiere: string | null; + constructor(note: { + note: string | null; + date: number; + medianeClasse: string | null; + sousMatiere: string | null; + noteMin: string | null; + appreciation: string | null; + bareme: number; + coefficient: number; + pjs: Array; + id: number; + titreDevoir: string; + noteMax: string | null; + facultatif: boolean; + moyenne: string | null; + matiere?: string; + comptabilise: boolean; + commentaireDevoir: string; + }); + static stringNoteToNumber(note: string | null): number | null; +} diff --git a/types/entities/Note/NotesList.d.ts b/types/entities/Note/NotesList.d.ts new file mode 100644 index 0000000..043d618 --- /dev/null +++ b/types/entities/Note/NotesList.d.ts @@ -0,0 +1,33 @@ +import Note from './Note'; +export default class NotesList { + moduleNotesActif: boolean; + codeEleve: string; + nbNotesMax: number; + listeNotes: Note[]; + private errmsg; + constructor(notesList: { + errmsg: string | null; + moduleNotesActif: boolean; + codeEleve: string; + nbNotesMax: number; + listeNotes: { + note: string | null; + date: number; + medianeClasse: string | null; + sousMatiere: string | null; + noteMin: string | null; + appreciation: string | null; + bareme: number; + coefficient: number; + pjs: Array; + id: number; + titreDevoir: string; + noteMax: string | null; + facultatif: boolean; + moyenne: string | null; + matiere?: string; + comptabilise: boolean; + commentaireDevoir: string; + }[]; + }); +} diff --git a/types/entities/Note/Releve.d.ts b/types/entities/Note/Releve.d.ts new file mode 100644 index 0000000..d8aa92d --- /dev/null +++ b/types/entities/Note/Releve.d.ts @@ -0,0 +1,37 @@ +import Trimestre from './Trimestre'; +export default class Releve { + trimestres: Array; + constructor(releve: Array<{ + matieres: Array<{ + bareme: string; + moyenneEleve: string; + devoirs: Array<{ + note: string | null; + date: number; + medianeClasse: string | null; + sousMatiere: string | null; + noteMin: string | null; + appreciation: string | null; + bareme: number; + coefficient: number; + pjs: Array; + id: number; + titreDevoir: string; + noteMax: string | null; + facultatif: boolean; + moyenne: string | null; + matiere?: string; + comptabilise: boolean; + commentaireDevoir: string; + }>; + enseignants: Array; + matiereLibelle: string; + moyenneClasse: string; + }>; + idPeriode: number; + libelleClasse: string; + periodeLibelle: string; + periodeEnCours: boolean; + bareme: string; + }>); +} diff --git a/types/entities/Note/Trimestre.d.ts b/types/entities/Note/Trimestre.d.ts new file mode 100644 index 0000000..5d6dc3b --- /dev/null +++ b/types/entities/Note/Trimestre.d.ts @@ -0,0 +1,57 @@ +import Matiere from './Matiere'; +export default class Trimestre { + matieres: Array; + idPeriode: number; + libelleClasse: string; + periodeLibelle: string; + periodeEnCours: boolean; + bareme: number; + constructor(trimestre: { + matieres: Array<{ + bareme: string; + moyenneEleve: string; + devoirs: Array<{ + note: string | null; + date: number; + medianeClasse: string | null; + sousMatiere: string | null; + noteMin: string | null; + appreciation: string | null; + bareme: number; + coefficient: number; + pjs: Array; + id: number; + titreDevoir: string; + noteMax: string | null; + facultatif: boolean; + moyenne: string | null; + matiere?: string; + comptabilise: boolean; + commentaireDevoir: string; + }>; + enseignants: Array; + matiereLibelle: string; + moyenneClasse: string; + }>; + idPeriode: number; + libelleClasse: string; + periodeLibelle: string; + periodeEnCours: boolean; + bareme: string; + }); + /** + * Retourne la moyenne générale de l'élève + * @return {number} + */ + getMoyenneGenerale(): number | false; + /** + * Retourne la médiane des moyennes des matières de l'élève + * @return {number} + */ + getMedianeGenerale(): number | false; + /** + * Retourne un tableau contenant les moyennes des matières de l'élève + * @return {number[]} + */ + private getTableauMoyennes; +} diff --git a/types/entities/Prof/AbsenceEleveAppel.d.ts b/types/entities/Prof/AbsenceEleveAppel.d.ts new file mode 100644 index 0000000..eab47ea --- /dev/null +++ b/types/entities/Prof/AbsenceEleveAppel.d.ts @@ -0,0 +1,18 @@ +export default class AbsenceEleveAppel { + idAbsence: number | undefined; + type: string; + dateDebut: Date; + dateFin: Date; + idMotif: string | undefined; + modifiable: boolean; + idEleve: string | undefined; + constructor(absenceEleveAppel: { + idEleve: string | undefined; + idAbsence: number | undefined; + type: string; + dateDebut: number; + dateFin: number; + idMotif: string | undefined; + modifiable: boolean; + }); +} diff --git a/types/entities/Prof/Appel.d.ts b/types/entities/Prof/Appel.d.ts new file mode 100644 index 0000000..4eb1576 --- /dev/null +++ b/types/entities/Prof/Appel.d.ts @@ -0,0 +1,30 @@ +import EleveAppel from './EleveAppel'; +export default class Appel { + isEnCours: boolean; + dateDebut: Date; + dateFin: Date; + idAppel: number; + libelleGroupe: string; + listeElevesAppel: EleveAppel[]; + constructor(appel: { + isEnCours: boolean; + dateDebut: number; + dateFin: number; + idAppel: number; + libelleGroupe: string; + listeElevesAppel: { + nomEleve: string; + prenomEleve: string; + idEleve: string; + absenceEleveAppel: { + idEleve: string | undefined; + idAbsence: number | undefined; + type: string; + dateDebut: number; + dateFin: number; + idMotif: string | undefined; + modifiable: boolean; + } | undefined; + }[]; + }); +} diff --git a/types/entities/Prof/EleveAppel.d.ts b/types/entities/Prof/EleveAppel.d.ts new file mode 100644 index 0000000..16fc0df --- /dev/null +++ b/types/entities/Prof/EleveAppel.d.ts @@ -0,0 +1,21 @@ +import AbsenceEleveAppel from './AbsenceEleveAppel'; +export default class EleveAppel { + nomEleve: string; + prenomEleve: string; + idEleve: string; + absenceEleveAppel: AbsenceEleveAppel | undefined; + constructor(eleveAppel: { + nomEleve: string; + prenomEleve: string; + idEleve: string; + absenceEleveAppel: { + idEleve: string | undefined; + idAbsence: number | undefined; + type: string; + dateDebut: number; + dateFin: number; + idMotif: string | undefined; + modifiable: boolean; + } | undefined; + }); +} diff --git a/types/entities/Prof/GestionAppels.d.ts b/types/entities/Prof/GestionAppels.d.ts new file mode 100644 index 0000000..e44958f --- /dev/null +++ b/types/entities/Prof/GestionAppels.d.ts @@ -0,0 +1,29 @@ +import Appel from './Appel'; +export default class GestionAppels { + dateDuJour: Date; + listeAppels: Appel[]; + constructor(gestionAppels: { + dateDuJour: number; + listeAppels: { + isEnCours: boolean; + dateDebut: number; + dateFin: number; + idAppel: number; + libelleGroupe: string; + listeElevesAppel: { + nomEleve: string; + prenomEleve: string; + idEleve: string; + absenceEleveAppel: { + idEleve: string | undefined; + idAbsence: number | undefined; + type: string; + dateDebut: number; + dateFin: number; + idMotif: string | undefined; + modifiable: boolean; + } | undefined; + }[]; + }[]; + }); +} diff --git a/types/entities/Travail/ContenuActivite.d.ts b/types/entities/Travail/ContenuActivite.d.ts new file mode 100644 index 0000000..aaf9fd3 --- /dev/null +++ b/types/entities/Travail/ContenuActivite.d.ts @@ -0,0 +1,30 @@ +import Attachment from '../Messagerie/Attachment'; +export default class ContenuActivite { + codeHTML: string; + flagTravailAfaire: boolean; + flagRealise: boolean; + titre: string; + date: Date; + isFaitModifiable: boolean; + type: string; + matiere: string; + pjs: Attachment[]; + private errmsg; + constructor(contenuActivite: { + errmsg: string | null; + codeHTML: string; + flagTravailAFaire: boolean; + flagRealise: boolean; + titre: string; + date: number; + isFaitModifiable: boolean; + type: string; + matiere: string; + pjs: { + idRessource: number | null; + url: string | null; + name: string; + typeMIME: string | null; + }[]; + }); +} diff --git a/types/entities/Travail/ListeTravaux.d.ts b/types/entities/Travail/ListeTravaux.d.ts new file mode 100644 index 0000000..2f2aa3d --- /dev/null +++ b/types/entities/Travail/ListeTravaux.d.ts @@ -0,0 +1,18 @@ +import Travail from './Travail'; +export default class ListeTravaux { + date: Date; + listTravail: Travail[]; + constructor(listTravaux: { + date: number; + listTravail: { + type: string; + temps: number; + matiere: string; + flagRealise: boolean; + titre: string; + date: number; + uid: string; + uidSeance: string; + }[]; + }); +} diff --git a/types/entities/Travail/Travail.d.ts b/types/entities/Travail/Travail.d.ts new file mode 100644 index 0000000..d72972b --- /dev/null +++ b/types/entities/Travail/Travail.d.ts @@ -0,0 +1,20 @@ +export default class Travail { + type: string; + temps: number; + matiere: string; + flagRealise: boolean; + titre: string; + date: Date; + uid: number; + uidSeance: number; + constructor(travailAFaire: { + type: string; + temps: number; + matiere: string; + flagRealise: boolean; + titre: string; + date: number; + uid: string; + uidSeance: string; + }); +} diff --git a/types/entities/Travail/TravailAFaire.d.ts b/types/entities/Travail/TravailAFaire.d.ts new file mode 100644 index 0000000..ee1918e --- /dev/null +++ b/types/entities/Travail/TravailAFaire.d.ts @@ -0,0 +1,23 @@ +import ListeTravaux from './ListeTravaux'; +export default class TravailAFaire { + tafOuvert: boolean; + listeTravaux: ListeTravaux[]; + private errmsg; + constructor(travailAFaire: { + errmsg: string | null; + tafOuvert: boolean; + listeTravaux: { + date: number; + listTravail: { + type: string; + temps: number; + matiere: string; + flagRealise: boolean; + titre: string; + date: number; + uid: string; + uidSeance: string; + }[]; + }[]; + }); +} diff --git a/types/entities/User/Eleve.d.ts b/types/entities/User/Eleve.d.ts new file mode 100644 index 0000000..8e272ac --- /dev/null +++ b/types/entities/User/Eleve.d.ts @@ -0,0 +1,12 @@ +export default class Eleve { + active: boolean; + nom: string; + uid: string; + permissions: string | null; + constructor(eleve: { + active: boolean; + nom: string; + uid: string; + permissions: string | null; + }); +} diff --git a/types/entities/User/Etablissement.d.ts b/types/entities/User/Etablissement.d.ts new file mode 100644 index 0000000..03fd060 --- /dev/null +++ b/types/entities/User/Etablissement.d.ts @@ -0,0 +1,12 @@ +export default class Etablissement { + permissions: string; + uid: string; + nom: string; + active: boolean; + constructor(etablissement: { + permissions: string; + uid: string; + nom: string; + active: boolean; + }); +} diff --git a/types/entities/User/Utilisateur.d.ts b/types/entities/User/Utilisateur.d.ts new file mode 100644 index 0000000..872d2d6 --- /dev/null +++ b/types/entities/User/Utilisateur.d.ts @@ -0,0 +1,50 @@ +import Eleve from './Eleve'; +import Etablissement from './Etablissement'; +export default class Utilisateur { + type: number; + nom: string; + eleves: Array; + xiti: { + idProjet: string; + idCollectivite: string; + idXiti: string; + idEtab: string; + idPlateforme: string; + codeProfil: string; + }; + idEtablissementSelectionne: string | null; + idEleveSelectionne: string | null; + protection: string; + etabs: Array; + timezone: string; + private errmsg; + constructor(utilisateur: { + errmsg: string | null; + type: number; + nom: string; + eleves: Array<{ + active: boolean; + nom: string; + uid: string; + permissions: string | null; + }> | null; + xiti: { + idProjet: string; + idCollectivite: string; + idXiti: string; + idEtab: string; + idPlateforme: string; + codeProfil: string; + }; + idEtablissementSelectionne: string | null; + idEleveSelectionne: string | null; + protection: string; + etabs: Array<{ + permissions: string; + uid: string; + nom: string; + active: boolean; + }> | null; + timezone: string; + }); +} diff --git a/types/entities/VieScolaire/Absence.d.ts b/types/entities/VieScolaire/Absence.d.ts new file mode 100644 index 0000000..0296702 --- /dev/null +++ b/types/entities/VieScolaire/Absence.d.ts @@ -0,0 +1,16 @@ +export default class Absence { + dateFin: Date; + motif: string | null; + type: string; + matiere: string | null; + dateDebut: Date; + justifiee: boolean; + constructor(absence: { + dateFin: number; + motif: string | null; + type: string; + matiere: string; + dateDebut: number; + justifiee: boolean; + }); +} diff --git a/types/entities/VieScolaire/AbsencesList.d.ts b/types/entities/VieScolaire/AbsencesList.d.ts new file mode 100644 index 0000000..8273fc6 --- /dev/null +++ b/types/entities/VieScolaire/AbsencesList.d.ts @@ -0,0 +1,20 @@ +import Absence from './Absence'; +export default class AbsencesList { + codeEleve: string; + nbAbsencesMax: number; + listeAbsences: Absence[]; + private errmsg; + constructor(absenceList: { + errmsg: string | null; + codeEleve: string; + nbAbsencesMax: number; + listeAbsences: { + dateFin: number; + motif: string | null; + type: string; + matiere: string; + dateDebut: number; + justifiee: boolean; + }[]; + }); +}