@communecter/cocolight-api-client 1.0.123 → 1.0.125
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 +2 -2
- 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.ts +20 -4
- package/src/ApiClient.ts +28 -0
- package/src/api/BaseEntity.ts +484 -149
- package/src/api/Classified.ts +171 -0
- package/src/api/EndpointApi.ts +291 -118
- package/src/api/EndpointApi.types.ts +527 -19
- package/src/api/EntityRegistry.ts +11 -3
- package/src/api/Event.ts +6 -1
- package/src/api/Organization.ts +15 -2
- package/src/api/Poi.ts +14 -4
- package/src/api/Project.ts +7 -2
- package/src/api/User.ts +1 -0
- package/src/api/UserApi.ts +3 -2
- package/src/api/serverDataType/Classified.ts +152 -0
- package/src/endpoints.module.ts +181 -51
- package/src/index.ts +3 -0
- package/src/types/entities.ts +3 -2
- package/types/Api.d.ts +2 -0
- package/types/ApiClient.d.ts +15 -0
- package/types/api/BaseEntity.d.ts +184 -12
- package/types/api/Classified.d.ts +30 -0
- package/types/api/EndpointApi.d.ts +108 -1
- package/types/api/EndpointApi.types.d.ts +476 -23
- package/types/api/EntityRegistry.d.ts +1 -1
- package/types/api/Organization.d.ts +1 -1
- package/types/api/Poi.d.ts +1 -0
- package/types/api/User.d.ts +1 -0
- package/types/api/serverDataType/Classified.d.ts +72 -0
- package/types/endpoints.module.d.ts +3502 -478
- package/types/index.d.ts +3 -0
- package/types/types/entities.d.ts +3 -2
package/src/index.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type { Organization } from "./api/Organization.js";
|
|
|
69
69
|
export type { Project } from "./api/Project.js";
|
|
70
70
|
export type { Event } from "./api/Event.js";
|
|
71
71
|
export type { Poi } from "./api/Poi.js";
|
|
72
|
+
export type { Classified } from "./api/Classified.js";
|
|
72
73
|
export type { Badge } from "./api/Badge.js";
|
|
73
74
|
export type { News } from "./api/News.js";
|
|
74
75
|
export type { Comment } from "./api/Comment.js";
|
|
@@ -85,6 +86,8 @@ export { PROJECT_AVANCEMENTS } from "./api/serverDataType/Project.js";
|
|
|
85
86
|
export { EVENT_TYPES } from "./api/serverDataType/Event.js";
|
|
86
87
|
export { POI_TYPES } from "./api/serverDataType/Poi.js";
|
|
87
88
|
export type * from "./api/serverDataType/Project.js";
|
|
89
|
+
export { CLASSIFIED_SECTIONS, CLASSIFIED_CATEGORIES, CLASSIFIED_SUBCATEGORIES } from "./api/serverDataType/Classified.js";
|
|
90
|
+
export type * from "./api/serverDataType/Classified.js";
|
|
88
91
|
export type * from "./api/serverDataType/Event.js";
|
|
89
92
|
export type * from "./api/serverDataType/Poi.js";
|
|
90
93
|
export type * from "./api/serverDataType/News.js";
|
package/src/types/entities.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { Answer } from "../api/Answer.js";
|
|
4
4
|
import type { Badge } from "../api/Badge.js";
|
|
5
|
+
import type { Classified } from "../api/Classified.js";
|
|
5
6
|
import type { Comment } from "../api/Comment.js";
|
|
6
7
|
import type { Event } from "../api/Event.js";
|
|
7
8
|
import type { Form } from "../api/Form.js";
|
|
@@ -14,7 +15,7 @@ import type { User } from "../api/User.js";
|
|
|
14
15
|
/**
|
|
15
16
|
* Union type for all possible entity types
|
|
16
17
|
*/
|
|
17
|
-
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form;
|
|
18
|
+
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form | Classified;
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Type union représentant les entités pouvant être retournées par une recherche.
|
|
@@ -34,7 +35,7 @@ export type EntityData =
|
|
|
34
35
|
/**
|
|
35
36
|
* Types de collection possibles
|
|
36
37
|
*/
|
|
37
|
-
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms";
|
|
38
|
+
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms" | "classifieds";
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Types pour les références entre entités
|
package/types/Api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Answer } from "./api/Answer.js";
|
|
2
|
+
import { Classified } from "./api/Classified.js";
|
|
2
3
|
import EndpointApi from "./api/EndpointApi.js";
|
|
3
4
|
import { Event } from "./api/Event.js";
|
|
4
5
|
import { Form } from "./api/Form.js";
|
|
@@ -65,6 +66,7 @@ export default class Api {
|
|
|
65
66
|
form(formData: {
|
|
66
67
|
id: string;
|
|
67
68
|
}): Promise<Form>;
|
|
69
|
+
classified(classifiedData: EntityData): Promise<Classified>;
|
|
68
70
|
/**
|
|
69
71
|
* Retourne une entité à partir d'un slug.
|
|
70
72
|
*/
|
package/types/ApiClient.d.ts
CHANGED
|
@@ -327,6 +327,15 @@ export default class ApiClient extends EventEmitter {
|
|
|
327
327
|
*/
|
|
328
328
|
private _normalizeImage;
|
|
329
329
|
/**
|
|
330
|
+
* Normalise les valeurs numériques renvoyées en string par le backend
|
|
331
|
+
* (cas typique : content-type application/x-www-form-urlencoded qui
|
|
332
|
+
* sérialise tout en string, et le backend stocke tel quel).
|
|
333
|
+
*
|
|
334
|
+
* @param value - La valeur à normaliser.
|
|
335
|
+
* @returns Number si conversion possible, sinon la valeur d'origine.
|
|
336
|
+
*/
|
|
337
|
+
private _normalizeNumber;
|
|
338
|
+
/**
|
|
330
339
|
* Liste des champs d'image à normaliser.
|
|
331
340
|
*/
|
|
332
341
|
private _imageFields;
|
|
@@ -335,6 +344,12 @@ export default class ApiClient extends EventEmitter {
|
|
|
335
344
|
*/
|
|
336
345
|
private _dateFields;
|
|
337
346
|
/**
|
|
347
|
+
* Liste des champs numériques à normaliser (le backend les renvoie en string
|
|
348
|
+
* via x-www-form-urlencoded ; sans cette coercion, JSON.stringify diff
|
|
349
|
+
* produit des faux positifs dans `hasChanges()`).
|
|
350
|
+
*/
|
|
351
|
+
private _numberFields;
|
|
352
|
+
/**
|
|
338
353
|
* Normalise récursivement un objet, un tableau ou une valeur simple.
|
|
339
354
|
* Cette fonction réalise en une seule passe les opérations suivantes :
|
|
340
355
|
* - Conversion des chaînes "true"/"false" en booléens.
|
|
@@ -1,4 +1,4 @@
|
|
|
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, CoformAnswersByFormsData, FundingEnvelopeData } 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, CoformAnswersByFormsData, FundingEnvelopeData, CoremuOperationData } from "./EndpointApi.types.js";
|
|
2
2
|
import type { TransformsMap } from "../types/entities.js";
|
|
3
3
|
import type { CountryItem } from "./serverDataType/Country.js";
|
|
4
4
|
import type { ZoneItemNormalized } from "./serverDataType/Zone.js";
|
|
@@ -26,6 +26,9 @@ type EventInput = {
|
|
|
26
26
|
} | {
|
|
27
27
|
slug: string;
|
|
28
28
|
} | Record<string, any>;
|
|
29
|
+
type ClassifiedInput = {
|
|
30
|
+
id: string;
|
|
31
|
+
} | Record<string, any>;
|
|
29
32
|
type BadgeInput = {
|
|
30
33
|
id: string;
|
|
31
34
|
} | Record<string, any>;
|
|
@@ -44,7 +47,8 @@ type Badge = import("./Badge.js").Badge;
|
|
|
44
47
|
type Comment = import("./Comment.js").Comment;
|
|
45
48
|
type Answer = import("./Answer.js").Answer;
|
|
46
49
|
type Form = import("./Form.js").Form;
|
|
47
|
-
type
|
|
50
|
+
type Classified = import("./Classified.js").Classified;
|
|
51
|
+
type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer | Form | Classified;
|
|
48
52
|
type ParentLike = BaseEntity<any> & {
|
|
49
53
|
apiClient: ApiClient;
|
|
50
54
|
userContext?: User | null;
|
|
@@ -65,6 +69,7 @@ interface Deps {
|
|
|
65
69
|
Comment?: any;
|
|
66
70
|
Answer?: any;
|
|
67
71
|
Form?: any;
|
|
72
|
+
Classified?: any;
|
|
68
73
|
}
|
|
69
74
|
interface BaseEntityConfig {
|
|
70
75
|
entityTag?: string;
|
|
@@ -80,6 +85,7 @@ interface EntityTypeMap {
|
|
|
80
85
|
comments: Comment;
|
|
81
86
|
answers: Answer;
|
|
82
87
|
forms: Form;
|
|
88
|
+
classifieds: Classified;
|
|
83
89
|
}
|
|
84
90
|
type ReadableWithMeta = import("stream").Readable & {
|
|
85
91
|
path?: string;
|
|
@@ -87,6 +93,10 @@ type ReadableWithMeta = import("stream").Readable & {
|
|
|
87
93
|
};
|
|
88
94
|
type UploadInput = File | Blob | Buffer | import("stream").Readable;
|
|
89
95
|
type ValidatedUpload = File | Buffer | ReadableWithMeta;
|
|
96
|
+
export type FundingEnvelopeProjectItem = {
|
|
97
|
+
project?: AnyEntity | object;
|
|
98
|
+
[k: string]: unknown;
|
|
99
|
+
};
|
|
90
100
|
export type FundingEnvelopeResult = {
|
|
91
101
|
contextData?: AnyEntity | object;
|
|
92
102
|
context?: AnyEntity | object;
|
|
@@ -94,10 +104,17 @@ export type FundingEnvelopeResult = {
|
|
|
94
104
|
form?: object;
|
|
95
105
|
paymentMethods?: object;
|
|
96
106
|
nopropProject?: AnyEntity[] | object;
|
|
97
|
-
projects?:
|
|
107
|
+
projects?: FundingEnvelopeProjectItem[];
|
|
98
108
|
userOrga?: AnyEntity[] | object;
|
|
99
109
|
[k: string]: unknown;
|
|
100
110
|
};
|
|
111
|
+
export type CostumContextFields = {
|
|
112
|
+
costumSlug: string;
|
|
113
|
+
contextId: string;
|
|
114
|
+
contextType: EntityType;
|
|
115
|
+
sourceKey: string[];
|
|
116
|
+
};
|
|
117
|
+
export type WithCostumContext<T> = T & CostumContextFields;
|
|
101
118
|
type PaginationCursor = {
|
|
102
119
|
searchType?: string[];
|
|
103
120
|
searchBy?: string;
|
|
@@ -157,7 +174,7 @@ interface LinkMeta {
|
|
|
157
174
|
}
|
|
158
175
|
type BaseEntityCtor = typeof BaseEntity & {
|
|
159
176
|
entityTag: string;
|
|
160
|
-
entityType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers";
|
|
177
|
+
entityType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds";
|
|
161
178
|
SCHEMA_CONSTANTS: string | string[];
|
|
162
179
|
};
|
|
163
180
|
interface FilterValueExistsOnly {
|
|
@@ -198,7 +215,7 @@ interface FinalizerResult<TOut> {
|
|
|
198
215
|
total: number;
|
|
199
216
|
} & Record<string, any>;
|
|
200
217
|
}
|
|
201
|
-
type EntityType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers";
|
|
218
|
+
export type EntityType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds";
|
|
202
219
|
/**
|
|
203
220
|
* Classe de base pour toutes les entités métiers : utilisateurs, projets, organisations, etc.
|
|
204
221
|
* Fournit un système de brouillon (draft), transformation, appel API sécurisé,
|
|
@@ -283,7 +300,7 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
283
300
|
/** @returns Indique si cette entité représente l'utilisateur connecté */
|
|
284
301
|
get isMe(): boolean;
|
|
285
302
|
/** @returns Type de l'entité (ex: 'citoyens') */
|
|
286
|
-
getEntityType(): "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers";
|
|
303
|
+
getEntityType(): "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds";
|
|
287
304
|
/**
|
|
288
305
|
* Indique si le draft contient des modifications par rapport aux données initiales.
|
|
289
306
|
* @returns {boolean}
|
|
@@ -1067,6 +1084,16 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1067
1084
|
* @throws {Error} Si une erreur se produit lors de la création du POI.
|
|
1068
1085
|
*/
|
|
1069
1086
|
poi(poiData?: PoiInput): Promise<Poi>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Crée une instance de ressource classifiée (besoin ou offre).
|
|
1089
|
+
*
|
|
1090
|
+
* @param classifiedData - Les données pour initialiser la ressource.
|
|
1091
|
+
* - Si { id } : récupère la ressource existante (GET)
|
|
1092
|
+
* - Sinon : crée une nouvelle instance (CREATE)
|
|
1093
|
+
* @returns Une promesse qui résout l'objet Classified créé.
|
|
1094
|
+
* @throws {Error} Si une erreur se produit lors de la création.
|
|
1095
|
+
*/
|
|
1096
|
+
classified(classifiedData?: ClassifiedInput): Promise<Classified>;
|
|
1070
1097
|
/**
|
|
1071
1098
|
* Crée une instance d'événement et la récupère si nécessaire.
|
|
1072
1099
|
*
|
|
@@ -1504,12 +1531,7 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1504
1531
|
/**
|
|
1505
1532
|
* Injection de contexte Communecter dans une requête finalizer.
|
|
1506
1533
|
*/
|
|
1507
|
-
_withCostumContext<TIn extends Record<string, unknown>, TOut>(baseFinalizer: (data: TIn &
|
|
1508
|
-
costumSlug: string;
|
|
1509
|
-
contextId: string;
|
|
1510
|
-
contextType: EntityType;
|
|
1511
|
-
sourceKey: string[];
|
|
1512
|
-
}) => Promise<TOut>): (data: TIn) => Promise<TOut>;
|
|
1534
|
+
_withCostumContext<TIn extends Record<string, unknown>, TOut>(baseFinalizer: (data: TIn & CostumContextFields) => Promise<TOut>): (data: TIn) => Promise<TOut>;
|
|
1513
1535
|
/**
|
|
1514
1536
|
* ───────────────────────────────
|
|
1515
1537
|
* custom
|
|
@@ -1761,6 +1783,156 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1761
1783
|
*
|
|
1762
1784
|
*/
|
|
1763
1785
|
generateNewAnswerId(formId: string): Promise<any>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Associe un compte Discourse à l'utilisateur courant dans le contexte de l'instance.
|
|
1788
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1789
|
+
*
|
|
1790
|
+
* @param username - Nom d'utilisateur Discourse à associer
|
|
1791
|
+
* @returns Résultat de la liaison avec les informations du compte Discourse trouvé
|
|
1792
|
+
* @throws {ApiError} Si `username` est absent ou invalide
|
|
1793
|
+
*
|
|
1794
|
+
* @example
|
|
1795
|
+
* const result = await user.linkDiscourseAccount("john_doe");
|
|
1796
|
+
* if (result.result) {
|
|
1797
|
+
* console.log(result.profileUrl); // URL du profil Discourse
|
|
1798
|
+
* } else {
|
|
1799
|
+
* console.error(result.error);
|
|
1800
|
+
* }
|
|
1801
|
+
*/
|
|
1802
|
+
linkDiscourseAccount(username: string): Promise<{
|
|
1803
|
+
result: boolean;
|
|
1804
|
+
error?: string;
|
|
1805
|
+
username?: string;
|
|
1806
|
+
profileUrl?: string;
|
|
1807
|
+
}>;
|
|
1808
|
+
/**
|
|
1809
|
+
* Dissocie le compte Discourse de l'utilisateur courant dans le contexte de l'instance.
|
|
1810
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1811
|
+
*
|
|
1812
|
+
* @returns Résultat du délien du compte Discourse
|
|
1813
|
+
*
|
|
1814
|
+
* @example
|
|
1815
|
+
* const result = await user.unlinkDiscourseAccount();
|
|
1816
|
+
* result.result; // true si succès
|
|
1817
|
+
*/
|
|
1818
|
+
unlinkDiscourseAccount(): Promise<{
|
|
1819
|
+
result: boolean;
|
|
1820
|
+
error?: string;
|
|
1821
|
+
}>;
|
|
1822
|
+
/**
|
|
1823
|
+
* Récupère le profil Discourse d'un utilisateur dans le contexte de l'instance.
|
|
1824
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1825
|
+
*
|
|
1826
|
+
* @param username - Nom d'utilisateur Discourse cible
|
|
1827
|
+
* @returns Profil Discourse avec `summary` et `profileUrl`, ou `error` en cas d'échec
|
|
1828
|
+
* @throws {ApiError} Si `username` est absent ou invalide
|
|
1829
|
+
*
|
|
1830
|
+
* @example
|
|
1831
|
+
* const result = await user.getDiscourseProfile("john_doe");
|
|
1832
|
+
* result.profileUrl; // "https://forum.example.org/u/john_doe/summary"
|
|
1833
|
+
*/
|
|
1834
|
+
getDiscourseProfile(username: string): Promise<{
|
|
1835
|
+
summary?: Record<string, unknown>;
|
|
1836
|
+
profileUrl?: string;
|
|
1837
|
+
error?: string;
|
|
1838
|
+
}>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Vérifie si l'email de l'utilisateur connecté correspond à un compte Discourse.
|
|
1841
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1842
|
+
* L'email utilisé est celui de l'utilisateur connecté (géré côté serveur).
|
|
1843
|
+
*
|
|
1844
|
+
* @returns `{ found: true, user }` si un compte correspondant existe, `{ found: false }` sinon
|
|
1845
|
+
*
|
|
1846
|
+
* @example
|
|
1847
|
+
* const result = await user.checkDiscourseEmailMatch();
|
|
1848
|
+
* if (result.found) {
|
|
1849
|
+
* console.log(result.user); // infos du compte Discourse trouvé
|
|
1850
|
+
* }
|
|
1851
|
+
*/
|
|
1852
|
+
checkDiscourseEmailMatch(): Promise<{
|
|
1853
|
+
found: boolean;
|
|
1854
|
+
user?: Record<string, unknown>;
|
|
1855
|
+
}>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Ignore la suggestion de liaison de compte Discourse pour l'instance courante.
|
|
1858
|
+
* Persiste le refus côté serveur (`interop.discourse[costumSlug] = false`).
|
|
1859
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1860
|
+
*
|
|
1861
|
+
* @returns `{ result: true }` si le dismiss a réussi
|
|
1862
|
+
*
|
|
1863
|
+
* @example
|
|
1864
|
+
* const result = await user.dismissDiscourseLink();
|
|
1865
|
+
* result.result; // true
|
|
1866
|
+
*/
|
|
1867
|
+
dismissDiscourseLink(): Promise<{
|
|
1868
|
+
result: boolean;
|
|
1869
|
+
error?: string;
|
|
1870
|
+
}>;
|
|
1871
|
+
/**
|
|
1872
|
+
* Associe un compte MediaWiki à l'entité courante dans le contexte de l'instance.
|
|
1873
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1874
|
+
*
|
|
1875
|
+
* @param username - Nom d'utilisateur MediaWiki à associer
|
|
1876
|
+
* @returns Résultat de la liaison avec les informations du compte MediaWiki trouvé
|
|
1877
|
+
* @throws {ApiError} Si `username` est absent ou invalide
|
|
1878
|
+
*
|
|
1879
|
+
* @example
|
|
1880
|
+
* const result = await user.linkMediaWikiAccount("John_Doe");
|
|
1881
|
+
* if (result.result) {
|
|
1882
|
+
* console.log(result.username); // nom d'utilisateur confirmé
|
|
1883
|
+
* } else {
|
|
1884
|
+
* console.error(result.error);
|
|
1885
|
+
* }
|
|
1886
|
+
*/
|
|
1887
|
+
linkMediaWikiAccount(username: string): Promise<{
|
|
1888
|
+
result: boolean;
|
|
1889
|
+
error?: string;
|
|
1890
|
+
username?: string;
|
|
1891
|
+
msg?: string;
|
|
1892
|
+
}>;
|
|
1893
|
+
/**
|
|
1894
|
+
* Dissocie le compte MediaWiki de l'entité courante dans le contexte de l'instance.
|
|
1895
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1896
|
+
*
|
|
1897
|
+
* @returns Résultat du délien du compte MediaWiki
|
|
1898
|
+
*
|
|
1899
|
+
* @example
|
|
1900
|
+
* const result = await user.unlinkMediaWikiAccount();
|
|
1901
|
+
* result.result; // true si succès
|
|
1902
|
+
*/
|
|
1903
|
+
unlinkMediaWikiAccount(): Promise<{
|
|
1904
|
+
result: boolean;
|
|
1905
|
+
error?: string;
|
|
1906
|
+
msg?: string;
|
|
1907
|
+
}>;
|
|
1908
|
+
/**
|
|
1909
|
+
* Récupère les contributions MediaWiki d'un utilisateur dans le contexte de l'instance.
|
|
1910
|
+
* Injecte automatiquement le `costumSlug` via `_withCostumContext`.
|
|
1911
|
+
*
|
|
1912
|
+
* @param username - Nom d'utilisateur MediaWiki cible
|
|
1913
|
+
* @param limit - Nombre maximum de contributions à retourner (optionnel)
|
|
1914
|
+
* @returns Liste des contributions MediaWiki, ou `error` en cas d'échec
|
|
1915
|
+
* @throws {ApiError} Si `username` est absent ou invalide
|
|
1916
|
+
*
|
|
1917
|
+
* @example
|
|
1918
|
+
* const result = await user.getMediaWikiContributions("John_Doe", 10);
|
|
1919
|
+
* result.contribs; // objet contenant les contributions
|
|
1920
|
+
*/
|
|
1921
|
+
getMediaWikiContributions(username: string, limit?: number): Promise<{
|
|
1922
|
+
result: boolean;
|
|
1923
|
+
contribs?: Record<string, unknown>;
|
|
1924
|
+
}>;
|
|
1925
|
+
/**
|
|
1926
|
+
* Wrapper pour l'endpoint COREMU_OPERATION : génère une proposition à partir
|
|
1927
|
+
* d'un formulaire et d'un projet. Cette méthode injecte les `const` du schéma
|
|
1928
|
+
* (`answer: "new"`, `action: "generateproposition"`) et délègue à l'EndpointApi.
|
|
1929
|
+
*
|
|
1930
|
+
* @param data.form - ID Mongo (24 hex) du formulaire
|
|
1931
|
+
* @param data.project - ID Mongo (24 hex) du projet
|
|
1932
|
+
* @returns Résultat brut de l'API (ou entité liée si `collection` est présent)
|
|
1933
|
+
* @throws {ApiError} Si les paramètres sont manquants ou invalides
|
|
1934
|
+
*/
|
|
1935
|
+
coremuOperation(data: Pick<CoremuOperationData, "form" | "project">): Promise<any>;
|
|
1764
1936
|
/**
|
|
1765
1937
|
* ───────────────────────────────
|
|
1766
1938
|
* Pagination restoration methods
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseEntity } from "./BaseEntity.js";
|
|
2
|
+
import type { AddClassifiedData } from "./EndpointApi.types.js";
|
|
3
|
+
import type { ClassifiedItemNormalized } from "./serverDataType/Classified.js";
|
|
4
|
+
export declare class Classified extends BaseEntity<ClassifiedItemNormalized> {
|
|
5
|
+
static entityType: string;
|
|
6
|
+
static entityTag: string;
|
|
7
|
+
static SCHEMA_CONSTANTS: string[];
|
|
8
|
+
static ADD_BLOCKS: Map<"ADD_CLASSIFIED", "addClassified">;
|
|
9
|
+
defaultFields: Record<string, unknown>;
|
|
10
|
+
removeFields: string[];
|
|
11
|
+
transforms: Record<string, (val: any, full?: any) => any>;
|
|
12
|
+
_add: (payload: Record<string, unknown>) => Promise<void>;
|
|
13
|
+
_update: (payload: Record<string, unknown>) => Promise<boolean>;
|
|
14
|
+
addClassified(data?: Partial<AddClassifiedData>): Promise<unknown>;
|
|
15
|
+
getOrganizations(): Promise<never>;
|
|
16
|
+
getProjects(): Promise<never>;
|
|
17
|
+
getEvents(): Promise<never>;
|
|
18
|
+
getPois(): Promise<never>;
|
|
19
|
+
getBadgesIssuer(): Promise<never>;
|
|
20
|
+
getNews(): Promise<never>;
|
|
21
|
+
project(): Promise<never>;
|
|
22
|
+
poi(): Promise<never>;
|
|
23
|
+
event(): Promise<never>;
|
|
24
|
+
badge(): Promise<never>;
|
|
25
|
+
news(): Promise<never>;
|
|
26
|
+
classified(): Promise<never>;
|
|
27
|
+
follow(): Promise<never>;
|
|
28
|
+
unfollow(): Promise<never>;
|
|
29
|
+
getGallery(): Promise<never>;
|
|
30
|
+
}
|
|
@@ -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, GetCoformByIdData, CoformUploadAnswerFileData, CoformGetAnswerFilesData, SaveCoformAnswerData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, GenerateAnswerFromFormData, FundingEnvelopeData } 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, GetCoformByIdData, CoformUploadAnswerFileData, CoformGetAnswerFilesData, SaveCoformAnswerData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, GenerateAnswerFromFormData, FundingEnvelopeData, CoremuOperationData, CostumProjectActionRequestNewData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData } from "./EndpointApi.types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
5
5
|
*/
|
|
@@ -1162,5 +1162,112 @@ export declare class EndpointApi {
|
|
|
1162
1162
|
* @throws {Error} - En cas d'erreur inattendue.
|
|
1163
1163
|
*/
|
|
1164
1164
|
fundingEnvelope(data: FundingEnvelopeData): Promise<any>;
|
|
1165
|
+
/**
|
|
1166
|
+
* Créer une proposition COREMU : Génère une proposition à partir d'un formulaire et d'un projet.
|
|
1167
|
+
* Constant : COREMU_OPERATION
|
|
1168
|
+
* @param data - Données envoyées à l'API
|
|
1169
|
+
* @returns Les données de réponse.
|
|
1170
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1171
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1172
|
+
*/
|
|
1173
|
+
coremuOperation(data: CoremuOperationData): Promise<any>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Ajouter nouvel action : Crée une nouvelle action rattachée à un projet.
|
|
1176
|
+
* Constant : COSTUM_PROJECT_ACTION_REQUEST_NEW
|
|
1177
|
+
* @param data - Données envoyées à l'API
|
|
1178
|
+
* @returns Les données de réponse.
|
|
1179
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1180
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1181
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1182
|
+
*/
|
|
1183
|
+
costumProjectActionRequestNew(data: CostumProjectActionRequestNewData): Promise<any>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Interoperabilité Discourse Lié un compte : Lier un compte Discourse
|
|
1186
|
+
* Constant : LINK_DISCOURSE_ACCOUNT
|
|
1187
|
+
* @param data - Données envoyées à l'API
|
|
1188
|
+
* @returns Les données de réponse.
|
|
1189
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1190
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1191
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1192
|
+
*/
|
|
1193
|
+
linkDiscourseAccount(data: LinkDiscourseAccountData): Promise<any>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Interoperabilité Discourse Délier un compte : Délier un compte Discourse
|
|
1196
|
+
* Constant : UNLINK_DISCOURSE_ACCOUNT
|
|
1197
|
+
* @param data - Données envoyées à l'API
|
|
1198
|
+
* @returns Les données de réponse.
|
|
1199
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1200
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1201
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1202
|
+
*/
|
|
1203
|
+
unlinkDiscourseAccount(data: UnlinkDiscourseAccountData): Promise<any>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Interoperabilité Discourse Profil : Obtenir le profil d'un compte Discourse
|
|
1206
|
+
* Constant : DISCOURSE_PROFILE
|
|
1207
|
+
* @param data - Données envoyées à l'API
|
|
1208
|
+
* @returns Les données de réponse.
|
|
1209
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1210
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1211
|
+
*/
|
|
1212
|
+
discourseProfile(data: DiscourseProfileData): Promise<any>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Interoperabilité Discourse Check Email for User : Vérifier si l'email correspond à un utilisateur Discourse
|
|
1215
|
+
* Constant : DISCOURSE_CHECK_EMAIL
|
|
1216
|
+
* @param data - Données envoyées à l'API
|
|
1217
|
+
* @returns Les données de réponse.
|
|
1218
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1219
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1220
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1221
|
+
*/
|
|
1222
|
+
discourseCheckEmail(data: DiscourseCheckEmailData): Promise<any>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Interoperabilité Discourse Dismiss Link : Ignorer le lien Discourse
|
|
1225
|
+
* Constant : DISCOURSE_DISMISS_LINK
|
|
1226
|
+
* @param data - Données envoyées à l'API
|
|
1227
|
+
* @returns Les données de réponse.
|
|
1228
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1229
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1230
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1231
|
+
*/
|
|
1232
|
+
discourseDismissLink(data: DiscourseDismissLinkData): Promise<any>;
|
|
1233
|
+
/**
|
|
1234
|
+
* Interoperabilité MediaWiki Lié un compte : Lier un compte MediaWiki
|
|
1235
|
+
* Constant : LINK_MEDIAWIKI_ACCOUNT
|
|
1236
|
+
* @param data - Données envoyées à l'API
|
|
1237
|
+
* @returns Les données de réponse.
|
|
1238
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1239
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1240
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1241
|
+
*/
|
|
1242
|
+
linkMediawikiAccount(data: LinkMediawikiAccountData): Promise<any>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Interoperabilité MediaWiki Délier un compte : Délier un compte MediaWiki
|
|
1245
|
+
* Constant : UNLINK_MEDIAWIKI_ACCOUNT
|
|
1246
|
+
* @param data - Données envoyées à l'API
|
|
1247
|
+
* @returns Les données de réponse.
|
|
1248
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1249
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1250
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1251
|
+
*/
|
|
1252
|
+
unlinkMediawikiAccount(data: UnlinkMediawikiAccountData): Promise<any>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Interoperabilité MediaWiki Get Contributions : Obtenir les contributions d'un compte MediaWiki
|
|
1255
|
+
* Constant : GET_MEDIAWIKI_CONTRIBUTIONS
|
|
1256
|
+
* @param data - Données envoyées à l'API
|
|
1257
|
+
* @returns Les données de réponse.
|
|
1258
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1259
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1260
|
+
*/
|
|
1261
|
+
getMediawikiContributions(data: GetMediawikiContributionsData): Promise<any>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Créer une ressource classifiée : Crée une nouvelle ressource classifiée (besoin ou offre).
|
|
1264
|
+
* Constant : ADD_CLASSIFIED
|
|
1265
|
+
* @param data - Données envoyées à l'API
|
|
1266
|
+
* @returns Les données de réponse.
|
|
1267
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1268
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1269
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1270
|
+
*/
|
|
1271
|
+
addClassified(data: AddClassifiedData): Promise<any>;
|
|
1165
1272
|
}
|
|
1166
1273
|
export default EndpointApi;
|