@ikatec/digisac-api-sdk 4.2.0 → 4.4.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/dist/apis/contacts/ContactsApi.cjs +70 -0
- package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.d.ts +51 -1
- package/dist/apis/contacts/ContactsApi.d.ts.map +1 -1
- package/dist/apis/contacts/ContactsApi.mjs +70 -0
- package/dist/apis/contacts/ContactsApi.mjs.map +1 -1
- package/dist/apis/contacts/types.d.ts +141 -1
- package/dist/apis/contacts/types.d.ts.map +1 -1
- package/dist/apis/dashboard/DashboardApi.cjs +36 -1
- package/dist/apis/dashboard/DashboardApi.cjs.map +1 -1
- package/dist/apis/dashboard/DashboardApi.d.ts +55 -2
- package/dist/apis/dashboard/DashboardApi.d.ts.map +1 -1
- package/dist/apis/dashboard/DashboardApi.mjs +36 -1
- package/dist/apis/dashboard/DashboardApi.mjs.map +1 -1
- package/dist/apis/dashboard/types.d.ts +71 -0
- package/dist/apis/dashboard/types.d.ts.map +1 -1
- package/dist/apis/services/ServicesApi.cjs +8 -0
- package/dist/apis/services/ServicesApi.cjs.map +1 -1
- package/dist/apis/services/ServicesApi.d.ts +7 -1
- package/dist/apis/services/ServicesApi.d.ts.map +1 -1
- package/dist/apis/services/ServicesApi.mjs +8 -0
- package/dist/apis/services/ServicesApi.mjs.map +1 -1
- package/dist/apis/services/types.d.ts +7 -0
- package/dist/apis/services/types.d.ts.map +1 -1
- package/dist/apis/tags/TagsApi.cjs +23 -0
- package/dist/apis/tags/TagsApi.cjs.map +1 -1
- package/dist/apis/tags/TagsApi.d.ts +19 -1
- package/dist/apis/tags/TagsApi.d.ts.map +1 -1
- package/dist/apis/tags/TagsApi.mjs +23 -0
- package/dist/apis/tags/TagsApi.mjs.map +1 -1
- package/dist/apis/tags/types.d.ts +8 -0
- package/dist/apis/tags/types.d.ts.map +1 -1
- package/dist/apis/users/UsersApi.cjs +77 -0
- package/dist/apis/users/UsersApi.cjs.map +1 -1
- package/dist/apis/users/UsersApi.d.ts +59 -1
- package/dist/apis/users/UsersApi.d.ts.map +1 -1
- package/dist/apis/users/UsersApi.mjs +77 -0
- package/dist/apis/users/UsersApi.mjs.map +1 -1
- package/dist/apis/users/types.d.ts +102 -0
- package/dist/apis/users/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/acceptanceTerms/AcceptanceTermsApi.test.ts +1 -1
- package/src/apis/authHistory/AuthHistoryApi.test.ts +1 -1
- package/src/apis/campaigns/CampaignsApi.test.ts +1 -1
- package/src/apis/contacts/ContactsApi.test.ts +182 -5
- package/src/apis/contacts/ContactsApi.ts +128 -0
- package/src/apis/contacts/types.ts +154 -1
- package/src/apis/dashboard/DashboardApi.test-d.ts +49 -0
- package/src/apis/dashboard/DashboardApi.test.ts +197 -9
- package/src/apis/dashboard/DashboardApi.ts +130 -2
- package/src/apis/dashboard/types.ts +78 -0
- package/src/apis/messages/MessagesApi.test.ts +3 -3
- package/src/apis/payloads.test-d.ts +26 -0
- package/src/apis/queryFormat.test.ts +91 -3
- package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.test.ts +2 -2
- package/src/apis/services/ServicesApi.test.ts +49 -0
- package/src/apis/services/ServicesApi.ts +10 -1
- package/src/apis/services/types.ts +9 -0
- package/src/apis/stickerUsers/StickerUsersApi.test.ts +1 -1
- package/src/apis/tags/TagsApi.test.ts +79 -0
- package/src/apis/tags/TagsApi.ts +57 -1
- package/src/apis/tags/types.ts +9 -0
- package/src/apis/terms/TermsApi.test.ts +1 -1
- package/src/apis/users/UsersApi.test.ts +228 -0
- package/src/apis/users/UsersApi.ts +152 -1
- package/src/apis/users/types.ts +121 -0
|
@@ -69,6 +69,76 @@ var ContactsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
69
69
|
transferTicket(contactId, payload, headers) {
|
|
70
70
|
return this.client.post(`${this.basePath}/${contactId}/ticket/transfer`, payload, headers);
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates or updates several contacts in one call. Existing contacts (same service and
|
|
74
|
+
* number or e-mail) are updated; the others are created. Returns the resulting contacts.
|
|
75
|
+
* @permissions contacts.view OR contacts.update OR contacts.create
|
|
76
|
+
*/
|
|
77
|
+
createMany(body, query, headers) {
|
|
78
|
+
const queryString = this.toQueryString(query);
|
|
79
|
+
return this.client.post(`${this.basePath}/many${queryString}`, body, headers);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Deletes every contact of the account that matches the selection.
|
|
83
|
+
* @permissions contacts.view OR contacts.destroy
|
|
84
|
+
*/
|
|
85
|
+
deleteMany(body, headers) {
|
|
86
|
+
return this.client.request("DELETE", `${this.basePath}/many`, body, headers);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Exports the contacts that match the filter as CSV. Resolves to the CSV text.
|
|
90
|
+
* @permissions contacts.view AND contacts.export
|
|
91
|
+
*/
|
|
92
|
+
exportCsv(body, headers) {
|
|
93
|
+
return this.client.post(`${this.basePath}/export/csv`, body, headers);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs
|
|
97
|
+
* in the background; the header line is validated against the service type template.
|
|
98
|
+
* Resolves to `'OK'`.
|
|
99
|
+
* @permissions contacts.view OR contacts.update OR contacts.create
|
|
100
|
+
*/
|
|
101
|
+
importCsv(body, headers) {
|
|
102
|
+
return this.client.post(`${this.basePath}/import-contacts`, body, headers);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Marks the contact as read and, when needed, syncs it with the messaging service.
|
|
106
|
+
* Resolves to `'OK'`.
|
|
107
|
+
* @permissions contacts.view OR contacts.update
|
|
108
|
+
*/
|
|
109
|
+
sync(id, body, headers) {
|
|
110
|
+
return this.client.post(`${this.basePath}/${id}/sync`, body ?? {}, headers);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Blocks or unblocks a contact. Blocking closes the contact's open ticket. Requires the
|
|
114
|
+
* block list to be active on the account.
|
|
115
|
+
* @permissions contacts.block
|
|
116
|
+
*/
|
|
117
|
+
block(id, body, headers) {
|
|
118
|
+
return this.client.post(`${this.basePath}/${id}/block`, body, headers);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Resets the contact's unread counter. Resolves to `'OK'`.
|
|
122
|
+
* @permissions contacts.view OR contacts.update
|
|
123
|
+
*/
|
|
124
|
+
markRead(id, headers) {
|
|
125
|
+
return this.client.post(`${this.basePath}/${id}/mark-read`, void 0, headers);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Returns the files and links exchanged with a contact, cursor-paginated.
|
|
129
|
+
* @permissions contacts.view
|
|
130
|
+
*/
|
|
131
|
+
getMedia(contactId, query, headers) {
|
|
132
|
+
const queryString = this.toQueryString(query);
|
|
133
|
+
return this.client.get(`${this.basePath}/${contactId}/media${queryString}`, headers);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Transfers several tickets at once to a department and/or user.
|
|
137
|
+
* @permissions tickets.transfer.all.bulk
|
|
138
|
+
*/
|
|
139
|
+
bulkTransferTickets(body, headers) {
|
|
140
|
+
return this.client.post(`${this.basePath}/ticket/bulk-transfer`, body, headers);
|
|
141
|
+
}
|
|
72
142
|
};
|
|
73
143
|
|
|
74
144
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAeA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,WAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
|
|
1
|
+
{"version":3,"file":"ContactsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n BlockContactPayload,\n BulkTransferTicketsPayload,\n BulkTransferTicketsResult,\n Contact,\n ContactMediaPage,\n ContactMediaQuery,\n ContactsSelection,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n CreateManyContactsItem,\n ExistsContactsParams,\n ExportCsvPayload,\n ExportTemplatePayload,\n ImportContactsPayload,\n SyncContactPayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n\n /**\n * Creates or updates several contacts in one call. Existing contacts (same service and\n * number or e-mail) are updated; the others are created. Returns the resulting contacts.\n * @permissions contacts.view OR contacts.update OR contacts.create\n */\n createMany(\n body: CreateManyContactsItem[],\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Contact[]> {\n const queryString = this.toQueryString(query)\n return this.client.post<Contact[], CreateManyContactsItem[]>(\n `${this.basePath}/many${queryString}`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes every contact of the account that matches the selection.\n * @permissions contacts.view OR contacts.destroy\n */\n deleteMany(body: ContactsSelection, headers?: Record<string, string>): Promise<boolean> {\n return this.client.request<boolean, ContactsSelection>(\n 'DELETE',\n `${this.basePath}/many`,\n body,\n headers,\n )\n }\n\n /**\n * Exports the contacts that match the filter as CSV. Resolves to the CSV text.\n * @permissions contacts.view AND contacts.export\n */\n exportCsv(body: ExportCsvPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, ExportCsvPayload>(`${this.basePath}/export/csv`, body, headers)\n }\n\n /**\n * Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs\n * in the background; the header line is validated against the service type template.\n * Resolves to `'OK'`.\n * @permissions contacts.view OR contacts.update OR contacts.create\n */\n importCsv(body: ImportContactsPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, ImportContactsPayload>(\n `${this.basePath}/import-contacts`,\n body,\n headers,\n )\n }\n\n /**\n * Marks the contact as read and, when needed, syncs it with the messaging service.\n * Resolves to `'OK'`.\n * @permissions contacts.view OR contacts.update\n */\n sync(id: string, body?: SyncContactPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, SyncContactPayload>(\n `${this.basePath}/${id}/sync`,\n body ?? {},\n headers,\n )\n }\n\n /**\n * Blocks or unblocks a contact. Blocking closes the contact's open ticket. Requires the\n * block list to be active on the account.\n * @permissions contacts.block\n */\n block(id: string, body: BlockContactPayload, headers?: Record<string, string>): Promise<Contact> {\n return this.client.post<Contact, BlockContactPayload>(\n `${this.basePath}/${id}/block`,\n body,\n headers,\n )\n }\n\n /**\n * Resets the contact's unread counter. Resolves to `'OK'`.\n * @permissions contacts.view OR contacts.update\n */\n markRead(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(`${this.basePath}/${id}/mark-read`, undefined, headers)\n }\n\n /**\n * Returns the files and links exchanged with a contact, cursor-paginated.\n * @permissions contacts.view\n */\n getMedia(\n contactId: string,\n query?: ContactMediaQuery,\n headers?: Record<string, string>,\n ): Promise<ContactMediaPage> {\n const queryString = this.toQueryString(query)\n return this.client.get<ContactMediaPage>(\n `${this.basePath}/${contactId}/media${queryString}`,\n headers,\n )\n }\n\n /**\n * Transfers several tickets at once to a department and/or user.\n * @permissions tickets.transfer.all.bulk\n */\n bulkTransferTickets(\n body: BulkTransferTicketsPayload,\n headers?: Record<string, string>,\n ): Promise<BulkTransferTicketsResult> {\n return this.client.post<BulkTransferTicketsResult, BulkTransferTicketsPayload>(\n `${this.basePath}/ticket/bulk-transfer`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAyBA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,WAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS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ACjB,GAAG,KAAK,SAAS,GAAG,UAAU,QAAQ,eACtC,QACD;;;;;;CAOH,oBACE,MACA,SACoC;AACpC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,wBACjB,MACA,QACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
2
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
3
|
import type { ListQuery, Paginated } from '../../core/types';
|
|
4
|
-
import type { Contact, CountContactsQuery, CountMediaResult, CreateContactPayload, ExistsContactsParams, ExportTemplatePayload, TransferTicketPayload, UpdateContactPayload } from './types';
|
|
4
|
+
import type { BlockContactPayload, BulkTransferTicketsPayload, BulkTransferTicketsResult, Contact, ContactMediaPage, ContactMediaQuery, ContactsSelection, CountContactsQuery, CountMediaResult, CreateContactPayload, CreateManyContactsItem, ExistsContactsParams, ExportCsvPayload, ExportTemplatePayload, ImportContactsPayload, SyncContactPayload, TransferTicketPayload, UpdateContactPayload } from './types';
|
|
5
5
|
export declare class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {
|
|
6
6
|
constructor(client: ApiClient);
|
|
7
7
|
/**
|
|
@@ -49,5 +49,55 @@ export declare class ContactsApi extends BaseCrudApi<Contact, CreateContactPaylo
|
|
|
49
49
|
* @permissions tickets.transfer.all OR tickets.transfer.me
|
|
50
50
|
*/
|
|
51
51
|
transferTicket(contactId: string, payload: TransferTicketPayload, headers?: Record<string, string>): Promise<unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates or updates several contacts in one call. Existing contacts (same service and
|
|
54
|
+
* number or e-mail) are updated; the others are created. Returns the resulting contacts.
|
|
55
|
+
* @permissions contacts.view OR contacts.update OR contacts.create
|
|
56
|
+
*/
|
|
57
|
+
createMany(body: CreateManyContactsItem[], query?: ListQuery<Contact>, headers?: Record<string, string>): Promise<Contact[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Deletes every contact of the account that matches the selection.
|
|
60
|
+
* @permissions contacts.view OR contacts.destroy
|
|
61
|
+
*/
|
|
62
|
+
deleteMany(body: ContactsSelection, headers?: Record<string, string>): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Exports the contacts that match the filter as CSV. Resolves to the CSV text.
|
|
65
|
+
* @permissions contacts.view AND contacts.export
|
|
66
|
+
*/
|
|
67
|
+
exportCsv(body: ExportCsvPayload, headers?: Record<string, string>): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs
|
|
70
|
+
* in the background; the header line is validated against the service type template.
|
|
71
|
+
* Resolves to `'OK'`.
|
|
72
|
+
* @permissions contacts.view OR contacts.update OR contacts.create
|
|
73
|
+
*/
|
|
74
|
+
importCsv(body: ImportContactsPayload, headers?: Record<string, string>): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Marks the contact as read and, when needed, syncs it with the messaging service.
|
|
77
|
+
* Resolves to `'OK'`.
|
|
78
|
+
* @permissions contacts.view OR contacts.update
|
|
79
|
+
*/
|
|
80
|
+
sync(id: string, body?: SyncContactPayload, headers?: Record<string, string>): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Blocks or unblocks a contact. Blocking closes the contact's open ticket. Requires the
|
|
83
|
+
* block list to be active on the account.
|
|
84
|
+
* @permissions contacts.block
|
|
85
|
+
*/
|
|
86
|
+
block(id: string, body: BlockContactPayload, headers?: Record<string, string>): Promise<Contact>;
|
|
87
|
+
/**
|
|
88
|
+
* Resets the contact's unread counter. Resolves to `'OK'`.
|
|
89
|
+
* @permissions contacts.view OR contacts.update
|
|
90
|
+
*/
|
|
91
|
+
markRead(id: string, headers?: Record<string, string>): Promise<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the files and links exchanged with a contact, cursor-paginated.
|
|
94
|
+
* @permissions contacts.view
|
|
95
|
+
*/
|
|
96
|
+
getMedia(contactId: string, query?: ContactMediaQuery, headers?: Record<string, string>): Promise<ContactMediaPage>;
|
|
97
|
+
/**
|
|
98
|
+
* Transfers several tickets at once to a department and/or user.
|
|
99
|
+
* @permissions tickets.transfer.all.bulk
|
|
100
|
+
*/
|
|
101
|
+
bulkTransferTickets(body: BulkTransferTicketsPayload, headers?: Record<string, string>): Promise<BulkTransferTicketsResult>;
|
|
52
102
|
}
|
|
53
103
|
//# sourceMappingURL=ContactsApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/contacts/ContactsApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EACV,OAAO,EACP,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,qBAAa,WAAY,SAAQ,WAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,CAAC;gBACnF,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ/F;;;OAGG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAK/F;;;OAGG;IACH,SAAS,CACP,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAA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EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ9F;;;;OAIG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAQhG;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvE;;;OAGG;IACH,QAAQ,CACN,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;;OAGG;IACH,mBAAmB,CACjB,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,yBAAyB,CAAC;CAOtC"}
|
|
@@ -66,6 +66,76 @@ var ContactsApi = class extends BaseCrudApi {
|
|
|
66
66
|
transferTicket(contactId, payload, headers) {
|
|
67
67
|
return this.client.post(`${this.basePath}/${contactId}/ticket/transfer`, payload, headers);
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates or updates several contacts in one call. Existing contacts (same service and
|
|
71
|
+
* number or e-mail) are updated; the others are created. Returns the resulting contacts.
|
|
72
|
+
* @permissions contacts.view OR contacts.update OR contacts.create
|
|
73
|
+
*/
|
|
74
|
+
createMany(body, query, headers) {
|
|
75
|
+
const queryString = this.toQueryString(query);
|
|
76
|
+
return this.client.post(`${this.basePath}/many${queryString}`, body, headers);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Deletes every contact of the account that matches the selection.
|
|
80
|
+
* @permissions contacts.view OR contacts.destroy
|
|
81
|
+
*/
|
|
82
|
+
deleteMany(body, headers) {
|
|
83
|
+
return this.client.request("DELETE", `${this.basePath}/many`, body, headers);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Exports the contacts that match the filter as CSV. Resolves to the CSV text.
|
|
87
|
+
* @permissions contacts.view AND contacts.export
|
|
88
|
+
*/
|
|
89
|
+
exportCsv(body, headers) {
|
|
90
|
+
return this.client.post(`${this.basePath}/export/csv`, body, headers);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs
|
|
94
|
+
* in the background; the header line is validated against the service type template.
|
|
95
|
+
* Resolves to `'OK'`.
|
|
96
|
+
* @permissions contacts.view OR contacts.update OR contacts.create
|
|
97
|
+
*/
|
|
98
|
+
importCsv(body, headers) {
|
|
99
|
+
return this.client.post(`${this.basePath}/import-contacts`, body, headers);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Marks the contact as read and, when needed, syncs it with the messaging service.
|
|
103
|
+
* Resolves to `'OK'`.
|
|
104
|
+
* @permissions contacts.view OR contacts.update
|
|
105
|
+
*/
|
|
106
|
+
sync(id, body, headers) {
|
|
107
|
+
return this.client.post(`${this.basePath}/${id}/sync`, body ?? {}, headers);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Blocks or unblocks a contact. Blocking closes the contact's open ticket. Requires the
|
|
111
|
+
* block list to be active on the account.
|
|
112
|
+
* @permissions contacts.block
|
|
113
|
+
*/
|
|
114
|
+
block(id, body, headers) {
|
|
115
|
+
return this.client.post(`${this.basePath}/${id}/block`, body, headers);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Resets the contact's unread counter. Resolves to `'OK'`.
|
|
119
|
+
* @permissions contacts.view OR contacts.update
|
|
120
|
+
*/
|
|
121
|
+
markRead(id, headers) {
|
|
122
|
+
return this.client.post(`${this.basePath}/${id}/mark-read`, void 0, headers);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Returns the files and links exchanged with a contact, cursor-paginated.
|
|
126
|
+
* @permissions contacts.view
|
|
127
|
+
*/
|
|
128
|
+
getMedia(contactId, query, headers) {
|
|
129
|
+
const queryString = this.toQueryString(query);
|
|
130
|
+
return this.client.get(`${this.basePath}/${contactId}/media${queryString}`, headers);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Transfers several tickets at once to a department and/or user.
|
|
134
|
+
* @permissions tickets.transfer.all.bulk
|
|
135
|
+
*/
|
|
136
|
+
bulkTransferTickets(body, headers) {
|
|
137
|
+
return this.client.post(`${this.basePath}/ticket/bulk-transfer`, body, headers);
|
|
138
|
+
}
|
|
69
139
|
};
|
|
70
140
|
|
|
71
141
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsApi.mjs","names":[],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAeA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,GAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
|
|
1
|
+
{"version":3,"file":"ContactsApi.mjs","names":[],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n BlockContactPayload,\n BulkTransferTicketsPayload,\n BulkTransferTicketsResult,\n Contact,\n ContactMediaPage,\n ContactMediaQuery,\n ContactsSelection,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n CreateManyContactsItem,\n ExistsContactsParams,\n ExportCsvPayload,\n ExportTemplatePayload,\n ImportContactsPayload,\n SyncContactPayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n\n /**\n * Creates or updates several contacts in one call. Existing contacts (same service and\n * number or e-mail) are updated; the others are created. Returns the resulting contacts.\n * @permissions contacts.view OR contacts.update OR contacts.create\n */\n createMany(\n body: CreateManyContactsItem[],\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Contact[]> {\n const queryString = this.toQueryString(query)\n return this.client.post<Contact[], CreateManyContactsItem[]>(\n `${this.basePath}/many${queryString}`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes every contact of the account that matches the selection.\n * @permissions contacts.view OR contacts.destroy\n */\n deleteMany(body: ContactsSelection, headers?: Record<string, string>): Promise<boolean> {\n return this.client.request<boolean, ContactsSelection>(\n 'DELETE',\n `${this.basePath}/many`,\n body,\n headers,\n )\n }\n\n /**\n * Exports the contacts that match the filter as CSV. Resolves to the CSV text.\n * @permissions contacts.view AND contacts.export\n */\n exportCsv(body: ExportCsvPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, ExportCsvPayload>(`${this.basePath}/export/csv`, body, headers)\n }\n\n /**\n * Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs\n * in the background; the header line is validated against the service type template.\n * Resolves to `'OK'`.\n * @permissions contacts.view OR contacts.update OR contacts.create\n */\n importCsv(body: ImportContactsPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, ImportContactsPayload>(\n `${this.basePath}/import-contacts`,\n body,\n headers,\n )\n }\n\n /**\n * Marks the contact as read and, when needed, syncs it with the messaging service.\n * Resolves to `'OK'`.\n * @permissions contacts.view OR contacts.update\n */\n sync(id: string, body?: SyncContactPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, SyncContactPayload>(\n `${this.basePath}/${id}/sync`,\n body ?? {},\n headers,\n )\n }\n\n /**\n * Blocks or unblocks a contact. Blocking closes the contact's open ticket. Requires the\n * block list to be active on the account.\n * @permissions contacts.block\n */\n block(id: string, body: BlockContactPayload, headers?: Record<string, string>): Promise<Contact> {\n return this.client.post<Contact, BlockContactPayload>(\n `${this.basePath}/${id}/block`,\n body,\n headers,\n )\n }\n\n /**\n * Resets the contact's unread counter. Resolves to `'OK'`.\n * @permissions contacts.view OR contacts.update\n */\n markRead(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(`${this.basePath}/${id}/mark-read`, undefined, headers)\n }\n\n /**\n * Returns the files and links exchanged with a contact, cursor-paginated.\n * @permissions contacts.view\n */\n getMedia(\n contactId: string,\n query?: ContactMediaQuery,\n headers?: Record<string, string>,\n ): Promise<ContactMediaPage> {\n const queryString = this.toQueryString(query)\n return this.client.get<ContactMediaPage>(\n `${this.basePath}/${contactId}/media${queryString}`,\n headers,\n )\n }\n\n /**\n * Transfers several tickets at once to a department and/or user.\n * @permissions tickets.transfer.all.bulk\n */\n bulkTransferTickets(\n body: BulkTransferTicketsPayload,\n headers?: Record<string, string>,\n ): Promise<BulkTransferTicketsResult> {\n return this.client.post<BulkTransferTicketsResult, BulkTransferTicketsPayload>(\n `${this.basePath}/ticket/bulk-transfer`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAyBA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,GAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD;;;;;;;CAQH,WACE,MACA,OACA,SACoB;EACpB,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,OAAO,eACxB,MACA,QACD;;;;;;CAOH,WAAW,MAAyB,SAAoD;AACtF,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;CAOH,UAAU,MAAwB,SAAmD;AACnF,SAAO,KAAK,OAAO,KAA+B,GAAG,KAAK,SAAS,cAAc,MAAM,QAAQ;;;;;;;;CASjG,UAAU,MAA6B,SAAmD;AACxF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;;CAQH,KAAK,IAAY,MAA2B,SAAmD;AAC7F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,QACvB,QAAQ,EAAE,EACV,QACD;;;;;;;CAQH,MAAM,IAAY,MAA2B,SAAoD;AAC/F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,SACvB,MACA,QACD;;;;;;CAOH,SAAS,IAAY,SAAmD;AACtE,SAAO,KAAK,OAAO,KAAa,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;;;;CAOzF,SACE,WACA,OACA,SAC2B;EAC3B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,UAAU,QAAQ,eACtC,QACD;;;;;;CAOH,oBACE,MACA,SACoC;AACpC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,wBACjB,MACA,QACD"}
|
|
@@ -4,7 +4,7 @@ import type { Service } from '../services/types';
|
|
|
4
4
|
import type { Tag } from '../tags/types';
|
|
5
5
|
import type { Ticket } from '../tickets/types';
|
|
6
6
|
import type { User } from '../users/types';
|
|
7
|
-
import type { ListQuery } from '../../core/types';
|
|
7
|
+
import type { IncludeItem, ListQuery, WhereClause } from '../../core/types';
|
|
8
8
|
export type ContactStatus = 'online' | 'offline' | 'absent';
|
|
9
9
|
export type ContactOrigin = 'api' | 'app' | 'campaign' | 'driver' | 'import' | 'web';
|
|
10
10
|
export type ContactData = {
|
|
@@ -191,4 +191,144 @@ export type TransferTicketPayload = {
|
|
|
191
191
|
kanbanCardSubject?: string;
|
|
192
192
|
initialMessage?: string;
|
|
193
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* One item of `POST /contacts/many`. The backend matches existing contacts by service and
|
|
196
|
+
* number (or e-mail) and updates them; the others are created. Items repeating a number of
|
|
197
|
+
* the same batch are dropped (the first one wins).
|
|
198
|
+
*/
|
|
199
|
+
export type CreateManyContactsItem = {
|
|
200
|
+
serviceId: string;
|
|
201
|
+
name: string;
|
|
202
|
+
/** Phone number with country code, or the e-mail address for e-mail connections. */
|
|
203
|
+
number: string;
|
|
204
|
+
internalName?: string;
|
|
205
|
+
personId?: string;
|
|
206
|
+
defaultDepartmentId?: string;
|
|
207
|
+
defaultUserId?: string;
|
|
208
|
+
tagIds?: string[];
|
|
209
|
+
/** When `true`, the given `tagIds` are merged into the existing ones instead of replacing them. */
|
|
210
|
+
mergeRelations?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Only `data.number` is read, as a fallback when `number` is empty; the backend rebuilds
|
|
213
|
+
* `data` from the number.
|
|
214
|
+
*/
|
|
215
|
+
data?: {
|
|
216
|
+
number: string;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Selects a set of contacts by filter. Used by `DELETE /contacts/many` and by the tag
|
|
221
|
+
* attach/detach routes. The backend always scopes the filter to the current account.
|
|
222
|
+
*
|
|
223
|
+
* `where` is required on purpose: the backend applies the operation to every contact the
|
|
224
|
+
* filter matches, so an empty filter would reach every contact of the account.
|
|
225
|
+
*/
|
|
226
|
+
export type ContactsSelection = {
|
|
227
|
+
where: WhereClause<Contact>;
|
|
228
|
+
include?: IncludeItem<Contact>[];
|
|
229
|
+
customFilter?: Record<string, unknown>;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* CSV layout of the contact export and import, as in `exportTemplate`:
|
|
233
|
+
* - `'colon'`: `;` as the column delimiter (any other value uses `,`);
|
|
234
|
+
* - `'google'`: phone columns as DDI + Phone ("Telefone") instead of DDI + Number.
|
|
235
|
+
*
|
|
236
|
+
* E-mail and webchat connections ignore it for the contact columns (Email / Email + Number).
|
|
237
|
+
*/
|
|
238
|
+
export type ContactsCsvType = 'colon' | 'google' | (string & {});
|
|
239
|
+
/** Body for `POST /contacts/export/csv`. */
|
|
240
|
+
export type ExportCsvPayload = Omit<ListQuery<Contact>, 'page' | 'perPage'> & {
|
|
241
|
+
serviceType: string;
|
|
242
|
+
type: ContactsCsvType;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Body for `POST /contacts/import-contacts`. The CSV must be uploaded first (see `FilesApi`);
|
|
246
|
+
* the header line is checked against the template of the service type and language.
|
|
247
|
+
*/
|
|
248
|
+
export type ImportContactsPayload = {
|
|
249
|
+
service: Pick<Service, 'id' | 'accountId' | 'type'>;
|
|
250
|
+
file: {
|
|
251
|
+
id: string;
|
|
252
|
+
name: string;
|
|
253
|
+
mimetype: string;
|
|
254
|
+
/** Sent by the web app; the backend reads only `id`. */
|
|
255
|
+
urlToUpload?: string;
|
|
256
|
+
};
|
|
257
|
+
csvHeaderLine: string[];
|
|
258
|
+
type: ContactsCsvType;
|
|
259
|
+
tagsIds?: string[];
|
|
260
|
+
defaultDepartmentId?: string;
|
|
261
|
+
defaultUserId?: string;
|
|
262
|
+
};
|
|
263
|
+
/** Body for `POST /contacts/:id/block`. Blocking a contact closes its open ticket. */
|
|
264
|
+
export type BlockContactPayload = {
|
|
265
|
+
block: boolean;
|
|
266
|
+
byUserId?: string;
|
|
267
|
+
description?: string;
|
|
268
|
+
};
|
|
269
|
+
/** Body for `POST /contacts/:id/sync`. */
|
|
270
|
+
export type SyncContactPayload = {
|
|
271
|
+
forceSync?: boolean;
|
|
272
|
+
};
|
|
273
|
+
export type ContactMediaType = 'media' | 'document' | 'link';
|
|
274
|
+
/**
|
|
275
|
+
* Query for `GET /contacts/:id/media`. Cursor-based: pass the previous page's `nextCursor`
|
|
276
|
+
* as `where.cursor`.
|
|
277
|
+
*/
|
|
278
|
+
export type ContactMediaQuery = {
|
|
279
|
+
where?: {
|
|
280
|
+
/** `'media'` = images and videos. Omitted = images, videos and documents. */
|
|
281
|
+
type?: ContactMediaType;
|
|
282
|
+
/** Case-insensitive filter by file name (ignored for links). */
|
|
283
|
+
name?: string;
|
|
284
|
+
cursor?: string;
|
|
285
|
+
};
|
|
286
|
+
perPage?: number;
|
|
287
|
+
order?: [string, 'ASC' | 'DESC' | 'asc' | 'desc'][];
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* One item of `GET /contacts/:id/media`. When the user cannot see the message, the
|
|
291
|
+
* identifying fields come as `'UNAUTHORIZED_MESSAGE'` and `isAuthorized` is `false`.
|
|
292
|
+
*/
|
|
293
|
+
export type ContactMediaItem = {
|
|
294
|
+
id: string;
|
|
295
|
+
/** ID of the message that carries the file or link. */
|
|
296
|
+
attachedId: string;
|
|
297
|
+
/** File name; absent for links. */
|
|
298
|
+
name?: string | null;
|
|
299
|
+
/** Only for files. */
|
|
300
|
+
mimetype?: string;
|
|
301
|
+
createdAt: string;
|
|
302
|
+
updatedAt: string;
|
|
303
|
+
accountId: string;
|
|
304
|
+
url: string | null;
|
|
305
|
+
/** Only for files (filled for videos). */
|
|
306
|
+
previewUrl?: string | null;
|
|
307
|
+
isAuthorized: boolean;
|
|
308
|
+
/** Only for `type: 'link'`. */
|
|
309
|
+
links?: string[];
|
|
310
|
+
};
|
|
311
|
+
export type ContactMediaPage = {
|
|
312
|
+
data: ContactMediaItem[];
|
|
313
|
+
limit: number;
|
|
314
|
+
hasNextPage: boolean;
|
|
315
|
+
nextCursor: string | null;
|
|
316
|
+
};
|
|
317
|
+
/** Body for `POST /contacts/ticket/bulk-transfer`. */
|
|
318
|
+
export type BulkTransferTicketsPayload = {
|
|
319
|
+
departmentId?: string;
|
|
320
|
+
/** `null` removes the assigned user. */
|
|
321
|
+
userId?: string | null;
|
|
322
|
+
comments?: string;
|
|
323
|
+
/** IDs of the tickets to transfer. Ignored when `allContactsSelected` is `true`. */
|
|
324
|
+
ticketsSelectedId?: string[];
|
|
325
|
+
allContactsSelected?: boolean;
|
|
326
|
+
/** Contact filter used with `allContactsSelected`. */
|
|
327
|
+
query?: ListQuery<Contact>;
|
|
328
|
+
};
|
|
329
|
+
export type BulkTransferTicketsResult = {
|
|
330
|
+
message: string;
|
|
331
|
+
/** IDs of the tickets actually transferred (the ones the target user can access). */
|
|
332
|
+
ticketsSelectedId: string[];
|
|
333
|
+
};
|
|
194
334
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/contacts/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/contacts/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAm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C3B,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B,CAAA"}
|
|
@@ -4,7 +4,8 @@ const require_core_BaseApi = require('../../core/BaseApi.cjs');
|
|
|
4
4
|
//#region src/apis/dashboard/DashboardApi.ts
|
|
5
5
|
/**
|
|
6
6
|
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
7
|
-
* authenticated user (no permission check).
|
|
7
|
+
* authenticated user (no permission check). Every route takes the same {@link DashboardQuery}
|
|
8
|
+
* filters; the grouped routes answer one item per day, user, department, topic or connection.
|
|
8
9
|
*/
|
|
9
10
|
var DashboardApi = class extends require_core_BaseApi.BaseApi {
|
|
10
11
|
basePath = "/dashboard";
|
|
@@ -12,6 +13,40 @@ var DashboardApi = class extends require_core_BaseApi.BaseApi {
|
|
|
12
13
|
getGeneral(query, headers) {
|
|
13
14
|
return this.client.get(`${this.basePath}/general${this.toQueryString(query)}`, headers);
|
|
14
15
|
}
|
|
16
|
+
getByPeriod(query, headers) {
|
|
17
|
+
return this.getGrouped("by-period", query, headers);
|
|
18
|
+
}
|
|
19
|
+
getByUser(query, headers) {
|
|
20
|
+
return this.getGrouped("by-user", query, headers);
|
|
21
|
+
}
|
|
22
|
+
getByDepartment(query, headers) {
|
|
23
|
+
return this.getGrouped("by-department", query, headers);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take
|
|
27
|
+
* `withTotals` (the backend ignores it).
|
|
28
|
+
*/
|
|
29
|
+
getByTopic(query, headers) {
|
|
30
|
+
return this.client.get(`${this.basePath}/by-topic${this.toQueryString(query)}`, headers);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The counts of each connection of the period (`GET /dashboard/by-service`). Does not take
|
|
34
|
+
* `withTotals` (the backend ignores it).
|
|
35
|
+
*/
|
|
36
|
+
getByService(query, headers) {
|
|
37
|
+
return this.client.get(`${this.basePath}/by-service${this.toQueryString(query)}`, headers);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the
|
|
41
|
+
* `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.
|
|
42
|
+
*/
|
|
43
|
+
getGrouped(route, query, headers) {
|
|
44
|
+
const { withTotals, ...filters } = query ?? {};
|
|
45
|
+
return this.client.get(`${this.basePath}/${route}${this.toQueryString(withTotals ? {
|
|
46
|
+
...filters,
|
|
47
|
+
withTotals: true
|
|
48
|
+
} : filters)}`, headers);
|
|
49
|
+
}
|
|
15
50
|
};
|
|
16
51
|
|
|
17
52
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/dashboard/DashboardApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type {
|
|
1
|
+
{"version":3,"file":"DashboardApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/dashboard/DashboardApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type {\n DashboardDepartmentItem,\n DashboardGeneral,\n DashboardGrouped,\n DashboardPeriodItem,\n DashboardQuery,\n DashboardServiceItem,\n DashboardTopicItem,\n DashboardUserItem,\n DashboardWithTotals,\n} from './types'\n\n/**\n * Service statistics (\"Estatísticas de atendimento\"). The `/dashboard` routes only require an\n * authenticated user (no permission check). Every route takes the same {@link DashboardQuery}\n * filters; the grouped routes answer one item per day, user, department, topic or connection.\n */\nexport class DashboardApi extends BaseApi {\n public readonly basePath = '/dashboard'\n\n /** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */\n getGeneral(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardGeneral> {\n return this.client.get<DashboardGeneral>(\n `${this.basePath}/general${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The counts of each bucket of the period (`GET /dashboard/by-period`): one item per day by default,\n * or per `grouping` (hour, week, month, year). With `withTotals: true` the answer is\n * `{ totals, items }`.\n */\n getByPeriod(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardPeriodItem>>\n getByPeriod(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByPeriod(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>>\n getByPeriod(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>> {\n return this.getGrouped<DashboardPeriodItem>('by-period', query, headers)\n }\n\n /**\n * The counts of each user of the period (`GET /dashboard/by-user`). With `withTotals: true` the\n * answer is `{ totals, items }`.\n */\n getByUser(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardUserItem>>\n getByUser(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByUser(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>>\n getByUser(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>> {\n return this.getGrouped<DashboardUserItem>('by-user', query, headers)\n }\n\n /**\n * The counts of each department of the period (`GET /dashboard/by-department`). With\n * `withTotals: true` the answer is `{ totals, items }`.\n */\n getByDepartment(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardDepartmentItem>>\n getByDepartment(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByDepartment(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>>\n getByDepartment(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>> {\n return this.getGrouped<DashboardDepartmentItem>('by-department', query, headers)\n }\n\n /**\n * The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take\n * `withTotals` (the backend ignores it).\n */\n getByTopic(\n query?: DashboardQuery,\n headers?: Record<string, string>,\n ): Promise<DashboardTopicItem[]> {\n return this.client.get<DashboardTopicItem[]>(\n `${this.basePath}/by-topic${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The counts of each connection of the period (`GET /dashboard/by-service`). Does not take\n * `withTotals` (the backend ignores it).\n */\n getByService(\n query?: DashboardQuery,\n headers?: Record<string, string>,\n ): Promise<DashboardServiceItem[]> {\n return this.client.get<DashboardServiceItem[]>(\n `${this.basePath}/by-service${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the\n * `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.\n */\n private getGrouped<TItem>(\n route: string,\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<TItem[] | DashboardGrouped<TItem>> {\n const { withTotals, ...filters } = query ?? {}\n return this.client.get<TItem[] | DashboardGrouped<TItem>>(\n `${this.basePath}/${route}${this.toQueryString(withTotals ? { ...filters, withTotals: true } : filters)}`,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAa,eAAb,cAAkCA,6BAAQ;CACxC,AAAgB,WAAW;;CAG3B,WAAW,OAAwB,SAA6D;AAC9F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,UAAU,KAAK,cAAc,MAAM,IACpD,QACD;;CAqBH,YACE,OACA,SACwE;AACxE,SAAO,KAAK,WAAgC,aAAa,OAAO,QAAQ;;CAoB1E,UACE,OACA,SACoE;AACpE,SAAO,KAAK,WAA8B,WAAW,OAAO,QAAQ;;CAoBtE,gBACE,OACA,SACgF;AAChF,SAAO,KAAK,WAAoC,iBAAiB,OAAO,QAAQ;;;;;;CAOlF,WACE,OACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,WAAW,KAAK,cAAc,MAAM,IACrD,QACD;;;;;;CAOH,aACE,OACA,SACiC;AACjC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;;;;CAOH,AAAQ,WACN,OACA,OACA,SAC4C;EAC5C,MAAM,EAAE,YAAY,GAAG,YAAY,SAAS,EAAE;AAC9C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,QAAQ,KAAK,cAAc,aAAa;GAAE,GAAG;GAAS,YAAY;GAAM,GAAG,QAAQ,IACvG,QACD"}
|
|
@@ -1,12 +1,65 @@
|
|
|
1
1
|
import { BaseApi } from '../../core/BaseApi';
|
|
2
|
-
import type { DashboardGeneral, DashboardQuery } from './types';
|
|
2
|
+
import type { DashboardDepartmentItem, DashboardGeneral, DashboardGrouped, DashboardPeriodItem, DashboardQuery, DashboardServiceItem, DashboardTopicItem, DashboardUserItem, DashboardWithTotals } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
5
|
-
* authenticated user (no permission check).
|
|
5
|
+
* authenticated user (no permission check). Every route takes the same {@link DashboardQuery}
|
|
6
|
+
* filters; the grouped routes answer one item per day, user, department, topic or connection.
|
|
6
7
|
*/
|
|
7
8
|
export declare class DashboardApi extends BaseApi {
|
|
8
9
|
readonly basePath = "/dashboard";
|
|
9
10
|
/** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */
|
|
10
11
|
getGeneral(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardGeneral>;
|
|
12
|
+
/**
|
|
13
|
+
* The counts of each bucket of the period (`GET /dashboard/by-period`): one item per day by default,
|
|
14
|
+
* or per `grouping` (hour, week, month, year). With `withTotals: true` the answer is
|
|
15
|
+
* `{ totals, items }`.
|
|
16
|
+
*/
|
|
17
|
+
getByPeriod(query: DashboardQuery & {
|
|
18
|
+
withTotals: true;
|
|
19
|
+
}, headers?: Record<string, string>): Promise<DashboardGrouped<DashboardPeriodItem>>;
|
|
20
|
+
getByPeriod(query?: DashboardQuery & {
|
|
21
|
+
withTotals?: false;
|
|
22
|
+
}, headers?: Record<string, string>): Promise<DashboardPeriodItem[]>;
|
|
23
|
+
/** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */
|
|
24
|
+
getByPeriod(query?: DashboardQuery & DashboardWithTotals, headers?: Record<string, string>): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>>;
|
|
25
|
+
/**
|
|
26
|
+
* The counts of each user of the period (`GET /dashboard/by-user`). With `withTotals: true` the
|
|
27
|
+
* answer is `{ totals, items }`.
|
|
28
|
+
*/
|
|
29
|
+
getByUser(query: DashboardQuery & {
|
|
30
|
+
withTotals: true;
|
|
31
|
+
}, headers?: Record<string, string>): Promise<DashboardGrouped<DashboardUserItem>>;
|
|
32
|
+
getByUser(query?: DashboardQuery & {
|
|
33
|
+
withTotals?: false;
|
|
34
|
+
}, headers?: Record<string, string>): Promise<DashboardUserItem[]>;
|
|
35
|
+
/** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */
|
|
36
|
+
getByUser(query?: DashboardQuery & DashboardWithTotals, headers?: Record<string, string>): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>>;
|
|
37
|
+
/**
|
|
38
|
+
* The counts of each department of the period (`GET /dashboard/by-department`). With
|
|
39
|
+
* `withTotals: true` the answer is `{ totals, items }`.
|
|
40
|
+
*/
|
|
41
|
+
getByDepartment(query: DashboardQuery & {
|
|
42
|
+
withTotals: true;
|
|
43
|
+
}, headers?: Record<string, string>): Promise<DashboardGrouped<DashboardDepartmentItem>>;
|
|
44
|
+
getByDepartment(query?: DashboardQuery & {
|
|
45
|
+
withTotals?: false;
|
|
46
|
+
}, headers?: Record<string, string>): Promise<DashboardDepartmentItem[]>;
|
|
47
|
+
/** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */
|
|
48
|
+
getByDepartment(query?: DashboardQuery & DashboardWithTotals, headers?: Record<string, string>): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>>;
|
|
49
|
+
/**
|
|
50
|
+
* The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take
|
|
51
|
+
* `withTotals` (the backend ignores it).
|
|
52
|
+
*/
|
|
53
|
+
getByTopic(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardTopicItem[]>;
|
|
54
|
+
/**
|
|
55
|
+
* The counts of each connection of the period (`GET /dashboard/by-service`). Does not take
|
|
56
|
+
* `withTotals` (the backend ignores it).
|
|
57
|
+
*/
|
|
58
|
+
getByService(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardServiceItem[]>;
|
|
59
|
+
/**
|
|
60
|
+
* `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the
|
|
61
|
+
* `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.
|
|
62
|
+
*/
|
|
63
|
+
private getGrouped;
|
|
11
64
|
}
|
|
12
65
|
//# sourceMappingURL=DashboardApi.d.ts.map
|