@communecter/cocolight-api-client 1.0.75 → 1.0.77
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 +63 -1
- package/src/api/EndpointApi.ts +33 -1
- package/src/api/EndpointApi.types.ts +53 -0
- package/src/api/News.ts +21 -5
- package/src/api/Organization.ts +118 -3
- package/src/endpoints.module.ts +12 -1
- package/types/api/BaseEntity.d.ts +29 -0
- package/types/api/EndpointApi.d.ts +21 -1
- package/types/api/EndpointApi.types.d.ts +49 -0
- package/types/api/Organization.d.ts +77 -0
- package/types/endpoints.module.d.ts +429 -0
|
@@ -186,6 +186,11 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
186
186
|
static entityTag: string;
|
|
187
187
|
static entityType?: string;
|
|
188
188
|
static SCHEMA_CONSTANTS?: string | string[];
|
|
189
|
+
static VIRTUAL_SCHEMAS?: Record<string, any>;
|
|
190
|
+
static CUSTOM_FIELD_HANDLERS?: Map<string, {
|
|
191
|
+
updateMethod: string;
|
|
192
|
+
schemaConstant?: string;
|
|
193
|
+
}>;
|
|
189
194
|
/**
|
|
190
195
|
* Vérifie que l'objet n'a pas été supprimé.
|
|
191
196
|
* @throws {ApiError} - Si l'objet a été supprimé.
|
|
@@ -593,6 +598,30 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
593
598
|
* @private
|
|
594
599
|
*/
|
|
595
600
|
private _compareValues;
|
|
601
|
+
/**
|
|
602
|
+
* Merge deux schémas JSON en combinant leurs propriétés.
|
|
603
|
+
* @param base - Schéma de base (peut être null/undefined)
|
|
604
|
+
* @param virtual - Schéma virtuel à fusionner
|
|
605
|
+
* @returns Schéma combiné
|
|
606
|
+
* @private
|
|
607
|
+
*/
|
|
608
|
+
private _mergeSchemas;
|
|
609
|
+
/**
|
|
610
|
+
* Vérifie si un champ a changé par rapport à l'état initial.
|
|
611
|
+
* @param fieldName - Nom du champ
|
|
612
|
+
* @returns true si le champ a changé
|
|
613
|
+
* @protected
|
|
614
|
+
*/
|
|
615
|
+
protected _hasFieldChanged(fieldName: string): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Invoque un handler personnalisé pour un champ spécifique.
|
|
618
|
+
* @param methodName - Nom de la méthode à appeler
|
|
619
|
+
* @param value - Valeur du champ
|
|
620
|
+
* @param fieldName - Nom du champ (pour les messages d'erreur)
|
|
621
|
+
* @returns Résultat de l'appel de la méthode
|
|
622
|
+
* @protected
|
|
623
|
+
*/
|
|
624
|
+
protected _invokeCustomFieldHandler(methodName: string, value: any, fieldName: string): Promise<any>;
|
|
596
625
|
_extractChangedFieldsFromSchema(apiClient: ApiClient, constant: string, data: Record<string, any> | undefined, getInitialDraft: () => Record<string, any> | void, removeFields?: string[]): Record<string, any> | null;
|
|
597
626
|
/**
|
|
598
627
|
* Extrait tous les champs valides selon le schéma, et retourne uniquement ceux qui ont changé par rapport au draft initial.
|
|
@@ -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 } 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 } from "./EndpointApi.types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
5
5
|
*/
|
|
@@ -1029,5 +1029,25 @@ export declare class EndpointApi {
|
|
|
1029
1029
|
* @throws {Error} - En cas d'erreur inattendue.
|
|
1030
1030
|
*/
|
|
1031
1031
|
addReportAbuse(data: AddReportAbuseData): Promise<any>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Mettre à jour une valeur de chemin pour une entité : Met à jour une valeur spécifique dans le chemin donné pour une entité.
|
|
1034
|
+
* Constant : UPDATE_PATH_VALUE
|
|
1035
|
+
* @param data - Données envoyées à l'API
|
|
1036
|
+
* @returns Les données de réponse.
|
|
1037
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1038
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1039
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1040
|
+
*/
|
|
1041
|
+
updatePathValue(data: UpdatePathValueData): Promise<any>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Supprimer une image/document par contexte d’entité : Supprimer des documents associés à une entité dans un contexte spécifique
|
|
1044
|
+
* Constant : DELETE_DOCUMENT_BY_CONTEXT
|
|
1045
|
+
* @param data - Données envoyées à l'API
|
|
1046
|
+
* @returns Les données de réponse.
|
|
1047
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1048
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1049
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1050
|
+
*/
|
|
1051
|
+
deleteDocumentByContext(data: DeleteDocumentByContextData): Promise<any>;
|
|
1032
1052
|
}
|
|
1033
1053
|
export default EndpointApi;
|
|
@@ -4458,3 +4458,52 @@ export interface AddReportAbuseData {
|
|
|
4458
4458
|
};
|
|
4459
4459
|
[k: string]: unknown;
|
|
4460
4460
|
}
|
|
4461
|
+
export interface UpdatePathValueData {
|
|
4462
|
+
/**
|
|
4463
|
+
* ID de l’utilisateur
|
|
4464
|
+
*/
|
|
4465
|
+
id: string;
|
|
4466
|
+
/**
|
|
4467
|
+
* Collection de l’entité
|
|
4468
|
+
*/
|
|
4469
|
+
collection: "citoyens" | "organizations" | "projects" | "events" | "poi";
|
|
4470
|
+
/**
|
|
4471
|
+
* Chemin de la valeur à mettre à jour
|
|
4472
|
+
*/
|
|
4473
|
+
path: string;
|
|
4474
|
+
arrayForm?: boolean;
|
|
4475
|
+
/**
|
|
4476
|
+
* Valeur à mettre à jour (peut être un objet, un tableau, une chaîne, etc.)
|
|
4477
|
+
*/
|
|
4478
|
+
value: {
|
|
4479
|
+
[k: string]: unknown;
|
|
4480
|
+
};
|
|
4481
|
+
[k: string]: unknown;
|
|
4482
|
+
}
|
|
4483
|
+
export interface DeleteDocumentByContextData {
|
|
4484
|
+
/**
|
|
4485
|
+
* ID de l’utilisateur
|
|
4486
|
+
*/
|
|
4487
|
+
parentId?: string;
|
|
4488
|
+
/**
|
|
4489
|
+
* Type de contexte de l’entité
|
|
4490
|
+
*/
|
|
4491
|
+
parentType?: "citoyens" | "organizations" | "projects" | "events" | "poi";
|
|
4492
|
+
path: "communecter";
|
|
4493
|
+
/**
|
|
4494
|
+
* ID image/document à supprimer
|
|
4495
|
+
*/
|
|
4496
|
+
ids?: string;
|
|
4497
|
+
pathParams?: {
|
|
4498
|
+
/**
|
|
4499
|
+
* ID du contexte de l’entité
|
|
4500
|
+
*/
|
|
4501
|
+
contextId: string;
|
|
4502
|
+
/**
|
|
4503
|
+
* Type de contexte de l’entité
|
|
4504
|
+
*/
|
|
4505
|
+
contextType: "citoyens" | "organizations" | "projects" | "events" | "poi";
|
|
4506
|
+
[k: string]: unknown;
|
|
4507
|
+
};
|
|
4508
|
+
[k: string]: unknown;
|
|
4509
|
+
}
|
|
@@ -1,12 +1,72 @@
|
|
|
1
1
|
import { BaseEntity } from "./BaseEntity.js";
|
|
2
2
|
import type { PaginatorPage } from "./BaseEntity.js";
|
|
3
3
|
import type { AddOrganizationData, GetMembersAdminData, GetMembersNoAdminData } from "./EndpointApi.types.js";
|
|
4
|
+
import type { OpeningHoursEntry } from "./serverDataType/common.js";
|
|
4
5
|
import type { OrganizationItemNormalized } from "./serverDataType/Organization.js";
|
|
5
6
|
import type { User } from "./User.js";
|
|
6
7
|
export declare class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
7
8
|
static entityType: string;
|
|
8
9
|
static entityTag: string;
|
|
9
10
|
static SCHEMA_CONSTANTS: string[];
|
|
11
|
+
static VIRTUAL_SCHEMAS: {
|
|
12
|
+
VIRTUAL_OPENING_HOURS: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
openingHours: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
minItems: number;
|
|
19
|
+
maxItems: number;
|
|
20
|
+
items: {
|
|
21
|
+
oneOf: ({
|
|
22
|
+
type: string;
|
|
23
|
+
const: string;
|
|
24
|
+
properties?: undefined;
|
|
25
|
+
required?: undefined;
|
|
26
|
+
additionalProperties?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
type: string;
|
|
29
|
+
properties: {
|
|
30
|
+
dayOfWeek: {
|
|
31
|
+
type: string;
|
|
32
|
+
enum: string[];
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
hours: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
items: {
|
|
39
|
+
type: string;
|
|
40
|
+
properties: {
|
|
41
|
+
opens: {
|
|
42
|
+
type: string;
|
|
43
|
+
pattern: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
closes: {
|
|
47
|
+
type: string;
|
|
48
|
+
pattern: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
required: string[];
|
|
53
|
+
additionalProperties: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
required: string[];
|
|
58
|
+
additionalProperties: boolean;
|
|
59
|
+
const?: undefined;
|
|
60
|
+
})[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
static CUSTOM_FIELD_HANDLERS: Map<"openingHours", {
|
|
67
|
+
readonly updateMethod: "updateOpeningHours";
|
|
68
|
+
readonly schemaConstant: "VIRTUAL_OPENING_HOURS";
|
|
69
|
+
}>;
|
|
10
70
|
static ADD_BLOCKS: Map<"PROFIL_IMAGE" | "ADD_ORGANIZATION", "updateImageProfil" | "addOrganization">;
|
|
11
71
|
static UPDATE_BLOCKS: Map<"UPDATE_BLOCK_DESCRIPTION" | "UPDATE_BLOCK_INFO" | "UPDATE_BLOCK_SOCIAL" | "UPDATE_BLOCK_LOCALITY" | "UPDATE_BLOCK_SLUG" | "PROFIL_IMAGE", "updateImageProfil" | "updateDescription" | "updateSocial" | "updateLocality" | "updateInfo" | "updateSlug">;
|
|
12
72
|
defaultFields: Record<string, any>;
|
|
@@ -135,6 +195,23 @@ export declare class Organization extends BaseEntity<OrganizationItemNormalized>
|
|
|
135
195
|
* Crée une instance de news et la récupère si nécessaire.
|
|
136
196
|
*/
|
|
137
197
|
news(newsData?: Parameters<BaseEntity<OrganizationItemNormalized>["news"]>[0]): Promise<import("./News.js").News>;
|
|
198
|
+
/**
|
|
199
|
+
* Met à jour les horaires d'ouverture de l'organisation.
|
|
200
|
+
* Utilise UPDATE_PATH_VALUE pour modifier le champ openingHours.
|
|
201
|
+
*
|
|
202
|
+
* @param hours - Tableau de 7 entrées (une par jour de la semaine)
|
|
203
|
+
* @returns Résultat de l'appel API
|
|
204
|
+
* @throws {ApiError} Si l'organisation n'a pas d'ID
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const openingHours = [
|
|
208
|
+
* { dayOfWeek: "Mo", hours: [{ opens: "09:00", closes: "18:00" }] },
|
|
209
|
+
* { dayOfWeek: "Tu", hours: [{ opens: "09:00", closes: "18:00" }] },
|
|
210
|
+
* // ... pour les 7 jours
|
|
211
|
+
* ];
|
|
212
|
+
* await org.updateOpeningHours(openingHours);
|
|
213
|
+
*/
|
|
214
|
+
updateOpeningHours(hours: OpeningHoursEntry[]): Promise<unknown>;
|
|
138
215
|
/**
|
|
139
216
|
* ───────────────────────────────
|
|
140
217
|
* Lien utilisateur ↔ organisation
|