@communecter/cocolight-api-client 1.0.120 → 1.0.121
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/api/BaseEntity.ts +26 -8
- package/src/api/EndpointApi.ts +16 -1
- package/src/api/EndpointApi.types.ts +21 -0
- package/src/api/serverDataType/Country.ts +1 -0
- package/src/endpoints.module.ts +1 -1
- package/src/index.ts +1 -0
- package/types/api/BaseEntity.d.ts +14 -1
- package/types/api/EndpointApi.d.ts +10 -1
- package/types/api/EndpointApi.types.d.ts +19 -0
- package/types/api/serverDataType/Country.d.ts +1 -0
- package/types/endpoints.module.d.ts +198 -0
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
package/src/api/BaseEntity.ts
CHANGED
|
@@ -46,10 +46,12 @@ import type {
|
|
|
46
46
|
SearchMemberAutocompleteData,
|
|
47
47
|
GetEventsData,
|
|
48
48
|
CostumFilterCoformData,
|
|
49
|
+
GetCountriesData,
|
|
49
50
|
SearchZonesData
|
|
50
51
|
} from "./EndpointApi.types.js";
|
|
51
52
|
import type { GetElementsKeyResponse } from "../types/api-responses.js";
|
|
52
53
|
import type { TransformsMap } from "../types/entities.js";
|
|
54
|
+
import type { CountryItem } from "./serverDataType/Country.js";
|
|
53
55
|
import type { ZoneItemNormalized } from "./serverDataType/Zone.js";
|
|
54
56
|
const { fromBuffer } = pkg;
|
|
55
57
|
|
|
@@ -3223,14 +3225,13 @@ export class BaseEntity<TServerData = any> {
|
|
|
3223
3225
|
finalizer: async (finalData) => {
|
|
3224
3226
|
if(this.isMe){
|
|
3225
3227
|
finalData.pathParams = { type: this.getEntityType(), id: this.id };
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
// };
|
|
3228
|
+
finalData.filters = {
|
|
3229
|
+
"$or": {
|
|
3230
|
+
[`links.contributors.${this.id}`]: { "$exists": true },
|
|
3231
|
+
[`parent.${this.id}`]: { "$exists": true }
|
|
3232
|
+
},
|
|
3233
|
+
[`links.contributors.${this.id}`]: { "$exists": true }
|
|
3234
|
+
};
|
|
3234
3235
|
} else {
|
|
3235
3236
|
delete finalData?.pathParams;
|
|
3236
3237
|
finalData.filters = {
|
|
@@ -4701,6 +4702,23 @@ export class BaseEntity<TServerData = any> {
|
|
|
4701
4702
|
return wrappedFinalizer(data) as Promise<ZoneItemNormalized[]>;
|
|
4702
4703
|
}
|
|
4703
4704
|
|
|
4705
|
+
/**
|
|
4706
|
+
* Récupère la liste de tous les pays (endpoint public, sans authentification).
|
|
4707
|
+
*
|
|
4708
|
+
* @param data - Paramètres optionnels (costumSlug, costumId, costumType)
|
|
4709
|
+
* @returns Liste des pays `{ name, countryCode, level, geo, ... }`
|
|
4710
|
+
*
|
|
4711
|
+
* @example
|
|
4712
|
+
* const countries = await organization.getCountries();
|
|
4713
|
+
* countries[0].name; // "France"
|
|
4714
|
+
* countries[0].countryCode; // "FR"
|
|
4715
|
+
*/
|
|
4716
|
+
async getCountries(
|
|
4717
|
+
data: Partial<GetCountriesData> = {},
|
|
4718
|
+
): Promise<CountryItem[]> {
|
|
4719
|
+
return this.endpointApi.getCountries(data as GetCountriesData) as Promise<CountryItem[]>;
|
|
4720
|
+
}
|
|
4721
|
+
|
|
4704
4722
|
/**
|
|
4705
4723
|
* ───────────────────────────────
|
|
4706
4724
|
* Pagination restoration methods
|
package/src/api/EndpointApi.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ApiAuthenticationError } from "../error.js";
|
|
3
3
|
|
|
4
4
|
import type ApiClient from "../ApiClient.js";
|
|
5
|
-
import type { PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeletePoiData, DeleteEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, ShareEventsData, InviteEventData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DemoteAdminData, CostumFilterCoformData, SearchZonesData } from "./EndpointApi.types.js";
|
|
5
|
+
import type { PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeletePoiData, DeleteEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, ShareEventsData, InviteEventData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DemoteAdminData, CostumFilterCoformData, GetCountriesData, SearchZonesData } from "./EndpointApi.types.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
@@ -1735,6 +1735,21 @@ export class EndpointApi {
|
|
|
1735
1735
|
return this.call("COSTUM_FILTER_COFORM", data);
|
|
1736
1736
|
}
|
|
1737
1737
|
|
|
1738
|
+
/**
|
|
1739
|
+
* Récupérer la liste des pays : Récupérer la liste de tous les pays
|
|
1740
|
+
* Constant : GET_COUNTRIES
|
|
1741
|
+
* @param data - Données envoyées à l'API
|
|
1742
|
+
* @returns Les données de réponse.
|
|
1743
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1744
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1745
|
+
*/
|
|
1746
|
+
async getCountries(data: GetCountriesData): Promise<any> {
|
|
1747
|
+
if (!data || typeof data !== "object") {
|
|
1748
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1749
|
+
}
|
|
1750
|
+
return this.call("GET_COUNTRIES", data);
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1738
1753
|
/**
|
|
1739
1754
|
* Rechercher des zones géographiques : Rechercher des zones géographiques
|
|
1740
1755
|
* Constant : SEARCH_ZONES
|
|
@@ -4973,6 +4973,27 @@ export interface CostumFilterCoformData {
|
|
|
4973
4973
|
}
|
|
4974
4974
|
|
|
4975
4975
|
|
|
4976
|
+
export interface GetCountriesData {
|
|
4977
|
+
/**
|
|
4978
|
+
* Slug personnalisé
|
|
4979
|
+
*/
|
|
4980
|
+
costumSlug?: string;
|
|
4981
|
+
/**
|
|
4982
|
+
* Mode édition personnalisé (boolean, string ou number)
|
|
4983
|
+
*/
|
|
4984
|
+
costumEditMode?: ("true" | "false") | (0 | 1) | boolean;
|
|
4985
|
+
/**
|
|
4986
|
+
* ID personnalisé (format ObjectID MongoDB)
|
|
4987
|
+
*/
|
|
4988
|
+
costumId?: string;
|
|
4989
|
+
/**
|
|
4990
|
+
* Type de collection
|
|
4991
|
+
*/
|
|
4992
|
+
costumType?: "organizations" | "projects" | "events" | "citoyens" | "poi";
|
|
4993
|
+
[k: string]: unknown;
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4996
|
+
|
|
4976
4997
|
export interface SearchZonesData {
|
|
4977
4998
|
/**
|
|
4978
4999
|
* Code du pays pour la recherche
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ZoneItemNormalized as CountryItem } from "./Zone.js";
|