@communecter/cocolight-api-client 1.0.83 → 1.0.85
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/Badge.ts +1 -1
- package/src/api/BaseEntity.ts +29 -1
- package/src/api/EndpointApi.types.ts +14 -6
- package/src/api/Event.ts +2 -2
- package/src/api/Organization.ts +8 -4
- package/src/api/Poi.ts +1 -1
- package/src/api/Project.ts +8 -4
- package/src/api/User.ts +9 -0
- package/src/endpoints.module.ts +1 -1
- package/types/api/BaseEntity.d.ts +8 -1
- package/types/api/EndpointApi.types.d.ts +14 -6
- package/types/api/Organization.d.ts +6 -0
- package/types/api/Project.d.ts +6 -1
- package/types/api/User.d.ts +6 -0
- package/types/endpoints.module.d.ts +204 -5
package/package.json
CHANGED
package/src/api/Badge.ts
CHANGED
package/src/api/BaseEntity.ts
CHANGED
|
@@ -43,7 +43,8 @@ import type {
|
|
|
43
43
|
GetBadgesData,
|
|
44
44
|
CoformAnswersSearchData,
|
|
45
45
|
ProfilBannerData,
|
|
46
|
-
SearchMemberAutocompleteData
|
|
46
|
+
SearchMemberAutocompleteData,
|
|
47
|
+
GetEventsData
|
|
47
48
|
} from "./EndpointApi.types.js";
|
|
48
49
|
import type { GetElementsKeyResponse } from "../types/api-responses.js";
|
|
49
50
|
import type { TransformsMap } from "../types/entities.js";
|
|
@@ -3046,6 +3047,33 @@ export class BaseEntity<TServerData = any> {
|
|
|
3046
3047
|
return paginator.next() as Promise<PaginatorPage<Project>>;
|
|
3047
3048
|
}
|
|
3048
3049
|
|
|
3050
|
+
/**
|
|
3051
|
+
* Récupérer les événements d'une entitée : liste des événements de l'entité ou elle est "organizer" ou "attendee".
|
|
3052
|
+
* Constant : GET_EVENTS
|
|
3053
|
+
* @param data - Paramètres (partiels) de recherche/pagination.
|
|
3054
|
+
* @returns - Les données de réponse.
|
|
3055
|
+
*/
|
|
3056
|
+
async getEvents(data: Partial<GetEventsData> = {}): Promise<PaginatorPage<EventEntity>> {
|
|
3057
|
+
data.searchType = this._getDefaultFromEndpoint("GET_EVENTS", "searchType") as GetEventsData["searchType"];
|
|
3058
|
+
const paginator = this._createPaginatorEngine({
|
|
3059
|
+
initialData: data,
|
|
3060
|
+
finalizer: async (finalData) => {
|
|
3061
|
+
delete finalData?.pathParams;
|
|
3062
|
+
finalData.filters = {
|
|
3063
|
+
"$or": {
|
|
3064
|
+
[`links.attendees.${this.id}`]: { "$exists": true },
|
|
3065
|
+
[`organizer.${this.id}`]: { "$exists": true }
|
|
3066
|
+
},
|
|
3067
|
+
[`links.attendees.${this.id}`]: { "$exists": true }
|
|
3068
|
+
};
|
|
3069
|
+
|
|
3070
|
+
return this.endpointApi.getEvents(finalData);
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3073
|
+
|
|
3074
|
+
return paginator.next() as Promise<PaginatorPage<EventEntity>>;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3049
3077
|
/**
|
|
3050
3078
|
* Récupérer les POIs d'une entité : liste des POIs de l'entité ou elle est "parent".
|
|
3051
3079
|
* Constant : GET_POIS_NO_ADMIN / GET_POIS_ADMIN
|
|
@@ -3732,17 +3732,13 @@ export interface AssignBadgesData {
|
|
|
3732
3732
|
|
|
3733
3733
|
|
|
3734
3734
|
export interface GetEventsData {
|
|
3735
|
-
searchType:
|
|
3735
|
+
searchType: "events"[];
|
|
3736
3736
|
indexMin: number;
|
|
3737
3737
|
indexStep: number;
|
|
3738
|
-
/**
|
|
3739
|
-
* Timestamp de début
|
|
3740
|
-
*/
|
|
3741
|
-
startDate: number;
|
|
3742
3738
|
/**
|
|
3743
3739
|
* Date de début (UTC)
|
|
3744
3740
|
*/
|
|
3745
|
-
startDateUTC
|
|
3741
|
+
startDateUTC?: string;
|
|
3746
3742
|
/**
|
|
3747
3743
|
* Date de fin (UTC)
|
|
3748
3744
|
*/
|
|
@@ -3790,6 +3786,18 @@ export interface GetEventsData {
|
|
|
3790
3786
|
count?: boolean;
|
|
3791
3787
|
countType?: unknown[];
|
|
3792
3788
|
fediverse: boolean;
|
|
3789
|
+
/**
|
|
3790
|
+
* Filtrer les événements récurrents (true/false)
|
|
3791
|
+
*/
|
|
3792
|
+
recurrency?: boolean;
|
|
3793
|
+
filters?: {
|
|
3794
|
+
$or?: Record<string, unknown>;
|
|
3795
|
+
/**
|
|
3796
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
3797
|
+
* via the `patternProperty` "^links\.attendees\.(?:[a-f0-9]{24}|@\w+)$".
|
|
3798
|
+
*/
|
|
3799
|
+
[k: string]: unknown;
|
|
3800
|
+
};
|
|
3793
3801
|
[k: string]: unknown;
|
|
3794
3802
|
}
|
|
3795
3803
|
|
package/src/api/Event.ts
CHANGED
|
@@ -140,7 +140,7 @@ export class Event extends BaseEntity<EventItemNormalized> {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
async getEvents(): Promise<never> {
|
|
143
|
+
override async getEvents(): Promise<never> {
|
|
144
144
|
throw new ApiError(`getEvents - les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`, 501);
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -222,7 +222,7 @@ export class Event extends BaseEntity<EventItemNormalized> {
|
|
|
222
222
|
const { toBeValidated, isAdmin, isInviting, isAdminPending, roles = [] } = options;
|
|
223
223
|
|
|
224
224
|
if(this.isMe){
|
|
225
|
-
finalData.pathParams = {
|
|
225
|
+
finalData.pathParams = { id: this.id };
|
|
226
226
|
// NOTE : dans le schema je crois que si pas de finalData.filters alors le default ce fait avec finalData.pathParams
|
|
227
227
|
// finalData.filters = {
|
|
228
228
|
// [`links.events.${this.id}`]: { "$exists": true },
|
package/src/api/Organization.ts
CHANGED
|
@@ -225,10 +225,14 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
|
225
225
|
return super.getProjects(data);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
/**
|
|
229
|
+
* {@inheritDoc BaseEntity#getEvents}
|
|
230
|
+
*
|
|
231
|
+
* Récupère les événements de l'organisation.
|
|
232
|
+
*/
|
|
233
|
+
override async getEvents(data: Parameters<BaseEntity<OrganizationItemNormalized>["getEvents"]>[0] = {}) {
|
|
234
|
+
return super.getEvents(data);
|
|
235
|
+
}
|
|
232
236
|
|
|
233
237
|
/**
|
|
234
238
|
* {@inheritDoc BaseEntity#getPois}
|
package/src/api/Poi.ts
CHANGED
|
@@ -116,7 +116,7 @@ export class Poi extends BaseEntity<any> {
|
|
|
116
116
|
throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`, 501);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
async getEvents(): Promise<never> {
|
|
119
|
+
override async getEvents(): Promise<never> {
|
|
120
120
|
throw new ApiError(`getEvents n'existe pas dans ${this.constructor.name}`, 501);
|
|
121
121
|
}
|
|
122
122
|
|
package/src/api/Project.ts
CHANGED
|
@@ -152,9 +152,13 @@ export class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
/**
|
|
156
|
+
* {@inheritDoc BaseEntity#getEvents}
|
|
157
|
+
*
|
|
158
|
+
* Récupère les événements d'un projet.
|
|
159
|
+
*/
|
|
160
|
+
override async getEvents(data: Parameters<BaseEntity<ProjectItemNormalized>["getEvents"]>[0] = {}) {
|
|
161
|
+
return super.getEvents(data);
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
/**
|
|
@@ -243,7 +247,7 @@ export class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
243
247
|
const { toBeValidated, isAdmin, isInviting, isAdminPending, roles = [] } = options;
|
|
244
248
|
|
|
245
249
|
if(this.isMe){
|
|
246
|
-
finalData.pathParams = {
|
|
250
|
+
finalData.pathParams = { id: this.id };
|
|
247
251
|
// NOTE : dans le schema je crois que si pas de finalData.filters alors le default ce fait avec finalData.pathParams
|
|
248
252
|
// finalData.filters = {
|
|
249
253
|
// [`links.projects.${this.id}`]: { "$exists": true },
|
package/src/api/User.ts
CHANGED
|
@@ -412,6 +412,15 @@ export class User extends BaseEntity<UserItemNormalized> {
|
|
|
412
412
|
return super.getProjects(data);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
/**
|
|
416
|
+
* {@inheritDoc BaseEntity#getEvents}
|
|
417
|
+
*
|
|
418
|
+
* Récupère les événements d'un utilisateur.
|
|
419
|
+
*/
|
|
420
|
+
override async getEvents(data: Parameters<BaseEntity<UserItemNormalized>["getEvents"]>[0] = {}) {
|
|
421
|
+
return super.getEvents(data);
|
|
422
|
+
}
|
|
423
|
+
|
|
415
424
|
/**
|
|
416
425
|
* {@inheritDoc BaseEntity#getPois}
|
|
417
426
|
*
|