@communecter/cocolight-api-client 1.0.44 → 1.0.46
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 +3 -3
- 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/api/BaseEntity.js +6 -1
- package/src/api/EndpointApi.js +15 -0
- package/src/api/EndpointApi.types.d.ts +12 -0
- package/src/endpoints.module.js +1 -1
package/package.json
CHANGED
package/src/api/BaseEntity.js
CHANGED
|
@@ -295,12 +295,17 @@ export class BaseEntity {
|
|
|
295
295
|
|
|
296
296
|
|
|
297
297
|
_toRawDeep(obj) {
|
|
298
|
+
|
|
299
|
+
if (!this || typeof this._toRawDeep !== "function") {
|
|
300
|
+
throw new Error("`this._toRawDeep` is not bound correctly. Use a lambda to preserve context.");
|
|
301
|
+
}
|
|
302
|
+
|
|
298
303
|
if (isSignal(obj)) {
|
|
299
304
|
return this._toRawDeep(obj.value);
|
|
300
305
|
}
|
|
301
306
|
|
|
302
307
|
if (Array.isArray(obj)) {
|
|
303
|
-
return obj.map(this._toRawDeep);
|
|
308
|
+
return obj.map((item) => this._toRawDeep(item));
|
|
304
309
|
}
|
|
305
310
|
|
|
306
311
|
if (typeof obj === "object" && obj !== null) {
|
package/src/api/EndpointApi.js
CHANGED
|
@@ -573,6 +573,21 @@ class EndpointApi {
|
|
|
573
573
|
return this.call("CITY_AUTOCOMPLETE", data);
|
|
574
574
|
}
|
|
575
575
|
|
|
576
|
+
/**
|
|
577
|
+
* Recherche de villes par pays : Recherche de villes par pays avec autocomplétion.
|
|
578
|
+
* Constant : CITY_AUTOCOMPLETE_BY_COUNTRY
|
|
579
|
+
* @param {import("./EndpointApi.types").CityAutocompleteByCountryData} data - Données envoyées à l'API
|
|
580
|
+
* @returns {Promise<Object>} - Les données de réponse.
|
|
581
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
582
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
583
|
+
*/
|
|
584
|
+
async cityAutocompleteByCountry(data) {
|
|
585
|
+
if (!data || typeof data !== "object") {
|
|
586
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
587
|
+
}
|
|
588
|
+
return this.call("CITY_AUTOCOMPLETE_BY_COUNTRY", data);
|
|
589
|
+
}
|
|
590
|
+
|
|
576
591
|
/**
|
|
577
592
|
* Suggestions d'entrée : Fournit des suggestions basées sur le nom recherché, etc.
|
|
578
593
|
* Constant : SUGGESTION_INPUT
|
|
@@ -1069,6 +1069,18 @@ export interface CityAutocompleteData {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
1071
|
|
|
1072
|
+
export interface CityAutocompleteByCountryData {
|
|
1073
|
+
type: "locality";
|
|
1074
|
+
scopeValue: string;
|
|
1075
|
+
formInMap: boolean;
|
|
1076
|
+
/**
|
|
1077
|
+
* Code du pays pour la recherche de localités
|
|
1078
|
+
*/
|
|
1079
|
+
countryCode: string;
|
|
1080
|
+
[k: string]: unknown;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
|
|
1072
1084
|
export interface SuggestionInputData {
|
|
1073
1085
|
/**
|
|
1074
1086
|
* Nom ou terme recherché
|