@communecter/cocolight-api-client 1.0.79 → 1.0.81

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@communecter/cocolight-api-client",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
package/src/ApiClient.ts CHANGED
@@ -1383,6 +1383,13 @@ export default class ApiClient extends EventEmitter {
1383
1383
  if(item?.author?.typeSig === "people"){
1384
1384
  item.author.type = "citoyens";
1385
1385
  }
1386
+
1387
+ if(item?.typeSig === "people"){
1388
+ item.collection = "citoyens";
1389
+ }
1390
+ if(item?.typeSig === "organizations"){
1391
+ item.collection = "organizations";
1392
+ }
1386
1393
 
1387
1394
  // Convertit en EJSON si besoin
1388
1395
  return this._fromJSONValue ? EJSON.fromJSONValue(item) : item;
@@ -42,7 +42,8 @@ import type {
42
42
  GetSubscribersData,
43
43
  GetBadgesData,
44
44
  CoformAnswersSearchData,
45
- ProfilBannerData
45
+ ProfilBannerData,
46
+ SearchMemberAutocompleteData
46
47
  } from "./EndpointApi.types.js";
47
48
  import type { GetElementsKeyResponse } from "../types/api-responses.js";
48
49
  import type { TransformsMap } from "../types/entities.js";
@@ -4087,6 +4088,30 @@ export class BaseEntity<TServerData = any> {
4087
4088
  return paginator.next() as Promise<PaginatorPage<any>>;
4088
4089
  }
4089
4090
 
4091
+ async searchMembers(data: SearchMemberAutocompleteData) {
4092
+ // TODO: j'ai l'impression que searchMode : "organizationOnly" ne renvois pas que des organisations
4093
+ const result = await this.endpointApi.searchMemberAutocomplete(data);
4094
+ if (!result || !Array.isArray(result)) {
4095
+ return [];
4096
+ }
4097
+
4098
+ const t = this.getEntityType();
4099
+ if (t === "badges" || t === "news" || t === "poi" || t === "comments") {
4100
+ throw new ApiError(`Le type d'entité "${t}" n'est pas supporté par searchMemberAutocomplete.`, 400);
4101
+ }
4102
+
4103
+ result.forEach(item => {
4104
+ for (const key of Object.keys(item)) {
4105
+ if (!["id", "name", "slug", "profilThumbImageUrl", "profilMarkerImageUrl", "type", "collection"].includes(key)) {
4106
+ delete item[key];
4107
+ }
4108
+ }
4109
+ });
4110
+
4111
+ const rawList = this._linkEntities(result);
4112
+ return rawList;
4113
+ }
4114
+
4090
4115
  }
4091
4116
 
4092
4117
  export default BaseEntity;
@@ -1814,6 +1814,29 @@ export interface GetFriendsAdminData {
1814
1814
  * Nombre d’éléments à récupérer (limite de pagination)
1815
1815
  */
1816
1816
  indexStep: number;
1817
+ /**
1818
+ * Index de fin global pour la pagination
1819
+ */
1820
+ indexMax?: number;
1821
+ /**
1822
+ * Configuration des plages de résultats pour chaque type de recherche
1823
+ */
1824
+ ranges?: {
1825
+ /**
1826
+ * This interface was referenced by `undefined`'s JSON-Schema definition
1827
+ * via the `patternProperty` "^[^\s]+$".
1828
+ */
1829
+ [k: string]: {
1830
+ /**
1831
+ * Index de départ pour la pagination
1832
+ */
1833
+ indexMin: number;
1834
+ /**
1835
+ * Index de fin pour la pagination
1836
+ */
1837
+ indexMax: number;
1838
+ };
1839
+ };
1817
1840
  /**
1818
1841
  * Flag pour ne pas filtrer sur une clé de source spécifique
1819
1842
  */