@communecter/cocolight-api-client 1.0.51 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/123.cocolight-api-client.browser.js +1 -1
- package/dist/123.cocolight-api-client.cjs +1 -1
- package/dist/774.cocolight-api-client.mjs.js +1 -1
- package/dist/cocolight-api-client.browser.js +1 -1
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +15 -9
- package/src/Api.js +41 -23
- package/src/ApiClient.js +33 -18
- package/src/api/EndpointApi.js +95 -95
- package/src/error.js +63 -10
- package/src/index.js +65 -2
- package/src/utils/FileStorageStrategy.node.js +28 -2
- package/src/utils/MultiServerFileStorageStrategy.node.js +24 -2
- package/src/utils/MultiServerTokenStorageStrategy.js +84 -27
- package/src/utils/TokenStorage.js +79 -19
- package/src/utils/createDefaultMultiServerTokenStorageStrategy.js +33 -27
- package/src/utils/createDefaultTokenStorageStrategy.js +29 -23
- package/types/Api.d.ts +131 -0
- package/types/ApiClient.d.ts +377 -0
- package/types/EJSONType.d.ts +27 -0
- package/types/api/Badge.d.ts +24 -0
- package/types/api/BaseEntity.d.ts +1017 -0
- package/types/api/EndpointApi.d.ts +933 -0
- package/types/api/EntityRegistry.d.ts +22 -0
- package/types/api/Event.d.ts +38 -0
- package/types/api/News.d.ts +45 -0
- package/types/api/Organization.d.ts +87 -0
- package/types/api/Poi.d.ts +25 -0
- package/types/api/Project.d.ts +81 -0
- package/types/api/User.d.ts +203 -0
- package/types/api/UserApi.d.ts +13 -0
- package/types/endpoints.module.d.ts +14852 -0
- package/types/error.d.ts +80 -0
- package/types/index.d.ts +52 -0
- package/types/mixin/UserMixin.d.ts +1 -0
- package/types/utils/FileOfflineStorageStrategy.node.d.ts +10 -0
- package/types/utils/FileStorageStrategy.node.d.ts +25 -0
- package/types/utils/MultiServerFileStorageStrategy.node.d.ts +22 -0
- package/types/utils/MultiServerTokenStorageStrategy.d.ts +65 -0
- package/types/utils/OfflineClientManager.d.ts +94 -0
- package/types/utils/OfflineQueueStorageStrategy.d.ts +13 -0
- package/types/utils/TokenStorage.d.ts +76 -0
- package/types/utils/createDefaultMultiServerTokenStorageStrategy.d.ts +11 -0
- package/types/utils/createDefaultOfflineStrategy.d.ts +3 -0
- package/types/utils/createDefaultTokenStorageStrategy.d.ts +12 -0
- package/types/utils/reactive.d.ts +60 -0
- package/types/utils/stream-utils.node.d.ts +2 -0
- /package/{src → types}/api/EndpointApi.types.d.ts +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enregistre une entité dans la registry.
|
|
3
|
+
* @param {string} tag - ex: "User", "Organization"
|
|
4
|
+
* @param {Function} EntityClass - la classe constructeur
|
|
5
|
+
*/
|
|
6
|
+
export function registerEntity(tag: string, EntityClass: Function): void;
|
|
7
|
+
/**
|
|
8
|
+
* Récupère une instance depuis un JSON générique.
|
|
9
|
+
* @param {Object} json - doit contenir __entityTag
|
|
10
|
+
* @param {Object} parent - ApiClient ou entité parent
|
|
11
|
+
* @param {Object} deps - dépendances (comme dans le constructeur)
|
|
12
|
+
* @returns {BaseEntity|null}
|
|
13
|
+
*/
|
|
14
|
+
export function fromEntityJSON(json: any, parent?: any): BaseEntity | null;
|
|
15
|
+
/**
|
|
16
|
+
* Crée une instance d'entité basée sur le seul nom de la collection.
|
|
17
|
+
* @param {string} collection - ex: "citoyens", "projects", ...
|
|
18
|
+
* @param {Object} parent - ApiClient ou entité parente
|
|
19
|
+
* @returns {BaseEntity|null}
|
|
20
|
+
*/
|
|
21
|
+
export function createFromCollection(collection: string, parent?: any, data?: {}): BaseEntity | null;
|
|
22
|
+
export const EntityRegistry: Map<any, any>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export class Event extends BaseEntity {
|
|
2
|
+
static entityType: string;
|
|
3
|
+
static SCHEMA_CONSTANTS: string[];
|
|
4
|
+
static ADD_BLOCKS: Map<string, string>;
|
|
5
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
6
|
+
defaultFields: {
|
|
7
|
+
typeElement: string;
|
|
8
|
+
};
|
|
9
|
+
transforms: {
|
|
10
|
+
parent: (val: any) => {
|
|
11
|
+
[k: string]: {
|
|
12
|
+
type: any;
|
|
13
|
+
name: any;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
organizer: (val: any) => {
|
|
17
|
+
[k: string]: {
|
|
18
|
+
type: any;
|
|
19
|
+
name: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
_add(payload: any): Promise<void>;
|
|
24
|
+
_update(payload: any): Promise<boolean>;
|
|
25
|
+
addEvent(data?: {}): Promise<any>;
|
|
26
|
+
getOrganizations(): Promise<void>;
|
|
27
|
+
getProjects(): Promise<void>;
|
|
28
|
+
getEvents(): Promise<void>;
|
|
29
|
+
getPois(): Promise<void>;
|
|
30
|
+
getBadgesIssuer(): Promise<void>;
|
|
31
|
+
getNews(data?: {}): Promise<any>;
|
|
32
|
+
getSubscribers(data?: {}): Promise<any>;
|
|
33
|
+
project(): Promise<void>;
|
|
34
|
+
poi(): Promise<void>;
|
|
35
|
+
event(): Promise<void>;
|
|
36
|
+
badge(): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
import BaseEntity from "./BaseEntity.js";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export class News extends BaseEntity {
|
|
2
|
+
static entityType: string;
|
|
3
|
+
static SCHEMA_CONSTANTS: string[];
|
|
4
|
+
static ADD_BLOCKS: Map<string, string>;
|
|
5
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
6
|
+
defaultFields: {};
|
|
7
|
+
removeFields: any[];
|
|
8
|
+
transforms: {
|
|
9
|
+
scope: (val: any) => any;
|
|
10
|
+
mentions: (val: any) => any[];
|
|
11
|
+
mediaImg: (val: any) => {
|
|
12
|
+
countImages: any;
|
|
13
|
+
images: any;
|
|
14
|
+
};
|
|
15
|
+
mediaFile: (val: any) => {
|
|
16
|
+
countFiles: any;
|
|
17
|
+
files: any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
_add(payload: any): Promise<void>;
|
|
21
|
+
_update(payload: any): Promise<boolean>;
|
|
22
|
+
addNews(data?: {}): Promise<any>;
|
|
23
|
+
updateNews(data?: {}): Promise<any>;
|
|
24
|
+
addMention({ slug, id }: {
|
|
25
|
+
slug: any;
|
|
26
|
+
id: any;
|
|
27
|
+
}): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Ajouter une image à une actualité : Ajoute une images à une actualité.
|
|
30
|
+
* Constant : ADD_IMAGE_NEWS
|
|
31
|
+
*/
|
|
32
|
+
addImage(image: any): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* Ajouter un fichier à une actualité : Ajoute un fichier à une actualité.
|
|
35
|
+
* Constant : ADD_FILE_NEWS
|
|
36
|
+
*/
|
|
37
|
+
addFile(file: any): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Supprimer une actualité : Supprime une actualité existante.
|
|
40
|
+
* Constant : DELETE_NEWS
|
|
41
|
+
*/
|
|
42
|
+
delete(): Promise<void>;
|
|
43
|
+
_isDeleted: boolean;
|
|
44
|
+
}
|
|
45
|
+
import BaseEntity from "./BaseEntity.js";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export class Organization extends BaseEntity {
|
|
2
|
+
static entityType: string;
|
|
3
|
+
static SCHEMA_CONSTANTS: string[];
|
|
4
|
+
static ADD_BLOCKS: Map<string, string>;
|
|
5
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
6
|
+
defaultFields: {
|
|
7
|
+
typeElement: string;
|
|
8
|
+
};
|
|
9
|
+
transforms: {
|
|
10
|
+
github: (val: any, full: any) => any;
|
|
11
|
+
gitlab: (val: any, full: any) => any;
|
|
12
|
+
facebook: (val: any, full: any) => any;
|
|
13
|
+
twitter: (val: any, full: any) => any;
|
|
14
|
+
instagram: (val: any, full: any) => any;
|
|
15
|
+
diaspora: (val: any, full: any) => any;
|
|
16
|
+
mastodon: (val: any, full: any) => any;
|
|
17
|
+
telegram: (val: any, full: any) => any;
|
|
18
|
+
signal: (val: any, full: any) => any;
|
|
19
|
+
};
|
|
20
|
+
_add(payload: any): Promise<void>;
|
|
21
|
+
_update(payload: any): Promise<boolean>;
|
|
22
|
+
addOrganization(data?: {}): Promise<any>;
|
|
23
|
+
getOrganizations(): Promise<void>;
|
|
24
|
+
getProjects(data?: {}): Promise<any>;
|
|
25
|
+
getEvents(): Promise<void>;
|
|
26
|
+
getPois(data?: {}): Promise<any>;
|
|
27
|
+
getBadgesIssuer(data?: {}): Promise<any>;
|
|
28
|
+
getNews(data?: {}): Promise<any>;
|
|
29
|
+
getSubscribers(data?: {}): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Récupérer les membres de l'organisation.
|
|
32
|
+
* Constant : GET_MEMBERS_ADMIN / GET_MEMBERS_NO_ADMIN
|
|
33
|
+
* @param {Object} data - Les données de requête.
|
|
34
|
+
* @param {Object} options - Options supplémentaires.
|
|
35
|
+
* @param {boolean} options.toBeValidated - Indique si les membres doivent être validés.
|
|
36
|
+
* @param {boolean} options.isAdmin - Indique si l'utilisateur est admin.
|
|
37
|
+
* @param {boolean} options.isAdminPending - Indique si l'utilisateur est en attente de validation pour être admin.
|
|
38
|
+
* @param {boolean} options.isInviting - Indique si l'utilisateur est en attente d'invitation.
|
|
39
|
+
* @param {Array} options.roles - Liste des rôles à filtrer.
|
|
40
|
+
* @param {boolean} isNext - Indique si c'est une recherche suivante (pagination).
|
|
41
|
+
* @returns {Promise<Object>} - Un objet contenant le nombre de membres et la liste des membres.
|
|
42
|
+
* @throws {ApiResponseError} - Si une erreur se produit lors de la récupération des contributeurs.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Récupérer tous les membres
|
|
46
|
+
* const members = await organization.getMembers();
|
|
47
|
+
*
|
|
48
|
+
* // Récupérer les membres avec validation en attente
|
|
49
|
+
* const membersToBeValidated = await organization.getMembers({}, { toBeValidated: true });
|
|
50
|
+
*
|
|
51
|
+
* // Récupérer les membres avec un rôle spécifique
|
|
52
|
+
* const membersWithRole = await organization.getMembers({}, { roles: ['admin'] });
|
|
53
|
+
*
|
|
54
|
+
* // Récupérer les membres en attente d'invitation
|
|
55
|
+
* const invitingMembers = await organization.getMembers({}, { isInviting: true });
|
|
56
|
+
*
|
|
57
|
+
* // Récupérer les membres admin
|
|
58
|
+
* const adminMembers = await organization.getMembers({}, { isAdmin: true });
|
|
59
|
+
*
|
|
60
|
+
* // Récupérer les membres admin et en attente d'invitation
|
|
61
|
+
* const adminInvitingMembers = await organization.getMembers({}, { isAdmin: true, isInviting: true });
|
|
62
|
+
*
|
|
63
|
+
* // Récupérer les membres avec validation en attente et admin
|
|
64
|
+
* const adminToBeValidatedMembers = await organization.getMembers({}, { toBeValidated: true, isAdmin: true });
|
|
65
|
+
*
|
|
66
|
+
* // Récupérer les membres en attente de validation pour être admin
|
|
67
|
+
* const adminPendingMembers = await organization.getMembers({}, { isAdminPending: true });
|
|
68
|
+
*
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
getMembers(data?: any, options?: {
|
|
72
|
+
toBeValidated: boolean;
|
|
73
|
+
isAdmin: boolean;
|
|
74
|
+
isAdminPending: boolean;
|
|
75
|
+
isInviting: boolean;
|
|
76
|
+
roles: any[];
|
|
77
|
+
}): Promise<any>;
|
|
78
|
+
/**
|
|
79
|
+
* recherche lié à l'organisation
|
|
80
|
+
*
|
|
81
|
+
* @param {Object} data - Les données de recherche.
|
|
82
|
+
* @returns {Promise<Object>} - Résultat de la recherche.
|
|
83
|
+
* @throws {ApiError} - Si le slug ou l'id de l'organisation n'est pas défini.
|
|
84
|
+
*/
|
|
85
|
+
searchCostum(data?: any): Promise<any>;
|
|
86
|
+
}
|
|
87
|
+
import BaseEntity from "./BaseEntity.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class Poi extends BaseEntity {
|
|
2
|
+
static entityType: string;
|
|
3
|
+
static SCHEMA_CONSTANTS: string[];
|
|
4
|
+
static ADD_BLOCKS: Map<string, string>;
|
|
5
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
6
|
+
defaultFields: {
|
|
7
|
+
typeElement: string;
|
|
8
|
+
};
|
|
9
|
+
transforms: {};
|
|
10
|
+
_add(payload: any): Promise<void>;
|
|
11
|
+
_update(payload: any): Promise<boolean>;
|
|
12
|
+
addPoi(data?: {}): Promise<any>;
|
|
13
|
+
getOrganizations(): Promise<void>;
|
|
14
|
+
getProjects(): Promise<void>;
|
|
15
|
+
getEvents(): Promise<void>;
|
|
16
|
+
getPois(): Promise<void>;
|
|
17
|
+
getBadgesIssuer(): Promise<void>;
|
|
18
|
+
getNews(data?: {}): Promise<any>;
|
|
19
|
+
getSubscribers(data?: {}): Promise<any>;
|
|
20
|
+
project(): Promise<void>;
|
|
21
|
+
poi(): Promise<void>;
|
|
22
|
+
event(): Promise<void>;
|
|
23
|
+
badge(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
import BaseEntity from "./BaseEntity.js";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export class Project extends BaseEntity {
|
|
2
|
+
static entityType: string;
|
|
3
|
+
static SCHEMA_CONSTANTS: string[];
|
|
4
|
+
static ADD_BLOCKS: Map<string, string>;
|
|
5
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
6
|
+
defaultFields: {
|
|
7
|
+
typeElement: string;
|
|
8
|
+
};
|
|
9
|
+
transforms: {
|
|
10
|
+
github: (val: any, full: any) => any;
|
|
11
|
+
gitlab: (val: any, full: any) => any;
|
|
12
|
+
facebook: (val: any, full: any) => any;
|
|
13
|
+
twitter: (val: any, full: any) => any;
|
|
14
|
+
instagram: (val: any, full: any) => any;
|
|
15
|
+
diaspora: (val: any, full: any) => any;
|
|
16
|
+
mastodon: (val: any, full: any) => any;
|
|
17
|
+
telegram: (val: any, full: any) => any;
|
|
18
|
+
signal: (val: any, full: any) => any;
|
|
19
|
+
parent: (val: any) => {
|
|
20
|
+
[k: string]: {
|
|
21
|
+
type: any;
|
|
22
|
+
name: any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
_add(payload: any): Promise<void>;
|
|
27
|
+
_update(payload: any): Promise<boolean>;
|
|
28
|
+
addProject(data?: {}): Promise<any>;
|
|
29
|
+
getOrganizations(): Promise<void>;
|
|
30
|
+
getProjects(data?: {}): Promise<any>;
|
|
31
|
+
getEvents(): Promise<void>;
|
|
32
|
+
getPois(data?: {}): Promise<any>;
|
|
33
|
+
getBadgesIssuer(data?: {}): Promise<any>;
|
|
34
|
+
getNews(data?: {}): Promise<any>;
|
|
35
|
+
getSubscribers(data?: {}): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Récupérer les contributeurs d'un projet.
|
|
38
|
+
* Constant : GET_CONTRIBUTORS_ADMIN / GET_CONTRIBUTORS_NO_ADMIN
|
|
39
|
+
* @param {Object} data - Les données de requête.
|
|
40
|
+
* @param {Object} options - Options supplémentaires.
|
|
41
|
+
* @param {boolean} options.toBeValidated - Indique si les contributeurs doivent être validés.
|
|
42
|
+
* @param {boolean} options.isAdmin - Indique si l'utilisateur est admin.
|
|
43
|
+
* @param {boolean} options.isInviting - Indique si l'utilisateur est en attente d'invitation.
|
|
44
|
+
* @param {Array} options.roles - Liste des rôles à filtrer.
|
|
45
|
+
* @param {boolean} isNext - Indique si c'est une recherche suivante (pagination).
|
|
46
|
+
* @returns {Promise<Object>} - Un objet contenant le nombre de contributeurs et la liste des contributeurs.
|
|
47
|
+
* @throws {ApiResponseError} - Si une erreur se produit lors de la récupération des contributeurs.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Récupérer tous les contributeurs
|
|
51
|
+
* const contributors = await project.getContributors();
|
|
52
|
+
*
|
|
53
|
+
* // Récupérer les contributeurs avec validation en attente
|
|
54
|
+
* const contributorsToBeValidated = await project.getContributors({}, { toBeValidated: true });
|
|
55
|
+
*
|
|
56
|
+
* // Récupérer les contributeurs avec un rôle spécifique
|
|
57
|
+
* const contributorsWithRole = await project.getContributors({}, { roles: ["admin"] });
|
|
58
|
+
*
|
|
59
|
+
* // Récupérer les contributeurs administrateurs
|
|
60
|
+
* const adminContributors = await project.getContributors({}, { isAdmin: true });
|
|
61
|
+
*
|
|
62
|
+
* // Récupérer les contributeurs en attente d'invitation
|
|
63
|
+
* const invitingContributors = await project.getContributors({}, { isInviting: true });
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
getContributors(data?: any, options?: {
|
|
67
|
+
toBeValidated: boolean;
|
|
68
|
+
isAdmin: boolean;
|
|
69
|
+
isInviting: boolean;
|
|
70
|
+
roles: any[];
|
|
71
|
+
}): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* Crée une instance de projet et récupère son profil si nécessaire.
|
|
74
|
+
*
|
|
75
|
+
* @param {Object} projectData - Les données nécessaires pour initialiser le projet.
|
|
76
|
+
* @returns {Promise<Project>} Une promesse qui résout l'objet Projet créé.
|
|
77
|
+
* @throws {Error} Si une erreur se produit lors de la création du projet.
|
|
78
|
+
*/
|
|
79
|
+
project(projectData?: any): Promise<Project>;
|
|
80
|
+
}
|
|
81
|
+
import BaseEntity from "./BaseEntity.js";
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
export class User extends BaseEntity {
|
|
2
|
+
static entityType: string;
|
|
3
|
+
static SCHEMA_CONSTANTS: string[];
|
|
4
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
5
|
+
static fromServerData(data: any, parent: any, deps: any): User;
|
|
6
|
+
/**
|
|
7
|
+
* Crée une instance de User.
|
|
8
|
+
*
|
|
9
|
+
* @param {ApiClient} apiClient - Le client API connecté.
|
|
10
|
+
* @param {Object} data - Données initiales (peuvent inclure `id`, `slug`, etc.).
|
|
11
|
+
* @param {string} [data.id] - ID de l'utilisateur.
|
|
12
|
+
* @param {string} [data.slug] - Slug de l'utilisateur.
|
|
13
|
+
* @param {Object} deps - Dépendances injectées.
|
|
14
|
+
* @param {function|object} deps.EndpointApi - Classe ou instance de EndpointApi.
|
|
15
|
+
* @param {function} deps.Organization - Classe Organization.
|
|
16
|
+
* @param {function} deps.Project - Classe Project.
|
|
17
|
+
* @param {function} deps.Event - Classe Events.
|
|
18
|
+
* @param {function} deps.Poi - Classe Poi.
|
|
19
|
+
* @param {function} deps.Badge - Classe Badge.
|
|
20
|
+
* @param {function} deps.News - Classe News.
|
|
21
|
+
*
|
|
22
|
+
* @throws {ApiError} - Si des dépendances nécessaires sont manquantes ou invalides.
|
|
23
|
+
*/
|
|
24
|
+
constructor(parent: any, data?: {
|
|
25
|
+
id?: string;
|
|
26
|
+
slug?: string;
|
|
27
|
+
}, deps?: {
|
|
28
|
+
EndpointApi: Function | object;
|
|
29
|
+
Organization: Function;
|
|
30
|
+
Project: Function;
|
|
31
|
+
Event: Function;
|
|
32
|
+
Poi: Function;
|
|
33
|
+
Badge: Function;
|
|
34
|
+
News: Function;
|
|
35
|
+
});
|
|
36
|
+
defaultFields: {
|
|
37
|
+
typeElement: string;
|
|
38
|
+
};
|
|
39
|
+
transforms: {
|
|
40
|
+
github: (val: any, full: any) => any;
|
|
41
|
+
gitlab: (val: any, full: any) => any;
|
|
42
|
+
facebook: (val: any, full: any) => any;
|
|
43
|
+
twitter: (val: any, full: any) => any;
|
|
44
|
+
instagram: (val: any, full: any) => any;
|
|
45
|
+
diaspora: (val: any, full: any) => any;
|
|
46
|
+
mastodon: (val: any, full: any) => any;
|
|
47
|
+
telegram: (val: any, full: any) => any;
|
|
48
|
+
signal: (val: any, full: any) => any;
|
|
49
|
+
};
|
|
50
|
+
get slug(): any;
|
|
51
|
+
get parentIsMe(): boolean;
|
|
52
|
+
get isActingUser(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Changer le mot de passe : Permet de changer le mot de passe d'un utilisateur.
|
|
55
|
+
* Constant : CHANGE_PASSWORD
|
|
56
|
+
*/
|
|
57
|
+
changePassword(data?: {}): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Supprimer un compte : Permet de supprimer un compte utilisateur.
|
|
60
|
+
* Constant : DELETE_ACCOUNT
|
|
61
|
+
*/
|
|
62
|
+
delete(data?: {}): Promise<any>;
|
|
63
|
+
_add(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Met à jour les blocs modifiés de l'utilisateur via les constantes de schéma définies.
|
|
66
|
+
*
|
|
67
|
+
* @param {Object} payload - Données courantes à comparer et envoyer.
|
|
68
|
+
* @returns {Promise<boolean>} - Indique s'il y a eu une modification réelle.
|
|
69
|
+
*/
|
|
70
|
+
_update(payload: any): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Mettre à jour les paramètres utilisateur : Mise à jour des paramètres spécifiques d'un utilisateur.
|
|
73
|
+
* Constant : UPDATE_SETTINGS
|
|
74
|
+
* @param {Object} data - Données à mettre à jour.
|
|
75
|
+
* @param {"birthDate"|"email"|"locality"|"phone"|"directory"} data.type - Type de paramètre à mettre à jour.
|
|
76
|
+
* @param {"private"|"public"|"mask"} data.value - Nouvelle valeur du paramètre.
|
|
77
|
+
* @returns {Promise<void>} - Résultat de la mise à jour.
|
|
78
|
+
*/
|
|
79
|
+
updateSettings(data?: {
|
|
80
|
+
type: "birthDate" | "email" | "locality" | "phone" | "directory";
|
|
81
|
+
value: "private" | "public" | "mask";
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Mettre à jour la description d'un élément : Permet de mettre à jour la description courte et complète d'un élément.
|
|
85
|
+
* Constant : UPDATE_BLOCK_DESCRIPTION
|
|
86
|
+
*/
|
|
87
|
+
updateDescription(data?: {}): Promise<any>;
|
|
88
|
+
/**
|
|
89
|
+
* Mettre à jour le slug d'un élément : Permet de mettre à jour le slug pour une URL simplifiée.
|
|
90
|
+
* Constant : UPDATE_BLOCK_SLUG
|
|
91
|
+
*/
|
|
92
|
+
updateSlug({ slug }: {
|
|
93
|
+
slug: any;
|
|
94
|
+
}): Promise<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Mettre à jour l'image de profil : Permet de mettre à jour l'image de profil d'un utilisateur ou d'une entité.
|
|
97
|
+
* Constant : PROFIL_IMAGE
|
|
98
|
+
*/
|
|
99
|
+
updateImageProfil({ profil_avatar: image }: {
|
|
100
|
+
profil_avatar: any;
|
|
101
|
+
}): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Récupérer les organisations d'un utilisateur : Récupère la liste des organisations auxquelles l'utilisateur appartient.
|
|
104
|
+
* Constant : GET_ORGANIZATIONS_ADMIN | GET_ORGANIZATIONS_NO_ADMIN
|
|
105
|
+
*/
|
|
106
|
+
getOrganizations(data?: {}): Promise<any>;
|
|
107
|
+
/**
|
|
108
|
+
* Récupérer les projets d'un utilisateur : Récupère la liste des projets auxquels l'utilisateur contribue.
|
|
109
|
+
* Constant : GET_PROJECTS_ADMIN | GET_PROJECTS_NO_ADMIN
|
|
110
|
+
*/
|
|
111
|
+
getProjects(data?: {}): Promise<any>;
|
|
112
|
+
/**
|
|
113
|
+
* Récupérer les POIs
|
|
114
|
+
* Constant : GET_POIS_NO_ADMIN / GET_POIS_ADMIN
|
|
115
|
+
*/
|
|
116
|
+
getPois(data?: {}): Promise<any>;
|
|
117
|
+
/**
|
|
118
|
+
* Récupérer les actualités : Récupère la liste des actualités liées à l'utilisateur.
|
|
119
|
+
* Constant : GET_NEWS
|
|
120
|
+
*/
|
|
121
|
+
getNews(data?: {}): Promise<any>;
|
|
122
|
+
/**
|
|
123
|
+
* Récupérer les amis administrables : Récupère les amis administrée par l’utilisateur.
|
|
124
|
+
* Constant : GET_FRIENDS_ADMIN
|
|
125
|
+
* question : qui peut voir la liste d'amis, seulement l'utilisateur connecté ? ou tous les utilisateurs connectés ?
|
|
126
|
+
* actuellement, c'est tous les utilisateurs connectés
|
|
127
|
+
*/
|
|
128
|
+
getFriends(data?: {}): Promise<any>;
|
|
129
|
+
/**
|
|
130
|
+
* Récupérer les suivis
|
|
131
|
+
* Constant : GET_SUBSCRIPTIONS / GET_SUBSCRIPTIONS_ADMIN
|
|
132
|
+
*/
|
|
133
|
+
getSubscriptions(data?: {}): Promise<any>;
|
|
134
|
+
/**
|
|
135
|
+
* Récupérer les abonnés
|
|
136
|
+
* Constant : GET_SUBSCRIBERS
|
|
137
|
+
*/
|
|
138
|
+
getSubscribers(data?: {}): Promise<any>;
|
|
139
|
+
/**
|
|
140
|
+
* Obtenir la liste des événements
|
|
141
|
+
* Constant : GET_EVENTS
|
|
142
|
+
* TODO : il n'est pas fait encore pour GET_EVENTS_ADMIN / GET_EVENTS_NO_ADMIN comme les autres dans endpointApi
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Liste des badges créés par l'utilisateur
|
|
146
|
+
* Constant : GET_BADGES
|
|
147
|
+
*/
|
|
148
|
+
getBadgesIssuer(data?: {}): Promise<any>;
|
|
149
|
+
/**
|
|
150
|
+
* Liste des badges associés à l'utilisateur
|
|
151
|
+
*
|
|
152
|
+
* TODO : documenté le fonctionnement et sont utilisation avec un exemple
|
|
153
|
+
*/
|
|
154
|
+
getBadges(filter?: {}): Promise<any[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Récupérer la galerie de l'utilisateur
|
|
157
|
+
* Constant : GET_GALLERY
|
|
158
|
+
*/
|
|
159
|
+
getGallery(data?: {}): Promise<any>;
|
|
160
|
+
user(userData: any): Promise<User>;
|
|
161
|
+
/**
|
|
162
|
+
* ───────────────────────────────
|
|
163
|
+
* Lien utilisateur ↔ utilisateur (ami)
|
|
164
|
+
* (demander, valider, se retirer)
|
|
165
|
+
* ───────────────────────────────
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* Envoie une demande d'amitié à cet utilisateur.
|
|
169
|
+
* L'utilisateur ciblé devra valider la demande pour établir la relation.
|
|
170
|
+
*
|
|
171
|
+
* @returns {Promise<Object>} - Résultat de la requête.
|
|
172
|
+
* @throws {ApiError} - Si l'utilisateur n'est pas connecté ou si l'action est interdite.
|
|
173
|
+
*/
|
|
174
|
+
sendFriendRequest(): Promise<any>;
|
|
175
|
+
/**
|
|
176
|
+
* Accepte une demande d'amitié envoyée par cet utilisateur.
|
|
177
|
+
* Cette action établit un lien entre les deux utilisateurs.
|
|
178
|
+
*
|
|
179
|
+
* @returns {Promise<Object>} - Résultat de la validation du lien.
|
|
180
|
+
* @throws {ApiError} - Si aucune invitation n'est en attente ou si l'action est interdite.
|
|
181
|
+
*/
|
|
182
|
+
acceptFriendRequest(): Promise<any>;
|
|
183
|
+
/**
|
|
184
|
+
* Supprime la relation d'amitié avec cet utilisateur.
|
|
185
|
+
* Cette action annule tout lien existant entre les deux profils.
|
|
186
|
+
*
|
|
187
|
+
* @returns {Promise<Object>} - Résultat de la suppression.
|
|
188
|
+
* @throws {ApiError} - Si aucune relation n'existe.
|
|
189
|
+
*/
|
|
190
|
+
removeFriend(): Promise<any>;
|
|
191
|
+
requestToJoin(): void;
|
|
192
|
+
requestToJoinAdmin(): void;
|
|
193
|
+
acceptInvitation(): void;
|
|
194
|
+
leave(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Vérifie si l'utilisateur connecté est ami avec cet utilisateur.
|
|
197
|
+
*
|
|
198
|
+
* @returns {boolean} - True si l'utilisateur connecté est ami, sinon false.
|
|
199
|
+
* @throws {ApiError} - Si l'utilisateur n'est pas connecté.
|
|
200
|
+
*/
|
|
201
|
+
isFriend(): boolean;
|
|
202
|
+
}
|
|
203
|
+
import BaseEntity from "./BaseEntity.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class UserApi {
|
|
2
|
+
constructor(clientOrOptions: any);
|
|
3
|
+
client: ApiClient;
|
|
4
|
+
loggedUser: User;
|
|
5
|
+
get isConnected(): boolean;
|
|
6
|
+
get userId(): any;
|
|
7
|
+
login(email: any, password: any): Promise<any>;
|
|
8
|
+
meIsconnected(): Promise<User>;
|
|
9
|
+
register({ name, username, email, pwd, }?: {}): Promise<any>;
|
|
10
|
+
recoverPassword(email: any): Promise<any>;
|
|
11
|
+
}
|
|
12
|
+
import ApiClient from "../ApiClient.js";
|
|
13
|
+
import { User } from "./User.js";
|