@communecter/cocolight-api-client 1.0.201 → 1.0.202

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@communecter/cocolight-api-client",
3
- "version": "1.0.201",
3
+ "version": "1.0.202",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
package/types/Api.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Answer } from "./api/Answer.js";
2
2
  import { Classified } from "./api/Classified.js";
3
+ import { Discussions } from "./api/Discussions.js";
3
4
  import EndpointApi from "./api/EndpointApi.js";
4
5
  import { Event } from "./api/Event.js";
5
6
  import { Form } from "./api/Form.js";
@@ -15,6 +16,7 @@ export default class Api {
15
16
  private _loggedUser;
16
17
  private _client;
17
18
  private _endpointApi?;
19
+ private _discussions?;
18
20
  /**
19
21
  * Authentifie l'utilisateur et retourne une instance d'Api.
20
22
  */
@@ -80,6 +82,11 @@ export default class Api {
80
82
  * Retourne l'instance d'EndpointApi.
81
83
  */
82
84
  get endpointApi(): EndpointApi;
85
+ /**
86
+ * Le panneau « Discussions » et l'espace de discussion d'un commun (spec « module comment » §6-§7) :
87
+ * `api.discussions.list()`, `markSeen()`, `space()`, `create()`. Réponses typées (voir `api/Discussions.ts`).
88
+ */
89
+ get discussions(): Discussions;
83
90
  /**
84
91
  * Recherche des tags correspondant à un mot-clé.
85
92
  *
@@ -1,3 +1,4 @@
1
+ import type { Comment as CommentEntity } from "./Comment.js";
1
2
  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, SearchEventsCostumData, CostumFilterCoformData, CostumFilterCoformByPathData, GetCountriesData, SearchZonesData, ZoneGetShapeData, ZoneGetZonirisData, CoformAnswersByFormsData, FundingEnvelopeData, CoremuOperationData, UpdatePathValueData } from "./EndpointApi.types.js";
2
3
  import type { CostumRuntimeContext } from "../costum/runtime.js";
3
4
  import type { TransformsMap } from "../types/entities.js";
@@ -1347,6 +1348,33 @@ export declare class BaseEntity<TServerData = any> {
1347
1348
  * @private
1348
1349
  */
1349
1350
  _entityInstanceData<T extends keyof EntityTypeMap>(entityType: T, entityData: object, config?: BaseEntityConfig): EntityTypeMap[T];
1351
+ /**
1352
+ * Créer un commentaire sur cette entité — ou une RÉPONSE, quand `this` est un commentaire
1353
+ * (`Comment._add` remonte alors à l'entité racine pour `contextId`/`contextType`).
1354
+ * Le brouillon est renvoyé non enregistré : `save()` l'envoie (ADD_COMMENTS).
1355
+ *
1356
+ * @param commentData - Champs du message : `text`, `path` (le fil d'une question), `mentions`,
1357
+ * `mediaImg` (§5.1), `markdownActive` (§5.3)…
1358
+ * @returns Instance de Comment (brouillon).
1359
+ * @throws {ApiError} 401 si non connecté.
1360
+ */
1361
+ comment(commentData?: Record<string, any>): Promise<CommentEntity>;
1362
+ /**
1363
+ * Récupérer les commentaires de cette entité : tous ses fils mêlés (GET_COMMENTS), ou UN fil
1364
+ * désigné par son `path` (GET_COMMENTS_BY_PATH — le `path` passe dans l'URL : posté dans le corps,
1365
+ * le legacy l'ignore). Le `type` vient de `getEntityType()`.
1366
+ *
1367
+ * @param options.path - Le fil d'une question d'un formulaire (segments `[A-Za-z0-9_-]` séparés
1368
+ * par des points, 256 caractères au plus) ; absent ou `null` → tous les fils de l'élément.
1369
+ * @returns Liste de Comment (proxy filtrant les supprimés).
1370
+ * @throws {ApiError} 400 sur un commentaire ou un badge (pas de fil propre) ; 404 si l'entité
1371
+ * n'a pas d'id.
1372
+ * @throws {ApiValidationError} avant tout appel : `type` hors des dix, `path` hors de la règle.
1373
+ * @throws {ApiResponseError} si la réponse n'est pas une liste.
1374
+ */
1375
+ getComments(options?: {
1376
+ path?: string | null;
1377
+ }): Promise<CommentEntity[]>;
1350
1378
  /**
1351
1379
  * Crée une instance d'entité, et déclenche get() si certaines propriétés sont présentes.
1352
1380
  * @template keyof EntityTypeMap T
@@ -19,6 +19,55 @@ export declare class Comment extends BaseEntity<CommentItemNormalized> {
19
19
  get(): Promise<never>;
20
20
  save(): Promise<Record<string, any>>;
21
21
  _add: (payload: Record<string, any>) => Promise<void>;
22
+ /**
23
+ * Identifiant 24 hex — la forme que le contrat exige partout (`^[a-f0-9]{24}$`).
24
+ */
25
+ private static _isObjectId;
26
+ /**
27
+ * Mentions, normalisées pour UPDATE_COMMENTS (spec « module comment » §5.2).
28
+ *
29
+ * Une mention RELUE porte plus que le contrat (`avatar`), un `count` en chaîne (`"1"`) que le schéma
30
+ * refuse, et une liste PHP à trous se relit en objet (`{ "0": …, "2": … }`). Une mention dont l'`id`
31
+ * n'est pas un identifiant, ou sans `slug`, est ÉCARTÉE (mentions legacy écrites de travers) : une
32
+ * seule mention de travers ne fait plus refuser toute l'édition. Chacune est ramenée aux six champs
33
+ * du contrat, tous requis.
34
+ *
35
+ * @returns la liste normalisée — vide, rien n'est envoyé et le serveur retire les mentions.
36
+ */
37
+ static _mentionsForWrite(raw: unknown): Array<{
38
+ id: string;
39
+ name: string;
40
+ slug: string;
41
+ type: string;
42
+ value: string;
43
+ count: number;
44
+ }>;
45
+ /**
46
+ * `mediaImg` ramené à sa forme d'ÉCRITURE (spec §5.1 / §5.2).
47
+ *
48
+ * Le brouillon d'un message relu porte la forme HYDRATÉE (des documents `{ id, imagePath, … }`) :
49
+ * renvoyée telle quelle, elle écrirait ces documents dans le commentaire à la place des identifiants.
50
+ * Chaque entrée — chaîne ou document (`id`, sinon `_id.$id`, `_id._str` ou `_id`) — donne un
51
+ * identifiant ; seuls les `^[a-f0-9]{24}$` restent.
52
+ *
53
+ * @returns `{ countImages, images }`, ou `null` s'il ne reste aucun identifiant — le champ est alors
54
+ * OMIS et le serveur retire `mediaImg` ($unset), ce qui est voulu pour un message sans image.
55
+ */
56
+ static _mediaImgForWrite(raw: unknown): {
57
+ countImages: number;
58
+ images: string[];
59
+ } | null;
60
+ /**
61
+ * Corriger un message — charge construite en LISTE BLANCHE, exactement celle du schéma
62
+ * `UPDATE_COMMENTS` (`{ id, params }`, fermé) : spec « module comment » §5.2.
63
+ *
64
+ * Le brouillon d'un message relu porte tous les champs de la lecture (`path`, `contextId`,
65
+ * `mentions` hydratées…) ; laissés à la racine, ils faisaient lever `ApiValidationError`. Et les
66
+ * retirer ne suffit pas : le serveur fait `$unset mentions` dès que `params.mentions` manque,
67
+ * `$unset mediaImg` dès que `params.mediaImg` manque, et remet `markdownActive` à faux dès qu'il
68
+ * manque. D'où : mentions normalisées, images réduites à des identifiants, `markdownActive` repris
69
+ * en booléen strict (une chaîne posée au brouillon n'est pas reprise — le schéma la refuserait).
70
+ */
22
71
  _update: (payload: Record<string, any>) => Promise<boolean>;
23
72
  addComments(data?: Partial<AddCommentsData>): Promise<unknown>;
24
73
  updateComments(data?: Partial<UpdateCommentsData>): Promise<unknown>;
@@ -27,12 +76,6 @@ export declare class Comment extends BaseEntity<CommentItemNormalized> {
27
76
  * Constant : DELETE_COMMENT
28
77
  */
29
78
  delete(): Promise<void>;
30
- /**
31
- * Créer une réponse à ce commentaire (commentaire sur commentaire).
32
- * @param commentData - Données du commentaire.
33
- * @returns Instance de Comment.
34
- */
35
- comment(commentData?: Record<string, any>): Promise<Comment>;
36
79
  /**
37
80
  * Ajoute un vote sur ce commentaire
38
81
  *
@@ -0,0 +1,184 @@
1
+ import type EndpointApi from "./EndpointApi.js";
2
+ import type { CreateDiscussionData, GetDiscussionSpaceData, GetDiscussionsData, MarkCommentsSeenData } from "./EndpointApi.types.js";
3
+ /** Mode d'une liste de discussions : déduit par le serveur du périmètre reçu, jamais élargi. */
4
+ export type DiscussionDepth = "rail" | "fils" | "fil" | "all";
5
+ /** Audience d'une discussion supplémentaire sur un commun. */
6
+ export type DiscussionAudience = "authorAll" | "authorAdmin" | "private";
7
+ /** Lien de la personne connectée avec un porteur : un espace où lancer une discussion, ou un espace croisé. */
8
+ export type DiscussionMembership = "self" | "admin" | "member" | null;
9
+ /** Référence au porteur d'un fil (`null` : fil sans porteur). */
10
+ export interface DiscussionCarrierRef {
11
+ type: string;
12
+ id: string;
13
+ }
14
+ /** La fiche d'un porteur, sans compteurs (mode `fil`). Le porteur NUL a `id` et `type` à `null`. */
15
+ export interface DiscussionCarrierCard {
16
+ id: string | null;
17
+ type: string | null;
18
+ name: string | null;
19
+ slug: string | null;
20
+ image: string | null;
21
+ }
22
+ /** Un porteur du rail : sa fiche et ses compteurs, calculés pour la session. */
23
+ export interface DiscussionCarrier extends DiscussionCarrierCard {
24
+ /** Nombre de fils sous ce porteur. */
25
+ threads: number;
26
+ /** Messages en tout. */
27
+ total: number;
28
+ /** Messages non lus par la personne connectée. */
29
+ unread: number;
30
+ /** Date du dernier message, en SECONDES ; `null` si aucun. */
31
+ last: number | null;
32
+ /** La personne connectée a écrit dans l'un des fils. */
33
+ mine: boolean;
34
+ membership: DiscussionMembership;
35
+ }
36
+ /** Un fil : le triplet (contextType, contextId, path), ses compteurs, son porteur. */
37
+ export interface DiscussionThread {
38
+ /** `type:id` ou `type:id:path`. */
39
+ key: string;
40
+ contextType: string;
41
+ contextId: string;
42
+ /** Une question d'un formulaire ; `null` partout ailleurs (fil racine). */
43
+ path: string | null;
44
+ /** Texte nu, 120 caractères au plus ; `null` quand l'écran doit nommer. */
45
+ title: string | null;
46
+ carrier: DiscussionCarrierRef | null;
47
+ total: number;
48
+ unread: number;
49
+ /** Secondes ; `null` si aucun message. */
50
+ last: number | null;
51
+ mine: boolean;
52
+ /** Un fil À LANCER, fabriqué à zéro message. */
53
+ virtual: boolean;
54
+ }
55
+ /** Un fil de l'espace d'un commun : les champs d'un fil du panneau, `carrier` toujours `null`, et sa place dans l'appel. */
56
+ export interface DiscussionSpaceThread extends DiscussionThread {
57
+ carrier: null;
58
+ kind: "general" | "discussion" | "question" | "expense";
59
+ /** Nom de l'étape, pour une question ou une ligne de dépense. */
60
+ group: string | null;
61
+ /** Pour une discussion supplémentaire. */
62
+ audience: DiscussionAudience | null;
63
+ /** Clé de la ligne dans la liste des dépenses du commun. */
64
+ line: string | null;
65
+ /** Clé de l'étape où vit la question. */
66
+ step: string | null;
67
+ }
68
+ /** Réponse de `list()` en `rail`, `fils` ou `all` : les porteurs, et leurs fils sauf en `rail`. */
69
+ export interface DiscussionsListResponse {
70
+ result: true;
71
+ depth: "rail" | "fils" | "all";
72
+ limit: number;
73
+ /** La liste a été coupée à `limit`. */
74
+ truncated: boolean;
75
+ /** Des fils manquent pour cet utilisateur : budget de lecture du serveur dépassé. */
76
+ scanTruncated: boolean;
77
+ /** Plus de porteurs vierges qu'il n'en est rendu (500). */
78
+ carriersTruncated: boolean;
79
+ /** Servi par l'index des porteurs (`true`) ou par le balayage du parc : la réponse est la même. */
80
+ indexed: boolean;
81
+ carriers: DiscussionCarrier[];
82
+ /** Absent en `rail`. */
83
+ threads?: DiscussionThread[];
84
+ }
85
+ /** Réponse de `list()` en `fil` : ce seul fil, la fiche de son porteur, le jugement du serveur sur l'écriture. */
86
+ export interface DiscussionThreadResponse {
87
+ result: true;
88
+ depth: "fil";
89
+ thread: DiscussionThread;
90
+ carrier: DiscussionCarrierCard | null;
91
+ canComment: boolean;
92
+ }
93
+ /** Réponse de `list()` : discriminée par `depth`. */
94
+ export type DiscussionsResponse = DiscussionsListResponse | DiscussionThreadResponse;
95
+ /** Réponse de `markSeen()` : combien de messages viennent de passer en « lu » (0 n'est pas une erreur). */
96
+ export interface MarkSeenResponse {
97
+ result: true;
98
+ marked: number;
99
+ }
100
+ /** Réponse de `space()` : tous les fils d'un commun, dans l'ordre du serveur. La liste fait autorité. */
101
+ export interface DiscussionSpaceResponse {
102
+ result: true;
103
+ space: {
104
+ type: "answers";
105
+ id: string;
106
+ title: string | null;
107
+ formId: string;
108
+ };
109
+ /** Seulement : y a-t-il une session. */
110
+ canComment: boolean;
111
+ /** Les audiences que ce lecteur peut donner à une discussion qu'il crée ; vide, il n'en crée pas. */
112
+ creatableAudiences: DiscussionAudience[];
113
+ truncated: boolean;
114
+ threads: DiscussionSpaceThread[];
115
+ }
116
+ /** Réponse de `create()` : le fil créé, vide et `virtual`, avec le `path` à passer à `form.getComments({ path })`. */
117
+ export interface CreateDiscussionResponse {
118
+ result: true;
119
+ thread: DiscussionSpaceThread;
120
+ }
121
+ /**
122
+ * `api.discussions` — le panneau « Discussions » et l'espace d'un commun.
123
+ *
124
+ * @example
125
+ * const rail = await api.discussions.list(); // les porteurs et leurs compteurs
126
+ * const fil = await api.discussions.list({ contextType: "news", contextId });
127
+ * if (fil.depth === "fil") console.log(fil.thread.unread, fil.canComment);
128
+ * await api.discussions.markSeen({ contextType: "news", contextId, ids });
129
+ * const espace = await api.discussions.space({ contextType: "answers", contextId: commun });
130
+ * const { thread } = await api.discussions.create({ contextType: "answers", contextId: commun, name, audience: "authorAll" });
131
+ */
132
+ export declare class Discussions {
133
+ private readonly _endpointApi;
134
+ constructor(endpointApi: EndpointApi);
135
+ /**
136
+ * Le panneau « Discussions » de la personne connectée (`GET_DISCUSSIONS`, auth bearer).
137
+ *
138
+ * Le mode se déduit du périmètre : rien → `rail` (porteurs et compteurs, aucun titre de fil) ;
139
+ * `carrier` → `fils` (les fils d'UN porteur) ; `contextType` + `contextId` (+ `path`) → `fil`.
140
+ * `depth: "all"` seul demande tout (jamais implicite) : ne jamais le passer « pour être explicite ».
141
+ * Sans `path`, c'est le fil RACINE qui est rendu, jamais le premier venu.
142
+ *
143
+ * @param options - Corps POST, tous facultatifs, AUCUN défaut injecté.
144
+ * @throws {ApiAuthenticationError} sans jeton, avant tout appel.
145
+ * @throws {ApiValidationError} requête hors schéma (clé inconnue, `includeEmpty` non chaîne…), avant tout appel.
146
+ * @throws {ApiResponseError} refus du serveur — `error.responseData.code` ∈ `bad-request`, `hidden` (neutre : fil introuvable ou réservé).
147
+ */
148
+ list(options?: GetDiscussionsData): Promise<DiscussionsResponse>;
149
+ /**
150
+ * Marquer un fil comme LU pour la personne connectée (`MARK_COMMENTS_SEEN`, auth bearer).
151
+ *
152
+ * L'utilisateur vient de la session, jamais d'un paramètre. Le `path` absent vise le fil des
153
+ * messages SANS chemin (pas « tous les fils du contexte »). `ids` restreint aux messages AFFICHÉS
154
+ * (500 au plus) : un message arrivé depuis le chargement n'est pas marqué. Rouvrir un fil déjà lu
155
+ * n'écrit rien : `marked` vaut 0.
156
+ *
157
+ * @throws {ApiAuthenticationError} sans jeton, avant tout appel.
158
+ * @throws {ApiValidationError} `ids` vide, > 500 ou mal formé ; contexte hors schéma.
159
+ * @throws {ApiResponseError} refus du serveur — `code` = `bad-request`.
160
+ */
161
+ markSeen(options: MarkCommentsSeenData): Promise<MarkSeenResponse>;
162
+ /**
163
+ * L'espace de discussion d'un commun (`GET_DISCUSSION_SPACE`, auth none = session FACULTATIVE :
164
+ * le jeton est joint quand il existe, et ne manque à personne).
165
+ *
166
+ * Tous les fils d'une réponse à un appel : général, questions, lignes de dépense, discussions
167
+ * supplémentaires. Un fil rendu est lisible par ce lecteur. Sans session : `canComment: false`,
168
+ * `creatableAudiences: []`.
169
+ *
170
+ * @throws {ApiValidationError} `contextType` ≠ `answers`, `includeEmpty` hors `"0"`/`"1"`, id en majuscules.
171
+ * @throws {ApiResponseError} refus — `code` ∈ `bad-request`, `hidden` (commun ou appel introuvable).
172
+ */
173
+ space(options: GetDiscussionSpaceData): Promise<DiscussionSpaceResponse>;
174
+ /**
175
+ * Créer une discussion supplémentaire sur un commun (`CREATE_DISCUSSION`, auth bearer) — le
176
+ * bouton « + » de l'espace. La requête ne porte aucun chemin : clé, étape et `path` sont fabriqués
177
+ * par le serveur. Qui peut créer, et avec quelle audience : `creatableAudiences` de l'espace.
178
+ *
179
+ * @throws {ApiAuthenticationError} sans jeton, avant tout appel.
180
+ * @throws {ApiValidationError} audience hors liste, `name` vide ou > 120, clé de trop.
181
+ * @throws {ApiResponseError} refus — `code` ∈ `bad-request`, `hidden`, `forbidden`, `bad-name`, `too-many`, `failed`.
182
+ */
183
+ create(options: CreateDiscussionData): Promise<CreateDiscussionResponse>;
184
+ }
@@ -1,5 +1,5 @@
1
1
  import type ApiClient from "../ApiClient.js";
2
- import type { DocumentListData, PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, PasswordResetData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, RelaunchInvitationData, ContactSendData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GlobalAutocompleteAdminCostumData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetUserEligiblePlacesData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, LinkSetRolesData, CreateInvitationLinkData, ConnectByRefData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, SaveCitoyenData, AddProjectData, AddPoiData, AddEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, SearchEventsCostumData, ShareEventsData, InviteMembersData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, NavigatorGettlData, NavigatorGetRessourceTlData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, AgendaGetPdfData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, GetCoformByIdData, CoformUploadAnswerFileData, DeleteCoformAnswerFileData, CoformGetAnswerFilesData, GetCoformCatalogsData, SaveCoformAnswerData, GetCoformAnswerHistoryData, GetCoformMultievalDataData, GetCoformCommontableContributorsData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, CostumFilterCoformByPathData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, CostumToolsCatalogData, CostumToolUsersData, CostumCommunInfoData, CostumSaveToolEnrichmentData, CostumCommunListData, GenerateAnswerFromFormData, GenerateProjectFromAnswerData, GenerateMilestoneFromDepenseData, FundingEnvelopeData, CoremuOperationData, CoremuAddFinancerData, CoremuPayFinancerData, CoremuValidateFinancerPaymentData, CoremuDeleteFinancerData, CostumProjectActionRequestNewData, CostumProjectActionRequestSetStatusData, CostumProjectActionRequestSetDateData, CostumProjectActionRequestSetContributorsData, CostumProjectActionRequestCancelData, CostumProjectActionRequestArchiveData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData, PersonActivateData, PersonValidateInvitationData, ValidateInvitationByMailData, ImportPreviewData, ExportElementsData, ImportElementsData, GeocodageData, ValidateGroupData, SetSourceData, TransferSourceCheckData, TransferSourceApplyData, TransferSourceRollbackData, TransferSourceHistoryData, ModerateData, NewsModerateData, CommentModerateData, UploadDocumentData, ZoneGetShapeData, ZoneGetZonirisData, CostumListValuesData, CostumResolvedData, DirectoryProposalData, DirectoryProposalCountData, DirectoryProposalNewCounterData, CostumCreateAmpliData, CostumRemoveAmpliData } from "./EndpointApi.types.js";
2
+ import type { DocumentListData, PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, PasswordResetData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, RelaunchInvitationData, ContactSendData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, GetCommentsByPathData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, GetDiscussionsData, MarkCommentsSeenData, GetDiscussionSpaceData, CreateDiscussionData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GlobalAutocompleteAdminCostumData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetUserEligiblePlacesData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, LinkSetRolesData, CreateInvitationLinkData, ConnectByRefData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, SaveCitoyenData, AddProjectData, AddPoiData, AddEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, SearchEventsCostumData, ShareEventsData, InviteMembersData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, NavigatorGettlData, NavigatorGetRessourceTlData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, AgendaGetPdfData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, GetCoformByIdData, CoformUploadAnswerFileData, DeleteCoformAnswerFileData, CoformGetAnswerFilesData, GetCoformCatalogsData, SaveCoformAnswerData, GetCoformAnswerHistoryData, GetCoformMultievalDataData, GetCoformCommontableContributorsData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, CostumFilterCoformByPathData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, CostumToolsCatalogData, CostumToolUsersData, CostumCommunInfoData, CostumSaveToolEnrichmentData, CostumCommunListData, GenerateAnswerFromFormData, GenerateProjectFromAnswerData, GenerateMilestoneFromDepenseData, FundingEnvelopeData, CoremuOperationData, CoremuAddFinancerData, CoremuPayFinancerData, CoremuValidateFinancerPaymentData, CoremuDeleteFinancerData, CostumProjectActionRequestNewData, CostumProjectActionRequestSetStatusData, CostumProjectActionRequestSetDateData, CostumProjectActionRequestSetContributorsData, CostumProjectActionRequestCancelData, CostumProjectActionRequestArchiveData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData, PersonActivateData, PersonValidateInvitationData, ValidateInvitationByMailData, ImportPreviewData, ExportElementsData, ImportElementsData, GeocodageData, ValidateGroupData, SetSourceData, TransferSourceCheckData, TransferSourceApplyData, TransferSourceRollbackData, TransferSourceHistoryData, ModerateData, NewsModerateData, CommentModerateData, UploadDocumentData, ZoneGetShapeData, ZoneGetZonirisData, CostumListValuesData, CostumResolvedData, DirectoryProposalData, DirectoryProposalCountData, DirectoryProposalNewCounterData, CostumCreateAmpliData, CostumRemoveAmpliData } from "./EndpointApi.types.js";
3
3
  /**
4
4
  * Classe EndpointApi générée automatiquement depuis endpoints-copie.json
5
5
  */
@@ -356,7 +356,16 @@ export declare class EndpointApi {
356
356
  */
357
357
  getComments(data: GetCommentsData): Promise<any>;
358
358
  /**
359
- * Ajouter un commentaire : Ajoute un commentaire à une actualité ou autre contexte.
359
+ * Récupérer les commentaires d'un fil désigné par son path : Récupère les messages d'UN fil d'un élément : ceux dont le `path` est celui demandé (une question d'un formulaire). Sans path (GET_COMMENTS), tous les fils de l'élément sont rendus mêlés. Le path passe dans l'URL : posté dans le corps, il est ignoré (liaison Yii des paramètres d'action).
360
+ * Constant : GET_COMMENTS_BY_PATH
361
+ * @param data - Données envoyées à l'API
362
+ * @returns Les données de réponse.
363
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
364
+ * @throws {Error} - En cas d'erreur inattendue.
365
+ */
366
+ getCommentsByPath(data: GetCommentsByPathData): Promise<any>;
367
+ /**
368
+ * Ajouter un commentaire : Ajoute un commentaire à l'un des dix types commentables (actualité, organisation, projet, événement, POI, réponse, formulaire, annonce, action, personne).
360
369
  * Constant : ADD_COMMENTS
361
370
  * @param data - Données envoyées à l'API
362
371
  * @returns Les données de réponse.
@@ -385,6 +394,45 @@ export declare class EndpointApi {
385
394
  * @throws {Error} - En cas d'erreur inattendue.
386
395
  */
387
396
  updateComments(data: UpdateCommentsData): Promise<any>;
397
+ /**
398
+ * Panneau Discussions : Le panneau « Discussions » de la personne connectée : les porteurs (rail) et leurs fils, ou un seul fil. Le MODE se déduit du périmètre reçu (rien → rail ; carrier → fils ; contextType+contextId → fil) et ne l'élargit jamais ; `depth:"all"` seul demande tout. Aucun texte de message ne transite : titres, compteurs, dates. Les compteurs unread/mine sont calculés pour la session, jamais pour un utilisateur passé en paramètre. Façade : Api.discussions.list().
399
+ * Constant : GET_DISCUSSIONS
400
+ * @param data - Données envoyées à l'API
401
+ * @returns Les données de réponse.
402
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
403
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
404
+ * @throws {Error} - En cas d'erreur inattendue.
405
+ */
406
+ getDiscussions(data: GetDiscussionsData): Promise<any>;
407
+ /**
408
+ * Marquer un fil comme lu : Marque comme LUS, pour la personne connectée, les messages d'un fil (views.<userId>.date). L'utilisateur vient de la session. Rouvrir un fil déjà lu n'écrit rien (marked = 0, pas une erreur). Le path absent vise le fil des messages SANS chemin, pas tous les fils du contexte. `ids` RESTREINT aux messages affichés (le contexte et le chemin restent exigés) ; absent, tout le fil. Un fil illisible pour le lecteur rend {result:true, marked:0}. Façade : Api.discussions.markSeen().
409
+ * Constant : MARK_COMMENTS_SEEN
410
+ * @param data - Données envoyées à l'API
411
+ * @returns Les données de réponse.
412
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
413
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
414
+ * @throws {Error} - En cas d'erreur inattendue.
415
+ */
416
+ markCommentsSeen(data: MarkCommentsSeenData): Promise<any>;
417
+ /**
418
+ * Espace de discussion d'un commun : Tous les fils d'un commun (une réponse `answers` à un appel) : fil général (answers:<commun>), questions, lignes de dépense et discussions supplémentaires (forms:<appel> avec un path dont le 3e segment est le commun). Session FACULTATIVE (auth none : le jeton est joint quand il existe) ; compteurs et audiences calculés pour la session. La liste fait autorité : un fil rendu est lisible par ce lecteur. Aucun texte de message. Façade : Api.discussions.space().
419
+ * Constant : GET_DISCUSSION_SPACE
420
+ * @param data - Données envoyées à l'API
421
+ * @returns Les données de réponse.
422
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
423
+ * @throws {Error} - En cas d'erreur inattendue.
424
+ */
425
+ getDiscussionSpace(data: GetDiscussionSpaceData): Promise<any>;
426
+ /**
427
+ * Créer une discussion supplémentaire sur un commun : Le bouton « + » de l'espace : une discussion de plus sur un commun, nommée, réservée à une audience. La requête ne porte AUCUN chemin : clé, étape et path sont fabriqués par le serveur. Qui crée : admin de l'appel (les trois audiences), déposant du commun ou référent (authorAll, authorAdmin) — la même règle que `creatableAudiences` de l'espace. Le nom est ramené à du texte nu (1 à 120 caractères visibles, sinon refusé, jamais tronqué) ; 50 discussions au plus par commun ; aucune notification. Façade : Api.discussions.create().
428
+ * Constant : CREATE_DISCUSSION
429
+ * @param data - Données envoyées à l'API
430
+ * @returns Les données de réponse.
431
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
432
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
433
+ * @throws {Error} - En cas d'erreur inattendue.
434
+ */
435
+ createDiscussion(data: CreateDiscussionData): Promise<any>;
388
436
  /**
389
437
  * Rechercher des tags : Recherche des tags correspondant à un mot-clé.
390
438
  * Constant : SEARCH_TAGS
@@ -979,9 +979,9 @@ export interface ShareNewsData {
979
979
  export interface GetCommentsData {
980
980
  pathParams?: {
981
981
  /**
982
- * Type de l'élément
982
+ * Type (collection) de l'élément commenté — les dix types commentables
983
983
  */
984
- type: "news";
984
+ type: "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "answers" | "forms" | "classifieds" | "actions";
985
985
  /**
986
986
  * ID de l'élément dont on veut récupérer les commentaires
987
987
  */
@@ -990,6 +990,24 @@ export interface GetCommentsData {
990
990
  };
991
991
  [k: string]: unknown;
992
992
  }
993
+ export interface GetCommentsByPathData {
994
+ pathParams?: {
995
+ /**
996
+ * Type (collection) de l'élément commenté — les dix types commentables
997
+ */
998
+ type: "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "answers" | "forms" | "classifieds" | "actions";
999
+ /**
1000
+ * ID de l'élément dont on veut récupérer les commentaires
1001
+ */
1002
+ id: string;
1003
+ /**
1004
+ * Chemin du fil (une question d'un formulaire) : segments [A-Za-z0-9_-] séparés par des points
1005
+ */
1006
+ path: string;
1007
+ [k: string]: unknown;
1008
+ };
1009
+ [k: string]: unknown;
1010
+ }
993
1011
  export interface AddCommentsData {
994
1012
  /**
995
1013
  * ID du commentaire parent (optionnel) ou chaîne vide
@@ -1004,9 +1022,9 @@ export interface AddCommentsData {
1004
1022
  */
1005
1023
  contextId: string;
1006
1024
  /**
1007
- * Type de l'élément auquel le commentaire est associé
1025
+ * Type (collection) de l'élément auquel le commentaire est associé — requis, sans défaut (un défaut serait INJECTÉ par AJV)
1008
1026
  */
1009
- contextType: "news";
1027
+ contextType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "answers" | "forms" | "classifieds" | "actions";
1010
1028
  /**
1011
1029
  * Valeur de l'argument (optionnel)
1012
1030
  */
@@ -1053,6 +1071,25 @@ export interface AddCommentsData {
1053
1071
  * Contexte costum : collection de l'entité porteuse (organizations | projects | events | citoyens). Facultatif, complète costumSlug.
1054
1072
  */
1055
1073
  costumType?: string;
1074
+ /**
1075
+ * Images du commentaire : identifiants des documents téléversés (UPLOAD_DOCUMENT, folder `comments`). `countImages` : le legacy l'écrit en chaîne. Omis à l'update → le serveur retire les images ($unset).
1076
+ */
1077
+ mediaImg?: {
1078
+ /**
1079
+ * Nombre d'images (entier ou chaîne, parité legacy)
1080
+ */
1081
+ countImages?: number | string;
1082
+ /**
1083
+ * Identifiants des documents (24 hex)
1084
+ *
1085
+ * @maxItems 5
1086
+ */
1087
+ images: [] | [string] | [string, string] | [string, string, string] | [string, string, string, string] | [string, string, string, string, string];
1088
+ };
1089
+ /**
1090
+ * Le texte est en markdown. Recalculé par le serveur à chaque écriture : absent → faux (le legacy perd la mise en forme)
1091
+ */
1092
+ markdownActive?: boolean;
1056
1093
  [k: string]: unknown;
1057
1094
  }
1058
1095
  export interface DeleteCommentsData {
@@ -1070,6 +1107,9 @@ export interface UpdateCommentsData {
1070
1107
  * ID du commentaire à mettre à jour
1071
1108
  */
1072
1109
  id: string;
1110
+ /**
1111
+ * Liste blanche : text (requis), mentions, mediaImg, markdownActive. Le serveur RETIRE mentions et mediaImg s'ils manquent, et remet markdownActive à faux.
1112
+ */
1073
1113
  params: {
1074
1114
  /**
1075
1115
  * Nouveau texte du commentaire
@@ -1101,10 +1141,109 @@ export interface UpdateCommentsData {
1101
1141
  */
1102
1142
  count: number;
1103
1143
  }[];
1144
+ /**
1145
+ * Images du commentaire : identifiants des documents téléversés (UPLOAD_DOCUMENT, folder `comments`). `countImages` : le legacy l'écrit en chaîne. Omis à l'update → le serveur retire les images ($unset).
1146
+ */
1147
+ mediaImg?: {
1148
+ /**
1149
+ * Nombre d'images (entier ou chaîne, parité legacy)
1150
+ */
1151
+ countImages?: number | string;
1152
+ /**
1153
+ * Identifiants des documents (24 hex)
1154
+ *
1155
+ * @maxItems 5
1156
+ */
1157
+ images: [] | [string] | [string, string] | [string, string, string] | [string, string, string, string] | [string, string, string, string, string];
1158
+ };
1159
+ /**
1160
+ * Le texte est en markdown. Recalculé par le serveur à chaque écriture : absent → faux (le legacy perd la mise en forme)
1161
+ */
1162
+ markdownActive?: boolean;
1104
1163
  [k: string]: unknown;
1105
1164
  };
1106
1165
  [k: string]: unknown;
1107
1166
  }
1167
+ export interface GetDiscussionsData {
1168
+ /**
1169
+ * Ne sert qu'à demander `all` (jamais implicite, charge tout le parc). Les trois autres se déduisent du périmètre ; ne pas le passer « pour être explicite »
1170
+ */
1171
+ depth?: "rail" | "fils" | "fil" | "all";
1172
+ /**
1173
+ * Porteur `type:id` (mode fils)
1174
+ */
1175
+ carrier?: string;
1176
+ /**
1177
+ * Porteur, forme éclatée (avec carrierId)
1178
+ */
1179
+ carrierType?: "citoyens" | "organizations" | "projects" | "events" | "cities" | "poi" | "classifieds";
1180
+ carrierId?: string;
1181
+ /**
1182
+ * Un fil précis (mode fil), avec contextId
1183
+ */
1184
+ contextType?: "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "answers" | "forms" | "classifieds" | "actions";
1185
+ contextId?: string;
1186
+ /**
1187
+ * Le fil d'une question (mode fil) ; absent → le fil RACINE
1188
+ */
1189
+ path?: string;
1190
+ /**
1191
+ * Défaut serveur 200, borné à 1000
1192
+ */
1193
+ limit?: number;
1194
+ /**
1195
+ * Rendre les porteurs et fils VIERGES (défaut serveur 1). En chaîne : tout paramètre posté sous une autre forme est refusé (bad-request)
1196
+ */
1197
+ includeEmpty?: "0" | "1";
1198
+ [k: string]: unknown;
1199
+ }
1200
+ export interface MarkCommentsSeenData {
1201
+ contextType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "answers" | "forms" | "classifieds" | "actions";
1202
+ contextId: string;
1203
+ /**
1204
+ * Le fil d'une question ; absent, vide ou "0" → le fil racine. SANS défaut : un path injecté élargirait le marquage
1205
+ */
1206
+ path?: string;
1207
+ /**
1208
+ * Les messages AFFICHÉS, et eux seuls (500 au plus par appel). Un identifiant d'un autre fil ne marque rien
1209
+ *
1210
+ * @minItems 1
1211
+ * @maxItems 500
1212
+ */
1213
+ ids?: [string, ...string[]];
1214
+ [k: string]: unknown;
1215
+ }
1216
+ export interface GetDiscussionSpaceData {
1217
+ /**
1218
+ * Liste blanche : la seule nature d'espace aujourd'hui
1219
+ */
1220
+ contextType: "answers";
1221
+ /**
1222
+ * Identifiant du commun (minuscules ; le serveur accepte aussi des majuscules et les ramène)
1223
+ */
1224
+ contextId: string;
1225
+ /**
1226
+ * "0" : ne pas fabriquer les fils où personne n'a écrit (défaut serveur : rendus). En chaîne, sans défaut
1227
+ */
1228
+ includeEmpty?: "0" | "1";
1229
+ [k: string]: unknown;
1230
+ }
1231
+ export interface CreateDiscussionData {
1232
+ contextType: "answers";
1233
+ /**
1234
+ * Identifiant du commun
1235
+ */
1236
+ contextId: string;
1237
+ /**
1238
+ * Borne sur la saisie brute ; le serveur juge le texte nettoyé (bad-name)
1239
+ */
1240
+ name: string;
1241
+ /**
1242
+ * Publique · admins de l'appel, déposant et référents · admins de l'appel
1243
+ */
1244
+ audience: "authorAll" | "authorAdmin" | "private";
1245
+ [k: string]: unknown;
1246
+ }
1108
1247
  export interface SearchTagsData {
1109
1248
  pathParams?: {
1110
1249
  /**
@@ -7800,9 +7939,9 @@ export interface UploadDocumentData {
7800
7939
  folderId?: string;
7801
7940
  pathParams?: {
7802
7941
  /**
7803
- * Type (collection) de l'élément porteur
7942
+ * Type (collection) de l'élément porteur ; `comments` = image d'un commentaire, téléversée depuis la personne connectée (ownerId = me.id) AVANT le message qui la porte (mediaImg.images)
7804
7943
  */
7805
- folder: "citoyens" | "projects" | "organizations" | "events" | "poi" | "classifieds";
7944
+ folder: "citoyens" | "projects" | "organizations" | "events" | "poi" | "classifieds" | "comments";
7806
7945
  /**
7807
7946
  * ID de l'élément porteur (doit exister)
7808
7947
  */
@@ -1,5 +1,4 @@
1
1
  import { BaseEntity } from "./BaseEntity.js";
2
- import type { Comment } from "./Comment.js";
3
2
  import type { AddNewsData, UpdateNewsData } from "./EndpointApi.types.js";
4
3
  import type { NewsItemNormalized } from "./serverDataType/News.js";
5
4
  export declare class News extends BaseEntity<NewsItemNormalized> {
@@ -60,20 +59,6 @@ export declare class News extends BaseEntity<NewsItemNormalized> {
60
59
  * Constant : DELETE_NEWS
61
60
  */
62
61
  delete(): Promise<void>;
63
- /**
64
- * Créer une instance de commentaire pour cette news.
65
- * @param commentData - Données du commentaire.
66
- * @returns Instance de Comment.
67
- */
68
- comment(commentData?: Record<string, any>): Promise<Comment>;
69
- /**
70
- * Récupérer les commentaires : Récupère la liste de commentaires selon plusieurs critères.
71
- * Constant : GET_COMMENTS
72
- * @returns - Les données de réponse.
73
- * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
74
- * @throws {Error} - En cas d'erreur inattendue.
75
- */
76
- getComments(): Promise<Comment[]>;
77
62
  /**
78
63
  * Ajoute un vote sur cette news
79
64
  *