@ikatec/digisac-api-sdk 4.6.0 → 4.8.0
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/README.md +11 -8
- package/dist/apis/campaigns/CampaignsApi.cjs +122 -55
- package/dist/apis/campaigns/CampaignsApi.cjs.map +1 -1
- package/dist/apis/campaigns/CampaignsApi.d.ts +86 -24
- package/dist/apis/campaigns/CampaignsApi.d.ts.map +1 -1
- package/dist/apis/campaigns/CampaignsApi.mjs +120 -55
- package/dist/apis/campaigns/CampaignsApi.mjs.map +1 -1
- package/dist/apis/campaigns/types.d.ts +153 -14
- package/dist/apis/campaigns/types.d.ts.map +1 -1
- package/dist/apis/tickets/TicketsApi.cjs +74 -1
- package/dist/apis/tickets/TicketsApi.cjs.map +1 -1
- package/dist/apis/tickets/TicketsApi.d.ts +68 -3
- package/dist/apis/tickets/TicketsApi.d.ts.map +1 -1
- package/dist/apis/tickets/TicketsApi.mjs +74 -1
- package/dist/apis/tickets/TicketsApi.mjs.map +1 -1
- package/dist/apis/tickets/types.d.ts +69 -8
- package/dist/apis/tickets/types.d.ts.map +1 -1
- package/dist/incommingWebhooks/index.d.ts +10 -2
- package/dist/incommingWebhooks/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/campaigns/CampaignsApi.test.ts +177 -44
- package/src/apis/campaigns/CampaignsApi.ts +167 -45
- package/src/apis/campaigns/types.ts +165 -14
- package/src/apis/payloads.test-d.ts +74 -1
- package/src/apis/queryFormat.test.ts +48 -0
- package/src/apis/tickets/TicketsApi.test.ts +142 -5
- package/src/apis/tickets/TicketsApi.ts +135 -3
- package/src/apis/tickets/types.ts +76 -6
- package/src/incommingWebhooks/index.test-d.ts +14 -1
- package/src/incommingWebhooks/index.ts +11 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignsApi.mjs","names":[],"sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core'\nimport { BaseCrudApi } from '../../core'\nimport type {\n AutoPauseModePayload,\n Campaign,\n CampaignStats,\n CreateCampaignPayload,\n ExportCampaignResultPayload,\n ExportTemplateCsvPayload,\n HsmLimit,\n SetIntervalPayload,\n UpdateCampaignPayload,\n} from './types'\n\nexport class CampaignsApi extends BaseCrudApi<\n Campaign,\n CreateCampaignPayload,\n UpdateCampaignPayload\n> {\n constructor(client: ApiClient) {\n super(client, '/campaigns')\n\n
|
|
1
|
+
{"version":3,"file":"CampaignsApi.mjs","names":[],"sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core'\nimport { BaseCrudApi } from '../../core'\nimport type {\n AutoPauseModePayload,\n Campaign,\n CampaignContactsPage,\n CampaignContactsQuery,\n CampaignListQuery,\n CampaignStats,\n CampaignTimelineEvent,\n CreateCampaignPayload,\n ExportCampaignImportErrorsQuery,\n ExportCampaignResultPayload,\n ExportTemplateCsvPayload,\n HsmLimit,\n SetIntervalPayload,\n UpdateCampaignPayload,\n} from './types'\n\n/**\n * Campaigns (mass sending). Every `/campaigns` route requires the campaigns feature in the plan of\n * the account.\n * `getMany` takes the `where` of a `ListQuery` and the flat filters of the Campaigns screen (see\n * {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the\n * text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default\n * `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.\n */\nexport class CampaignsApi extends BaseCrudApi<\n Campaign,\n CreateCampaignPayload,\n UpdateCampaignPayload,\n CampaignListQuery,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/campaigns')\n }\n\n /**\n * Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back\n * to `importing_contacts`). It becomes `done` once every contact is fired.\n * @permissions campaigns.view\n */\n sendById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/send`, undefined, headers)\n }\n\n /**\n * Sets the campaign as `paused` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n pauseById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/pause`, undefined, headers)\n }\n\n /**\n * Sets the campaign back to `processing` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n resumeById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/resume`, undefined, headers)\n }\n\n /**\n * Fires again the messages that failed: sets them as pending and the campaign as `processing`.\n * Answers the text `'OK'` (also when nothing failed, and then the status does not change); an\n * unknown id answers `false` (status 200).\n * @permissions campaigns.view\n */\n retryById(id: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.post<'OK' | false>(`${this.basePath}/${id}/retry`, undefined, headers)\n }\n\n /**\n * Creates a copy of the campaign (`ready`, same title, messages and tags), answered without the\n * messages. An unknown id answers 500.\n * @permissions campaigns.view\n */\n duplicateById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/duplicate`, undefined, headers)\n }\n\n /** Returns the send, delivery and interaction statistics of the campaign. */\n getStatsById(id: string, headers?: Record<string, string>): Promise<CampaignStats> {\n return this.client.get<CampaignStats>(`${this.basePath}/${id}/stats`, headers)\n }\n\n /**\n * Returns the events of the campaign (created, scheduled, started, finished and the last\n * interruption), the most recent first.\n */\n getTimeline(id: string, headers?: Record<string, string>): Promise<CampaignTimelineEvent[]> {\n return this.client.get<CampaignTimelineEvent[]>(`${this.basePath}/${id}/timeline`, headers)\n }\n\n /**\n * Returns a page of the contacts of the campaign with their sending status (15 per page by\n * default). An unknown id answers an empty page.\n */\n getContacts(\n id: string,\n query?: CampaignContactsQuery,\n headers?: Record<string, string>,\n ): Promise<CampaignContactsPage> {\n return this.client.get<CampaignContactsPage>(\n `${this.basePath}/${id}/contacts${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Sets the min/max interval between the sends (whole numbers, `0` or more) and answers `true`.\n * An unknown id answers 500.\n * @permissions campaigns.view\n */\n setIntervalById(\n id: string,\n data: SetIntervalPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SetIntervalPayload>(\n `${this.basePath}/${id}/interval`,\n data,\n headers,\n )\n }\n\n /** Returns the number of contacts targeted by the campaign. */\n getContactCount(id: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/${id}/contactCount`, headers)\n }\n\n /** Counts the `ready` campaigns of a connection. An unknown id counts 0. */\n countReadyByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-ready/${serviceId}`, headers)\n }\n\n /**\n * Sets the auto-pause mode of the campaigns of the account (`settings.campaign`). Answers the\n * text `'OK'`, or `false` when the account was not updated.\n */\n setAutoPauseMode(\n data: AutoPauseModePayload,\n headers?: Record<string, string>,\n ): Promise<'OK' | false> {\n return this.client.put<'OK' | false, AutoPauseModePayload>(\n `${this.basePath}/autoPauseMode`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the contacts of the campaign and their sending result as CSV (13 columns in the\n * language of the user; `,`, or `;` with `type: 'semiColon'`), streamed without a Content-Type.\n */\n exportCampaignResult(\n data: ExportCampaignResultPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportCampaignResultPayload>(\n `${this.basePath}/export/csv`,\n data,\n headers,\n )\n }\n\n /** Exports the CSV (`;`) to fill in the contacts of a campaign of the given HSM template. */\n exportTemplateCsv(\n data: ExportTemplateCsvPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportTemplateCsvPayload>(\n `${this.basePath}/exportTemplate`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the rows of the import file that were not imported (invalid number, unknown or\n * ambiguous username) as CSV: line, name, number, username and reason.\n */\n exportImportErrors(\n id: string,\n query?: ExportCampaignImportErrorsQuery,\n headers?: Record<string, string>,\n ): Promise<string> {\n const queryString = query?.delimiter ? `?${qs.stringify({ delimiter: query.delimiter })}` : ''\n return this.client.get<string>(`${this.basePath}/${id}/import-errors${queryString}`, headers)\n }\n\n /**\n * Deletes the campaigns of the given ids and answers `true` (unknown ids are skipped). No id, or\n * an id that is not a UUID, answers 400 `{ error: 'Invalid ids', code: 'INVALID_IDS' }`.\n * @permissions campaigns.view OR campaigns.destroy\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/delete-many`,\n { ids },\n headers,\n )\n }\n\n /** Returns the HSM message usage and limit of an account. */\n getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<HsmLimit> {\n return this.client.get<HsmLimit>(`/whatsapp-business-templates/${accountId}/hsmLimit`, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA4BA,IAAa,eAAb,cAAkC,YAMhC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;;CAQ7B,SAAS,IAAY,SAAqD;AACxE,SAAO,KAAK,OAAO,KAAe,GAAG,KAAK,SAAS,GAAG,GAAG,QAAQ,QAAW,QAAQ;;;;;;CAOtF,UAAU,IAAY,SAAoD;AACxE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,QAAW,QAAQ;;;;;;CAOtF,WAAW,IAAY,SAAoD;AACzE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,UAAU,QAAW,QAAQ;;;;;;;;CASvF,UAAU,IAAY,SAAyD;AAC7E,SAAO,KAAK,OAAO,KAAmB,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,QAAW,QAAQ;;;;;;;CAQ3F,cAAc,IAAY,SAAqD;AAC7E,SAAO,KAAK,OAAO,KAAe,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;CAI3F,aAAa,IAAY,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D;;;CAIH,YAAY,WAAmB,SAAqD;AAClF,SAAO,KAAK,OAAO,IAAc,gCAAgC,UAAU,YAAY,QAAQ"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import type { ListQuery } from '../../core';
|
|
2
|
+
import type { Account } from '../accounts';
|
|
1
3
|
import type { Department } from '../departments';
|
|
2
4
|
import type { File } from '../files';
|
|
3
|
-
import type { Message } from '../messages';
|
|
4
5
|
import type { Service } from '../services';
|
|
5
6
|
import type { Tag } from '../tags';
|
|
6
7
|
import type { User } from '../users';
|
|
7
8
|
import type { WhatsappBusinessTemplate } from '../whatsappBusinessTemplates';
|
|
8
9
|
export type CampaignStatus = 'ready' | 'queued' | 'processing' | 'paused' | 'waiting_connection' | 'canceled' | 'done' | 'insufficient_credits' | 'hsm_limit_exceeded' | 'import_error' | 'error' | 'importing_contacts' | 'preventive_break';
|
|
9
10
|
export type CampaignConfig = {
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Minimum interval in ms between sends. Absent until set (a new campaign answers `config: {}`);
|
|
13
|
+
* `setIntervalById` stores a number, `updateById` stores what it is sent (a string stays a string).
|
|
14
|
+
*/
|
|
15
|
+
minInterval?: number | string;
|
|
16
|
+
/** Maximum interval in ms between sends. Same rules as `minInterval`. */
|
|
17
|
+
maxInterval?: number | string;
|
|
14
18
|
/** Column name in the import file used as the contact name. */
|
|
15
19
|
nameField?: string;
|
|
16
20
|
/** Column name in the import file used as the phone number. */
|
|
@@ -34,11 +38,22 @@ export type Campaign = {
|
|
|
34
38
|
totalContacts: number | null;
|
|
35
39
|
totalContactsImported: number | null;
|
|
36
40
|
totalValidContacts: number | null;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
/** @deprecated Never answered: the campaign has no such column. */
|
|
42
|
+
sentContacts?: number | null;
|
|
43
|
+
/** @deprecated Never answered: the campaign has no such column. */
|
|
44
|
+
viewedContacts?: number | null;
|
|
45
|
+
/** @deprecated Never answered: read `getContactCount`. */
|
|
46
|
+
contactCount?: number | null;
|
|
40
47
|
mustOpenTicket: boolean;
|
|
41
|
-
|
|
48
|
+
/** @deprecated Never answered: the campaign transformer leaves the column out. */
|
|
49
|
+
marketingIntegration?: boolean;
|
|
50
|
+
/** Always `null`: the campaign has no such column (answered by the transformer). */
|
|
51
|
+
userId?: null;
|
|
52
|
+
/** Only in `getMany`: messages sent and viewed (ack 3). */
|
|
53
|
+
stats?: {
|
|
54
|
+
sent: number;
|
|
55
|
+
viewed: number;
|
|
56
|
+
};
|
|
42
57
|
accountId: string;
|
|
43
58
|
serviceId: string;
|
|
44
59
|
defaultDepartmentId: string | null;
|
|
@@ -54,9 +69,26 @@ export type Campaign = {
|
|
|
54
69
|
createdBy?: User | null;
|
|
55
70
|
sentBy?: User | null;
|
|
56
71
|
tags?: Tag[];
|
|
57
|
-
messages?:
|
|
72
|
+
messages?: CampaignMessage[];
|
|
58
73
|
importFile?: File | null;
|
|
59
74
|
};
|
|
75
|
+
/** A message of the campaign (`campaign_messages`), as the `messages` include answers it. */
|
|
76
|
+
export type CampaignMessage = {
|
|
77
|
+
id: string;
|
|
78
|
+
text: string | null;
|
|
79
|
+
extraOptions: Record<string, unknown> | null;
|
|
80
|
+
hsmId: string | null;
|
|
81
|
+
hsmFileId: string | null;
|
|
82
|
+
accountId: string;
|
|
83
|
+
campaignId: string;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
deletedAt: string | null;
|
|
87
|
+
account?: Account;
|
|
88
|
+
file?: File | null;
|
|
89
|
+
hsmFile?: File | null;
|
|
90
|
+
hsm?: WhatsappBusinessTemplate | null;
|
|
91
|
+
};
|
|
60
92
|
export type CampaignRelationships = 'service' | 'defaultDepartment' | 'defaultUser' | 'createdBy' | 'sentBy' | 'tags' | 'messages' | 'importFile';
|
|
61
93
|
export type CampaignTemplateParameterItem = {
|
|
62
94
|
type: string;
|
|
@@ -102,6 +134,80 @@ export type CreateCampaignPayload = {
|
|
|
102
134
|
marketingIntegration?: boolean;
|
|
103
135
|
};
|
|
104
136
|
export type UpdateCampaignPayload = Partial<CreateCampaignPayload>;
|
|
137
|
+
/** The visible states the `status` filter of `getMany` takes (`'scheduled'` is derived from `isScheduled` + `sendsAt`). */
|
|
138
|
+
export type CampaignListStatus = CampaignStatus | 'scheduled';
|
|
139
|
+
/**
|
|
140
|
+
* `getMany` query: the `ListQuery` of a campaign plus the flat filters of the Campaigns screen.
|
|
141
|
+
* A flat `status` takes precedence over `where.status`. An invalid `status` or date answers 400
|
|
142
|
+
* `{ error: 'Invalid status' | 'Invalid date', code: 'FILTER_STATUS_INVALID' | 'FILTER_DATE_INVALID' }`.
|
|
143
|
+
*/
|
|
144
|
+
export type CampaignListQuery = ListQuery<Campaign> & {
|
|
145
|
+
serviceId?: string;
|
|
146
|
+
status?: CampaignListStatus;
|
|
147
|
+
/**
|
|
148
|
+
* Quality of the HSM template of the messages. `'HIGH'`, `'MEDIUM'` and `'LOW'` only filter when
|
|
149
|
+
* `include` has `messages` (the filter rewrites that include); without it they are ignored.
|
|
150
|
+
* `'UNKNOWN'` keeps the campaigns without a rated template.
|
|
151
|
+
*/
|
|
152
|
+
templateHealth?: 'UNKNOWN' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
153
|
+
/** Searches the title (accent-insensitive). */
|
|
154
|
+
q?: string;
|
|
155
|
+
/**
|
|
156
|
+
* UTC ISO date-times ending in `Z` (a date alone answers 400 `FILTER_DATE_INVALID`); the days are
|
|
157
|
+
* taken in the timezone of the account. `sentAt*` filter `startedAt`.
|
|
158
|
+
*/
|
|
159
|
+
sentAtFrom?: string;
|
|
160
|
+
sentAtTo?: string;
|
|
161
|
+
createdAtFrom?: string;
|
|
162
|
+
createdAtTo?: string;
|
|
163
|
+
};
|
|
164
|
+
/** The sending status of a contact of the campaign (`not_sent` in the filter also matches `pending`). */
|
|
165
|
+
export type CampaignContactStatus = 'pending' | 'not_sent' | 'sent' | 'received' | 'read' | 'answered' | 'quality_hold' | 'quality_dropped';
|
|
166
|
+
export type CampaignContactsQuery = {
|
|
167
|
+
page?: number;
|
|
168
|
+
perPage?: number;
|
|
169
|
+
/** Searches the name, the number and the username of the contact. */
|
|
170
|
+
search?: string;
|
|
171
|
+
contactStatus?: CampaignContactStatus[];
|
|
172
|
+
failReason?: string;
|
|
173
|
+
sortBy?: 'contactName' | 'contactNumber' | 'contactUsername' | 'status' | 'sentAt' | 'failReason';
|
|
174
|
+
sortDir?: 'ASC' | 'DESC';
|
|
175
|
+
};
|
|
176
|
+
export type CampaignContact = {
|
|
177
|
+
id: string;
|
|
178
|
+
sentAt: string | null;
|
|
179
|
+
failed: boolean;
|
|
180
|
+
failReason: string | null;
|
|
181
|
+
parameters: unknown;
|
|
182
|
+
contactName: string;
|
|
183
|
+
/** `null` for a contact known only by its username. */
|
|
184
|
+
contactNumber: string | null;
|
|
185
|
+
contactUsername: string | null;
|
|
186
|
+
contactId: string;
|
|
187
|
+
status: CampaignContactStatus;
|
|
188
|
+
};
|
|
189
|
+
export type CampaignContactsPage = {
|
|
190
|
+
data: CampaignContact[];
|
|
191
|
+
total: number;
|
|
192
|
+
limit: number;
|
|
193
|
+
skip: number;
|
|
194
|
+
currentPage: number;
|
|
195
|
+
lastPage: number;
|
|
196
|
+
from: number;
|
|
197
|
+
to: number;
|
|
198
|
+
};
|
|
199
|
+
export type CampaignTimelineEvent = {
|
|
200
|
+
/** `created`, `scheduled`, `started`, `finished` or `status-<status>`. */
|
|
201
|
+
id: string;
|
|
202
|
+
type: 'created' | 'scheduled' | 'started' | 'finished' | CampaignStatus;
|
|
203
|
+
timestamp: string;
|
|
204
|
+
/** The name of the user who created or sent the campaign, or `'Sistema'`. */
|
|
205
|
+
actor: string;
|
|
206
|
+
triggerType: 'manual' | 'automatic';
|
|
207
|
+
};
|
|
208
|
+
export type ExportCampaignImportErrorsQuery = {
|
|
209
|
+
delimiter?: ',' | ';' | ':';
|
|
210
|
+
};
|
|
105
211
|
export type CampaignStatsInfo = {
|
|
106
212
|
totalValidContacts: number;
|
|
107
213
|
totalContacts: number;
|
|
@@ -109,34 +215,67 @@ export type CampaignStatsInfo = {
|
|
|
109
215
|
firedSuccessCount: number;
|
|
110
216
|
firedFailedCount: number;
|
|
111
217
|
totalMessagesCount: number;
|
|
218
|
+
sentMessagesCount: number;
|
|
112
219
|
totalFiredCount: number;
|
|
113
220
|
firedBlockedByMessageRuleCount: number;
|
|
114
221
|
};
|
|
222
|
+
/** Messages of the campaign by ack: `error`, `sending` (0), `sentToServer` (1), `received` (2), `viewed` (3), `played` (4). */
|
|
115
223
|
export type CampaignStatsMessages = {
|
|
116
224
|
error: number;
|
|
225
|
+
sending: number;
|
|
226
|
+
sentToServer: number;
|
|
117
227
|
received: number;
|
|
118
228
|
viewed: number;
|
|
229
|
+
played: number;
|
|
119
230
|
answered: number;
|
|
120
231
|
};
|
|
121
232
|
export type CampaignStats = {
|
|
122
233
|
campaignInfo: CampaignStatsInfo;
|
|
123
234
|
messageInfo: CampaignStatsMessages;
|
|
235
|
+
/** @deprecated Kept by the backend for backward compatibility: read `campaignInfo.totalMessagesCount`. */
|
|
236
|
+
total: number;
|
|
237
|
+
/** @deprecated Read `campaignInfo.sentMessagesCount`. */
|
|
238
|
+
sent: number;
|
|
239
|
+
/** @deprecated Read `campaignInfo.firedFailedCount`. */
|
|
240
|
+
failed: number;
|
|
241
|
+
/** @deprecated Read `messageInfo.sending`. */
|
|
242
|
+
sending: number;
|
|
243
|
+
/** @deprecated Read `messageInfo.sentToServer`. */
|
|
244
|
+
sentToServer: number;
|
|
245
|
+
/** @deprecated Read `messageInfo.received`. */
|
|
246
|
+
received: number;
|
|
247
|
+
/** @deprecated Read `messageInfo.viewed`. */
|
|
248
|
+
viewed: number;
|
|
249
|
+
/** @deprecated Read `messageInfo.played`. */
|
|
250
|
+
played: number;
|
|
251
|
+
/** @deprecated Read `messageInfo.answered`. */
|
|
252
|
+
answered: number;
|
|
253
|
+
/** @deprecated Same as `messageInfo.sentToServer`. */
|
|
254
|
+
sentAndNotReceived: number;
|
|
124
255
|
};
|
|
256
|
+
/** Whole numbers, `0` or more (numeric strings are accepted). */
|
|
125
257
|
export type SetIntervalPayload = {
|
|
126
|
-
minInterval: string;
|
|
127
|
-
maxInterval: string;
|
|
258
|
+
minInterval: number | string;
|
|
259
|
+
maxInterval: number | string;
|
|
128
260
|
};
|
|
129
261
|
export type ExportCampaignResultPayload = {
|
|
130
|
-
|
|
262
|
+
where: {
|
|
263
|
+
campaignId: string;
|
|
264
|
+
[key: string]: unknown;
|
|
265
|
+
};
|
|
266
|
+
/** `'semiColon'` separates the columns with `;` (default `,`). */
|
|
267
|
+
type?: 'semiColon';
|
|
131
268
|
};
|
|
132
269
|
export type ExportTemplateCsvPayload = {
|
|
133
270
|
hsmId: string;
|
|
134
271
|
};
|
|
135
272
|
export type AutoPauseModePayload = {
|
|
136
|
-
mode:
|
|
273
|
+
mode: 'low-health' | 'medium-health' | 'disabled';
|
|
137
274
|
};
|
|
138
275
|
export type HsmLimit = {
|
|
139
276
|
hsmLimit: number;
|
|
140
277
|
hsmUsedLimit: number;
|
|
278
|
+
/** The HSM messages still available (`0` when none or the plan has no WhatsApp Business); `true` when the limit is disabled. */
|
|
279
|
+
hasLimit: number | boolean;
|
|
141
280
|
};
|
|
142
281
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/campaigns/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/campaigns/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM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MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,YAAY,GAAG,eAAe,GAAG,UAAU,CAAA;CAClD,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,gIAAgI;IAChI,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B,CAAA"}
|
|
@@ -2,21 +2,94 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/apis/tickets/TicketsApi.ts
|
|
5
|
+
/**
|
|
6
|
+
* Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,
|
|
7
|
+
* the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by
|
|
8
|
+
* `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the
|
|
9
|
+
* `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`
|
|
10
|
+
* of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the
|
|
11
|
+
* tickets of the contacts of the connections restricted to that user; the counts and `getById`
|
|
12
|
+
* do not.
|
|
13
|
+
*/
|
|
5
14
|
var TicketsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
6
15
|
constructor(client) {
|
|
7
16
|
super(client, "/tickets");
|
|
8
17
|
}
|
|
18
|
+
/** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */
|
|
19
|
+
create(body, headers) {
|
|
20
|
+
return super.create(body, headers);
|
|
21
|
+
}
|
|
22
|
+
/** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */
|
|
23
|
+
updateById(id, body, headers) {
|
|
24
|
+
return super.updateById(id, body, headers);
|
|
25
|
+
}
|
|
26
|
+
/** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */
|
|
27
|
+
deleteById(id, headers) {
|
|
28
|
+
return super.deleteById(id, headers);
|
|
29
|
+
}
|
|
9
30
|
/**
|
|
10
31
|
* Closes multiple tickets in a single request. This is the only ticket-close
|
|
11
32
|
* endpoint exposed by the API — there is no per-ticket close/update route.
|
|
12
33
|
*
|
|
13
34
|
* Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`
|
|
14
|
-
* to close every OPEN ticket matching `query` (the backend forces `isOpen: true`)
|
|
35
|
+
* to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty
|
|
36
|
+
* `where` closes every open ticket of the account. The answer has no body. Ids of closed,
|
|
37
|
+
* unknown or other accounts' tickets are skipped in silence; no id and no
|
|
38
|
+
* `allContactsSelected` answers 400 `ids not found`.
|
|
15
39
|
* @permissions tickets.close.all OR tickets.close.me
|
|
16
40
|
*/
|
|
17
41
|
closeMany(payload, headers) {
|
|
18
42
|
return this.client.put(`${this.basePath}/close-many`, payload, headers);
|
|
19
43
|
}
|
|
44
|
+
count(query, headers) {
|
|
45
|
+
return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
|
|
46
|
+
}
|
|
47
|
+
countPost(body, headers) {
|
|
48
|
+
return this.client.post(`${this.basePath}/count`, body, headers);
|
|
49
|
+
}
|
|
50
|
+
/** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */
|
|
51
|
+
countOpenByService(serviceId, headers) {
|
|
52
|
+
return this.client.get(`${this.basePath}/count-open/${serviceId}`, headers);
|
|
53
|
+
}
|
|
54
|
+
/** Counts the open tickets of a department. An unknown id counts 0. */
|
|
55
|
+
countOpenByDepartment(departmentId, headers) {
|
|
56
|
+
return this.client.get(`${this.basePath}/count-open-by-department/${departmentId}`, headers);
|
|
57
|
+
}
|
|
58
|
+
/** Counts the open tickets assigned to a user. An unknown id counts 0. */
|
|
59
|
+
countOpenByUser(userId, headers) {
|
|
60
|
+
return this.client.get(`${this.basePath}/count-open-by-user/${userId}`, headers);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while
|
|
64
|
+
* it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read
|
|
65
|
+
* `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.
|
|
66
|
+
*/
|
|
67
|
+
getFirstWaitingTime(id, headers) {
|
|
68
|
+
return this.client.get(`${this.basePath}/${id}/first-waiting-time`, headers);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,
|
|
72
|
+
* summary, dates and the messages without the internal comments), sent as the attachment
|
|
73
|
+
* `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty
|
|
74
|
+
* (`undefined`); an unknown protocol never answers.
|
|
75
|
+
*/
|
|
76
|
+
exportTxt(protocol, headers) {
|
|
77
|
+
return this.client.post(`${this.basePath}/export`, { protocol }, headers);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of
|
|
81
|
+
* the user, dates in the timezone of the account), streamed without a Content-Type.
|
|
82
|
+
*
|
|
83
|
+
* The query must include `contact` with its `service` (the History screen also includes
|
|
84
|
+
* `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),
|
|
85
|
+
* and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header
|
|
86
|
+
* is sent, the answer never ends. Leave `page` out: the route pages through every match itself
|
|
87
|
+
* (`perPage` only sets the size of each batch), and a `page` in the query is read on every
|
|
88
|
+
* batch, so its rows are repeated or the CSV comes with the header only.
|
|
89
|
+
*/
|
|
90
|
+
exportHistory(query, headers) {
|
|
91
|
+
return this.client.post(`${this.basePath}/export-history${this.toQueryString(query)}`, void 0, headers);
|
|
92
|
+
}
|
|
20
93
|
};
|
|
21
94
|
|
|
22
95
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TicketsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/tickets/TicketsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Ticket,\n CreateTicketPayload,\n UpdateTicketPayload,\n CloseManyTicketsPayload,\n} from './types'\n\nexport class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {\n constructor(client: ApiClient) {\n super(client, '/tickets')\n }\n\n /**\n * Closes multiple tickets in a single request. This is the only ticket-close\n * endpoint exposed by the API — there is no per-ticket close/update route.\n *\n * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`\n * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`)
|
|
1
|
+
{"version":3,"file":"TicketsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/tickets/TicketsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Ticket,\n CreateTicketPayload,\n UpdateTicketPayload,\n CloseManyTicketsPayload,\n TicketsCount,\n TicketsCountManyQuery,\n TicketsCountPostPayload,\n TicketsCounts,\n TicketsListQuery,\n} from './types'\n\n/**\n * Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,\n * the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by\n * `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the\n * `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`\n * of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the\n * tickets of the contacts of the connections restricted to that user; the counts and `getById`\n * do not.\n */\nexport class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {\n constructor(client: ApiClient) {\n super(client, '/tickets')\n }\n\n /** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */\n override create(body: CreateTicketPayload, headers?: Record<string, string>): Promise<Ticket> {\n return super.create(body, headers)\n }\n\n /** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */\n override updateById(\n id: string,\n body: UpdateTicketPayload,\n headers?: Record<string, string>,\n ): Promise<Ticket> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Ticket> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Closes multiple tickets in a single request. This is the only ticket-close\n * endpoint exposed by the API — there is no per-ticket close/update route.\n *\n * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`\n * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty\n * `where` closes every open ticket of the account. The answer has no body. Ids of closed,\n * unknown or other accounts' tickets are skipped in silence; no id and no\n * `allContactsSelected` answers 400 `ids not found`.\n * @permissions tickets.close.all OR tickets.close.me\n */\n closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.put<void, CloseManyTicketsPayload>(\n `${this.basePath}/close-many`,\n payload,\n headers,\n )\n }\n\n /**\n * Counts the tickets matching the query. With `queries`, answers one count per query, in the\n * same order (the root filters are then ignored).\n */\n count(query: TicketsCountManyQuery, headers?: Record<string, string>): Promise<TicketsCounts>\n count(query?: TicketsListQuery, headers?: Record<string, string>): Promise<TicketsCount>\n count(\n query?: TicketsListQuery | TicketsCountManyQuery,\n headers?: Record<string, string>,\n ): Promise<TicketsCount | TicketsCounts> {\n return this.client.get<TicketsCount | TicketsCounts>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * POST variant of `count`, for queries too long for the URL. See {@link TicketsCountPostPayload}:\n * `query` is required.\n */\n countPost(\n body: TicketsCountPostPayload & { query: { queries: TicketsListQuery[] } },\n headers?: Record<string, string>,\n ): Promise<TicketsCounts>\n countPost(body: TicketsCountPostPayload, headers?: Record<string, string>): Promise<TicketsCount>\n countPost(\n body: TicketsCountPostPayload,\n headers?: Record<string, string>,\n ): Promise<TicketsCount | TicketsCounts> {\n return this.client.post<TicketsCount | TicketsCounts, TicketsCountPostPayload>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */\n countOpenByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-open/${serviceId}`, headers)\n }\n\n /** Counts the open tickets of a department. An unknown id counts 0. */\n countOpenByDepartment(departmentId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(\n `${this.basePath}/count-open-by-department/${departmentId}`,\n headers,\n )\n }\n\n /** Counts the open tickets assigned to a user. An unknown id counts 0. */\n countOpenByUser(userId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-open-by-user/${userId}`, headers)\n }\n\n /**\n * The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while\n * it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read\n * `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.\n */\n getFirstWaitingTime(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(`${this.basePath}/${id}/first-waiting-time`, headers)\n }\n\n /**\n * Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,\n * summary, dates and the messages without the internal comments), sent as the attachment\n * `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty\n * (`undefined`); an unknown protocol never answers.\n */\n exportTxt(protocol: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, { protocol: string }>(\n `${this.basePath}/export`,\n { protocol },\n headers,\n )\n }\n\n /**\n * Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of\n * the user, dates in the timezone of the account), streamed without a Content-Type.\n *\n * The query must include `contact` with its `service` (the History screen also includes\n * `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),\n * and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header\n * is sent, the answer never ends. Leave `page` out: the route pages through every match itself\n * (`perPage` only sets the size of each batch), and a `page` in the query is read on every\n * batch, so its rows are repeated or the CSV comes with the header only.\n */\n exportHistory(query: TicketsListQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(\n `${this.basePath}/export-history${this.toQueryString(query)}`,\n undefined,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAa,aAAb,cAAgCA,qCAA8D;CAC5F,YAAY,QAAmB;AAC7B,QAAM,QAAQ,WAAW;;;CAI3B,AAAS,OAAO,MAA2B,SAAmD;AAC5F,SAAO,MAAM,OAAO,MAAM,QAAQ;;;CAIpC,AAAS,WACP,IACA,MACA,SACiB;AACjB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAAmD;AACjF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;;;;;;;CActC,UAAU,SAAkC,SAAiD;AAC3F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,cACjB,SACA,QACD;;CASH,MACE,OACA,SACuC;AACvC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;CAYH,UACE,MACA,SACuC;AACvC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;CAIH,mBAAmB,WAAmB,SAAmD;AACvF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,cAAc,aAAa,QAAQ;;;CAIrF,sBAAsB,cAAsB,SAAmD;AAC7F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,4BAA4B,gBAC7C,QACD;;;CAIH,gBAAgB,QAAgB,SAAmD;AACjF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,sBAAsB,UAAU,QAAQ;;;;;;;CAQ1F,oBAAoB,IAAY,SAAmD;AACjF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,GAAG,GAAG,sBAAsB,QAAQ;;;;;;;;CAStF,UAAU,UAAkB,SAAmD;AAC7E,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,UACjB,EAAE,UAAU,EACZ,QACD;;;;;;;;;;;;;CAcH,cAAc,OAAyB,SAAmD;AACxF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,iBAAiB,KAAK,cAAc,MAAM,IAC3D,QACA,QACD"}
|
|
@@ -1,16 +1,81 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
2
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
|
-
import type { Ticket, CreateTicketPayload, UpdateTicketPayload, CloseManyTicketsPayload } from './types';
|
|
3
|
+
import type { Ticket, CreateTicketPayload, UpdateTicketPayload, CloseManyTicketsPayload, TicketsCount, TicketsCountManyQuery, TicketsCountPostPayload, TicketsCounts, TicketsListQuery } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,
|
|
6
|
+
* the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by
|
|
7
|
+
* `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the
|
|
8
|
+
* `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`
|
|
9
|
+
* of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the
|
|
10
|
+
* tickets of the contacts of the connections restricted to that user; the counts and `getById`
|
|
11
|
+
* do not.
|
|
12
|
+
*/
|
|
4
13
|
export declare class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {
|
|
5
14
|
constructor(client: ApiClient);
|
|
15
|
+
/** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */
|
|
16
|
+
create(body: CreateTicketPayload, headers?: Record<string, string>): Promise<Ticket>;
|
|
17
|
+
/** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */
|
|
18
|
+
updateById(id: string, body: UpdateTicketPayload, headers?: Record<string, string>): Promise<Ticket>;
|
|
19
|
+
/** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */
|
|
20
|
+
deleteById(id: string, headers?: Record<string, string>): Promise<Ticket>;
|
|
6
21
|
/**
|
|
7
22
|
* Closes multiple tickets in a single request. This is the only ticket-close
|
|
8
23
|
* endpoint exposed by the API — there is no per-ticket close/update route.
|
|
9
24
|
*
|
|
10
25
|
* Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`
|
|
11
|
-
* to close every OPEN ticket matching `query` (the backend forces `isOpen: true`)
|
|
26
|
+
* to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty
|
|
27
|
+
* `where` closes every open ticket of the account. The answer has no body. Ids of closed,
|
|
28
|
+
* unknown or other accounts' tickets are skipped in silence; no id and no
|
|
29
|
+
* `allContactsSelected` answers 400 `ids not found`.
|
|
12
30
|
* @permissions tickets.close.all OR tickets.close.me
|
|
13
31
|
*/
|
|
14
|
-
closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<
|
|
32
|
+
closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Counts the tickets matching the query. With `queries`, answers one count per query, in the
|
|
35
|
+
* same order (the root filters are then ignored).
|
|
36
|
+
*/
|
|
37
|
+
count(query: TicketsCountManyQuery, headers?: Record<string, string>): Promise<TicketsCounts>;
|
|
38
|
+
count(query?: TicketsListQuery, headers?: Record<string, string>): Promise<TicketsCount>;
|
|
39
|
+
/**
|
|
40
|
+
* POST variant of `count`, for queries too long for the URL. See {@link TicketsCountPostPayload}:
|
|
41
|
+
* `query` is required.
|
|
42
|
+
*/
|
|
43
|
+
countPost(body: TicketsCountPostPayload & {
|
|
44
|
+
query: {
|
|
45
|
+
queries: TicketsListQuery[];
|
|
46
|
+
};
|
|
47
|
+
}, headers?: Record<string, string>): Promise<TicketsCounts>;
|
|
48
|
+
countPost(body: TicketsCountPostPayload, headers?: Record<string, string>): Promise<TicketsCount>;
|
|
49
|
+
/** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */
|
|
50
|
+
countOpenByService(serviceId: string, headers?: Record<string, string>): Promise<number>;
|
|
51
|
+
/** Counts the open tickets of a department. An unknown id counts 0. */
|
|
52
|
+
countOpenByDepartment(departmentId: string, headers?: Record<string, string>): Promise<number>;
|
|
53
|
+
/** Counts the open tickets assigned to a user. An unknown id counts 0. */
|
|
54
|
+
countOpenByUser(userId: string, headers?: Record<string, string>): Promise<number>;
|
|
55
|
+
/**
|
|
56
|
+
* The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while
|
|
57
|
+
* it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read
|
|
58
|
+
* `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.
|
|
59
|
+
*/
|
|
60
|
+
getFirstWaitingTime(id: string, headers?: Record<string, string>): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,
|
|
63
|
+
* summary, dates and the messages without the internal comments), sent as the attachment
|
|
64
|
+
* `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty
|
|
65
|
+
* (`undefined`); an unknown protocol never answers.
|
|
66
|
+
*/
|
|
67
|
+
exportTxt(protocol: string, headers?: Record<string, string>): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of
|
|
70
|
+
* the user, dates in the timezone of the account), streamed without a Content-Type.
|
|
71
|
+
*
|
|
72
|
+
* The query must include `contact` with its `service` (the History screen also includes
|
|
73
|
+
* `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),
|
|
74
|
+
* and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header
|
|
75
|
+
* is sent, the answer never ends. Leave `page` out: the route pages through every match itself
|
|
76
|
+
* (`perPage` only sets the size of each batch), and a `page` in the query is read on every
|
|
77
|
+
* batch, so its rows are repeated or the CSV comes with the header only.
|
|
78
|
+
*/
|
|
79
|
+
exportHistory(query: TicketsListQuery, headers?: Record<string, string>): Promise<string>;
|
|
15
80
|
}
|
|
16
81
|
//# sourceMappingURL=TicketsApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TicketsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/tickets/TicketsApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"TicketsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/tickets/TicketsApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAEhB;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;gBAC/E,MAAM,EAAE,SAAS;IAI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,CAAC;IAYjG,uFAAuF;IACvF,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxF,uEAAuE;IACvE,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAO9F,0EAA0E;IAC1E,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlF;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlF;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ9E;;;;;;;;;;OAUG;IACH,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAO1F"}
|
|
@@ -1,21 +1,94 @@
|
|
|
1
1
|
import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/apis/tickets/TicketsApi.ts
|
|
4
|
+
/**
|
|
5
|
+
* Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,
|
|
6
|
+
* the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by
|
|
7
|
+
* `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the
|
|
8
|
+
* `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`
|
|
9
|
+
* of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the
|
|
10
|
+
* tickets of the contacts of the connections restricted to that user; the counts and `getById`
|
|
11
|
+
* do not.
|
|
12
|
+
*/
|
|
4
13
|
var TicketsApi = class extends BaseCrudApi {
|
|
5
14
|
constructor(client) {
|
|
6
15
|
super(client, "/tickets");
|
|
7
16
|
}
|
|
17
|
+
/** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */
|
|
18
|
+
create(body, headers) {
|
|
19
|
+
return super.create(body, headers);
|
|
20
|
+
}
|
|
21
|
+
/** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */
|
|
22
|
+
updateById(id, body, headers) {
|
|
23
|
+
return super.updateById(id, body, headers);
|
|
24
|
+
}
|
|
25
|
+
/** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */
|
|
26
|
+
deleteById(id, headers) {
|
|
27
|
+
return super.deleteById(id, headers);
|
|
28
|
+
}
|
|
8
29
|
/**
|
|
9
30
|
* Closes multiple tickets in a single request. This is the only ticket-close
|
|
10
31
|
* endpoint exposed by the API — there is no per-ticket close/update route.
|
|
11
32
|
*
|
|
12
33
|
* Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`
|
|
13
|
-
* to close every OPEN ticket matching `query` (the backend forces `isOpen: true`)
|
|
34
|
+
* to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty
|
|
35
|
+
* `where` closes every open ticket of the account. The answer has no body. Ids of closed,
|
|
36
|
+
* unknown or other accounts' tickets are skipped in silence; no id and no
|
|
37
|
+
* `allContactsSelected` answers 400 `ids not found`.
|
|
14
38
|
* @permissions tickets.close.all OR tickets.close.me
|
|
15
39
|
*/
|
|
16
40
|
closeMany(payload, headers) {
|
|
17
41
|
return this.client.put(`${this.basePath}/close-many`, payload, headers);
|
|
18
42
|
}
|
|
43
|
+
count(query, headers) {
|
|
44
|
+
return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
|
|
45
|
+
}
|
|
46
|
+
countPost(body, headers) {
|
|
47
|
+
return this.client.post(`${this.basePath}/count`, body, headers);
|
|
48
|
+
}
|
|
49
|
+
/** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */
|
|
50
|
+
countOpenByService(serviceId, headers) {
|
|
51
|
+
return this.client.get(`${this.basePath}/count-open/${serviceId}`, headers);
|
|
52
|
+
}
|
|
53
|
+
/** Counts the open tickets of a department. An unknown id counts 0. */
|
|
54
|
+
countOpenByDepartment(departmentId, headers) {
|
|
55
|
+
return this.client.get(`${this.basePath}/count-open-by-department/${departmentId}`, headers);
|
|
56
|
+
}
|
|
57
|
+
/** Counts the open tickets assigned to a user. An unknown id counts 0. */
|
|
58
|
+
countOpenByUser(userId, headers) {
|
|
59
|
+
return this.client.get(`${this.basePath}/count-open-by-user/${userId}`, headers);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while
|
|
63
|
+
* it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read
|
|
64
|
+
* `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.
|
|
65
|
+
*/
|
|
66
|
+
getFirstWaitingTime(id, headers) {
|
|
67
|
+
return this.client.get(`${this.basePath}/${id}/first-waiting-time`, headers);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,
|
|
71
|
+
* summary, dates and the messages without the internal comments), sent as the attachment
|
|
72
|
+
* `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty
|
|
73
|
+
* (`undefined`); an unknown protocol never answers.
|
|
74
|
+
*/
|
|
75
|
+
exportTxt(protocol, headers) {
|
|
76
|
+
return this.client.post(`${this.basePath}/export`, { protocol }, headers);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of
|
|
80
|
+
* the user, dates in the timezone of the account), streamed without a Content-Type.
|
|
81
|
+
*
|
|
82
|
+
* The query must include `contact` with its `service` (the History screen also includes
|
|
83
|
+
* `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),
|
|
84
|
+
* and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header
|
|
85
|
+
* is sent, the answer never ends. Leave `page` out: the route pages through every match itself
|
|
86
|
+
* (`perPage` only sets the size of each batch), and a `page` in the query is read on every
|
|
87
|
+
* batch, so its rows are repeated or the CSV comes with the header only.
|
|
88
|
+
*/
|
|
89
|
+
exportHistory(query, headers) {
|
|
90
|
+
return this.client.post(`${this.basePath}/export-history${this.toQueryString(query)}`, void 0, headers);
|
|
91
|
+
}
|
|
19
92
|
};
|
|
20
93
|
|
|
21
94
|
//#endregion
|