@communecter/cocolight-api-client 1.0.120 → 1.0.122
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/203.cocolight-api-client.cjs +1 -0
- package/dist/278.cocolight-api-client.browser.js +1 -0
- package/dist/278.cocolight-api-client.cjs +1 -0
- package/dist/278.cocolight-api-client.mjs.js +1 -0
- package/dist/401.cocolight-api-client.mjs.js +1 -1
- package/dist/407.cocolight-api-client.browser.js +1 -0
- package/dist/407.cocolight-api-client.mjs.js +1 -0
- package/dist/499.cocolight-api-client.browser.js +1 -0
- package/dist/499.cocolight-api-client.cjs +1 -0
- package/dist/499.cocolight-api-client.mjs.js +1 -0
- package/dist/556.cocolight-api-client.browser.js +1 -0
- package/dist/556.cocolight-api-client.cjs +1 -0
- package/dist/556.cocolight-api-client.mjs.js +1 -0
- package/dist/588.cocolight-api-client.mjs.js +1 -1
- package/dist/593.cocolight-api-client.mjs.js +1 -1
- package/dist/839.cocolight-api-client.mjs.js +1 -1
- package/dist/85.cocolight-api-client.browser.js +1 -0
- package/dist/85.cocolight-api-client.cjs +1 -0
- package/dist/85.cocolight-api-client.mjs.js +1 -0
- package/dist/906.cocolight-api-client.browser.js +1 -0
- package/dist/906.cocolight-api-client.cjs +1 -0
- package/dist/906.cocolight-api-client.mjs.js +1 -0
- package/dist/cocolight-api-client.browser.js +3 -3
- 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 +21 -2
- package/src/api/BaseEntity.ts +171 -12
- package/src/api/EndpointApi.ts +140 -1
- package/src/api/EndpointApi.types.ts +201 -1
- package/src/api/EntityRegistry.ts +11 -3
- package/src/api/Form.ts +60 -0
- package/src/api/User.ts +2 -0
- package/src/api/UserApi.ts +3 -2
- package/src/api/serverDataType/Country.ts +1 -0
- package/src/api/serverDataType/Form.ts +56 -0
- package/src/endpoints.module.ts +1 -1
- package/src/index.ts +4 -1
- package/src/types/entities.ts +3 -2
- package/types/Api.d.ts +7 -0
- package/types/api/BaseEntity.d.ts +112 -3
- package/types/api/EndpointApi.d.ts +86 -1
- package/types/api/EndpointApi.types.d.ts +183 -1
- package/types/api/EntityRegistry.d.ts +1 -1
- package/types/api/Form.d.ts +23 -0
- package/types/api/Organization.d.ts +1 -1
- package/types/api/User.d.ts +1 -0
- package/types/api/serverDataType/Country.d.ts +1 -0
- package/types/api/serverDataType/Form.d.ts +51 -0
- package/types/endpoints.module.d.ts +2834 -141
- package/types/index.d.ts +4 -1
- package/types/types/entities.d.ts +3 -2
package/package.json
CHANGED
package/src/Api.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { Comment } from "./api/Comment.js";
|
|
|
5
5
|
import EndpointApi from "./api/EndpointApi.js";
|
|
6
6
|
import { createFromCollection, registerEntity } from "./api/EntityRegistry.js";
|
|
7
7
|
import { Event } from "./api/Event.js";
|
|
8
|
+
import { Form } from "./api/Form.js";
|
|
8
9
|
import { News } from "./api/News.js";
|
|
9
10
|
import { Organization } from "./api/Organization.js";
|
|
10
11
|
import { Poi } from "./api/Poi.js";
|
|
@@ -29,6 +30,7 @@ registerEntity("EndpointApi", EndpointApi);
|
|
|
29
30
|
registerEntity("News", News);
|
|
30
31
|
registerEntity("Comment", Comment);
|
|
31
32
|
registerEntity("Answer", Answer);
|
|
33
|
+
registerEntity("Form", Form);
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
|
|
@@ -126,9 +128,9 @@ export default class Api {
|
|
|
126
128
|
async user(userData: EntityData): Promise<User> {
|
|
127
129
|
try {
|
|
128
130
|
if (!userData.id && !userData.slug) {
|
|
129
|
-
return new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment });
|
|
131
|
+
return new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer });
|
|
130
132
|
} else {
|
|
131
|
-
const user = new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment });
|
|
133
|
+
const user = new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer });
|
|
132
134
|
await user.get();
|
|
133
135
|
return user;
|
|
134
136
|
}
|
|
@@ -224,6 +226,23 @@ export default class Api {
|
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Creates a new Form instance and optionally retrieves form data.
|
|
231
|
+
*/
|
|
232
|
+
async form(formData: { id: string }): Promise<Form> {
|
|
233
|
+
try {
|
|
234
|
+
const form = new Form(this._client, formData, { EndpointApi, User, Organization, Project });
|
|
235
|
+
if (!formData.id) {
|
|
236
|
+
throw new Error("Vous devez fournir un id pour créer une instance Form.");
|
|
237
|
+
}
|
|
238
|
+
await form.get();
|
|
239
|
+
return form;
|
|
240
|
+
} catch (error) {
|
|
241
|
+
console.error("[Api.form] Erreur lors de la création d'un objet Form :", (error as Error).message);
|
|
242
|
+
throw error;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
227
246
|
/**
|
|
228
247
|
* Retourne une entité à partir d'un slug.
|
|
229
248
|
*/
|
package/src/api/BaseEntity.ts
CHANGED
|
@@ -46,10 +46,14 @@ import type {
|
|
|
46
46
|
SearchMemberAutocompleteData,
|
|
47
47
|
GetEventsData,
|
|
48
48
|
CostumFilterCoformData,
|
|
49
|
-
|
|
49
|
+
GetCountriesData,
|
|
50
|
+
SearchZonesData,
|
|
51
|
+
CoformAnswersByFormsData,
|
|
52
|
+
FundingEnvelopeData
|
|
50
53
|
} from "./EndpointApi.types.js";
|
|
51
54
|
import type { GetElementsKeyResponse } from "../types/api-responses.js";
|
|
52
55
|
import type { TransformsMap } from "../types/entities.js";
|
|
56
|
+
import type { CountryItem } from "./serverDataType/Country.js";
|
|
53
57
|
import type { ZoneItemNormalized } from "./serverDataType/Zone.js";
|
|
54
58
|
const { fromBuffer } = pkg;
|
|
55
59
|
|
|
@@ -83,9 +87,10 @@ type News = import("./News.js").News;
|
|
|
83
87
|
type Badge = import("./Badge.js").Badge;
|
|
84
88
|
type Comment = import("./Comment.js").Comment;
|
|
85
89
|
type Answer = import("./Answer.js").Answer;
|
|
90
|
+
type Form = import("./Form.js").Form;
|
|
86
91
|
|
|
87
92
|
// Types d'union
|
|
88
|
-
type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer;
|
|
93
|
+
type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer | Form;
|
|
89
94
|
type ParentLike = BaseEntity<any> & { apiClient: ApiClient, userContext?: User | null };
|
|
90
95
|
|
|
91
96
|
// Types pour les dépendances
|
|
@@ -103,6 +108,7 @@ interface Deps {
|
|
|
103
108
|
News?: any;
|
|
104
109
|
Comment?: any;
|
|
105
110
|
Answer?: any;
|
|
111
|
+
Form?: any;
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
interface BaseEntityConfig {
|
|
@@ -120,6 +126,7 @@ interface EntityTypeMap {
|
|
|
120
126
|
badges: Badge;
|
|
121
127
|
comments: Comment;
|
|
122
128
|
answers: Answer;
|
|
129
|
+
forms: Form;
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
// Types pour les streams et uploads
|
|
@@ -127,6 +134,19 @@ type ReadableWithMeta = import("stream").Readable & { path?: string, mimeType?:
|
|
|
127
134
|
type UploadInput = File | Blob | Buffer | import("stream").Readable;
|
|
128
135
|
type ValidatedUpload = File | Buffer | ReadableWithMeta;
|
|
129
136
|
|
|
137
|
+
// Type de retour pour fundingEnvelope
|
|
138
|
+
export type FundingEnvelopeResult = {
|
|
139
|
+
contextData?: AnyEntity | object;
|
|
140
|
+
context?: AnyEntity | object;
|
|
141
|
+
links?: object;
|
|
142
|
+
form?: object;
|
|
143
|
+
paymentMethods?: object;
|
|
144
|
+
nopropProject?: AnyEntity[] | object;
|
|
145
|
+
projects?: AnyEntity[] | any[];
|
|
146
|
+
userOrga?: AnyEntity[] | object;
|
|
147
|
+
[k: string]: unknown;
|
|
148
|
+
};
|
|
149
|
+
|
|
130
150
|
// Type pour le curseur de pagination utilisé dans _createPaginatorEngine
|
|
131
151
|
type PaginationCursor = {
|
|
132
152
|
searchType?: string[];
|
|
@@ -1892,6 +1912,7 @@ export class BaseEntity<TServerData = any> {
|
|
|
1892
1912
|
News: selfTag === "News" ? selfClass : this.deps.News,
|
|
1893
1913
|
Comment: selfTag === "Comment" ? selfClass : this.deps.Comment,
|
|
1894
1914
|
Answer: selfTag === "Answer" ? selfClass : this.deps.Answer,
|
|
1915
|
+
Form: selfTag === "Form" ? selfClass : this.deps.Form,
|
|
1895
1916
|
};
|
|
1896
1917
|
|
|
1897
1918
|
const map = {
|
|
@@ -1909,6 +1930,7 @@ export class BaseEntity<TServerData = any> {
|
|
|
1909
1930
|
} },
|
|
1910
1931
|
comments: { entityClass: commonDeps.Comment, deps: { ...commonDeps } },
|
|
1911
1932
|
answers: { entityClass: commonDeps.Answer, deps: { ...commonDeps } },
|
|
1933
|
+
forms: { entityClass: commonDeps.Form, deps: { ...commonDeps } },
|
|
1912
1934
|
};
|
|
1913
1935
|
|
|
1914
1936
|
return (map as Record<string, EntityMeta | undefined>)[entityType] || null;
|
|
@@ -3223,14 +3245,13 @@ export class BaseEntity<TServerData = any> {
|
|
|
3223
3245
|
finalizer: async (finalData) => {
|
|
3224
3246
|
if(this.isMe){
|
|
3225
3247
|
finalData.pathParams = { type: this.getEntityType(), id: this.id };
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
// };
|
|
3248
|
+
finalData.filters = {
|
|
3249
|
+
"$or": {
|
|
3250
|
+
[`links.contributors.${this.id}`]: { "$exists": true },
|
|
3251
|
+
[`parent.${this.id}`]: { "$exists": true }
|
|
3252
|
+
},
|
|
3253
|
+
[`links.contributors.${this.id}`]: { "$exists": true }
|
|
3254
|
+
};
|
|
3234
3255
|
} else {
|
|
3235
3256
|
delete finalData?.pathParams;
|
|
3236
3257
|
finalData.filters = {
|
|
@@ -4628,10 +4649,37 @@ export class BaseEntity<TServerData = any> {
|
|
|
4628
4649
|
}
|
|
4629
4650
|
|
|
4630
4651
|
|
|
4652
|
+
/**
|
|
4653
|
+
* Recherche paginée des réponses CoForm liées à l'entité courante.
|
|
4654
|
+
* Injecte automatiquement le contexte (costumSlug, contextId, contextType) via `_withCostumContext`,
|
|
4655
|
+
* puis pagine via `_createPaginatorEngine`.
|
|
4656
|
+
*
|
|
4657
|
+
* `searchType` est pré-rempli à `["answers"]` si non fourni.
|
|
4658
|
+
* Les autres champs required (`indexStep`, `count`, `initType`, `fediverse`)
|
|
4659
|
+
* sont injectés automatiquement par AJV via les `default` du schema.
|
|
4660
|
+
*
|
|
4661
|
+
* @param data - Paramètres de recherche (partiels). Seuls `filters` et `fields` sont
|
|
4662
|
+
* généralement nécessaires côté appelant.
|
|
4663
|
+
* @param options - Options de pagination
|
|
4664
|
+
* @param options.restoredState - État de pagination à restaurer (pour reprendre une navigation)
|
|
4665
|
+
* @returns Première page paginée avec `results` (Answer[]), `count`, `hasNext`, `hasPrev`, etc.
|
|
4666
|
+
*
|
|
4667
|
+
* @example
|
|
4668
|
+
* const page = await organization.coformAnswersSearch({
|
|
4669
|
+
* filters: { form: "6927e9f0db22da724360303c" },
|
|
4670
|
+
* fields: ["vote", "voteCount", "user"],
|
|
4671
|
+
* sortBy: { created: -1 }
|
|
4672
|
+
* });
|
|
4673
|
+
* page.results; // Answer[]
|
|
4674
|
+
* page.count.total; // nombre total de résultats
|
|
4675
|
+
* page.hasNext; // true si une page suivante existe
|
|
4676
|
+
*/
|
|
4631
4677
|
async coformAnswersSearch(
|
|
4632
4678
|
data: Partial<CoformAnswersSearchData> = {},
|
|
4633
4679
|
options?: { restoredState?: PaginatorState }
|
|
4634
|
-
): Promise<PaginatorPage<
|
|
4680
|
+
): Promise<PaginatorPage<Answer>> {
|
|
4681
|
+
data.searchType = data.searchType ?? ["answers"];
|
|
4682
|
+
|
|
4635
4683
|
const paginator = this._createPaginatorEngine({
|
|
4636
4684
|
initialData: data,
|
|
4637
4685
|
methodName: "coformAnswersSearch",
|
|
@@ -4640,9 +4688,83 @@ export class BaseEntity<TServerData = any> {
|
|
|
4640
4688
|
(finalData: CoformAnswersSearchData) => this.endpointApi.coformAnswersSearch(finalData)
|
|
4641
4689
|
),
|
|
4642
4690
|
});
|
|
4643
|
-
return paginator.next() as Promise<PaginatorPage<
|
|
4691
|
+
return paginator.next() as Promise<PaginatorPage<Answer>>;
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
|
|
4695
|
+
/**
|
|
4696
|
+
* Récupère les réponses pour plusieurs formulaires CoForm.
|
|
4697
|
+
* Chaque entrée du résultat contient les `answers` liées en entités
|
|
4698
|
+
* et les `documents` associés.
|
|
4699
|
+
*
|
|
4700
|
+
* @param data - Paramètres de recherche
|
|
4701
|
+
* @param data.forms - Objet `{ [formId]: pathDeRecherche }` — au moins une entrée requise.
|
|
4702
|
+
* Chaque clé est un ObjectID de formulaire, chaque valeur est un chemin
|
|
4703
|
+
* dot-notation vers le champ answers (ex: `"answers.xxx.finderxxx.orgId"`).
|
|
4704
|
+
* @returns Tableau d'items par formulaire, avec `answers` transformées en entités
|
|
4705
|
+
* @throws {ApiError} Si `forms` est absent, vide, ou n'est pas un objet
|
|
4706
|
+
*
|
|
4707
|
+
* @example
|
|
4708
|
+
* const results = await organization.searchAnswersByForms({
|
|
4709
|
+
* forms: {
|
|
4710
|
+
* "646498a5f2b3d6423d74b7f6": "answers.formName.finderPath.orgId",
|
|
4711
|
+
* "645b300b6d70bb35426fc0e3": "answers.formName.finderPath.orgId"
|
|
4712
|
+
* }
|
|
4713
|
+
* });
|
|
4714
|
+
*/
|
|
4715
|
+
async searchAnswersByForms(
|
|
4716
|
+
data: Partial<CoformAnswersByFormsData> = {},
|
|
4717
|
+
): Promise<{ answers: Answer[]; documents: any[]; [k: string]: unknown }[]> {
|
|
4718
|
+
if(!data.forms || Array.isArray(data.forms) || Object.keys(data.forms).length === 0){
|
|
4719
|
+
throw new ApiError("Le paramètre 'forms' est requis et doit être un objet non vide.", 400);
|
|
4720
|
+
}
|
|
4721
|
+
const result = await this.endpointApi.coformAnswersByForms(data);
|
|
4722
|
+
|
|
4723
|
+
return result.map((item: any) => ({
|
|
4724
|
+
...item,
|
|
4725
|
+
answers: this._linkEntities(Object.values(item.answers || {}))
|
|
4726
|
+
}));
|
|
4644
4727
|
}
|
|
4645
4728
|
|
|
4729
|
+
/**
|
|
4730
|
+
* Récupère les informations d'enveloppes de financement pour l'entité courante.
|
|
4731
|
+
* Injecte automatiquement le contexte (costumSlug, contextId, contextType) via `_withCostumContext`.
|
|
4732
|
+
*
|
|
4733
|
+
* Les champs `contextData`, `context`, `nopropProject`, `projects` et `userOrga`
|
|
4734
|
+
* de la réponse sont automatiquement liés en entités quand possible.
|
|
4735
|
+
*
|
|
4736
|
+
* @param data - Paramètres optionnels de recherche
|
|
4737
|
+
* @param data.action - Action à effectuer (`"getEnvelopeData"`, `"getFormData"`, etc.)
|
|
4738
|
+
* @param data.formId - ID du formulaire cible (pour `action: "getFormData"`)
|
|
4739
|
+
* @param data.financerId - ID du financeur pour filtrer
|
|
4740
|
+
* @param data.financerType - Type du financeur (ex: `"citoyens"`)
|
|
4741
|
+
* @param data.params - Paramètres supplémentaires (ex: `{ project: "all" }`)
|
|
4742
|
+
* @returns Données d'enveloppe avec entités liées
|
|
4743
|
+
*
|
|
4744
|
+
* @example
|
|
4745
|
+
* const envelope = await organization.fundingEnvelope({
|
|
4746
|
+
* action: "getEnvelopeData"
|
|
4747
|
+
* });
|
|
4748
|
+
* envelope.form; // données du formulaire
|
|
4749
|
+
* envelope.projects; // Project[] liés
|
|
4750
|
+
*/
|
|
4751
|
+
async fundingEnvelope(
|
|
4752
|
+
data: Partial<Omit<FundingEnvelopeData, "contextId" | "contextType">> = {},
|
|
4753
|
+
): Promise<FundingEnvelopeResult> {
|
|
4754
|
+
const wrappedFinalizer = this._withCostumContext(
|
|
4755
|
+
(finalData: FundingEnvelopeData) => this.endpointApi.fundingEnvelope(finalData)
|
|
4756
|
+
);
|
|
4757
|
+
|
|
4758
|
+
const result = await wrappedFinalizer(data as FundingEnvelopeData);
|
|
4759
|
+
return {
|
|
4760
|
+
...result,
|
|
4761
|
+
...(result.contextData && { contextData: this._linkEntity(result.contextData.collection, result.contextData) ?? result.contextData }),
|
|
4762
|
+
...(result.context && { context: this._linkEntity(result.context.collection, result.context) ?? result.context }),
|
|
4763
|
+
...(result.nopropProject && { nopropProject: this._linkEntities(Object.values(result.nopropProject)) ?? result.nopropProject }),
|
|
4764
|
+
...(result.projects && { projects: this._linkEntities(result.projects) ?? result.projects }),
|
|
4765
|
+
...(result.userOrga && { userOrga: this._linkEntities(Object.values(result.userOrga)) ?? result.userOrga })
|
|
4766
|
+
};
|
|
4767
|
+
}
|
|
4646
4768
|
|
|
4647
4769
|
/**
|
|
4648
4770
|
* Récupère les filtres disponibles basés sur les réponses CoForm de l'entité courante.
|
|
@@ -4701,6 +4823,41 @@ export class BaseEntity<TServerData = any> {
|
|
|
4701
4823
|
return wrappedFinalizer(data) as Promise<ZoneItemNormalized[]>;
|
|
4702
4824
|
}
|
|
4703
4825
|
|
|
4826
|
+
/**
|
|
4827
|
+
* Récupère la liste de tous les pays (endpoint public, sans authentification).
|
|
4828
|
+
*
|
|
4829
|
+
* @param data - Paramètres optionnels (costumSlug, costumId, costumType)
|
|
4830
|
+
* @returns Liste des pays `{ name, countryCode, level, geo, ... }`
|
|
4831
|
+
*
|
|
4832
|
+
* @example
|
|
4833
|
+
* const countries = await organization.getCountries();
|
|
4834
|
+
* countries[0].name; // "France"
|
|
4835
|
+
* countries[0].countryCode; // "FR"
|
|
4836
|
+
*/
|
|
4837
|
+
async getCountries(
|
|
4838
|
+
data: Partial<GetCountriesData> = {},
|
|
4839
|
+
): Promise<CountryItem[]> {
|
|
4840
|
+
return this.endpointApi.getCountries(data as GetCountriesData) as Promise<CountryItem[]>;
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
/**
|
|
4844
|
+
* Generer un nouveau identifiant unique pour un answers basé sur un formulaire donnée
|
|
4845
|
+
*
|
|
4846
|
+
* @param formId - Identifiant du formulaire pour lequel générer un nouvel ID d'answers
|
|
4847
|
+
* @returns Un nouvel answers avec le nouveau ID généré
|
|
4848
|
+
* @throws {ApiError} Si formId est absent ou invalide
|
|
4849
|
+
*
|
|
4850
|
+
*/
|
|
4851
|
+
async generateNewAnswerId(
|
|
4852
|
+
formId: string
|
|
4853
|
+
): Promise<any> {
|
|
4854
|
+
if (!formId || typeof formId !== "string") {
|
|
4855
|
+
throw new ApiError("formId est requis et doit être une chaîne de caractères.", 400);
|
|
4856
|
+
}
|
|
4857
|
+
const result = await this.endpointApi.generateAnswerFromForm({pathParams: { formId }, action: "new" });
|
|
4858
|
+
return this._linkEntity?.(result.collection, result) ?? result;
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4704
4861
|
/**
|
|
4705
4862
|
* ───────────────────────────────
|
|
4706
4863
|
* Pagination restoration methods
|
|
@@ -4791,6 +4948,8 @@ export class BaseEntity<TServerData = any> {
|
|
|
4791
4948
|
};
|
|
4792
4949
|
}
|
|
4793
4950
|
|
|
4951
|
+
|
|
4952
|
+
|
|
4794
4953
|
}
|
|
4795
4954
|
|
|
4796
4955
|
export default BaseEntity;
|
package/src/api/EndpointApi.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ApiAuthenticationError } from "../error.js";
|
|
3
3
|
|
|
4
4
|
import type ApiClient from "../ApiClient.js";
|
|
5
|
-
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, SearchZonesData } from "./EndpointApi.types.js";
|
|
5
|
+
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";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
@@ -1640,6 +1640,69 @@ export class EndpointApi {
|
|
|
1640
1640
|
return this.call("COFORM_ANSWERS_BY_ID", data);
|
|
1641
1641
|
}
|
|
1642
1642
|
|
|
1643
|
+
/**
|
|
1644
|
+
* Récupérer un formulaire par son ID : Récupère les informations complètes d'un formulaire CoForm par son ID parent
|
|
1645
|
+
* Constant : GET_COFORM_BY_ID
|
|
1646
|
+
* @param data - Données envoyées à l'API
|
|
1647
|
+
* @returns Les données de réponse.
|
|
1648
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1649
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1650
|
+
*/
|
|
1651
|
+
async getCoformById(data: GetCoformByIdData): Promise<any> {
|
|
1652
|
+
if (!data || typeof data !== "object") {
|
|
1653
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1654
|
+
}
|
|
1655
|
+
return this.call("GET_COFORM_BY_ID", data);
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Uploader un fichier de réponse CoForm : Endpoint de pré-upload CoForm (image/document). Si answerId est absent, l'endpoint crée un MongoId de réponse, réutilise la logique d'upload document existante et retourne answerId + docPath.
|
|
1660
|
+
* Constant : COFORM_UPLOAD_ANSWER_FILE
|
|
1661
|
+
* @param data - Données envoyées à l'API
|
|
1662
|
+
* @returns Les données de réponse.
|
|
1663
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1664
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1665
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1666
|
+
*/
|
|
1667
|
+
async coformUploadAnswerFile(data: CoformUploadAnswerFileData): Promise<any> {
|
|
1668
|
+
if (!data || typeof data !== "object") {
|
|
1669
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1670
|
+
}
|
|
1671
|
+
return this.callIsConnected("COFORM_UPLOAD_ANSWER_FILE", data);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* Récupérer les fichiers d'une réponse CoForm : Récupère la liste des fichiers uploadés pour un input spécifique dans une réponse CoForm. Utilisé pour récupérer les fichiers de l'ancien système qui n'ont que 'updateDate' sans la clé 'files'.
|
|
1676
|
+
* Constant : COFORM_GET_ANSWER_FILES
|
|
1677
|
+
* @param data - Données envoyées à l'API
|
|
1678
|
+
* @returns Les données de réponse.
|
|
1679
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1680
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1681
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1682
|
+
*/
|
|
1683
|
+
async coformGetAnswerFiles(data: CoformGetAnswerFilesData): Promise<any> {
|
|
1684
|
+
if (!data || typeof data !== "object") {
|
|
1685
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1686
|
+
}
|
|
1687
|
+
return this.callIsConnected("COFORM_GET_ANSWER_FILES", data);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
/**
|
|
1691
|
+
* Sauvegarder une réponse de formulaire CoForm : Enregistre ou met à jour les réponses d'un utilisateur pour un formulaire CoForm
|
|
1692
|
+
* Constant : SAVE_COFORM_ANSWER
|
|
1693
|
+
* @param data - Données envoyées à l'API
|
|
1694
|
+
* @returns Les données de réponse.
|
|
1695
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1696
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1697
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1698
|
+
*/
|
|
1699
|
+
async saveCoformAnswer(data: SaveCoformAnswerData): Promise<any> {
|
|
1700
|
+
if (!data || typeof data !== "object") {
|
|
1701
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1702
|
+
}
|
|
1703
|
+
return this.callIsConnected("SAVE_COFORM_ANSWER", data);
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1643
1706
|
/**
|
|
1644
1707
|
* Voter sur un élément (commentaire ou news) : Permet de voter sur un commentaire ou une news en spécifiant un statut de vote
|
|
1645
1708
|
* Constant : ADD_VOTE
|
|
@@ -1704,6 +1767,22 @@ export class EndpointApi {
|
|
|
1704
1767
|
return this.callIsConnected("DELETE_DOCUMENT_BY_CONTEXT", data);
|
|
1705
1768
|
}
|
|
1706
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* Supprimer un document par son ID : Supprime un document (fichier ou image) par son identifiant MongoDB
|
|
1772
|
+
* Constant : DELETE_DOCUMENT_BY_ID
|
|
1773
|
+
* @param data - Données envoyées à l'API
|
|
1774
|
+
* @returns Les données de réponse.
|
|
1775
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1776
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1777
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1778
|
+
*/
|
|
1779
|
+
async deleteDocumentById(data: DeleteDocumentByIdData): Promise<any> {
|
|
1780
|
+
if (!data || typeof data !== "object") {
|
|
1781
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1782
|
+
}
|
|
1783
|
+
return this.callIsConnected("DELETE_DOCUMENT_BY_ID", data);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1707
1786
|
/**
|
|
1708
1787
|
* Rétirer les droits d’administrateur d’un membre : Rétirer les droits d’administrateur d’un membre d’une organisation ou d’un projet
|
|
1709
1788
|
* Constant : DEMOTE_ADMIN
|
|
@@ -1735,6 +1814,21 @@ export class EndpointApi {
|
|
|
1735
1814
|
return this.call("COSTUM_FILTER_COFORM", data);
|
|
1736
1815
|
}
|
|
1737
1816
|
|
|
1817
|
+
/**
|
|
1818
|
+
* Récupérer la liste des pays : Récupérer la liste de tous les pays
|
|
1819
|
+
* Constant : GET_COUNTRIES
|
|
1820
|
+
* @param data - Données envoyées à l'API
|
|
1821
|
+
* @returns Les données de réponse.
|
|
1822
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1823
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1824
|
+
*/
|
|
1825
|
+
async getCountries(data: GetCountriesData): Promise<any> {
|
|
1826
|
+
if (!data || typeof data !== "object") {
|
|
1827
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1828
|
+
}
|
|
1829
|
+
return this.call("GET_COUNTRIES", data);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1738
1832
|
/**
|
|
1739
1833
|
* Rechercher des zones géographiques : Rechercher des zones géographiques
|
|
1740
1834
|
* Constant : SEARCH_ZONES
|
|
@@ -1750,6 +1844,51 @@ export class EndpointApi {
|
|
|
1750
1844
|
return this.call("SEARCH_ZONES", data);
|
|
1751
1845
|
}
|
|
1752
1846
|
|
|
1847
|
+
/**
|
|
1848
|
+
* Recuperer la liste des reponses pour plusieurs formulaires : Recuperer la liste des reponses pour plusieurs formulaires
|
|
1849
|
+
* Constant : COFORM_ANSWERS_BY_FORMS
|
|
1850
|
+
* @param data - Données envoyées à l'API
|
|
1851
|
+
* @returns Les données de réponse.
|
|
1852
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1853
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1854
|
+
*/
|
|
1855
|
+
async coformAnswersByForms(data: CoformAnswersByFormsData): Promise<any> {
|
|
1856
|
+
if (!data || typeof data !== "object") {
|
|
1857
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1858
|
+
}
|
|
1859
|
+
return this.call("COFORM_ANSWERS_BY_FORMS", data);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/**
|
|
1863
|
+
* Generer une nouvelle reponse à partir d'un formulaire : Generer une nouvelle reponse à partir d'un formulaire
|
|
1864
|
+
* Constant : GENERATE_ANSWER_FROM_FORM
|
|
1865
|
+
* @param data - Données envoyées à l'API
|
|
1866
|
+
* @returns Les données de réponse.
|
|
1867
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1868
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1869
|
+
*/
|
|
1870
|
+
async generateAnswerFromForm(data: GenerateAnswerFromFormData): Promise<any> {
|
|
1871
|
+
if (!data || typeof data !== "object") {
|
|
1872
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1873
|
+
}
|
|
1874
|
+
return this.call("GENERATE_ANSWER_FROM_FORM", data);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* Trouver les informations sur les enveloppes d’un formulaire : Trouver les informations sur les enveloppes d’un formulaire
|
|
1879
|
+
* Constant : FUNDING_ENVELOPE
|
|
1880
|
+
* @param data - Données envoyées à l'API
|
|
1881
|
+
* @returns Les données de réponse.
|
|
1882
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1883
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1884
|
+
*/
|
|
1885
|
+
async fundingEnvelope(data: FundingEnvelopeData): Promise<any> {
|
|
1886
|
+
if (!data || typeof data !== "object") {
|
|
1887
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1888
|
+
}
|
|
1889
|
+
return this.call("FUNDING_ENVELOPE", data);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1753
1892
|
}
|
|
1754
1893
|
|
|
1755
1894
|
export default EndpointApi;
|