@communecter/cocolight-api-client 1.0.119 → 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/ApiClient.ts +1 -2
- package/src/api/BaseEntity.ts +88 -9
- package/src/api/Comment.ts +1 -1
- package/src/api/EndpointApi.ts +46 -1
- package/src/api/EndpointApi.types.ts +78 -1
- package/src/api/UserApi.ts +1 -1
- package/src/api/serverDataType/Country.ts +1 -0
- package/src/api/serverDataType/Zone.ts +33 -0
- package/src/endpoints.module.ts +4 -1
- package/src/index.ts +2 -0
- package/types/api/BaseEntity.d.ts +52 -1
- package/types/api/EndpointApi.d.ts +28 -1
- package/types/api/EndpointApi.types.d.ts +72 -1
- package/types/api/serverDataType/Country.d.ts +1 -0
- package/types/api/serverDataType/Zone.d.ts +30 -0
- package/types/endpoints.module.d.ts +995 -0
- package/types/index.d.ts +2 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, GetNewsData, GetGalleryData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestDatesData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetOrganizationsAdminData, GetOrganizationsNoAdminData, GetProjectsAdminData, GetProjectsNoAdminData, GetPoisAdminData, GetPoisNoAdminData, GetSubscribersData, GetBadgesData, CoformAnswersSearchData, SearchMemberAutocompleteData, GetEventsData } from "./EndpointApi.types.js";
|
|
1
|
+
import type { UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, GetNewsData, GetGalleryData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestDatesData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetOrganizationsAdminData, GetOrganizationsNoAdminData, GetProjectsAdminData, GetProjectsNoAdminData, GetPoisAdminData, GetPoisNoAdminData, GetSubscribersData, GetBadgesData, CoformAnswersSearchData, SearchMemberAutocompleteData, GetEventsData, CostumFilterCoformData, GetCountriesData, SearchZonesData } from "./EndpointApi.types.js";
|
|
2
2
|
import type { TransformsMap } from "../types/entities.js";
|
|
3
|
+
import type { CountryItem } from "./serverDataType/Country.js";
|
|
4
|
+
import type { ZoneItemNormalized } from "./serverDataType/Zone.js";
|
|
3
5
|
/**
|
|
4
6
|
* Types pour les méthodes d'entité (organization, project, poi, event, badge, news)
|
|
5
7
|
* Permettent soit de récupérer une entité existante (GET), soit de créer une nouvelle instance (CREATE)
|
|
@@ -1614,6 +1616,55 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1614
1616
|
coformAnswersSearch(data?: Partial<CoformAnswersSearchData>, options?: {
|
|
1615
1617
|
restoredState?: PaginatorState;
|
|
1616
1618
|
}): Promise<PaginatorPage<any>>;
|
|
1619
|
+
/**
|
|
1620
|
+
* Récupère les filtres disponibles basés sur les réponses CoForm de l'entité courante.
|
|
1621
|
+
* Utilise le contexte Communecter (costumSlug, contextId, contextType) de l'entité.
|
|
1622
|
+
*
|
|
1623
|
+
* La réponse est un objet indexé par nom de filtre, chaque entrée contenant :
|
|
1624
|
+
* - `count` : nombre de résultats par catégorie
|
|
1625
|
+
* - `results` : valeurs disponibles pour ce filtre (libellé, image, etc.)
|
|
1626
|
+
*
|
|
1627
|
+
* @param data - Paramètres optionnels de recherche
|
|
1628
|
+
* @param data.searchedData - Filtres actifs : clé → `{ label, forms, path, finderPath }`
|
|
1629
|
+
* @returns Objet `Record<filterName, { count, results }>` des filtres disponibles
|
|
1630
|
+
*
|
|
1631
|
+
* @example
|
|
1632
|
+
* const filters = await project.coformFiltersSearch({
|
|
1633
|
+
* searchedData: {
|
|
1634
|
+
* "activités": {
|
|
1635
|
+
* label: "Activités",
|
|
1636
|
+
* forms: "6486d24e9cad105cbf29a777",
|
|
1637
|
+
* path: "lesCommunsDesTierslieux...",
|
|
1638
|
+
* finderPath: "answers.lesCommunsDesTierslieux..."
|
|
1639
|
+
* }
|
|
1640
|
+
* }
|
|
1641
|
+
* });
|
|
1642
|
+
* filters["activités"].count; // { "Atelier": 12, "Coworking": 8 }
|
|
1643
|
+
*/
|
|
1644
|
+
coformFiltersSearch(data?: Partial<CostumFilterCoformData>): Promise<any>;
|
|
1645
|
+
/**
|
|
1646
|
+
* Recherche des zones géographiques selon un pays et un niveau administratif.
|
|
1647
|
+
* Utilise le contexte Communecter de l'entité courante.
|
|
1648
|
+
*
|
|
1649
|
+
* @param data - Paramètres de recherche
|
|
1650
|
+
* @param data.countryCode - Code(s) pays ISO (ex: `["FR"]`)
|
|
1651
|
+
* @param data.level - Niveau(x) administratif(s) (ex: `["1"]`)
|
|
1652
|
+
* @returns Liste des zones correspondantes
|
|
1653
|
+
* @throws {ApiError} Si `countryCode` ou `level` sont absents
|
|
1654
|
+
*/
|
|
1655
|
+
searchZone(data: SearchZonesData): Promise<ZoneItemNormalized[]>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Récupère la liste de tous les pays (endpoint public, sans authentification).
|
|
1658
|
+
*
|
|
1659
|
+
* @param data - Paramètres optionnels (costumSlug, costumId, costumType)
|
|
1660
|
+
* @returns Liste des pays `{ name, countryCode, level, geo, ... }`
|
|
1661
|
+
*
|
|
1662
|
+
* @example
|
|
1663
|
+
* const countries = await organization.getCountries();
|
|
1664
|
+
* countries[0].name; // "France"
|
|
1665
|
+
* countries[0].countryCode; // "FR"
|
|
1666
|
+
*/
|
|
1667
|
+
getCountries(data?: Partial<GetCountriesData>): Promise<CountryItem[]>;
|
|
1617
1668
|
/**
|
|
1618
1669
|
* ───────────────────────────────
|
|
1619
1670
|
* Pagination restoration methods
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ApiClient from "../ApiClient.js";
|
|
2
|
-
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 } from "./EndpointApi.types.js";
|
|
2
|
+
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";
|
|
3
3
|
/**
|
|
4
4
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
5
5
|
*/
|
|
@@ -1059,5 +1059,32 @@ export declare class EndpointApi {
|
|
|
1059
1059
|
* @throws {Error} - En cas d'erreur inattendue.
|
|
1060
1060
|
*/
|
|
1061
1061
|
demoteAdmin(data: DemoteAdminData): Promise<any>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Filtre par reponses CoForm : Recuperer tous les filtres possibles via l'answers
|
|
1064
|
+
* Constant : COSTUM_FILTER_COFORM
|
|
1065
|
+
* @param data - Données envoyées à l'API
|
|
1066
|
+
* @returns Les données de réponse.
|
|
1067
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1068
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1069
|
+
*/
|
|
1070
|
+
costumFilterCoform(data: CostumFilterCoformData): Promise<any>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Récupérer la liste des pays : Récupérer la liste de tous les pays
|
|
1073
|
+
* Constant : GET_COUNTRIES
|
|
1074
|
+
* @param data - Données envoyées à l'API
|
|
1075
|
+
* @returns Les données de réponse.
|
|
1076
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1077
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1078
|
+
*/
|
|
1079
|
+
getCountries(data: GetCountriesData): Promise<any>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Rechercher des zones géographiques : Rechercher des zones géographiques
|
|
1082
|
+
* Constant : SEARCH_ZONES
|
|
1083
|
+
* @param data - Données envoyées à l'API
|
|
1084
|
+
* @returns Les données de réponse.
|
|
1085
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1086
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1087
|
+
*/
|
|
1088
|
+
searchZones(data: SearchZonesData): Promise<any>;
|
|
1062
1089
|
}
|
|
1063
1090
|
export default EndpointApi;
|
|
@@ -3641,7 +3641,7 @@ export interface GlobalAutocompleteCostumData {
|
|
|
3641
3641
|
/**
|
|
3642
3642
|
* Type de la localité : 'cities' pour une ville ou 'level1' pour une région
|
|
3643
3643
|
*/
|
|
3644
|
-
type: "cities" | "level1";
|
|
3644
|
+
type: "cities" | "level1" | "level2" | "level3" | "level4" | "level5";
|
|
3645
3645
|
};
|
|
3646
3646
|
};
|
|
3647
3647
|
/**
|
|
@@ -4550,3 +4550,74 @@ export interface DemoteAdminData {
|
|
|
4550
4550
|
isAdmin: false;
|
|
4551
4551
|
[k: string]: unknown;
|
|
4552
4552
|
}
|
|
4553
|
+
export interface CostumFilterCoformData {
|
|
4554
|
+
/**
|
|
4555
|
+
* Données de recherche pour le filtre
|
|
4556
|
+
*/
|
|
4557
|
+
searchedData?: {
|
|
4558
|
+
[k: string]: unknown;
|
|
4559
|
+
};
|
|
4560
|
+
/**
|
|
4561
|
+
* Slug du costume
|
|
4562
|
+
*/
|
|
4563
|
+
costumSlug?: string;
|
|
4564
|
+
/**
|
|
4565
|
+
* ID du costume
|
|
4566
|
+
*/
|
|
4567
|
+
costumId?: string;
|
|
4568
|
+
/**
|
|
4569
|
+
* Type du costume
|
|
4570
|
+
*/
|
|
4571
|
+
costumType?: string;
|
|
4572
|
+
[k: string]: unknown;
|
|
4573
|
+
}
|
|
4574
|
+
export interface GetCountriesData {
|
|
4575
|
+
/**
|
|
4576
|
+
* Slug personnalisé
|
|
4577
|
+
*/
|
|
4578
|
+
costumSlug?: string;
|
|
4579
|
+
/**
|
|
4580
|
+
* Mode édition personnalisé (boolean, string ou number)
|
|
4581
|
+
*/
|
|
4582
|
+
costumEditMode?: ("true" | "false") | (0 | 1) | boolean;
|
|
4583
|
+
/**
|
|
4584
|
+
* ID personnalisé (format ObjectID MongoDB)
|
|
4585
|
+
*/
|
|
4586
|
+
costumId?: string;
|
|
4587
|
+
/**
|
|
4588
|
+
* Type de collection
|
|
4589
|
+
*/
|
|
4590
|
+
costumType?: "organizations" | "projects" | "events" | "citoyens" | "poi";
|
|
4591
|
+
[k: string]: unknown;
|
|
4592
|
+
}
|
|
4593
|
+
export interface SearchZonesData {
|
|
4594
|
+
/**
|
|
4595
|
+
* Code du pays pour la recherche
|
|
4596
|
+
*/
|
|
4597
|
+
countryCode: unknown[];
|
|
4598
|
+
/**
|
|
4599
|
+
* Niveau de la zone géographique pour la recherche
|
|
4600
|
+
*/
|
|
4601
|
+
level: unknown[];
|
|
4602
|
+
/**
|
|
4603
|
+
* Critère de tri des résultats
|
|
4604
|
+
*/
|
|
4605
|
+
sortBy?: string;
|
|
4606
|
+
/**
|
|
4607
|
+
* ID du niveau supérieur pour la recherche
|
|
4608
|
+
*/
|
|
4609
|
+
upperLevelId?: string;
|
|
4610
|
+
/**
|
|
4611
|
+
* Slug du costume
|
|
4612
|
+
*/
|
|
4613
|
+
costumSlug?: string;
|
|
4614
|
+
/**
|
|
4615
|
+
* ID du costume
|
|
4616
|
+
*/
|
|
4617
|
+
costumId?: string;
|
|
4618
|
+
/**
|
|
4619
|
+
* Type du costume
|
|
4620
|
+
*/
|
|
4621
|
+
costumType?: string;
|
|
4622
|
+
[k: string]: unknown;
|
|
4623
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ZoneItemNormalized as CountryItem } from "./Zone.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GeoCoordinates, GeoPosition, IdObject } from "./common.js";
|
|
2
|
+
import type EJSONType from "../../EJSONType.js";
|
|
3
|
+
type ObjectIDCtor = typeof EJSONType["ObjectID"];
|
|
4
|
+
type ObjectID = InstanceType<ObjectIDCtor>;
|
|
5
|
+
export interface ZoneItemNormalized {
|
|
6
|
+
_id: IdObject;
|
|
7
|
+
countryCode: string;
|
|
8
|
+
geo: GeoCoordinates;
|
|
9
|
+
geoPosition: GeoPosition;
|
|
10
|
+
level: string[];
|
|
11
|
+
name: string;
|
|
12
|
+
osmID?: string;
|
|
13
|
+
wikidataID?: string;
|
|
14
|
+
translateId: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface ZoneItemJson {
|
|
18
|
+
id: string;
|
|
19
|
+
_id: ObjectID;
|
|
20
|
+
countryCode: string;
|
|
21
|
+
geo: GeoCoordinates;
|
|
22
|
+
geoPosition: GeoPosition;
|
|
23
|
+
level: string[];
|
|
24
|
+
name: string;
|
|
25
|
+
osmID?: string;
|
|
26
|
+
wikidataID?: string;
|
|
27
|
+
translateId: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export {};
|