@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@communecter/cocolight-api-client",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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) {
@@ -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é