@ikatec/digisac-api-sdk 4.14.0 → 4.15.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 +7 -2
- package/dist/apis/authHistory/AuthHistoryApi.cjs +9 -2
- package/dist/apis/authHistory/AuthHistoryApi.cjs.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.d.ts +7 -2
- package/dist/apis/authHistory/AuthHistoryApi.d.ts.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.mjs +9 -2
- package/dist/apis/authHistory/AuthHistoryApi.mjs.map +1 -1
- package/dist/apis/authHistory/types.d.ts +6 -1
- package/dist/apis/authHistory/types.d.ts.map +1 -1
- package/dist/apis/contacts/ContactsApi.cjs +10 -0
- package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.d.ts +10 -2
- package/dist/apis/contacts/ContactsApi.d.ts.map +1 -1
- package/dist/apis/contacts/ContactsApi.mjs +10 -0
- package/dist/apis/contacts/ContactsApi.mjs.map +1 -1
- package/dist/apis/contacts/types.d.ts +76 -2
- package/dist/apis/contacts/types.d.ts.map +1 -1
- package/dist/apis/files/FilesApi.cjs +13 -1
- package/dist/apis/files/FilesApi.cjs.map +1 -1
- package/dist/apis/files/FilesApi.d.ts +12 -2
- package/dist/apis/files/FilesApi.d.ts.map +1 -1
- package/dist/apis/files/FilesApi.mjs +13 -1
- package/dist/apis/files/FilesApi.mjs.map +1 -1
- package/dist/apis/files/types.d.ts +19 -1
- package/dist/apis/files/types.d.ts.map +1 -1
- package/dist/core/BaseReadApi.cjs +2 -2
- package/dist/core/BaseReadApi.cjs.map +1 -1
- package/dist/core/BaseReadApi.d.ts +2 -2
- package/dist/core/BaseReadApi.mjs +2 -2
- package/dist/core/BaseReadApi.mjs.map +1 -1
- package/package.json +1 -1
- package/src/apis/authHistory/AuthHistoryApi.test.ts +16 -0
- package/src/apis/authHistory/AuthHistoryApi.ts +10 -2
- package/src/apis/authHistory/types.ts +6 -1
- package/src/apis/contacts/ContactsApi.test.ts +13 -0
- package/src/apis/contacts/ContactsApi.ts +23 -1
- package/src/apis/contacts/types.ts +83 -1
- package/src/apis/files/FilesApi.test.ts +21 -0
- package/src/apis/files/FilesApi.ts +19 -1
- package/src/apis/files/types.ts +20 -1
- package/src/apis/payloads.test-d.ts +39 -1
- package/src/core/BaseReadApi.ts +2 -2
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Available resources:
|
|
|
84
84
|
| Accounts (deprecated: the backend serves no `/accounts`; use `MeApi.getAccount`) | `AccountsApi` | `/accounts` |
|
|
85
85
|
| Activity Log | `ActivityLogApi` | `/log` |
|
|
86
86
|
| Answers | `AnswersApi` | `/answers` |
|
|
87
|
-
| Auth History (
|
|
87
|
+
| Auth History (reads and `registerLogout`) | `AuthHistoryApi` | `/auth-history` |
|
|
88
88
|
| Bot Simulators | `BotSimulatorsApi` | `/bot-simulators` |
|
|
89
89
|
| Bot Versions (read-only; the write methods are deprecated) | `BotVersionsApi` | `/bot-versions` |
|
|
90
90
|
| Bots | `BotsApi` | `/bots` |
|
|
@@ -100,7 +100,7 @@ Available resources:
|
|
|
100
100
|
| Dashboard | `DashboardApi` | `/dashboard` |
|
|
101
101
|
| Departments | `DepartmentsApi` | `/departments` |
|
|
102
102
|
| Distribution | `DistributionApi` | `/distribution` |
|
|
103
|
-
| Files (`createToUpload` + `upload`, `create`, `deleteById`; the reads and the update are deprecated) | `FilesApi` | `/files` |
|
|
103
|
+
| Files (`createToUpload` + `upload`, `create`, `duplicateFile`, `deleteById`; the reads and the update are deprecated) | `FilesApi` | `/files` |
|
|
104
104
|
| Holidays | `HolidayApi` | `/holiday` |
|
|
105
105
|
| Integrations | `IntegrationsApi` | `/integrations` |
|
|
106
106
|
| Interactive Messages | `InteractiveMessagesApi` | `/interactive-messages` |
|
|
@@ -375,6 +375,11 @@ import { FilesApi } from '@ikatec/digisac-api-sdk/files'
|
|
|
375
375
|
const files = new FilesApi(client)
|
|
376
376
|
const file = await files.createToUpload({ name: 'contacts.csv', mimetype: 'text/csv', attachedType: 'campaign.file' })
|
|
377
377
|
await files.upload(file.urlToUpload!, csvContent, 'text/csv') // no API token: the storage refuses it
|
|
378
|
+
|
|
379
|
+
// A copy of the content: in a new record, or in a record created to receive it
|
|
380
|
+
const copyId = await files.duplicateFile({ fileId: file.id })
|
|
381
|
+
const slot = await files.createToUpload({ name: 'copy.csv', mimetype: 'text/csv' })
|
|
382
|
+
await files.duplicateFile({ fileId: file.id, urlToUpload: slot.urlToUpload! }) // resolves file.id; the copy is slot.id
|
|
378
383
|
```
|
|
379
384
|
|
|
380
385
|
## Development
|
|
@@ -3,8 +3,8 @@ const require_core_BaseReadApi = require('../../core/BaseReadApi.cjs');
|
|
|
3
3
|
|
|
4
4
|
//#region src/apis/authHistory/AuthHistoryApi.ts
|
|
5
5
|
/**
|
|
6
|
-
* Authentication events (auth, password_change, logout), read
|
|
7
|
-
* `authHistory.view
|
|
6
|
+
* Authentication events (auth, password_change, logout, 2fa_disabled), read with
|
|
7
|
+
* `authHistory.view`. Non-admin users can only see and access their own records.
|
|
8
8
|
*
|
|
9
9
|
* Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as
|
|
10
10
|
* `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent
|
|
@@ -14,6 +14,13 @@ var AuthHistoryApi = class extends require_core_BaseReadApi.BaseReadApi {
|
|
|
14
14
|
constructor(client) {
|
|
15
15
|
super(client, "/auth-history");
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Records the `logout` event of the current session, as the web app does before revoking its
|
|
19
|
+
* token (revoke the token apart: this call does not). Resolves with no body.
|
|
20
|
+
*/
|
|
21
|
+
registerLogout(headers) {
|
|
22
|
+
return this.client.post(this.basePath, {}, headers);
|
|
23
|
+
}
|
|
17
24
|
};
|
|
18
25
|
|
|
19
26
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.cjs","names":["BaseReadApi"],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseReadApi } from '../../core/BaseReadApi'\nimport type { AuthHistory } from './types'\n\n/**\n * Authentication events (auth, password_change, logout), read
|
|
1
|
+
{"version":3,"file":"AuthHistoryApi.cjs","names":["BaseReadApi"],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseReadApi } from '../../core/BaseReadApi'\nimport type { AuthHistory } from './types'\n\n/**\n * Authentication events (auth, password_change, logout, 2fa_disabled), read with\n * `authHistory.view`. Non-admin users can only see and access their own records.\n *\n * Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as\n * `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent\n * as the query string — move them to the third argument.\n */\nexport class AuthHistoryApi extends BaseReadApi<AuthHistory> {\n constructor(client: ApiClient) {\n super(client, '/auth-history')\n }\n\n /**\n * Records the `logout` event of the current session, as the web app does before revoking its\n * token (revoke the token apart: this call does not). Resolves with no body.\n */\n registerLogout(headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, Record<string, never>>(this.basePath, {}, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,iBAAb,cAAoCA,qCAAyB;CAC3D,YAAY,QAAmB;AAC7B,QAAM,QAAQ,gBAAgB;;;;;;CAOhC,eAAe,SAAiD;AAC9D,SAAO,KAAK,OAAO,KAAkC,KAAK,UAAU,EAAE,EAAE,QAAQ"}
|
|
@@ -2,8 +2,8 @@ import type { ApiClient } from '../../core/ApiClient';
|
|
|
2
2
|
import { BaseReadApi } from '../../core/BaseReadApi';
|
|
3
3
|
import type { AuthHistory } from './types';
|
|
4
4
|
/**
|
|
5
|
-
* Authentication events (auth, password_change, logout), read
|
|
6
|
-
* `authHistory.view
|
|
5
|
+
* Authentication events (auth, password_change, logout, 2fa_disabled), read with
|
|
6
|
+
* `authHistory.view`. Non-admin users can only see and access their own records.
|
|
7
7
|
*
|
|
8
8
|
* Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as
|
|
9
9
|
* `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent
|
|
@@ -11,5 +11,10 @@ import type { AuthHistory } from './types';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class AuthHistoryApi extends BaseReadApi<AuthHistory> {
|
|
13
13
|
constructor(client: ApiClient);
|
|
14
|
+
/**
|
|
15
|
+
* Records the `logout` event of the current session, as the web app does before revoking its
|
|
16
|
+
* token (revoke the token apart: this call does not). Resolves with no body.
|
|
17
|
+
*/
|
|
18
|
+
registerLogout(headers?: Record<string, string>): Promise<void>;
|
|
14
19
|
}
|
|
15
20
|
//# sourceMappingURL=AuthHistoryApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,WAAW,CAAC;gBAC9C,MAAM,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,WAAW,CAAC;gBAC9C,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGhE"}
|
|
@@ -2,8 +2,8 @@ import { BaseReadApi } from "../../core/BaseReadApi.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/apis/authHistory/AuthHistoryApi.ts
|
|
4
4
|
/**
|
|
5
|
-
* Authentication events (auth, password_change, logout), read
|
|
6
|
-
* `authHistory.view
|
|
5
|
+
* Authentication events (auth, password_change, logout, 2fa_disabled), read with
|
|
6
|
+
* `authHistory.view`. Non-admin users can only see and access their own records.
|
|
7
7
|
*
|
|
8
8
|
* Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as
|
|
9
9
|
* `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent
|
|
@@ -13,6 +13,13 @@ var AuthHistoryApi = class extends BaseReadApi {
|
|
|
13
13
|
constructor(client) {
|
|
14
14
|
super(client, "/auth-history");
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Records the `logout` event of the current session, as the web app does before revoking its
|
|
18
|
+
* token (revoke the token apart: this call does not). Resolves with no body.
|
|
19
|
+
*/
|
|
20
|
+
registerLogout(headers) {
|
|
21
|
+
return this.client.post(this.basePath, {}, headers);
|
|
22
|
+
}
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.mjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseReadApi } from '../../core/BaseReadApi'\nimport type { AuthHistory } from './types'\n\n/**\n * Authentication events (auth, password_change, logout), read
|
|
1
|
+
{"version":3,"file":"AuthHistoryApi.mjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseReadApi } from '../../core/BaseReadApi'\nimport type { AuthHistory } from './types'\n\n/**\n * Authentication events (auth, password_change, logout, 2fa_disabled), read with\n * `authHistory.view`. Non-admin users can only see and access their own records.\n *\n * Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as\n * `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent\n * as the query string — move them to the third argument.\n */\nexport class AuthHistoryApi extends BaseReadApi<AuthHistory> {\n constructor(client: ApiClient) {\n super(client, '/auth-history')\n }\n\n /**\n * Records the `logout` event of the current session, as the web app does before revoking its\n * token (revoke the token apart: this call does not). Resolves with no body.\n */\n registerLogout(headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, Record<string, never>>(this.basePath, {}, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,iBAAb,cAAoC,YAAyB;CAC3D,YAAY,QAAmB;AAC7B,QAAM,QAAQ,gBAAgB;;;;;;CAOhC,eAAe,SAAiD;AAC9D,SAAO,KAAK,OAAO,KAAkC,KAAK,UAAU,EAAE,EAAE,QAAQ"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Account } from '../accounts/types';
|
|
2
2
|
import type { User } from '../users/types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `auth`: a login (after the second factor, when active); `password_change`: by the user, by an
|
|
5
|
+
* admin or by the password reset; `logout`: recorded by `AuthHistoryApi.registerLogout`;
|
|
6
|
+
* `2fa_disabled`: the second factor turned off, by the user or by an admin.
|
|
7
|
+
*/
|
|
8
|
+
export type AuthHistoryEvent = 'auth' | 'password_change' | 'logout' | '2fa_disabled';
|
|
4
9
|
export type AuthHistory = {
|
|
5
10
|
id: string;
|
|
6
11
|
event: AuthHistoryEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,GAAG,QAAQ,GAAG,cAAc,CAAA;AAErF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,MAAM,CAAA"}
|
|
@@ -10,6 +10,16 @@ var ContactsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
10
10
|
super(client, "/contacts");
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
+
* Returns a contact by ID. When it does not exist the route answers 200 with an empty body, which
|
|
14
|
+
* resolves to `undefined`. With `formatCustomFields: true` (and the include
|
|
15
|
+
* `{ model: 'customFieldValues', include: ['customField'] }`), the custom fields come keyed by name
|
|
16
|
+
* in `customFields`.
|
|
17
|
+
* @permissions contacts.view
|
|
18
|
+
*/
|
|
19
|
+
getById(id, query, headers) {
|
|
20
|
+
return super.getById(id, query, headers);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
13
23
|
* Downloads the CSV template (`;`-separated header line, in the language of the user) for
|
|
14
24
|
* importing contacts, with columns based on the service type. Answered with no Content-Type.
|
|
15
25
|
* @permissions contacts.view AND contacts.export
|
|
@@ -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 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 SummarizeTicketResult,\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 the CSV template (`;`-separated header line, in the language of the user) for\n * importing contacts, with columns based on the service type. Answered with no Content-Type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, 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; `csvHeaderLine` is validated against the service type template, with\n * every column of `exportTemplate` (including \"Criado em\"/\"Created at\"): a different header\n * answers 403 `Csv File - Invalid Header`. The file itself is only read by the job.\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 (`settings.isBlockListActive`; 400 otherwise).\n * `byUserId` and `description` are stored as sent: the backend does not fill in the user.\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 * Generates an AI summary of the open ticket of the contact. Consumes AI credits; resolves\n * `{ success, limitReached? }`. A contact with no open ticket (or an unknown contact) answers\n * 400.\n * @permissions tickets.update\n */\n summarizeTicket(id: string, headers?: Record<string, string>): Promise<SummarizeTicketResult> {\n return this.client.post<SummarizeTicketResult>(\n `${this.basePath}/${id}/ticket/summary`,\n undefined,\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":";;;;;;;AA0BA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;CAQ5B,eAAe,MAA6B,SAAmD;AAC7F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SA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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;;;;;;;;CASH,MAAM,IAAY,MAA2B,SAAoD;AAC/F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,SACvB,MACA,QACD;;;;;;;;CASH,gBAAgB,IAAY,SAAkE;AAC5F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,kBACvB,QACA,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"}
|
|
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 ContactGetByIdQuery,\n ContactListQuery,\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 SummarizeTicketResult,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<\n Contact,\n CreateContactPayload,\n UpdateContactPayload,\n ContactListQuery\n> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Returns a contact by ID. When it does not exist the route answers 200 with an empty body, which\n * resolves to `undefined`. With `formatCustomFields: true` (and the include\n * `{ model: 'customFieldValues', include: ['customField'] }`), the custom fields come keyed by name\n * in `customFields`.\n * @permissions contacts.view\n */\n override getById(\n id: string,\n query?: ContactGetByIdQuery,\n headers?: Record<string, string>,\n ): Promise<Contact> {\n return super.getById(id, query, headers)\n }\n\n /**\n * Downloads the CSV template (`;`-separated header line, in the language of the user) for\n * importing contacts, with columns based on the service type. Answered with no Content-Type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, 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; `csvHeaderLine` is validated against the service type template, with\n * every column of `exportTemplate` (including \"Criado em\"/\"Created at\"): a different header\n * answers 403 `Csv File - Invalid Header`. The file itself is only read by the job.\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 (`settings.isBlockListActive`; 400 otherwise).\n * `byUserId` and `description` are stored as sent: the backend does not fill in the user.\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 * Generates an AI summary of the open ticket of the contact. Consumes AI credits; resolves\n * `{ success, limitReached? }`. A contact with no open ticket (or an unknown contact) answers\n * 400.\n * @permissions tickets.update\n */\n summarizeTicket(id: string, headers?: Record<string, string>): Promise<SummarizeTicketResult> {\n return this.client.post<SummarizeTicketResult>(\n `${this.basePath}/${id}/ticket/summary`,\n undefined,\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":";;;;;;;AA4BA,IAAa,cAAb,cAAiCA,qCAK/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;;;CAU5B,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;;;;;CAQ1C,eAAe,MAA6B,SAAmD;AAC7F,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,G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AK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,kBACvB,QACA,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"}
|
|
@@ -1,9 +1,17 @@
|
|
|
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 { BlockContactPayload, BulkTransferTicketsPayload, BulkTransferTicketsResult, Contact, ContactMediaPage, ContactMediaQuery, ContactsSelection, CountContactsQuery, CountMediaResult, CreateContactPayload, CreateManyContactsItem, ExistsContactsParams, ExportCsvPayload, ExportTemplatePayload, ImportContactsPayload, SyncContactPayload, TransferTicketPayload, UpdateContactPayload, SummarizeTicketResult } from './types';
|
|
5
|
-
export declare class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {
|
|
4
|
+
import type { BlockContactPayload, BulkTransferTicketsPayload, BulkTransferTicketsResult, Contact, ContactGetByIdQuery, ContactListQuery, ContactMediaPage, ContactMediaQuery, ContactsSelection, CountContactsQuery, CountMediaResult, CreateContactPayload, CreateManyContactsItem, ExistsContactsParams, ExportCsvPayload, ExportTemplatePayload, ImportContactsPayload, SyncContactPayload, TransferTicketPayload, UpdateContactPayload, SummarizeTicketResult } from './types';
|
|
5
|
+
export declare class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload, ContactListQuery> {
|
|
6
6
|
constructor(client: ApiClient);
|
|
7
|
+
/**
|
|
8
|
+
* Returns a contact by ID. When it does not exist the route answers 200 with an empty body, which
|
|
9
|
+
* resolves to `undefined`. With `formatCustomFields: true` (and the include
|
|
10
|
+
* `{ model: 'customFieldValues', include: ['customField'] }`), the custom fields come keyed by name
|
|
11
|
+
* in `customFields`.
|
|
12
|
+
* @permissions contacts.view
|
|
13
|
+
*/
|
|
14
|
+
getById(id: string, query?: ContactGetByIdQuery, headers?: Record<string, string>): Promise<Contact>;
|
|
7
15
|
/**
|
|
8
16
|
* Downloads the CSV template (`;`-separated header line, in the language of the user) for
|
|
9
17
|
* importing contacts, with columns based on the service type. Answered with no Content-Type.
|
|
@@ -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,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,qBAAa,WAAY,SAAQ,WAAW,
|
|
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,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BAAyB,CAAC;CAOtC"}
|
|
@@ -7,6 +7,16 @@ var ContactsApi = class extends BaseCrudApi {
|
|
|
7
7
|
super(client, "/contacts");
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
+
* Returns a contact by ID. When it does not exist the route answers 200 with an empty body, which
|
|
11
|
+
* resolves to `undefined`. With `formatCustomFields: true` (and the include
|
|
12
|
+
* `{ model: 'customFieldValues', include: ['customField'] }`), the custom fields come keyed by name
|
|
13
|
+
* in `customFields`.
|
|
14
|
+
* @permissions contacts.view
|
|
15
|
+
*/
|
|
16
|
+
getById(id, query, headers) {
|
|
17
|
+
return super.getById(id, query, headers);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
10
20
|
* Downloads the CSV template (`;`-separated header line, in the language of the user) for
|
|
11
21
|
* importing contacts, with columns based on the service type. Answered with no Content-Type.
|
|
12
22
|
* @permissions contacts.view AND contacts.export
|
|
@@ -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 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 SummarizeTicketResult,\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 the CSV template (`;`-separated header line, in the language of the user) for\n * importing contacts, with columns based on the service type. Answered with no Content-Type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, 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; `csvHeaderLine` is validated against the service type template, with\n * every column of `exportTemplate` (including \"Criado em\"/\"Created at\"): a different header\n * answers 403 `Csv File - Invalid Header`. The file itself is only read by the job.\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 (`settings.isBlockListActive`; 400 otherwise).\n * `byUserId` and `description` are stored as sent: the backend does not fill in the user.\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 * Generates an AI summary of the open ticket of the contact. Consumes AI credits; resolves\n * `{ success, limitReached? }`. A contact with no open ticket (or an unknown contact) answers\n * 400.\n * @permissions tickets.update\n */\n summarizeTicket(id: string, headers?: Record<string, string>): Promise<SummarizeTicketResult> {\n return this.client.post<SummarizeTicketResult>(\n `${this.basePath}/${id}/ticket/summary`,\n undefined,\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":";;;;AA0BA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;CAQ5B,eAAe,MAA6B,SAAmD;AAC7F,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;;;;;;;;;;CAWjG,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;;;;;;;;CASH,MAAM,IAAY,MAA2B,SAAoD;AAC/F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,SACvB,MACA,QACD;;;;;;;;CASH,gBAAgB,IAAY,SAAkE;AAC5F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,kBACvB,QACA,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"}
|
|
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 ContactGetByIdQuery,\n ContactListQuery,\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 SummarizeTicketResult,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<\n Contact,\n CreateContactPayload,\n UpdateContactPayload,\n ContactListQuery\n> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Returns a contact by ID. When it does not exist the route answers 200 with an empty body, which\n * resolves to `undefined`. With `formatCustomFields: true` (and the include\n * `{ model: 'customFieldValues', include: ['customField'] }`), the custom fields come keyed by name\n * in `customFields`.\n * @permissions contacts.view\n */\n override getById(\n id: string,\n query?: ContactGetByIdQuery,\n headers?: Record<string, string>,\n ): Promise<Contact> {\n return super.getById(id, query, headers)\n }\n\n /**\n * Downloads the CSV template (`;`-separated header line, in the language of the user) for\n * importing contacts, with columns based on the service type. Answered with no Content-Type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, 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; `csvHeaderLine` is validated against the service type template, with\n * every column of `exportTemplate` (including \"Criado em\"/\"Created at\"): a different header\n * answers 403 `Csv File - Invalid Header`. The file itself is only read by the job.\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 (`settings.isBlockListActive`; 400 otherwise).\n * `byUserId` and `description` are stored as sent: the backend does not fill in the user.\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 * Generates an AI summary of the open ticket of the contact. Consumes AI credits; resolves\n * `{ success, limitReached? }`. A contact with no open ticket (or an unknown contact) answers\n * 400.\n * @permissions tickets.update\n */\n summarizeTicket(id: string, headers?: Record<string, string>): Promise<SummarizeTicketResult> {\n return this.client.post<SummarizeTicketResult>(\n `${this.basePath}/${id}/ticket/summary`,\n undefined,\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":";;;;AA4BA,IAAa,cAAb,cAAiC,YAK/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;;;CAU5B,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;;;;;CAQ1C,eAAe,MAA6B,SAAmD;AAC7F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7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mD;AAC7F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,QACvB,QAAQ,EAAE,EACV,QACD;;;;;;;;CASH,MAAM,IAAY,MAA2B,SAAoD;AAC/F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,SACvB,MACA,QACD;;;;;;;;CASH,gBAAgB,IAAY,SAAkE;AAC5F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,kBACvB,QACA,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"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { CustomField, CustomFieldType } from '../customFields/types';
|
|
1
2
|
import type { Department } from '../departments/types';
|
|
2
3
|
import type { Person } from '../people/types';
|
|
3
4
|
import type { Service } from '../services/types';
|
|
4
5
|
import type { Tag } from '../tags/types';
|
|
5
6
|
import type { Ticket } from '../tickets/types';
|
|
6
7
|
import type { User } from '../users/types';
|
|
7
|
-
import type { IncludeItem, ListQuery, WhereClause } from '../../core/types';
|
|
8
|
+
import type { GetByIdQuery, IncludeItem, ListQuery, WhereClause } from '../../core/types';
|
|
8
9
|
export type ContactStatus = 'online' | 'offline' | 'absent';
|
|
9
10
|
export type ContactOrigin = 'api' | 'app' | 'campaign' | 'driver' | 'import' | 'web';
|
|
10
11
|
export type ContactData = {
|
|
@@ -97,6 +98,52 @@ export type ContactDataBlock = {
|
|
|
97
98
|
date: string;
|
|
98
99
|
description: string;
|
|
99
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* A value of a custom field of the contact, as `include: ['customFieldValues']` answers it (the
|
|
103
|
+
* stored row).
|
|
104
|
+
*/
|
|
105
|
+
export type CustomFieldValue = {
|
|
106
|
+
id: string;
|
|
107
|
+
customFieldId: string;
|
|
108
|
+
/** The contact. */
|
|
109
|
+
relatedId: string;
|
|
110
|
+
relatedType: string | null;
|
|
111
|
+
/**
|
|
112
|
+
* The value as stored: text, or JSON text for the composite types (`date-range`, `hour-range`,
|
|
113
|
+
* `numeric`, `monetary`, `phone`, `postal-code`).
|
|
114
|
+
*/
|
|
115
|
+
value: string;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
updatedAt: string;
|
|
118
|
+
deletedAt: string | null;
|
|
119
|
+
customField?: CustomField;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* A custom field of the contact as `formatCustomFields: true` answers it, keyed by the name of the
|
|
123
|
+
* field in `Contact.customFields`.
|
|
124
|
+
*/
|
|
125
|
+
export type FormattedCustomField = {
|
|
126
|
+
name: string;
|
|
127
|
+
/** The value, parsed from JSON for the composite types. */
|
|
128
|
+
value: unknown;
|
|
129
|
+
/** Id of the value. */
|
|
130
|
+
id: string;
|
|
131
|
+
type: CustomFieldType;
|
|
132
|
+
/** Id of the field. */
|
|
133
|
+
fieldId: string;
|
|
134
|
+
/** When the field was created. */
|
|
135
|
+
createdAt: string;
|
|
136
|
+
};
|
|
137
|
+
/** A custom field value sent in the create or update of a contact. */
|
|
138
|
+
export type ContactCustomFieldInput = {
|
|
139
|
+
/**
|
|
140
|
+
* Id of the custom field (`CustomField.id`, `FormattedCustomField.fieldId` or
|
|
141
|
+
* `CustomFieldValue.customFieldId`), not the id of the value.
|
|
142
|
+
*/
|
|
143
|
+
id: string;
|
|
144
|
+
/** Text, or an object for the composite types (stored as JSON). */
|
|
145
|
+
value: unknown;
|
|
146
|
+
};
|
|
100
147
|
export type Contact = {
|
|
101
148
|
id: string;
|
|
102
149
|
idFromService: string | null;
|
|
@@ -140,8 +187,27 @@ export type Contact = {
|
|
|
140
187
|
person?: Person | null;
|
|
141
188
|
tags?: Tag[];
|
|
142
189
|
currentTicket?: Ticket | null;
|
|
190
|
+
/** With `include: ['customFieldValues']`, unless `formatCustomFields` is set. */
|
|
191
|
+
customFieldValues?: CustomFieldValue[];
|
|
192
|
+
/**
|
|
193
|
+
* With `formatCustomFields: true` and the include
|
|
194
|
+
* `{ model: 'customFieldValues', include: ['customField'] }`: the values keyed by the field name.
|
|
195
|
+
*/
|
|
196
|
+
customFields?: Record<string, FormattedCustomField>;
|
|
197
|
+
};
|
|
198
|
+
export type ContactRelationships = 'service' | 'defaultDepartment' | 'defaultUser' | 'person' | 'tags' | 'currentTicket' | 'customFieldValues' | 'customFields';
|
|
199
|
+
type FormatCustomFieldsOption = {
|
|
200
|
+
/**
|
|
201
|
+
* Answers `customFields` keyed by the field name instead of the raw `customFieldValues` (with the
|
|
202
|
+
* include `{ model: 'customFieldValues', include: ['customField'] }`; without the nested
|
|
203
|
+
* `customField`, `customFields` comes empty).
|
|
204
|
+
*/
|
|
205
|
+
formatCustomFields?: boolean;
|
|
143
206
|
};
|
|
144
|
-
|
|
207
|
+
/** Query of `ContactsApi.getById`. */
|
|
208
|
+
export type ContactGetByIdQuery = GetByIdQuery<Contact> & FormatCustomFieldsOption;
|
|
209
|
+
/** Query of `ContactsApi.getMany` and `getOne`. */
|
|
210
|
+
export type ContactListQuery = ListQuery<Contact> & FormatCustomFieldsOption;
|
|
145
211
|
export type CreateContactPayload = {
|
|
146
212
|
name?: string;
|
|
147
213
|
serviceId: string;
|
|
@@ -153,6 +219,8 @@ export type CreateContactPayload = {
|
|
|
153
219
|
data?: ContactData;
|
|
154
220
|
note?: string;
|
|
155
221
|
origin?: ContactOrigin;
|
|
222
|
+
/** Values of the custom fields of the account. An id that is not a custom field answers 400. */
|
|
223
|
+
customFields?: ContactCustomFieldInput[];
|
|
156
224
|
};
|
|
157
225
|
export type UpdateContactPayload = {
|
|
158
226
|
name?: string;
|
|
@@ -166,6 +234,11 @@ export type UpdateContactPayload = {
|
|
|
166
234
|
block?: boolean;
|
|
167
235
|
/** Tag IDs to associate with the contact. */
|
|
168
236
|
tagIds?: string[];
|
|
237
|
+
/**
|
|
238
|
+
* Values of the custom fields of the account: a value of the same field is updated. An id that is
|
|
239
|
+
* not a custom field is skipped.
|
|
240
|
+
*/
|
|
241
|
+
customFields?: ContactCustomFieldInput[];
|
|
169
242
|
};
|
|
170
243
|
/** Result of `ContactsApi.summarizeTicket`. */
|
|
171
244
|
export type SummarizeTicketResult = {
|
|
@@ -336,4 +409,5 @@ export type BulkTransferTicketsResult = {
|
|
|
336
409
|
/** IDs of the tickets actually transferred (the ones the target user can access). */
|
|
337
410
|
ticketsSelectedId: string[];
|
|
338
411
|
};
|
|
412
|
+
export {};
|
|
339
413
|
//# 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,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE3E,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;AAC3D,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG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I,EAAE,gBAAgB,EAAE,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,sDAAsD;AACtD,MAAM,MAAM,0BAA0B,GAAG;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,sDAAsD;IACtD,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B,CAAA"}
|
|
@@ -39,12 +39,24 @@ var FilesApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
39
39
|
* Creates the record of a file and returns the signed URL to upload its content: send the
|
|
40
40
|
* content with {@link upload}. An audio that must be converted (a voice message for the
|
|
41
41
|
* connection) is sent in `base64` instead, and then no `urlToUpload` is returned. `name` and
|
|
42
|
-
* `mimetype` are required (500 without them; an audio without `name` is named `recording`).
|
|
42
|
+
* `mimetype` are required (500 without them; an audio without `name` is named `recording`). With
|
|
43
|
+
* `serviceId`, an extension the account blocks for the type of the connection answers 403.
|
|
43
44
|
*/
|
|
44
45
|
createToUpload(body, headers) {
|
|
45
46
|
return this.client.post(`${this.basePath}/create-to-upload`, body, headers);
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
49
|
+
* Copies the content of a file. With `urlToUpload` (the signed URL of a record created by
|
|
50
|
+
* {@link createToUpload} with the same `mimetype` as the file copied), the content is sent to that
|
|
51
|
+
* record and the answer is the `fileId` given; without it, a new record (`attachedType`
|
|
52
|
+
* `'message.file'`) is created with the copied content and its id is the answer, and with
|
|
53
|
+
* `serviceId` an extension the account blocks for the type of the connection answers 403. An
|
|
54
|
+
* unknown `fileId` answers 500.
|
|
55
|
+
*/
|
|
56
|
+
duplicateFile(body, headers) {
|
|
57
|
+
return this.client.post(`${this.basePath}/duplicate-file`, body, headers);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
48
60
|
* Uploads the content of a file to the `urlToUpload` returned by {@link createToUpload}. The URL
|
|
49
61
|
* is signed by the storage, so the request goes straight to it, without the API token (the
|
|
50
62
|
* storage refuses an `Authorization` header). `mimetype` must be the one sent to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesApi.cjs","names":["BaseCrudApi","requestExternal"],"sources":["../../../src/apis/files/FilesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport { requestExternal } from '../../core/requestExternal'\nimport type { GetByIdQuery, ListQuery, Paginated } from '../../core/types'\nimport type {\n File,\n CreateFilePayload,\n UpdateFilePayload,\n CreateToUploadPayload,\n CreateToUploadResult,\n DeleteFileResult,\n} from './types'\n\n/**\n * Files of the account. The backend serves `POST /files` (the record only, no content),\n * `POST /files/create-to-upload` (record + signed URL to upload the content), `POST\n * /files/duplicate-file`, `DELETE /files/:id` and the signed download `GET\n * /files/:accountId/:filename`; there is no list, read by id nor update.\n */\nexport class FilesApi extends BaseCrudApi<\n File,\n CreateFilePayload,\n UpdateFilePayload,\n ListQuery<File>,\n DeleteFileResult\n> {\n constructor(client: ApiClient) {\n super(client, '/files')\n }\n\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getMany(\n query: ListQuery<File> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<File[]>\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getMany(\n query?: ListQuery<File> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<File>>\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getMany(\n query?: ListQuery<File>,\n headers?: Record<string, string>,\n ): Promise<Paginated<File> | File[]>\n override getMany(\n query?: ListQuery<File>,\n headers?: Record<string, string>,\n ): Promise<Paginated<File> | File[]> {\n return super.getMany(query, headers)\n }\n\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getOne(query?: ListQuery<File>, headers?: Record<string, string>): Promise<File | null> {\n return super.getOne(query, headers)\n }\n\n /** @deprecated Not served: the backend has no GET /files/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<File>,\n headers?: Record<string, string>,\n ): Promise<File> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /files/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateFilePayload,\n headers?: Record<string, string>,\n ): Promise<File> {\n return super.updateById(id, body, headers)\n }\n\n /**\n * Deletes a file. Resolves `{ success: true }`, also for an unknown id; a file of another\n * account answers 403.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<DeleteFileResult> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Creates the record of a file and returns the signed URL to upload its content: send the\n * content with {@link upload}. An audio that must be converted (a voice message for the\n * connection) is sent in `base64` instead, and then no `urlToUpload` is returned. `name` and\n * `mimetype` are required (500 without them; an audio without `name` is named `recording`).\n */\n createToUpload(\n body: CreateToUploadPayload,\n headers?: Record<string, string>,\n ): Promise<CreateToUploadResult> {\n return this.client.post<CreateToUploadResult, CreateToUploadPayload>(\n `${this.basePath}/create-to-upload`,\n body,\n headers,\n )\n }\n\n /**\n * Uploads the content of a file to the `urlToUpload` returned by {@link createToUpload}. The URL\n * is signed by the storage, so the request goes straight to it, without the API token (the\n * storage refuses an `Authorization` header). `mimetype` must be the one sent to\n * `createToUpload`. Sent through `client.requestExternal` (the global `fetch` for a client\n * without it). A non-2xx answer of the storage throws `ApiError`.\n */\n async upload(urlToUpload: string, content: BodyInit, mimetype: string): Promise<void> {\n const headers = { 'Content-Type': mimetype }\n await (this.client.requestExternal\n ? this.client.requestExternal('PUT', urlToUpload, content, headers)\n : requestExternal('PUT', urlToUpload, content, headers))\n }\n}\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FilesApi.cjs","names":["BaseCrudApi","requestExternal"],"sources":["../../../src/apis/files/FilesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport { requestExternal } from '../../core/requestExternal'\nimport type { GetByIdQuery, ListQuery, Paginated } from '../../core/types'\nimport type {\n File,\n CreateFilePayload,\n UpdateFilePayload,\n CreateToUploadPayload,\n CreateToUploadResult,\n DeleteFileResult,\n DuplicateFilePayload,\n} from './types'\n\n/**\n * Files of the account. The backend serves `POST /files` (the record only, no content),\n * `POST /files/create-to-upload` (record + signed URL to upload the content), `POST\n * /files/duplicate-file`, `DELETE /files/:id` and the signed download `GET\n * /files/:accountId/:filename`; there is no list, read by id nor update.\n */\nexport class FilesApi extends BaseCrudApi<\n File,\n CreateFilePayload,\n UpdateFilePayload,\n ListQuery<File>,\n DeleteFileResult\n> {\n constructor(client: ApiClient) {\n super(client, '/files')\n }\n\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getMany(\n query: ListQuery<File> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<File[]>\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getMany(\n query?: ListQuery<File> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<File>>\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getMany(\n query?: ListQuery<File>,\n headers?: Record<string, string>,\n ): Promise<Paginated<File> | File[]>\n override getMany(\n query?: ListQuery<File>,\n headers?: Record<string, string>,\n ): Promise<Paginated<File> | File[]> {\n return super.getMany(query, headers)\n }\n\n /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */\n override getOne(query?: ListQuery<File>, headers?: Record<string, string>): Promise<File | null> {\n return super.getOne(query, headers)\n }\n\n /** @deprecated Not served: the backend has no GET /files/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<File>,\n headers?: Record<string, string>,\n ): Promise<File> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /files/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateFilePayload,\n headers?: Record<string, string>,\n ): Promise<File> {\n return super.updateById(id, body, headers)\n }\n\n /**\n * Deletes a file. Resolves `{ success: true }`, also for an unknown id; a file of another\n * account answers 403.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<DeleteFileResult> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Creates the record of a file and returns the signed URL to upload its content: send the\n * content with {@link upload}. An audio that must be converted (a voice message for the\n * connection) is sent in `base64` instead, and then no `urlToUpload` is returned. `name` and\n * `mimetype` are required (500 without them; an audio without `name` is named `recording`). With\n * `serviceId`, an extension the account blocks for the type of the connection answers 403.\n */\n createToUpload(\n body: CreateToUploadPayload,\n headers?: Record<string, string>,\n ): Promise<CreateToUploadResult> {\n return this.client.post<CreateToUploadResult, CreateToUploadPayload>(\n `${this.basePath}/create-to-upload`,\n body,\n headers,\n )\n }\n\n /**\n * Copies the content of a file. With `urlToUpload` (the signed URL of a record created by\n * {@link createToUpload} with the same `mimetype` as the file copied), the content is sent to that\n * record and the answer is the `fileId` given; without it, a new record (`attachedType`\n * `'message.file'`) is created with the copied content and its id is the answer, and with\n * `serviceId` an extension the account blocks for the type of the connection answers 403. An\n * unknown `fileId` answers 500.\n */\n duplicateFile(body: DuplicateFilePayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, DuplicateFilePayload>(\n `${this.basePath}/duplicate-file`,\n body,\n headers,\n )\n }\n\n /**\n * Uploads the content of a file to the `urlToUpload` returned by {@link createToUpload}. The URL\n * is signed by the storage, so the request goes straight to it, without the API token (the\n * storage refuses an `Authorization` header). `mimetype` must be the one sent to\n * `createToUpload`. Sent through `client.requestExternal` (the global `fetch` for a client\n * without it). A non-2xx answer of the storage throws `ApiError`.\n */\n async upload(urlToUpload: string, content: BodyInit, mimetype: string): Promise<void> {\n const headers = { 'Content-Type': mimetype }\n await (this.client.requestExternal\n ? this.client.requestExternal('PUT', urlToUpload, content, headers)\n : requestExternal('PUT', urlToUpload, content, headers))\n }\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,WAAb,cAA8BA,qCAM5B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,SAAS;;CAkBzB,AAAS,QACP,OACA,SACmC;AACnC,SAAO,MAAM,QAAQ,OAAO,QAAQ;;;CAItC,AAAS,OAAO,OAAyB,SAAwD;AAC/F,SAAO,MAAM,OAAO,OAAO,QAAQ;;;CAIrC,AAAS,QACP,IACA,OACA,SACe;AACf,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WACP,IACA,MACA,SACe;AACf,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;;;;CAO5C,AAAS,WAAW,IAAY,SAA6D;AAC3F,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;;;CAUtC,eACE,MACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,oBACjB,MACA,QACD;;;;;;;;;;CAWH,cAAc,MAA4B,SAAmD;AAC3F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD;;;;;;;;;CAUH,MAAM,OAAO,aAAqB,SAAmB,UAAiC;EACpF,MAAM,UAAU,EAAE,gBAAgB,UAAU;AAC5C,SAAO,KAAK,OAAO,kBACf,KAAK,OAAO,gBAAgB,OAAO,aAAa,SAAS,QAAQ,GACjEC,6CAAgB,OAAO,aAAa,SAAS,QAAQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
2
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
3
|
import type { GetByIdQuery, ListQuery, Paginated } from '../../core/types';
|
|
4
|
-
import type { File, CreateFilePayload, UpdateFilePayload, CreateToUploadPayload, CreateToUploadResult, DeleteFileResult } from './types';
|
|
4
|
+
import type { File, CreateFilePayload, UpdateFilePayload, CreateToUploadPayload, CreateToUploadResult, DeleteFileResult, DuplicateFilePayload } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Files of the account. The backend serves `POST /files` (the record only, no content),
|
|
7
7
|
* `POST /files/create-to-upload` (record + signed URL to upload the content), `POST
|
|
@@ -35,9 +35,19 @@ export declare class FilesApi extends BaseCrudApi<File, CreateFilePayload, Updat
|
|
|
35
35
|
* Creates the record of a file and returns the signed URL to upload its content: send the
|
|
36
36
|
* content with {@link upload}. An audio that must be converted (a voice message for the
|
|
37
37
|
* connection) is sent in `base64` instead, and then no `urlToUpload` is returned. `name` and
|
|
38
|
-
* `mimetype` are required (500 without them; an audio without `name` is named `recording`).
|
|
38
|
+
* `mimetype` are required (500 without them; an audio without `name` is named `recording`). With
|
|
39
|
+
* `serviceId`, an extension the account blocks for the type of the connection answers 403.
|
|
39
40
|
*/
|
|
40
41
|
createToUpload(body: CreateToUploadPayload, headers?: Record<string, string>): Promise<CreateToUploadResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Copies the content of a file. With `urlToUpload` (the signed URL of a record created by
|
|
44
|
+
* {@link createToUpload} with the same `mimetype` as the file copied), the content is sent to that
|
|
45
|
+
* record and the answer is the `fileId` given; without it, a new record (`attachedType`
|
|
46
|
+
* `'message.file'`) is created with the copied content and its id is the answer, and with
|
|
47
|
+
* `serviceId` an extension the account blocks for the type of the connection answers 403. An
|
|
48
|
+
* unknown `fileId` answers 500.
|
|
49
|
+
*/
|
|
50
|
+
duplicateFile(body: DuplicateFilePayload, headers?: Record<string, string>): Promise<string>;
|
|
41
51
|
/**
|
|
42
52
|
* Uploads the content of a file to the `urlToUpload` returned by {@link createToUpload}. The URL
|
|
43
53
|
* is signed by the storage, so the request goes straight to it, without the API token (the
|