@communecter/cocolight-api-client 1.0.47 → 1.0.49
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/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 +1 -1
- package/src/ApiClient.js +4 -2
- package/src/api/BaseEntity.js +18 -0
- package/src/api/EndpointApi.js +15 -0
- package/src/api/EndpointApi.types.d.ts +95 -59
- package/src/api/Event.js +8 -0
- package/src/api/Organization.js +12 -0
- package/src/api/Project.js +12 -0
- package/src/api/User.js +8 -0
- package/src/endpoints.module.js +2 -2
package/package.json
CHANGED
package/src/ApiClient.js
CHANGED
|
@@ -1074,7 +1074,7 @@ export default class ApiClient extends EventEmitter {
|
|
|
1074
1074
|
data.results = Object.keys(data.results).map((key) => {
|
|
1075
1075
|
return this._normalizeJsonData({ id: key, ...data.results[key] });
|
|
1076
1076
|
});
|
|
1077
|
-
} else if (Array.isArray(data.results)) {
|
|
1077
|
+
} else if (Array.isArray(data.results) && data.results.length > 0) {
|
|
1078
1078
|
data.results = data.results.map((item) => this._normalizeJsonData(item));
|
|
1079
1079
|
} else if (data.news && Array.isArray(data.news) && data.news.length === 0) {
|
|
1080
1080
|
data = data.news;
|
|
@@ -1441,7 +1441,9 @@ export default class ApiClient extends EventEmitter {
|
|
|
1441
1441
|
"profilRealBannerUrl",
|
|
1442
1442
|
"imagePath",
|
|
1443
1443
|
"imageThumbPath",
|
|
1444
|
-
"docPath"
|
|
1444
|
+
"docPath",
|
|
1445
|
+
"imageThumb",
|
|
1446
|
+
"imageMediumPath"
|
|
1445
1447
|
];
|
|
1446
1448
|
|
|
1447
1449
|
/**
|
package/src/api/BaseEntity.js
CHANGED
|
@@ -2171,6 +2171,24 @@ export class BaseEntity {
|
|
|
2171
2171
|
return this._createFilteredProxy(rawList);
|
|
2172
2172
|
}
|
|
2173
2173
|
|
|
2174
|
+
/**
|
|
2175
|
+
* Récupérer la galerie d'une entité.
|
|
2176
|
+
* Constant : GET_GALLERY
|
|
2177
|
+
* @param {Object} data - Les données à envoyer.
|
|
2178
|
+
* @param {string} data.pathParams.docType - Type de document (default: "image")
|
|
2179
|
+
* @param {string} data.contentKey - Clé de contenu pour la galerie (default: "null")
|
|
2180
|
+
* @param {string} data.folderId - ID du dossier pour la galerie (default: "null")
|
|
2181
|
+
* @returns {Promise<Object>} - Les données de réponse.
|
|
2182
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
2183
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
2184
|
+
*/
|
|
2185
|
+
async getGallery(data = {}) {
|
|
2186
|
+
data.pathParams = { type: this.getEntityType(), id: this.id, docType: data.pathParams?.docType || "image" };
|
|
2187
|
+
const arrayObjet = await this.endpointApi.getGallery(data);
|
|
2188
|
+
|
|
2189
|
+
return arrayObjet;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2174
2192
|
/**
|
|
2175
2193
|
* Soumet une demande pour rejoindre l'entité courante (ex. organisation, projet, événement...).
|
|
2176
2194
|
* Si une invitation est en attente, elle est automatiquement acceptée.
|
package/src/api/EndpointApi.js
CHANGED
|
@@ -1513,6 +1513,21 @@ class EndpointApi {
|
|
|
1513
1513
|
return this.call("COSTUM_EVENT_REQUEST_LOAD_CONTEXT_TAG", data);
|
|
1514
1514
|
}
|
|
1515
1515
|
|
|
1516
|
+
/**
|
|
1517
|
+
* Récupération de la galerie : Renvoie soit la liste d’albums associés à une entité, soit les images d’un album spécifique.
|
|
1518
|
+
* Constant : GET_GALLERY
|
|
1519
|
+
* @param {import("./EndpointApi.types").GetGalleryData} data - Données envoyées à l'API
|
|
1520
|
+
* @returns {Promise<Object>} - Les données de réponse.
|
|
1521
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1522
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1523
|
+
*/
|
|
1524
|
+
async getGallery(data) {
|
|
1525
|
+
if (!data || typeof data !== "object") {
|
|
1526
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1527
|
+
}
|
|
1528
|
+
return this.call("GET_GALLERY", data);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1516
1531
|
}
|
|
1517
1532
|
|
|
1518
1533
|
export default EndpointApi;
|
|
@@ -283,62 +283,54 @@ export interface UpdateBlockLocalityData {
|
|
|
283
283
|
* Périmètre de mise à jour
|
|
284
284
|
*/
|
|
285
285
|
scope?: string;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
level4?: string;
|
|
335
|
-
/**
|
|
336
|
-
* Nom de la commune. Peut être vide pour les pays étrangers.
|
|
337
|
-
*/
|
|
338
|
-
level4Name?: string;
|
|
339
|
-
postalCode?: string;
|
|
340
|
-
streetAddress?: string;
|
|
341
|
-
};
|
|
286
|
+
geo?:
|
|
287
|
+
| ""
|
|
288
|
+
| {
|
|
289
|
+
"@type"?: "GeoCoordinates";
|
|
290
|
+
latitude: string | number;
|
|
291
|
+
longitude: string | number;
|
|
292
|
+
};
|
|
293
|
+
geoPosition?:
|
|
294
|
+
| ""
|
|
295
|
+
| {
|
|
296
|
+
type: "Point";
|
|
297
|
+
/**
|
|
298
|
+
* @minItems 2
|
|
299
|
+
* @maxItems 2
|
|
300
|
+
*/
|
|
301
|
+
coordinates: [number, number];
|
|
302
|
+
float: true;
|
|
303
|
+
[k: string]: unknown;
|
|
304
|
+
};
|
|
305
|
+
address:
|
|
306
|
+
| ""
|
|
307
|
+
| {
|
|
308
|
+
"@type": "PostalAddress";
|
|
309
|
+
addressCountry: string;
|
|
310
|
+
codeInsee: string;
|
|
311
|
+
addressLocality: string;
|
|
312
|
+
localityId: string;
|
|
313
|
+
level1: string;
|
|
314
|
+
level1Name: string;
|
|
315
|
+
/**
|
|
316
|
+
* ID du département. Peut être vide pour les pays étrangers.
|
|
317
|
+
*/
|
|
318
|
+
level3?: string;
|
|
319
|
+
/**
|
|
320
|
+
* Nom du département. Peut être vide pour les pays étrangers.
|
|
321
|
+
*/
|
|
322
|
+
level3Name?: string;
|
|
323
|
+
/**
|
|
324
|
+
* ID de la commune. Peut être vide pour les pays étrangers.
|
|
325
|
+
*/
|
|
326
|
+
level4?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Nom de la commune. Peut être vide pour les pays étrangers.
|
|
329
|
+
*/
|
|
330
|
+
level4Name?: string;
|
|
331
|
+
postalCode?: string;
|
|
332
|
+
streetAddress?: string;
|
|
333
|
+
};
|
|
342
334
|
[k: string]: unknown;
|
|
343
335
|
}
|
|
344
336
|
|
|
@@ -3894,7 +3886,7 @@ export interface GlobalAutocompleteCostumData {
|
|
|
3894
3886
|
/**
|
|
3895
3887
|
* Nom ou mot-clé de la recherche
|
|
3896
3888
|
*/
|
|
3897
|
-
name
|
|
3889
|
+
name?: string;
|
|
3898
3890
|
/**
|
|
3899
3891
|
* Liste des localités ciblées avec leur identifiant et leur type (city ou level1)
|
|
3900
3892
|
*/
|
|
@@ -3992,9 +3984,21 @@ export interface GlobalAutocompleteCostumData {
|
|
|
3992
3984
|
*/
|
|
3993
3985
|
count: true;
|
|
3994
3986
|
/**
|
|
3995
|
-
* Filtres additionnels appliqués à la recherche
|
|
3987
|
+
* Filtres additionnels appliqués à la recherche
|
|
3996
3988
|
*/
|
|
3997
|
-
filters
|
|
3989
|
+
filters?: {
|
|
3990
|
+
[k: string]: unknown;
|
|
3991
|
+
};
|
|
3992
|
+
/**
|
|
3993
|
+
* Liste des champs à retourner
|
|
3994
|
+
*/
|
|
3995
|
+
fields?: string[];
|
|
3996
|
+
/**
|
|
3997
|
+
* Champ de tri (clé = champ, valeur = 1 ou -1)
|
|
3998
|
+
*/
|
|
3999
|
+
sortBy?: {
|
|
4000
|
+
[k: string]: 1 | -1;
|
|
4001
|
+
};
|
|
3998
4002
|
/**
|
|
3999
4003
|
* Indique si la recherche doit s'étendre au Fediverse (toujours désactivé)
|
|
4000
4004
|
*/
|
|
@@ -4003,6 +4007,10 @@ export interface GlobalAutocompleteCostumData {
|
|
|
4003
4007
|
* Indique si la recherche est effectuée à partir d'une carte (toujours désactivé)
|
|
4004
4008
|
*/
|
|
4005
4009
|
mapUsed: boolean;
|
|
4010
|
+
/**
|
|
4011
|
+
* Indique si on doit exclure les éléments avec une source
|
|
4012
|
+
*/
|
|
4013
|
+
notSourceKey?: boolean;
|
|
4006
4014
|
/**
|
|
4007
4015
|
* ID du contexte de recherche (actuellement vide)
|
|
4008
4016
|
*/
|
|
@@ -4412,3 +4420,31 @@ export interface CostumEventRequestLoadContextTagData {
|
|
|
4412
4420
|
};
|
|
4413
4421
|
[k: string]: unknown;
|
|
4414
4422
|
}
|
|
4423
|
+
|
|
4424
|
+
|
|
4425
|
+
export interface GetGalleryData {
|
|
4426
|
+
/**
|
|
4427
|
+
* Clé de contenu pour correspondre à l'album ou aux images
|
|
4428
|
+
*/
|
|
4429
|
+
contentKey?: string;
|
|
4430
|
+
/**
|
|
4431
|
+
* ID du dossier à récupérer (pour les images d'un album)
|
|
4432
|
+
*/
|
|
4433
|
+
folderId?: string;
|
|
4434
|
+
pathParams?: {
|
|
4435
|
+
/**
|
|
4436
|
+
* ID de l'entité
|
|
4437
|
+
*/
|
|
4438
|
+
id: string;
|
|
4439
|
+
/**
|
|
4440
|
+
* Type d'entité
|
|
4441
|
+
*/
|
|
4442
|
+
type: "citoyens" | "organizations" | "projects";
|
|
4443
|
+
/**
|
|
4444
|
+
* Type de document
|
|
4445
|
+
*/
|
|
4446
|
+
docType: "image" | "file" | "bookmarks";
|
|
4447
|
+
[k: string]: unknown;
|
|
4448
|
+
};
|
|
4449
|
+
[k: string]: unknown;
|
|
4450
|
+
}
|
package/src/api/Event.js
CHANGED
|
@@ -8,6 +8,10 @@ export class Event extends BaseEntity {
|
|
|
8
8
|
|
|
9
9
|
static SCHEMA_CONSTANTS = [
|
|
10
10
|
"ADD_EVENT",
|
|
11
|
+
// "UPDATE_BLOCK_DESCRIPTION",
|
|
12
|
+
// "UPDATE_BLOCK_INFO",
|
|
13
|
+
// "UPDATE_BLOCK_SOCIAL",
|
|
14
|
+
// "UPDATE_BLOCK_LOCALITY",
|
|
11
15
|
"UPDATE_BLOCK_SLUG",
|
|
12
16
|
"PROFIL_IMAGE"
|
|
13
17
|
];
|
|
@@ -18,6 +22,10 @@ export class Event extends BaseEntity {
|
|
|
18
22
|
]);
|
|
19
23
|
|
|
20
24
|
static UPDATE_BLOCKS = new Map([
|
|
25
|
+
// ["UPDATE_BLOCK_DESCRIPTION", "updateDescription"],
|
|
26
|
+
// ["UPDATE_BLOCK_SOCIAL", "updateSocial"],
|
|
27
|
+
// ["UPDATE_BLOCK_LOCALITY", "updateLocality"],
|
|
28
|
+
// ["UPDATE_BLOCK_INFO", "updateInfo"],
|
|
21
29
|
["UPDATE_BLOCK_SLUG", "updateSlug"],
|
|
22
30
|
["PROFIL_IMAGE", "updateImageProfil"]
|
|
23
31
|
]);
|
package/src/api/Organization.js
CHANGED
|
@@ -214,6 +214,18 @@ export class Organization extends BaseEntity {
|
|
|
214
214
|
return paginator.next();
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Récupère la galerie de l'organisation.
|
|
219
|
+
*
|
|
220
|
+
* @param {Object} data - Les données de requête.
|
|
221
|
+
* @returns {Promise<Object>} - Un objet contenant les éléments de la galerie.
|
|
222
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
223
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
224
|
+
*/
|
|
225
|
+
async getGallery(data = {}) {
|
|
226
|
+
return super.getGallery(data);
|
|
227
|
+
}
|
|
228
|
+
|
|
217
229
|
/**
|
|
218
230
|
* Crée une instance de projet et récupère son profil si nécessaire.
|
|
219
231
|
*
|
package/src/api/Project.js
CHANGED
|
@@ -225,6 +225,18 @@ export class Project extends BaseEntity {
|
|
|
225
225
|
return paginator.next();
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Récupère la galerie d'un projet.
|
|
230
|
+
*
|
|
231
|
+
* @param {Object} data - Les données de requête pour la galerie.
|
|
232
|
+
* @returns {Promise<Object>} - Un objet contenant les images de la galerie.
|
|
233
|
+
* @throws {ApiResponseError} - Si une erreur se produit lors de la récupération de la galerie.
|
|
234
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
235
|
+
*/
|
|
236
|
+
async getGallery(data = {}) {
|
|
237
|
+
return super.getGallery(data);
|
|
238
|
+
}
|
|
239
|
+
|
|
228
240
|
/**
|
|
229
241
|
* Crée une instance de projet et récupère son profil si nécessaire.
|
|
230
242
|
*
|
package/src/api/User.js
CHANGED
|
@@ -441,6 +441,14 @@ export class User extends BaseEntity {
|
|
|
441
441
|
return filteredBadges;
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
+
/**
|
|
445
|
+
* Récupérer la galerie de l'utilisateur
|
|
446
|
+
* Constant : GET_GALLERY
|
|
447
|
+
*/
|
|
448
|
+
async getGallery(data = {}) {
|
|
449
|
+
return super.getGallery(data);
|
|
450
|
+
}
|
|
451
|
+
|
|
444
452
|
async user(userData) {
|
|
445
453
|
if(!this.isMe){
|
|
446
454
|
throw new ApiError("Vous devez être connecté et être l'utilisateur");
|