@ikatec/digisac-api-sdk 4.11.0 → 4.12.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/categories/types.d.ts +1 -0
- package/dist/apis/categories/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/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/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 +52 -0
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +45 -2
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +52 -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/categories/types.ts +1 -0
- 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/me/MeApi.test.ts +44 -0
- package/src/apis/me/MeApi.ts +83 -28
- package/src/apis/me/types.ts +75 -4
- package/src/apis/payloads.test-d.ts +36 -2
- 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 +75 -1
- package/src/apis/whatsappBusinessTemplates/types.ts +38 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/categories/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/categories/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,uEAAuE;AACvE,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
@@ -7,6 +7,21 @@ var InteractiveMessagesApi = class extends require_core_BaseCrudApi.BaseCrudApi
|
|
|
7
7
|
super(client, "/interactive-messages");
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
+
* Counts the interactive messages matching the query.
|
|
11
|
+
* @permissions interactive-messages.view OR interactive-messages.management.all.departments
|
|
12
|
+
*/
|
|
13
|
+
count(query, headers) {
|
|
14
|
+
return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
|
|
18
|
+
* sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
|
|
19
|
+
* @permissions interactive-messages.create OR interactive-messages.management.all.departments
|
|
20
|
+
*/
|
|
21
|
+
create(body, headers) {
|
|
22
|
+
return super.create(body, headers);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
10
25
|
* Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
|
|
11
26
|
* @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
|
|
12
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractiveMessagesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AASA,IAAa,yBAAb,cAA4CA,qCAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
1
|
+
{"version":3,"file":"InteractiveMessagesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Counts the interactive messages matching the query.\n * @permissions interactive-messages.view OR interactive-messages.management.all.departments\n */\n count(\n query?: ListQuery<InteractiveMessage>,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.get<{ count: number }>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as\n * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.\n * @permissions interactive-messages.create OR interactive-messages.management.all.departments\n */\n override create(\n body: CreateInteractiveMessagePayload,\n headers?: Record<string, string>,\n ): Promise<InteractiveMessage> {\n return super.create(body, headers)\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AASA,IAAa,yBAAb,cAA4CA,qCAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,MACE,OACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,AAAS,OACP,MACA,SAC6B;AAC7B,SAAO,MAAM,OAAO,MAAM,QAAQ;;;;;;CAOpC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -4,6 +4,19 @@ import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
|
4
4
|
import type { InteractiveMessage, CreateInteractiveMessagePayload, UpdateInteractiveMessagePayload } from './types';
|
|
5
5
|
export declare class InteractiveMessagesApi extends BaseCrudApi<InteractiveMessage, CreateInteractiveMessagePayload, UpdateInteractiveMessagePayload, ListQuery<InteractiveMessage>, 'OK'> {
|
|
6
6
|
constructor(client: ApiClient);
|
|
7
|
+
/**
|
|
8
|
+
* Counts the interactive messages matching the query.
|
|
9
|
+
* @permissions interactive-messages.view OR interactive-messages.management.all.departments
|
|
10
|
+
*/
|
|
11
|
+
count(query?: ListQuery<InteractiveMessage>, headers?: Record<string, string>): Promise<{
|
|
12
|
+
count: number;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
|
|
16
|
+
* sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
|
|
17
|
+
* @permissions interactive-messages.create OR interactive-messages.management.all.departments
|
|
18
|
+
*/
|
|
19
|
+
create(body: CreateInteractiveMessagePayload, headers?: Record<string, string>): Promise<InteractiveMessage>;
|
|
7
20
|
/**
|
|
8
21
|
* Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
|
|
9
22
|
* @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractiveMessagesApi.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.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,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,SAAS,CAAA;AAEhB,qBAAa,sBAAuB,SAAQ,WAAW,CACrD,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,SAAS,CAAC,kBAAkB,CAAC,EAC7B,IAAI,CACL;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjF"}
|
|
1
|
+
{"version":3,"file":"InteractiveMessagesApi.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.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,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,SAAS,CAAA;AAEhB,qBAAa,sBAAuB,SAAQ,WAAW,CACrD,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,SAAS,CAAC,kBAAkB,CAAC,EAC7B,IAAI,CACL;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,KAAK,CACH,KAAK,CAAC,EAAE,SAAS,CAAC,kBAAkB,CAAC,EACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAO7B;;;;OAIG;IACM,MAAM,CACb,IAAI,EAAE,+BAA+B,EACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAI9B;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjF"}
|
|
@@ -6,6 +6,21 @@ var InteractiveMessagesApi = class extends BaseCrudApi {
|
|
|
6
6
|
super(client, "/interactive-messages");
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
+
* Counts the interactive messages matching the query.
|
|
10
|
+
* @permissions interactive-messages.view OR interactive-messages.management.all.departments
|
|
11
|
+
*/
|
|
12
|
+
count(query, headers) {
|
|
13
|
+
return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
|
|
17
|
+
* sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
|
|
18
|
+
* @permissions interactive-messages.create OR interactive-messages.management.all.departments
|
|
19
|
+
*/
|
|
20
|
+
create(body, headers) {
|
|
21
|
+
return super.create(body, headers);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
9
24
|
* Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
|
|
10
25
|
* @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
|
|
11
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractiveMessagesApi.mjs","names":[],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AASA,IAAa,yBAAb,cAA4C,YAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
1
|
+
{"version":3,"file":"InteractiveMessagesApi.mjs","names":[],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Counts the interactive messages matching the query.\n * @permissions interactive-messages.view OR interactive-messages.management.all.departments\n */\n count(\n query?: ListQuery<InteractiveMessage>,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.get<{ count: number }>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as\n * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.\n * @permissions interactive-messages.create OR interactive-messages.management.all.departments\n */\n override create(\n body: CreateInteractiveMessagePayload,\n headers?: Record<string, string>,\n ): Promise<InteractiveMessage> {\n return super.create(body, headers)\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AASA,IAAa,yBAAb,cAA4C,YAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,MACE,OACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,AAAS,OACP,MACA,SAC6B;AAC7B,SAAO,MAAM,OAAO,MAAM,QAAQ;;;;;;CAOpC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -154,7 +154,8 @@ type InteractiveMessageFilePayload = {
|
|
|
154
154
|
export type InteractiveMessage = {
|
|
155
155
|
id: string;
|
|
156
156
|
name: string;
|
|
157
|
-
|
|
157
|
+
/** @deprecated Not a field of the backend (no such column): the type is `interactive.type`. */
|
|
158
|
+
type?: 'list' | 'button' | 'cta_url' | 'request_contact_info';
|
|
158
159
|
interactive: InteractiveMessageContent;
|
|
159
160
|
archivedAt: string | null;
|
|
160
161
|
accountId: string;
|
|
@@ -163,8 +164,9 @@ export type InteractiveMessage = {
|
|
|
163
164
|
deletedAt: string | null;
|
|
164
165
|
file?: File | null;
|
|
165
166
|
departments?: Department[];
|
|
167
|
+
account?: Record<string, unknown>;
|
|
166
168
|
};
|
|
167
|
-
export type InteractiveMessageRelationships = 'file' | 'departments';
|
|
169
|
+
export type InteractiveMessageRelationships = 'file' | 'departments' | 'account';
|
|
168
170
|
export type CreateInteractiveMessagePayload = {
|
|
169
171
|
name: string;
|
|
170
172
|
interactive: InteractiveMessageContentInput;
|
|
@@ -174,6 +176,10 @@ export type CreateInteractiveMessagePayload = {
|
|
|
174
176
|
}[];
|
|
175
177
|
file?: InteractiveMessageFilePayload;
|
|
176
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* The backend requires `name` and `interactive` on the update too. It replaces the departments: omitting
|
|
181
|
+
* `departmentIds`/`departments` clears them. Only `file.base64Url` is read (a `file.id` is ignored).
|
|
182
|
+
*/
|
|
177
183
|
export type UpdateInteractiveMessagePayload = {
|
|
178
184
|
name?: string;
|
|
179
185
|
interactive?: InteractiveMessageContentInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages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
|
@@ -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;;AAGvE,IAAa,QAAb,cAA2BA,6BAAQ;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,SAAO,KAAK,OAAO,IAAa,cAAc,KAAK,cAAc,MAAM,IAAI,KAAK;;CAYlF,kBACE,gBACA,SACyB;EACzB,MAAM,CAAC,OAAO,QAAQ,qBAA0C,gBAAgB,QAAQ;EACxF,MAAM,cAAc,QAAQ,KAAK,cAAc,EAAE,QAAQ,MAAM,OAAO,KAAK,IAAI,EAAE,CAAC,GAAG;AACrF,SAAO,KAAK,OAAO,IAAoB,0BAA0B,eAAe,KAAK;;;;;;;CAQvF,kBAAkB,SAA4D;AAC5E,SAAO,KAAK,OAAO,IAAqB,iCAAiC,QAAQ;;;;;;;CAQnF,SAAS,MAAuB,SAAiD;AAC/E,SAAO,KAAK,OAAO,IAA2B,OAAO,MAAM,QAAQ;;;;;;CAOrE,cAAc,MAA8B,SAAoD;AAC9F,SAAO,KAAK,OAAO,IAAqC,eAAe,MAAM,QAAQ;;;;;;;CAQvF,aACE,MACA,SAC2B;AAC3B,SAAO,KAAK,OAAO,IAA6C,cAAc,MAAM,QAAQ;;;;;;CAO9F,yBAAyB,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,mCAAmC,QAAW,QAAQ;;;;;;CAOzF,cAAc,MAA4B,SAAiD;AACzF,SAAO,KAAK,OAAO,KACjB,iCACA,MACA,QACD;;;CAIH,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,oBAAoB,QAAW,QAAQ;;;;;;CAOvE,SAAS,MAAwB,SAAiD;AAChF,SAAO,KAAK,OAAO,KAA4B,gBAAgB,MAAM,QAAQ;;;;;;CAO/E,gBAAgB,MAA8B,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,gBAAg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AAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/F;;;;OAIG;IACH,YAAY,CACV,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAI5B;;;OAGG;IACH,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5E;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,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,S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