@ikatec/digisac-api-sdk 4.11.0 → 4.13.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/absence/AbsenceApi.cjs +46 -2
- package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
- package/dist/apis/absence/AbsenceApi.d.ts +38 -4
- package/dist/apis/absence/AbsenceApi.d.ts.map +1 -1
- package/dist/apis/absence/AbsenceApi.mjs +46 -2
- package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
- package/dist/apis/absence/types.d.ts +51 -2
- package/dist/apis/absence/types.d.ts.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.cjs +10 -1
- package/dist/apis/activityLog/ActivityLogApi.cjs.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.d.ts +10 -3
- package/dist/apis/activityLog/ActivityLogApi.d.ts.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.mjs +10 -1
- package/dist/apis/activityLog/ActivityLogApi.mjs.map +1 -1
- package/dist/apis/activityLog/types.d.ts +48 -8
- package/dist/apis/activityLog/types.d.ts.map +1 -1
- package/dist/apis/categories/types.d.ts +1 -0
- package/dist/apis/categories/types.d.ts.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.cjs +31 -2
- package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.d.ts +21 -3
- package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.mjs +31 -2
- package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
- package/dist/apis/creditMovements/types.d.ts +73 -2
- package/dist/apis/creditMovements/types.d.ts.map +1 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs +15 -0
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs.map +1 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts +13 -0
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts.map +1 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs +15 -0
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs.map +1 -1
- package/dist/apis/interactiveMessages/types.d.ts +8 -2
- package/dist/apis/interactiveMessages/types.d.ts.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +27 -0
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +22 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +27 -0
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
- package/dist/apis/knowledgeBase/types.d.ts +56 -2
- package/dist/apis/knowledgeBase/types.d.ts.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +26 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +24 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +26 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
- package/dist/apis/knowledgeBaseItem/types.d.ts +23 -6
- package/dist/apis/knowledgeBaseItem/types.d.ts.map +1 -1
- package/dist/apis/me/MeApi.cjs +36 -29
- package/dist/apis/me/MeApi.cjs.map +1 -1
- package/dist/apis/me/MeApi.d.ts +33 -22
- package/dist/apis/me/MeApi.d.ts.map +1 -1
- package/dist/apis/me/MeApi.mjs +36 -29
- package/dist/apis/me/MeApi.mjs.map +1 -1
- package/dist/apis/me/types.d.ts +67 -4
- package/dist/apis/me/types.d.ts.map +1 -1
- package/dist/apis/notifications/NotificationsApi.cjs +50 -2
- package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
- package/dist/apis/notifications/NotificationsApi.d.ts +41 -3
- package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
- package/dist/apis/notifications/NotificationsApi.mjs +50 -2
- package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
- package/dist/apis/notifications/types.d.ts +54 -8
- package/dist/apis/notifications/types.d.ts.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +4 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
- package/dist/apis/serviceAccessManagement/types.d.ts +3 -0
- package/dist/apis/serviceAccessManagement/types.d.ts.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -1
- package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
- package/dist/apis/stickerUsers/types.d.ts +4 -0
- package/dist/apis/stickerUsers/types.d.ts.map +1 -1
- package/dist/apis/stickers/StickersApi.cjs +27 -3
- package/dist/apis/stickers/StickersApi.cjs.map +1 -1
- package/dist/apis/stickers/StickersApi.d.ts +24 -4
- package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
- package/dist/apis/stickers/StickersApi.mjs +27 -3
- package/dist/apis/stickers/StickersApi.mjs.map +1 -1
- package/dist/apis/stickers/types.d.ts +28 -4
- package/dist/apis/stickers/types.d.ts.map +1 -1
- package/dist/apis/transcripts/TranscriptsApi.cjs +12 -2
- package/dist/apis/transcripts/TranscriptsApi.cjs.map +1 -1
- package/dist/apis/transcripts/TranscriptsApi.d.ts +11 -5
- package/dist/apis/transcripts/TranscriptsApi.d.ts.map +1 -1
- package/dist/apis/transcripts/TranscriptsApi.mjs +12 -2
- package/dist/apis/transcripts/TranscriptsApi.mjs.map +1 -1
- package/dist/apis/transcripts/types.d.ts +4 -0
- package/dist/apis/transcripts/types.d.ts.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs +51 -0
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +44 -2
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +51 -0
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/types.d.ts +34 -1
- package/dist/apis/whatsappBusinessTemplates/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/absence/AbsenceApi.test.ts +65 -0
- package/src/apis/absence/AbsenceApi.ts +77 -4
- package/src/apis/absence/types.ts +53 -2
- package/src/apis/activityLog/ActivityLogApi.test.ts +44 -0
- package/src/apis/activityLog/ActivityLogApi.ts +22 -3
- package/src/apis/activityLog/types.ts +47 -8
- package/src/apis/categories/types.ts +1 -0
- package/src/apis/creditMovements/CreditMovementsApi.test.ts +88 -0
- package/src/apis/creditMovements/CreditMovementsApi.ts +73 -2
- package/src/apis/creditMovements/types.ts +74 -2
- package/src/apis/interactiveMessages/InteractiveMessagesApi.test.ts +59 -0
- package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +26 -0
- package/src/apis/interactiveMessages/types.ts +8 -2
- package/src/apis/knowledgeBase/KnowledgeBaseApi.test.ts +54 -0
- package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +61 -1
- package/src/apis/knowledgeBase/types.ts +62 -2
- package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.test.ts +57 -0
- package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +45 -0
- package/src/apis/knowledgeBaseItem/types.ts +23 -6
- package/src/apis/me/MeApi.test.ts +45 -1
- package/src/apis/me/MeApi.ts +83 -28
- package/src/apis/me/types.ts +75 -4
- package/src/apis/notifications/NotificationsApi.test.ts +74 -0
- package/src/apis/notifications/NotificationsApi.ts +88 -3
- package/src/apis/notifications/types.ts +65 -7
- package/src/apis/payloads.test-d.ts +82 -2
- package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +4 -1
- package/src/apis/serviceAccessManagement/types.ts +3 -0
- package/src/apis/stickerUsers/StickerUsersApi.ts +3 -1
- package/src/apis/stickerUsers/types.ts +4 -0
- package/src/apis/stickers/StickersApi.test.ts +58 -0
- package/src/apis/stickers/StickersApi.ts +46 -4
- package/src/apis/stickers/types.ts +29 -4
- package/src/apis/transcripts/TranscriptsApi.test.ts +14 -21
- package/src/apis/transcripts/TranscriptsApi.ts +15 -6
- package/src/apis/transcripts/types.ts +4 -0
- package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.test.ts +86 -0
- package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts +74 -1
- package/src/apis/whatsappBusinessTemplates/types.ts +38 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnowledgeBaseItemApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"KnowledgeBaseItemApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\n/**\n * Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the\n * `docs` (include, `fetchMany`) reads them from it.\n */\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:\n * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`\n * answers 400 `Invalid knowledge base item ids`.\n */\n fetchMany(ids: string[], headers?: Record<string, string>): Promise<KnowledgeBaseItem[]> {\n return this.client.post<KnowledgeBaseItem[], { ids: string[] }>(\n `${this.basePath}/fetch-many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).\n * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it\n * resolves `{ hasText: false }`.\n */\n checkPdfText(\n body: { fileId?: string },\n headers?: Record<string, string>,\n ): Promise<{ hasText: boolean }> {\n return this.client.post<{ hasText: boolean }, { fileId?: string }>(\n `${this.basePath}/check-pdf-text`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,uBAAb,cAA0CA,qCAMxC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,uBAAuB;;;;;;;CAQvC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,UAAU,KAAe,SAAgE;AACvF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,aACE,MACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD"}
|
|
@@ -2,6 +2,10 @@ import type { ApiClient } from '../../core/ApiClient';
|
|
|
2
2
|
import type { ListQuery } from '../../core/types';
|
|
3
3
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
4
4
|
import type { KnowledgeBaseItem, CreateKnowledgeBaseItemPayload, UpdateKnowledgeBaseItemPayload } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the
|
|
7
|
+
* `docs` (include, `fetchMany`) reads them from it.
|
|
8
|
+
*/
|
|
5
9
|
export declare class KnowledgeBaseItemApi extends BaseCrudApi<KnowledgeBaseItem, CreateKnowledgeBaseItemPayload, UpdateKnowledgeBaseItemPayload, ListQuery<KnowledgeBaseItem>, false> {
|
|
6
10
|
constructor(client: ApiClient);
|
|
7
11
|
/**
|
|
@@ -10,5 +14,25 @@ export declare class KnowledgeBaseItemApi extends BaseCrudApi<KnowledgeBaseItem,
|
|
|
10
14
|
* check with `getById`.
|
|
11
15
|
*/
|
|
12
16
|
deleteById(id: string, headers?: Record<string, string>): Promise<false>;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:
|
|
19
|
+
* unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`
|
|
20
|
+
* answers 400 `Invalid knowledge base item ids`.
|
|
21
|
+
*/
|
|
22
|
+
fetchMany(ids: string[], headers?: Record<string, string>): Promise<KnowledgeBaseItem[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).
|
|
25
|
+
* Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.
|
|
26
|
+
*/
|
|
27
|
+
deleteMany(ids: string[], headers?: Record<string, string>): Promise<true>;
|
|
28
|
+
/**
|
|
29
|
+
* Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it
|
|
30
|
+
* resolves `{ hasText: false }`.
|
|
31
|
+
*/
|
|
32
|
+
checkPdfText(body: {
|
|
33
|
+
fileId?: string;
|
|
34
|
+
}, headers?: Record<string, string>): Promise<{
|
|
35
|
+
hasText: boolean;
|
|
36
|
+
}>;
|
|
13
37
|
}
|
|
14
38
|
//# sourceMappingURL=KnowledgeBaseItemApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnowledgeBaseItemApi.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,SAAS,CAAA;AAEhB,qBAAa,oBAAqB,SAAQ,WAAW,CACnD,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,CAAC,iBAAiB,CAAC,EAC5B,KAAK,CACN;gBACa,MAAM,EAAE,SAAS;IAI7B;;;;OAIG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"KnowledgeBaseItemApi.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,WAAW,CACnD,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,CAAC,iBAAiB,CAAC,EAC5B,KAAK,CACN;gBACa,MAAM,EAAE,SAAS;IAI7B;;;;OAIG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IAIjF;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAQxF;;;OAGG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1E;;;OAGG;IACH,YAAY,CACV,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAOjC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts
|
|
4
|
+
/**
|
|
5
|
+
* Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the
|
|
6
|
+
* `docs` (include, `fetchMany`) reads them from it.
|
|
7
|
+
*/
|
|
4
8
|
var KnowledgeBaseItemApi = class extends BaseCrudApi {
|
|
5
9
|
constructor(client) {
|
|
6
10
|
super(client, "/knowledge-base-item");
|
|
@@ -13,6 +17,28 @@ var KnowledgeBaseItemApi = class extends BaseCrudApi {
|
|
|
13
17
|
deleteById(id, headers) {
|
|
14
18
|
return super.deleteById(id, headers);
|
|
15
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:
|
|
22
|
+
* unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`
|
|
23
|
+
* answers 400 `Invalid knowledge base item ids`.
|
|
24
|
+
*/
|
|
25
|
+
fetchMany(ids, headers) {
|
|
26
|
+
return this.client.post(`${this.basePath}/fetch-many`, { ids }, headers);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).
|
|
30
|
+
* Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.
|
|
31
|
+
*/
|
|
32
|
+
deleteMany(ids, headers) {
|
|
33
|
+
return this.client.request("DELETE", `${this.basePath}/many`, { ids }, headers);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it
|
|
37
|
+
* resolves `{ hasText: false }`.
|
|
38
|
+
*/
|
|
39
|
+
checkPdfText(body, headers) {
|
|
40
|
+
return this.client.post(`${this.basePath}/check-pdf-text`, body, headers);
|
|
41
|
+
}
|
|
16
42
|
};
|
|
17
43
|
|
|
18
44
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnowledgeBaseItemApi.mjs","names":[],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"KnowledgeBaseItemApi.mjs","names":[],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\n/**\n * Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the\n * `docs` (include, `fetchMany`) reads them from it.\n */\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:\n * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`\n * answers 400 `Invalid knowledge base item ids`.\n */\n fetchMany(ids: string[], headers?: Record<string, string>): Promise<KnowledgeBaseItem[]> {\n return this.client.post<KnowledgeBaseItem[], { ids: string[] }>(\n `${this.basePath}/fetch-many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).\n * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it\n * resolves `{ hasText: false }`.\n */\n checkPdfText(\n body: { fileId?: string },\n headers?: Record<string, string>,\n ): Promise<{ hasText: boolean }> {\n return this.client.post<{ hasText: boolean }, { fileId?: string }>(\n `${this.basePath}/check-pdf-text`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAaA,IAAa,uBAAb,cAA0C,YAMxC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,uBAAuB;;;;;;;CAQvC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,UAAU,KAAe,SAAgE;AACvF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,aACE,MACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD"}
|
|
@@ -1,30 +1,47 @@
|
|
|
1
1
|
import type { File } from '../files/types';
|
|
2
2
|
import type { KnowledgeBase } from '../knowledgeBase/types';
|
|
3
|
+
/** An item as the transformer answers it (no `knowledgeBaseId`, `fileId` nor `deletedAt`). */
|
|
3
4
|
export type KnowledgeBaseItem = {
|
|
4
5
|
id: string;
|
|
5
6
|
name: string;
|
|
6
|
-
type: string;
|
|
7
|
+
type: 'urls' | 'files' | 'messages' | (string & {});
|
|
7
8
|
sourceId: string | null;
|
|
8
9
|
url: string | null;
|
|
9
10
|
accountId: string;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/** @deprecated Not answered: the transformer of the backend does not send it. */
|
|
12
|
+
knowledgeBaseId?: string;
|
|
13
|
+
/** @deprecated Not answered: the transformer of the backend does not send it. */
|
|
14
|
+
fileId?: string | null;
|
|
12
15
|
createdAt: string;
|
|
13
16
|
updatedAt: string;
|
|
14
|
-
|
|
17
|
+
/** @deprecated Not answered: the transformer of the backend does not send it. */
|
|
18
|
+
deletedAt?: string | null;
|
|
19
|
+
/** @deprecated Not served: the include is dropped by the backend. */
|
|
15
20
|
knowledgeBase?: KnowledgeBase;
|
|
16
21
|
file?: File | null;
|
|
22
|
+
/** The vectorized documents (the include reads them from the AI service). */
|
|
23
|
+
docs?: Record<string, unknown>[];
|
|
24
|
+
account?: Record<string, unknown>;
|
|
17
25
|
};
|
|
18
|
-
export type KnowledgeBaseItemRelationships = 'knowledgeBase' | 'file';
|
|
26
|
+
export type KnowledgeBaseItemRelationships = 'knowledgeBase' | 'file' | 'docs' | 'account';
|
|
27
|
+
/**
|
|
28
|
+
* Creates an item and VECTORIZES its content in the AI service right away: `text` (type `messages`), `url`
|
|
29
|
+
* (type `urls`, the service fetches the page) or `fileId` (type `files`). Without any of the three it
|
|
30
|
+
* answers 400 `You must provide fileId, text, or url`.
|
|
31
|
+
*/
|
|
19
32
|
export type CreateKnowledgeBaseItemPayload = {
|
|
20
33
|
name: string;
|
|
21
|
-
type: string;
|
|
34
|
+
type: 'urls' | 'files' | 'messages' | (string & {});
|
|
22
35
|
knowledgeBaseId: string;
|
|
36
|
+
/** @deprecated Ignored by the backend. */
|
|
23
37
|
sourceId?: string;
|
|
38
|
+
text?: string;
|
|
24
39
|
url?: string;
|
|
25
40
|
fileId?: string;
|
|
26
41
|
};
|
|
42
|
+
/** The backend requires `name`, `type` and `knowledgeBaseId` on the update too (400 without them). */
|
|
27
43
|
export type UpdateKnowledgeBaseItemPayload = {
|
|
44
|
+
knowledgeBaseId?: string;
|
|
28
45
|
name?: string;
|
|
29
46
|
type?: string;
|
|
30
47
|
sourceId?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBaseItem/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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AA;CAClC,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAE1F;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACnD,eAAe,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,sGAAsG;AACtG,MAAM,MAAM,8BAA8B,GAAG;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB,CAAA"}
|
package/dist/apis/me/MeApi.cjs
CHANGED
|
@@ -2,62 +2,69 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_core_BaseApi = require('../../core/BaseApi.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/apis/me/MeApi.ts
|
|
5
|
+
/**
|
|
6
|
+
* A query object always has an array or an object among its values; the headers only have strings (a header that
|
|
7
|
+
* comes as `undefined` at runtime stays a header). That tells the two apart in the methods that took only the
|
|
8
|
+
* headers before and now take a query first.
|
|
9
|
+
*/
|
|
10
|
+
function splitQueryAndHeaders(queryOrHeaders, headers) {
|
|
11
|
+
return !!queryOrHeaders && Object.values(queryOrHeaders).some((value) => typeof value === "object" && value !== null) ? [queryOrHeaders, headers] : [void 0, queryOrHeaders];
|
|
12
|
+
}
|
|
5
13
|
var MeApi = class extends require_core_BaseApi.BaseApi {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
getMe(headers) {
|
|
11
|
-
return this.client.get("/me", headers);
|
|
14
|
+
getMe(queryOrHeaders, headers) {
|
|
15
|
+
const [query, sent] = splitQueryAndHeaders(queryOrHeaders, headers);
|
|
16
|
+
return this.client.get(`/me${this.toQueryString(query)}`, sent);
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return this.client.get(
|
|
18
|
+
getAccount(queryOrHeaders, headers) {
|
|
19
|
+
const [query, sent] = splitQueryAndHeaders(queryOrHeaders, headers);
|
|
20
|
+
return this.client.get(`/me/account${this.toQueryString(query)}`, sent);
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
getAccountAmounts(headers) {
|
|
22
|
-
return this.client.get("/me/get-account-amounts", headers);
|
|
22
|
+
getAccountAmounts(queryOrHeaders, headers) {
|
|
23
|
+
const [query, sent] = splitQueryAndHeaders(queryOrHeaders, headers);
|
|
24
|
+
const queryString = query ? this.toQueryString({ filter: query.filter.join(",") }) : "";
|
|
25
|
+
return this.client.get(`/me/get-account-amounts${queryString}`, sent);
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
|
-
* Returns a URL to the Agnus billing/plan management page for the current account.
|
|
28
|
+
* Returns a URL to the Agnus billing/plan management page for the current account. Calls Agnus (an external
|
|
29
|
+
* service) and, for accounts without credits control, reports the consumption to it first.
|
|
26
30
|
* @permissions myAccount.myPlan
|
|
27
31
|
*/
|
|
28
32
|
getAgnusMyPlanUrl(headers) {
|
|
29
33
|
return this.client.get("/me/account/agnus-my-plan-url", headers);
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
|
-
* Updates the current user's profile fields such as name, language, and preferences
|
|
33
|
-
*
|
|
34
|
-
* and
|
|
36
|
+
* Updates the current user's profile fields such as name, language, and preferences (`data` and `preferences`
|
|
37
|
+
* replace the stored objects). A new `password` needs `currentPassword` and a recent login, is validated against
|
|
38
|
+
* the last 6 passwords, and revokes the access tokens with an expiration — including the one of this request.
|
|
35
39
|
*/
|
|
36
40
|
updateMe(body, headers) {
|
|
37
41
|
return this.client.put("/me", body, headers);
|
|
38
42
|
}
|
|
39
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Updates account-level settings such as name, settings object, wizard progress, and default department. It
|
|
45
|
+
* applies to the whole account; the default department is required while the tickets are enabled.
|
|
46
|
+
*/
|
|
40
47
|
updateAccount(body, headers) {
|
|
41
48
|
return this.client.put("/me/account", body, headers);
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
|
-
* Updates the presence status of the current user (`online`, `offline`, or `away`)
|
|
51
|
+
* Updates the presence status of the current user (`online`, `offline`, or `away`) for a `client`.
|
|
45
52
|
* If setting to `online`, validates the user's timetable first — if outside working hours,
|
|
46
|
-
* the status is set to `offline` instead.
|
|
53
|
+
* the status is set to `offline` instead. Resolves the status fields of the user.
|
|
47
54
|
*/
|
|
48
55
|
updateStatus(body, headers) {
|
|
49
56
|
return this.client.put("/me/status", body, headers);
|
|
50
57
|
}
|
|
51
58
|
/**
|
|
52
|
-
* Extends the grace period for the current account when it has expired or is about to expire
|
|
53
|
-
* Returns the updated account.
|
|
59
|
+
* Extends the grace period for the current account when it has expired or is about to expire, and notifies the
|
|
60
|
+
* billing webhook. Returns the updated account; an account not in a grace period answers 400.
|
|
54
61
|
*/
|
|
55
62
|
extendAccountGracePeriod(headers) {
|
|
56
63
|
return this.client.post("/me/account/extend-grace-period", void 0, headers);
|
|
57
64
|
}
|
|
58
65
|
/**
|
|
59
|
-
* Registers
|
|
60
|
-
*
|
|
66
|
+
* Registers the push notification tokens of the current user (`data` replaces the whole `data` of the user).
|
|
67
|
+
* Resolves with no body.
|
|
61
68
|
*/
|
|
62
69
|
registerToken(body, headers) {
|
|
63
70
|
return this.client.post("/me/one-signal/register-token", body, headers);
|
|
@@ -67,8 +74,8 @@ var MeApi = class extends require_core_BaseApi.BaseApi {
|
|
|
67
74
|
return this.client.post("/me/report-login", void 0, headers);
|
|
68
75
|
}
|
|
69
76
|
/**
|
|
70
|
-
* Sets the current user's status to `online` for the given client and emits a takeover
|
|
71
|
-
* which signals other connected sessions to yield control to this one.
|
|
77
|
+
* Sets the current user's status to `online` for the given client (`'web'` by default) and emits a takeover
|
|
78
|
+
* event, which signals other connected sessions to yield control to this one. Resolves with no body.
|
|
72
79
|
*/
|
|
73
80
|
takeover(body, headers) {
|
|
74
81
|
return this.client.post("/me/takeover", body, headers);
|
|
@@ -83,7 +90,7 @@ var MeApi = class extends require_core_BaseApi.BaseApi {
|
|
|
83
90
|
/**
|
|
84
91
|
* Activates OTP (two-factor) authentication for the current user.
|
|
85
92
|
* Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key
|
|
86
|
-
* previously set via `setOtpSecretKey`.
|
|
93
|
+
* previously set via `setOtpSecretKey`. Resolves the text `'OK'`.
|
|
87
94
|
*/
|
|
88
95
|
activateOtpAuth(headers) {
|
|
89
96
|
return this.client.post("/me/activate-otp-auth", void 0, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user
|
|
1
|
+
{"version":3,"file":"MeApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n AccountAmounts,\n AccountAmountsQuery,\n MeAccountQuery,\n MeQuery,\n MeStatusResponse,\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\n/**\n * A query object always has an array or an object among its values; the headers only have strings (a header that\n * comes as `undefined` at runtime stays a header). That tells the two apart in the methods that took only the\n * headers before and now take a query first.\n */\nfunction splitQueryAndHeaders<TQuery extends object>(\n queryOrHeaders: TQuery | Record<string, string> | undefined,\n headers: Record<string, string> | undefined,\n): [TQuery | undefined, Record<string, string> | undefined] {\n const isQuery =\n !!queryOrHeaders &&\n Object.values(queryOrHeaders).some((value) => typeof value === 'object' && value !== null)\n return isQuery\n ? [queryOrHeaders as TQuery, headers]\n : [undefined, queryOrHeaders as Record<string, string> | undefined]\n}\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user. Without `include`, the user comes without relations (roles,\n * departments, timetable, account).\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User>\n getMe(query: MeQuery, headers?: Record<string, string>): Promise<User>\n getMe(\n queryOrHeaders?: MeQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<User> {\n const [query, sent] = splitQueryAndHeaders<MeQuery>(queryOrHeaders, headers)\n return this.client.get<User>(`/me${this.toQueryString(query)}`, sent)\n }\n\n /**\n * Returns the account of the current user. Send `where.id` with the `accountId` of the user (what the web app\n * does): without it, the route answers 500.\n */\n getAccount(headers?: Record<string, string>): Promise<Account>\n getAccount(query: MeAccountQuery, headers?: Record<string, string>): Promise<Account>\n getAccount(\n queryOrHeaders?: MeAccountQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<Account> {\n const [query, sent] = splitQueryAndHeaders<MeAccountQuery>(queryOrHeaders, headers)\n return this.client.get<Account>(`/me/account${this.toQueryString(query)}`, sent)\n }\n\n /**\n * Returns the amounts of the current account named in `filter` (services and/or users). The credit amounts are\n * never answered here. An account without credits control answers 400.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<AccountAmounts>\n getAccountAmounts(\n query: AccountAmountsQuery,\n headers?: Record<string, string>,\n ): Promise<AccountAmounts>\n getAccountAmounts(\n queryOrHeaders?: AccountAmountsQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<AccountAmounts> {\n const [query, sent] = splitQueryAndHeaders<AccountAmountsQuery>(queryOrHeaders, headers)\n const queryString = query ? this.toQueryString({ filter: query.filter.join(',') }) : ''\n return this.client.get<AccountAmounts>(`/me/get-account-amounts${queryString}`, sent)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account. Calls Agnus (an external\n * service) and, for accounts without credits control, reports the consumption to it first.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences (`data` and `preferences`\n * replace the stored objects). A new `password` needs `currentPassword` and a recent login, is validated against\n * the last 6 passwords, and revokes the access tokens with an expiration — including the one of this request.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /**\n * Updates account-level settings such as name, settings object, wizard progress, and default department. It\n * applies to the whole account; the default department is required while the tickets are enabled.\n */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`) for a `client`.\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead. Resolves the status fields of the user.\n */\n updateStatus(\n body: UpdateMeStatusPayload,\n headers?: Record<string, string>,\n ): Promise<MeStatusResponse> {\n return this.client.put<MeStatusResponse, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire, and notifies the\n * billing webhook. Returns the updated account; an account not in a grace period answers 400.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers the push notification tokens of the current user (`data` replaces the whole `data` of the user).\n * Resolves with no body.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client (`'web'` by default) and emits a takeover\n * event, which signals other connected sessions to yield control to this one. Resolves with no body.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`. Resolves the text `'OK'`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<'OK'> {\n return this.client.post<'OK'>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAS,qBACP,gBACA,SAC0D;AAI1D,QAFE,CAAC,CAAC,kBACF,OAAO,OAAO,eAAe,CAAC,MAAM,UAAU,OAAO,UAAU,YAAY,UAAU,KAAK,GAExF,CAAC,gBAA0B,QAAQ,GACnC,CAAC,QAAW,eAAqD;;AA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8B,SAAiD;AAC7F,SAAO,KAAK,OAAO,MAAoC,0BAA0B,MAAM,QAAQ;;;;;;;CAQjG,gBAAgB,SAAiD;AAC/D,SAAO,KAAK,OAAO,KAAW,yBAAyB,QAAW,QAAQ"}
|
package/dist/apis/me/MeApi.d.ts
CHANGED
|
@@ -1,56 +1,67 @@
|
|
|
1
1
|
import { BaseApi } from '../../core/BaseApi';
|
|
2
2
|
import type { Account } from '../accounts/types';
|
|
3
3
|
import type { User } from '../users/types';
|
|
4
|
-
import type { RegisterTokenPayload, SetOtpSecretKeyPayload, TakeoverPayload, UpdateMeAccountPayload, UpdateMePayload, UpdateMeStatusPayload } from './types';
|
|
4
|
+
import type { AccountAmounts, AccountAmountsQuery, MeAccountQuery, MeQuery, MeStatusResponse, RegisterTokenPayload, SetOtpSecretKeyPayload, TakeoverPayload, UpdateMeAccountPayload, UpdateMePayload, UpdateMeStatusPayload } from './types';
|
|
5
5
|
export declare class MeApi extends BaseApi {
|
|
6
6
|
/**
|
|
7
|
-
* Returns the currently authenticated user
|
|
7
|
+
* Returns the currently authenticated user. Without `include`, the user comes without relations (roles,
|
|
8
|
+
* departments, timetable, account).
|
|
8
9
|
* @permissions users.view
|
|
9
10
|
*/
|
|
10
11
|
getMe(headers?: Record<string, string>): Promise<User>;
|
|
11
|
-
|
|
12
|
+
getMe(query: MeQuery, headers?: Record<string, string>): Promise<User>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the account of the current user. Send `where.id` with the `accountId` of the user (what the web app
|
|
15
|
+
* does): without it, the route answers 500.
|
|
16
|
+
*/
|
|
12
17
|
getAccount(headers?: Record<string, string>): Promise<Account>;
|
|
18
|
+
getAccount(query: MeAccountQuery, headers?: Record<string, string>): Promise<Account>;
|
|
13
19
|
/**
|
|
14
|
-
* Returns
|
|
15
|
-
*
|
|
20
|
+
* Returns the amounts of the current account named in `filter` (services and/or users). The credit amounts are
|
|
21
|
+
* never answered here. An account without credits control answers 400.
|
|
16
22
|
*/
|
|
17
|
-
getAccountAmounts(headers?: Record<string, string>): Promise<
|
|
23
|
+
getAccountAmounts(headers?: Record<string, string>): Promise<AccountAmounts>;
|
|
24
|
+
getAccountAmounts(query: AccountAmountsQuery, headers?: Record<string, string>): Promise<AccountAmounts>;
|
|
18
25
|
/**
|
|
19
|
-
* Returns a URL to the Agnus billing/plan management page for the current account.
|
|
26
|
+
* Returns a URL to the Agnus billing/plan management page for the current account. Calls Agnus (an external
|
|
27
|
+
* service) and, for accounts without credits control, reports the consumption to it first.
|
|
20
28
|
* @permissions myAccount.myPlan
|
|
21
29
|
*/
|
|
22
30
|
getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{
|
|
23
31
|
url: string;
|
|
24
32
|
}>;
|
|
25
33
|
/**
|
|
26
|
-
* Updates the current user's profile fields such as name, language, and preferences
|
|
27
|
-
*
|
|
28
|
-
* and
|
|
34
|
+
* Updates the current user's profile fields such as name, language, and preferences (`data` and `preferences`
|
|
35
|
+
* replace the stored objects). A new `password` needs `currentPassword` and a recent login, is validated against
|
|
36
|
+
* the last 6 passwords, and revokes the access tokens with an expiration — including the one of this request.
|
|
29
37
|
*/
|
|
30
38
|
updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User>;
|
|
31
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Updates account-level settings such as name, settings object, wizard progress, and default department. It
|
|
41
|
+
* applies to the whole account; the default department is required while the tickets are enabled.
|
|
42
|
+
*/
|
|
32
43
|
updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account>;
|
|
33
44
|
/**
|
|
34
|
-
* Updates the presence status of the current user (`online`, `offline`, or `away`)
|
|
45
|
+
* Updates the presence status of the current user (`online`, `offline`, or `away`) for a `client`.
|
|
35
46
|
* If setting to `online`, validates the user's timetable first — if outside working hours,
|
|
36
|
-
* the status is set to `offline` instead.
|
|
47
|
+
* the status is set to `offline` instead. Resolves the status fields of the user.
|
|
37
48
|
*/
|
|
38
|
-
updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<
|
|
49
|
+
updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<MeStatusResponse>;
|
|
39
50
|
/**
|
|
40
|
-
* Extends the grace period for the current account when it has expired or is about to expire
|
|
41
|
-
* Returns the updated account.
|
|
51
|
+
* Extends the grace period for the current account when it has expired or is about to expire, and notifies the
|
|
52
|
+
* billing webhook. Returns the updated account; an account not in a grace period answers 400.
|
|
42
53
|
*/
|
|
43
54
|
extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account>;
|
|
44
55
|
/**
|
|
45
|
-
* Registers
|
|
46
|
-
*
|
|
56
|
+
* Registers the push notification tokens of the current user (`data` replaces the whole `data` of the user).
|
|
57
|
+
* Resolves with no body.
|
|
47
58
|
*/
|
|
48
59
|
registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void>;
|
|
49
60
|
/** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */
|
|
50
61
|
reportFirstLogin(headers?: Record<string, string>): Promise<User>;
|
|
51
62
|
/**
|
|
52
|
-
* Sets the current user's status to `online` for the given client and emits a takeover
|
|
53
|
-
* which signals other connected sessions to yield control to this one.
|
|
63
|
+
* Sets the current user's status to `online` for the given client (`'web'` by default) and emits a takeover
|
|
64
|
+
* event, which signals other connected sessions to yield control to this one. Resolves with no body.
|
|
54
65
|
*/
|
|
55
66
|
takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void>;
|
|
56
67
|
/**
|
|
@@ -61,8 +72,8 @@ export declare class MeApi extends BaseApi {
|
|
|
61
72
|
/**
|
|
62
73
|
* Activates OTP (two-factor) authentication for the current user.
|
|
63
74
|
* Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key
|
|
64
|
-
* previously set via `setOtpSecretKey`.
|
|
75
|
+
* previously set via `setOtpSecretKey`. Resolves the text `'OK'`.
|
|
65
76
|
*/
|
|
66
|
-
activateOtpAuth(headers?: Record<string, string>): Promise<
|
|
77
|
+
activateOtpAuth(headers?: Record<string, string>): Promise<'OK'>;
|
|
67
78
|
}
|
|
68
79
|
//# sourceMappingURL=MeApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeApi.d.ts","sourceRoot":"","sources":["../../../src/apis/me/MeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"MeApi.d.ts","sourceRoot":"","sources":["../../../src/apis/me/MeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAmBhB,qBAAa,KAAM,SAAQ,OAAO;IAChC;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACtD,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAStE;;;OAGG;IACH,UAAU,CAAC,OAAO,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EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1F,6FAA6F;IAC7F,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjE"}
|
package/dist/apis/me/MeApi.mjs
CHANGED
|
@@ -1,62 +1,69 @@
|
|
|
1
1
|
import { BaseApi } from "../../core/BaseApi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/apis/me/MeApi.ts
|
|
4
|
+
/**
|
|
5
|
+
* A query object always has an array or an object among its values; the headers only have strings (a header that
|
|
6
|
+
* comes as `undefined` at runtime stays a header). That tells the two apart in the methods that took only the
|
|
7
|
+
* headers before and now take a query first.
|
|
8
|
+
*/
|
|
9
|
+
function splitQueryAndHeaders(queryOrHeaders, headers) {
|
|
10
|
+
return !!queryOrHeaders && Object.values(queryOrHeaders).some((value) => typeof value === "object" && value !== null) ? [queryOrHeaders, headers] : [void 0, queryOrHeaders];
|
|
11
|
+
}
|
|
4
12
|
var MeApi = class extends BaseApi {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
getMe(headers) {
|
|
10
|
-
return this.client.get("/me", headers);
|
|
13
|
+
getMe(queryOrHeaders, headers) {
|
|
14
|
+
const [query, sent] = splitQueryAndHeaders(queryOrHeaders, headers);
|
|
15
|
+
return this.client.get(`/me${this.toQueryString(query)}`, sent);
|
|
11
16
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return this.client.get(
|
|
17
|
+
getAccount(queryOrHeaders, headers) {
|
|
18
|
+
const [query, sent] = splitQueryAndHeaders(queryOrHeaders, headers);
|
|
19
|
+
return this.client.get(`/me/account${this.toQueryString(query)}`, sent);
|
|
15
20
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getAccountAmounts(headers) {
|
|
21
|
-
return this.client.get("/me/get-account-amounts", headers);
|
|
21
|
+
getAccountAmounts(queryOrHeaders, headers) {
|
|
22
|
+
const [query, sent] = splitQueryAndHeaders(queryOrHeaders, headers);
|
|
23
|
+
const queryString = query ? this.toQueryString({ filter: query.filter.join(",") }) : "";
|
|
24
|
+
return this.client.get(`/me/get-account-amounts${queryString}`, sent);
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
|
-
* Returns a URL to the Agnus billing/plan management page for the current account.
|
|
27
|
+
* Returns a URL to the Agnus billing/plan management page for the current account. Calls Agnus (an external
|
|
28
|
+
* service) and, for accounts without credits control, reports the consumption to it first.
|
|
25
29
|
* @permissions myAccount.myPlan
|
|
26
30
|
*/
|
|
27
31
|
getAgnusMyPlanUrl(headers) {
|
|
28
32
|
return this.client.get("/me/account/agnus-my-plan-url", headers);
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
|
-
* Updates the current user's profile fields such as name, language, and preferences
|
|
32
|
-
*
|
|
33
|
-
* and
|
|
35
|
+
* Updates the current user's profile fields such as name, language, and preferences (`data` and `preferences`
|
|
36
|
+
* replace the stored objects). A new `password` needs `currentPassword` and a recent login, is validated against
|
|
37
|
+
* the last 6 passwords, and revokes the access tokens with an expiration — including the one of this request.
|
|
34
38
|
*/
|
|
35
39
|
updateMe(body, headers) {
|
|
36
40
|
return this.client.put("/me", body, headers);
|
|
37
41
|
}
|
|
38
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Updates account-level settings such as name, settings object, wizard progress, and default department. It
|
|
44
|
+
* applies to the whole account; the default department is required while the tickets are enabled.
|
|
45
|
+
*/
|
|
39
46
|
updateAccount(body, headers) {
|
|
40
47
|
return this.client.put("/me/account", body, headers);
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
|
-
* Updates the presence status of the current user (`online`, `offline`, or `away`)
|
|
50
|
+
* Updates the presence status of the current user (`online`, `offline`, or `away`) for a `client`.
|
|
44
51
|
* If setting to `online`, validates the user's timetable first — if outside working hours,
|
|
45
|
-
* the status is set to `offline` instead.
|
|
52
|
+
* the status is set to `offline` instead. Resolves the status fields of the user.
|
|
46
53
|
*/
|
|
47
54
|
updateStatus(body, headers) {
|
|
48
55
|
return this.client.put("/me/status", body, headers);
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
|
-
* Extends the grace period for the current account when it has expired or is about to expire
|
|
52
|
-
* Returns the updated account.
|
|
58
|
+
* Extends the grace period for the current account when it has expired or is about to expire, and notifies the
|
|
59
|
+
* billing webhook. Returns the updated account; an account not in a grace period answers 400.
|
|
53
60
|
*/
|
|
54
61
|
extendAccountGracePeriod(headers) {
|
|
55
62
|
return this.client.post("/me/account/extend-grace-period", void 0, headers);
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
|
-
* Registers
|
|
59
|
-
*
|
|
65
|
+
* Registers the push notification tokens of the current user (`data` replaces the whole `data` of the user).
|
|
66
|
+
* Resolves with no body.
|
|
60
67
|
*/
|
|
61
68
|
registerToken(body, headers) {
|
|
62
69
|
return this.client.post("/me/one-signal/register-token", body, headers);
|
|
@@ -66,8 +73,8 @@ var MeApi = class extends BaseApi {
|
|
|
66
73
|
return this.client.post("/me/report-login", void 0, headers);
|
|
67
74
|
}
|
|
68
75
|
/**
|
|
69
|
-
* Sets the current user's status to `online` for the given client and emits a takeover
|
|
70
|
-
* which signals other connected sessions to yield control to this one.
|
|
76
|
+
* Sets the current user's status to `online` for the given client (`'web'` by default) and emits a takeover
|
|
77
|
+
* event, which signals other connected sessions to yield control to this one. Resolves with no body.
|
|
71
78
|
*/
|
|
72
79
|
takeover(body, headers) {
|
|
73
80
|
return this.client.post("/me/takeover", body, headers);
|
|
@@ -82,7 +89,7 @@ var MeApi = class extends BaseApi {
|
|
|
82
89
|
/**
|
|
83
90
|
* Activates OTP (two-factor) authentication for the current user.
|
|
84
91
|
* Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key
|
|
85
|
-
* previously set via `setOtpSecretKey`.
|
|
92
|
+
* previously set via `setOtpSecretKey`. Resolves the text `'OK'`.
|
|
86
93
|
*/
|
|
87
94
|
activateOtpAuth(headers) {
|
|
88
95
|
return this.client.post("/me/activate-otp-auth", void 0, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeApi.mjs","names":[],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user
|
|
1
|
+
{"version":3,"file":"MeApi.mjs","names":[],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n AccountAmounts,\n AccountAmountsQuery,\n MeAccountQuery,\n MeQuery,\n MeStatusResponse,\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\n/**\n * A query object always has an array or an object among its values; the headers only have strings (a header that\n * comes as `undefined` at runtime stays a header). That tells the two apart in the methods that took only the\n * headers before and now take a query first.\n */\nfunction splitQueryAndHeaders<TQuery extends object>(\n queryOrHeaders: TQuery | Record<string, string> | undefined,\n headers: Record<string, string> | undefined,\n): [TQuery | undefined, Record<string, string> | undefined] {\n const isQuery =\n !!queryOrHeaders &&\n Object.values(queryOrHeaders).some((value) => typeof value === 'object' && value !== null)\n return isQuery\n ? [queryOrHeaders as TQuery, headers]\n : [undefined, queryOrHeaders as Record<string, string> | undefined]\n}\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user. Without `include`, the user comes without relations (roles,\n * departments, timetable, account).\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User>\n getMe(query: MeQuery, headers?: Record<string, string>): Promise<User>\n getMe(\n queryOrHeaders?: MeQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<User> {\n const [query, sent] = splitQueryAndHeaders<MeQuery>(queryOrHeaders, headers)\n return this.client.get<User>(`/me${this.toQueryString(query)}`, sent)\n }\n\n /**\n * Returns the account of the current user. Send `where.id` with the `accountId` of the user (what the web app\n * does): without it, the route answers 500.\n */\n getAccount(headers?: Record<string, string>): Promise<Account>\n getAccount(query: MeAccountQuery, headers?: Record<string, string>): Promise<Account>\n getAccount(\n queryOrHeaders?: MeAccountQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<Account> {\n const [query, sent] = splitQueryAndHeaders<MeAccountQuery>(queryOrHeaders, headers)\n return this.client.get<Account>(`/me/account${this.toQueryString(query)}`, sent)\n }\n\n /**\n * Returns the amounts of the current account named in `filter` (services and/or users). The credit amounts are\n * never answered here. An account without credits control answers 400.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<AccountAmounts>\n getAccountAmounts(\n query: AccountAmountsQuery,\n headers?: Record<string, string>,\n ): Promise<AccountAmounts>\n getAccountAmounts(\n queryOrHeaders?: AccountAmountsQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<AccountAmounts> {\n const [query, sent] = splitQueryAndHeaders<AccountAmountsQuery>(queryOrHeaders, headers)\n const queryString = query ? this.toQueryString({ filter: query.filter.join(',') }) : ''\n return this.client.get<AccountAmounts>(`/me/get-account-amounts${queryString}`, sent)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account. Calls Agnus (an external\n * service) and, for accounts without credits control, reports the consumption to it first.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences (`data` and `preferences`\n * replace the stored objects). A new `password` needs `currentPassword` and a recent login, is validated against\n * the last 6 passwords, and revokes the access tokens with an expiration — including the one of this request.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /**\n * Updates account-level settings such as name, settings object, wizard progress, and default department. It\n * applies to the whole account; the default department is required while the tickets are enabled.\n */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`) for a `client`.\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead. Resolves the status fields of the user.\n */\n updateStatus(\n body: UpdateMeStatusPayload,\n headers?: Record<string, string>,\n ): Promise<MeStatusResponse> {\n return this.client.put<MeStatusResponse, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire, and notifies the\n * billing webhook. Returns the updated account; an account not in a grace period answers 400.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers the push notification tokens of the current user (`data` replaces the whole `data` of the user).\n * Resolves with no body.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client (`'web'` by default) and emits a takeover\n * event, which signals other connected sessions to yield control to this one. Resolves with no body.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`. Resolves the text `'OK'`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<'OK'> {\n return this.client.post<'OK'>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;;;;;;AAsBA,SAAS,qBACP,gBACA,SAC0D;AAI1D,QAFE,CAAC,CAAC,kBACF,OAAO,OAAO,eAAe,CAAC,MAAM,UAAU,OAAO,UAAU,YAAY,UAAU,KAAK,GAExF,CAAC,gBAA0B,QAAQ,GACnC,CAAC,QAAW,eAAqD;;AAGvE,IAAa,QAAb,cAA2B,QAAQ;CAQjC,MACE,gBACA,SACe;EACf,MAAM,CAAC,OAAO,QAAQ,qBAA8B,gBAAgB,QAAQ;AAC5E,SAAO,KAAK,OAAO,IAAU,MAAM,KAAK,cAAc,MAAM,IAAI,KAAK;;CASvE,WACE,gBACA,SACkB;EAClB,MAAM,CAAC,OAAO,QAAQ,qBAAqC,gBAAgB,QAAQ;AACnF,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