@communecter/cocolight-api-client 1.0.84 → 1.0.86
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.ts +1 -1
- package/src/api/EndpointApi.types.ts +15 -7
- package/src/api/Event.ts +1 -1
- package/src/api/Organization.ts +8 -4
- package/src/api/Poi.ts +1 -1
- package/src/api/Project.ts +7 -3
- package/src/api/User.ts +9 -0
- package/src/endpoints.module.ts +122 -156
- package/types/api/BaseEntity.d.ts +8 -1
- package/types/api/EndpointApi.d.ts +1 -1
- package/types/api/EndpointApi.types.d.ts +15 -7
- 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 +248 -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
|
package/src/api/EndpointApi.ts
CHANGED
|
@@ -580,7 +580,7 @@ export class EndpointApi {
|
|
|
580
580
|
}
|
|
581
581
|
|
|
582
582
|
/**
|
|
583
|
-
* Afficher les votes d'une
|
|
583
|
+
* Afficher les votes d'une actualité/commentaire : Récupère la liste des votes (like, love, etc.) sur une actualité/commentaire.
|
|
584
584
|
* Constant : SHOW_VOTE
|
|
585
585
|
* @param data - Données envoyées à l'API
|
|
586
586
|
* @returns Les données de réponse.
|
|
@@ -944,7 +944,7 @@ export interface ShowVoteData {
|
|
|
944
944
|
/**
|
|
945
945
|
* Type de l'élément
|
|
946
946
|
*/
|
|
947
|
-
type: "news";
|
|
947
|
+
type: "news" | "comments";
|
|
948
948
|
/**
|
|
949
949
|
* ID de l'élément dont on veut récupérer les votes
|
|
950
950
|
*/
|
|
@@ -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
|
|
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
|
/**
|
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
|
*
|