@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
package/dist/apis/me/types.d.ts
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
import type { AccountSettings } from '../accounts/types';
|
|
2
2
|
import type { UserPreferences } from '../users/types';
|
|
3
3
|
import type { UserStatus } from '../users/types';
|
|
4
|
+
/** The client of the session that sets the status: the web app or the mobile app. */
|
|
5
|
+
export type MeClient = 'web' | 'app';
|
|
6
|
+
/** Query of `GET /me`: without `include`, the user comes without relations. */
|
|
7
|
+
export type MeQuery = {
|
|
8
|
+
include?: ('roles' | 'departments' | 'timetable' | 'account' | 'permissions' | 'organizations' | (string & {}))[];
|
|
9
|
+
attributes?: string[];
|
|
10
|
+
};
|
|
11
|
+
/** Query of `GET /me/account`: `where.id` is the id of the account of the user (`accountId` of `getMe`). */
|
|
12
|
+
export type MeAccountQuery = {
|
|
13
|
+
where: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
include?: string[];
|
|
17
|
+
attributes?: string[];
|
|
18
|
+
};
|
|
19
|
+
export type AccountAmountsFilter = 'services.amounts' | 'users.amounts';
|
|
20
|
+
/** Query of `GET /me/get-account-amounts`: which amounts to answer (the credit amounts are never answered). */
|
|
21
|
+
export type AccountAmountsQuery = {
|
|
22
|
+
filter: AccountAmountsFilter[];
|
|
23
|
+
};
|
|
24
|
+
export type UsersAmounts = {
|
|
25
|
+
planBase: number;
|
|
26
|
+
additional: number;
|
|
27
|
+
totalContracted: number;
|
|
28
|
+
planBaseConsumed: number;
|
|
29
|
+
additionalConsumed: number;
|
|
30
|
+
totalConsumed: number;
|
|
31
|
+
available: number;
|
|
32
|
+
};
|
|
33
|
+
export type AccountAmounts = {
|
|
34
|
+
accountId: string;
|
|
35
|
+
servicesAmounts?: Record<string, unknown>;
|
|
36
|
+
usersAmounts?: UsersAmounts;
|
|
37
|
+
};
|
|
38
|
+
/** What `updateStatus` answers: the status fields of the user, not the whole user. */
|
|
39
|
+
export type MeStatusResponse = {
|
|
40
|
+
id: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
status: UserStatus;
|
|
43
|
+
clientsStatus: Partial<Record<MeClient, UserStatus>>;
|
|
44
|
+
language: string;
|
|
45
|
+
account?: unknown;
|
|
46
|
+
};
|
|
4
47
|
export type UpdateMePayload = {
|
|
5
48
|
name?: string;
|
|
6
49
|
password?: string;
|
|
50
|
+
/** Required with `password`: the current password of the user. */
|
|
51
|
+
currentPassword?: string;
|
|
7
52
|
language?: string;
|
|
8
53
|
preferences?: UserPreferences;
|
|
9
54
|
otpAuthActive?: boolean;
|
|
@@ -12,19 +57,37 @@ export type UpdateMePayload = {
|
|
|
12
57
|
};
|
|
13
58
|
export type UpdateMeStatusPayload = {
|
|
14
59
|
status: UserStatus;
|
|
15
|
-
|
|
60
|
+
/** Required by the backend (400 without it). */
|
|
61
|
+
client?: MeClient;
|
|
16
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Merged over the account. The default department is required while the tickets are enabled
|
|
65
|
+
* (`settings.ticketsEnabled`; 400 `DEFAULT_DEPARTMENT_REQUIRED`).
|
|
66
|
+
*/
|
|
17
67
|
export type UpdateMeAccountPayload = {
|
|
18
68
|
name?: string;
|
|
19
69
|
settings?: Partial<AccountSettings>;
|
|
20
|
-
wizardProgress?: string;
|
|
70
|
+
wizardProgress?: 'notStarted' | 'started' | 'finished' | (string & {});
|
|
21
71
|
defaultDepartmentId?: string;
|
|
72
|
+
defaultDepartment?: {
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
22
75
|
};
|
|
23
76
|
export type TakeoverPayload = {
|
|
24
|
-
|
|
77
|
+
/** Defaults to `'web'`. */
|
|
78
|
+
client?: MeClient;
|
|
25
79
|
};
|
|
26
80
|
export type SetOtpSecretKeyPayload = {
|
|
27
81
|
secretKey: string;
|
|
28
82
|
};
|
|
29
|
-
|
|
83
|
+
/** The push tokens of the user. `data` REPLACES the whole `data` of the user (it is not merged). */
|
|
84
|
+
export type RegisterTokenPayload = {
|
|
85
|
+
data?: {
|
|
86
|
+
oneSignalToken?: string;
|
|
87
|
+
expoPushToken?: string | null;
|
|
88
|
+
fromApp?: boolean;
|
|
89
|
+
};
|
|
90
|
+
/** The backend ignores the call when it is `true`. */
|
|
91
|
+
isClientUser?: boolean;
|
|
92
|
+
};
|
|
30
93
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/me/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO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OAAO,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,UAAU,CAAA;IAClB,gDAAgD;IAChD,MAAM,CAAC,EAAE,QAAQ,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACnC,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,iBAAiB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,QAAQ,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,oGAAoG;AACpG,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IACpF,sDAAsD;IACtD,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA"}
|
|
@@ -4,9 +4,19 @@ const require_core_BaseApi = require('../../core/BaseApi.cjs');
|
|
|
4
4
|
//#region src/apis/transcripts/TranscriptsApi.ts
|
|
5
5
|
var TranscriptsApi = class extends require_core_BaseApi.BaseApi {
|
|
6
6
|
basePath = "/transcripts";
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Starts the transcription of the audio of a message: marks the message as transcribing and dispatches an async
|
|
9
|
+
* job, which calls the transcription service (AI) and debits the AI credits of the account. Resolves with no body;
|
|
10
|
+
* the result shows on the message. An unknown message answers 500.
|
|
11
|
+
*/
|
|
12
|
+
transcribe(messageId, headers) {
|
|
13
|
+
return this.client.get(`${this.basePath}/${messageId}`, headers);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Not a read: it starts the transcription of the message. Use {@link transcribe}.
|
|
17
|
+
*/
|
|
8
18
|
getById(id, headers) {
|
|
9
|
-
return this.
|
|
19
|
+
return this.transcribe(id, headers);
|
|
10
20
|
}
|
|
11
21
|
};
|
|
12
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptsApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/transcripts/TranscriptsApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\
|
|
1
|
+
{"version":3,"file":"TranscriptsApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/transcripts/TranscriptsApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\n\nexport class TranscriptsApi extends BaseApi {\n private readonly basePath = '/transcripts'\n\n /**\n * Starts the transcription of the audio of a message: marks the message as transcribing and dispatches an async\n * job, which calls the transcription service (AI) and debits the AI credits of the account. Resolves with no body;\n * the result shows on the message. An unknown message answers 500.\n */\n transcribe(messageId: string, headers?: Record<string, string>): Promise<void> {\n return this.client.get<void>(`${this.basePath}/${messageId}`, headers)\n }\n\n /**\n * @deprecated Not a read: it starts the transcription of the message. Use {@link transcribe}.\n */\n getById(id: string, headers?: Record<string, string>): Promise<void> {\n return this.transcribe(id, headers)\n }\n}\n"],"mappings":";;;;AAEA,IAAa,iBAAb,cAAoCA,6BAAQ;CAC1C,AAAiB,WAAW;;;;;;CAO5B,WAAW,WAAmB,SAAiD;AAC7E,SAAO,KAAK,OAAO,IAAU,GAAG,KAAK,SAAS,GAAG,aAAa,QAAQ;;;;;CAMxE,QAAQ,IAAY,SAAiD;AACnE,SAAO,KAAK,WAAW,IAAI,QAAQ"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { BaseApi } from '../../core/BaseApi';
|
|
2
|
-
|
|
3
|
-
import type { TranscriptResponse } from './types';
|
|
4
|
-
export declare class TranscriptsApi extends BaseApi implements HasGetById<TranscriptResponse> {
|
|
2
|
+
export declare class TranscriptsApi extends BaseApi {
|
|
5
3
|
private readonly basePath;
|
|
6
|
-
/**
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Starts the transcription of the audio of a message: marks the message as transcribing and dispatches an async
|
|
6
|
+
* job, which calls the transcription service (AI) and debits the AI credits of the account. Resolves with no body;
|
|
7
|
+
* the result shows on the message. An unknown message answers 500.
|
|
8
|
+
*/
|
|
9
|
+
transcribe(messageId: string, headers?: Record<string, string>): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Not a read: it starts the transcription of the message. Use {@link transcribe}.
|
|
12
|
+
*/
|
|
13
|
+
getById(id: string, headers?: Record<string, string>): Promise<void>;
|
|
8
14
|
}
|
|
9
15
|
//# sourceMappingURL=TranscriptsApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/transcripts/TranscriptsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"TranscriptsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/transcripts/TranscriptsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,qBAAa,cAAe,SAAQ,OAAO;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAE1C;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9E;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
|
|
@@ -3,9 +3,19 @@ import { BaseApi } from "../../core/BaseApi.mjs";
|
|
|
3
3
|
//#region src/apis/transcripts/TranscriptsApi.ts
|
|
4
4
|
var TranscriptsApi = class extends BaseApi {
|
|
5
5
|
basePath = "/transcripts";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Starts the transcription of the audio of a message: marks the message as transcribing and dispatches an async
|
|
8
|
+
* job, which calls the transcription service (AI) and debits the AI credits of the account. Resolves with no body;
|
|
9
|
+
* the result shows on the message. An unknown message answers 500.
|
|
10
|
+
*/
|
|
11
|
+
transcribe(messageId, headers) {
|
|
12
|
+
return this.client.get(`${this.basePath}/${messageId}`, headers);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Not a read: it starts the transcription of the message. Use {@link transcribe}.
|
|
16
|
+
*/
|
|
7
17
|
getById(id, headers) {
|
|
8
|
-
return this.
|
|
18
|
+
return this.transcribe(id, headers);
|
|
9
19
|
}
|
|
10
20
|
};
|
|
11
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptsApi.mjs","names":[],"sources":["../../../src/apis/transcripts/TranscriptsApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\
|
|
1
|
+
{"version":3,"file":"TranscriptsApi.mjs","names":[],"sources":["../../../src/apis/transcripts/TranscriptsApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\n\nexport class TranscriptsApi extends BaseApi {\n private readonly basePath = '/transcripts'\n\n /**\n * Starts the transcription of the audio of a message: marks the message as transcribing and dispatches an async\n * job, which calls the transcription service (AI) and debits the AI credits of the account. Resolves with no body;\n * the result shows on the message. An unknown message answers 500.\n */\n transcribe(messageId: string, headers?: Record<string, string>): Promise<void> {\n return this.client.get<void>(`${this.basePath}/${messageId}`, headers)\n }\n\n /**\n * @deprecated Not a read: it starts the transcription of the message. Use {@link transcribe}.\n */\n getById(id: string, headers?: Record<string, string>): Promise<void> {\n return this.transcribe(id, headers)\n }\n}\n"],"mappings":";;;AAEA,IAAa,iBAAb,cAAoC,QAAQ;CAC1C,AAAiB,WAAW;;;;;;CAO5B,WAAW,WAAmB,SAAiD;AAC7E,SAAO,KAAK,OAAO,IAAU,GAAG,KAAK,SAAS,GAAG,aAAa,QAAQ;;;;;CAMxE,QAAQ,IAAY,SAAiD;AACnE,SAAO,KAAK,WAAW,IAAI,QAAQ"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The route answers no body: `TranscriptsApi.transcribe` (and `getById`) resolve `undefined`. The
|
|
3
|
+
* transcription status shows on the message (`isTranscribing`, `transcribeError`).
|
|
4
|
+
*/
|
|
1
5
|
export type TranscriptResponse = {
|
|
2
6
|
id: string;
|
|
3
7
|
isTranscribing: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/transcripts/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,OAAO,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/transcripts/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,OAAO,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA"}
|
|
@@ -2,10 +2,62 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts
|
|
5
|
+
/**
|
|
6
|
+
* WhatsApp Business templates. Create, update, reads and count are local; `sendToReview`, `refreshTemplates`,
|
|
7
|
+
* `resume` and the delete of a template of a `whatsapp-business` connection call the provider (Meta, 360Dialog).
|
|
8
|
+
* `getById` answers `null` for an unknown id.
|
|
9
|
+
*/
|
|
5
10
|
var WhatsappBusinessTemplatesApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
6
11
|
constructor(client) {
|
|
7
12
|
super(client, "/whatsapp-business-templates");
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Counts the templates matching the query.
|
|
16
|
+
* @permissions hsm.view
|
|
17
|
+
*/
|
|
18
|
+
count(query, headers) {
|
|
19
|
+
return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reads the template limit of the plan of the account. Send the `accountId` of the current user: the route is
|
|
23
|
+
* outside the error handler of the backend, so an unknown id gets no answer (the request waits for the timeout).
|
|
24
|
+
* @permissions hsm.view
|
|
25
|
+
*/
|
|
26
|
+
getHsmLimit(accountId, headers) {
|
|
27
|
+
return this.client.get(`${this.basePath}/${accountId}/hsmLimit`, headers);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Deletes a template. On a `whatsapp-business` connection it goes to the provider (and answers what it answers);
|
|
31
|
+
* a draft of another connection type is deleted locally (answers the stored template). An unknown id answers 500.
|
|
32
|
+
* @permissions hsm.view OR hsm.destroy
|
|
33
|
+
*/
|
|
34
|
+
deleteById(id, headers) {
|
|
35
|
+
return super.deleteById(id, headers);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* SENDS the template to Meta for approval (through the provider of the connection). An unknown or archived
|
|
39
|
+
* template answers 500 before anything is sent.
|
|
40
|
+
* @permissions hsm.view OR hsm.send OR hsm.send.before.expire
|
|
41
|
+
*/
|
|
42
|
+
sendToReview(id, headers) {
|
|
43
|
+
return this.client.post(`${this.basePath}/${id}/send-to-review`, void 0, headers);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reads the templates of the connected `whatsapp-business` connections from the provider and syncs them (it may
|
|
47
|
+
* archive the local templates the provider no longer has). Resolves the text `'OK'`.
|
|
48
|
+
* @permissions hsm.view
|
|
49
|
+
*/
|
|
50
|
+
refreshTemplates(headers) {
|
|
51
|
+
return this.client.post(`${this.basePath}/refresh-templates`, void 0, headers);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads the template balance from 360Dialog. The backend looks for the 360Dialog connection on the whole platform,
|
|
55
|
+
* not only in the account, and calls 360Dialog when it finds one.
|
|
56
|
+
* @permissions hsm.view
|
|
57
|
+
*/
|
|
58
|
+
resume(headers) {
|
|
59
|
+
return this.client.get(`${this.basePath}/resume`, headers);
|
|
60
|
+
}
|
|
9
61
|
};
|
|
10
62
|
|
|
11
63
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsappBusinessTemplatesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload,\n} from './types'\n\nexport class WhatsappBusinessTemplatesApi extends BaseCrudApi<\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/whatsapp-business-templates')\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WhatsappBusinessTemplatesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload,\n WhatsappBusinessTemplateHsmLimit,\n} from './types'\n\n/**\n * WhatsApp Business templates. Create, update, reads and count are local; `sendToReview`, `refreshTemplates`,\n * `resume` and the delete of a template of a `whatsapp-business` connection call the provider (Meta, 360Dialog).\n * `getById` answers `null` for an unknown id.\n */\nexport class WhatsappBusinessTemplatesApi extends BaseCrudApi<\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload,\n ListQuery<WhatsappBusinessTemplate>,\n unknown\n> {\n constructor(client: ApiClient) {\n super(client, '/whatsapp-business-templates')\n }\n\n /**\n * Counts the templates matching the query.\n * @permissions hsm.view\n */\n count(\n query?: ListQuery<WhatsappBusinessTemplate>,\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 * Reads the template limit of the plan of the account. Send the `accountId` of the current user: the route is\n * outside the error handler of the backend, so an unknown id gets no answer (the request waits for the timeout).\n * @permissions hsm.view\n */\n getHsmLimit(\n accountId: string,\n headers?: Record<string, string>,\n ): Promise<WhatsappBusinessTemplateHsmLimit> {\n return this.client.get<WhatsappBusinessTemplateHsmLimit>(\n `${this.basePath}/${accountId}/hsmLimit`,\n headers,\n )\n }\n\n /**\n * Deletes a template. On a `whatsapp-business` connection it goes to the provider (and answers what it answers);\n * a draft of another connection type is deleted locally (answers the stored template). An unknown id answers 500.\n * @permissions hsm.view OR hsm.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<unknown> {\n return super.deleteById(id, headers)\n }\n\n /**\n * SENDS the template to Meta for approval (through the provider of the connection). An unknown or archived\n * template answers 500 before anything is sent.\n * @permissions hsm.view OR hsm.send OR hsm.send.before.expire\n */\n sendToReview(id: string, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown>(`${this.basePath}/${id}/send-to-review`, undefined, headers)\n }\n\n /**\n * Reads the templates of the connected `whatsapp-business` connections from the provider and syncs them (it may\n * archive the local templates the provider no longer has). Resolves the text `'OK'`.\n * @permissions hsm.view\n */\n refreshTemplates(headers?: Record<string, string>): Promise<'OK'> {\n return this.client.post<'OK'>(`${this.basePath}/refresh-templates`, undefined, headers)\n }\n\n /**\n * Reads the template balance from 360Dialog. The backend looks for the 360Dialog connection on the whole platform,\n * not only in the account, and calls 360Dialog when it finds one.\n * @permissions hsm.view\n */\n resume(headers?: Record<string, string>): Promise<Record<string, unknown>[]> {\n return this.client.get<Record<string, unknown>[]>(`${this.basePath}/resume`, headers)\n }\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,+BAAb,cAAkDA,qCAMhD;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,+BAA+B;;;;;;CAO/C,MACE,OACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,YACE,WACA,SAC2C;AAC3C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,UAAU,YAC9B,QACD;;;;;;;CAQH,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,aAAa,IAAY,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,kBAAkB,QAAW,QAAQ;;;;;;;CAQ/F,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,GAAG,KAAK,SAAS,qBAAqB,QAAW,QAAQ;;;;;;;CAQzF,OAAO,SAAsE;AAC3E,SAAO,KAAK,OAAO,IAA+B,GAAG,KAAK,SAAS,UAAU,QAAQ"}
|
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
|
+
import type { ListQuery } from '../../core/types';
|
|
2
3
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
|
-
import type { WhatsappBusinessTemplate, CreateWhatsappBusinessTemplatePayload, UpdateWhatsappBusinessTemplatePayload } from './types';
|
|
4
|
-
|
|
4
|
+
import type { WhatsappBusinessTemplate, CreateWhatsappBusinessTemplatePayload, UpdateWhatsappBusinessTemplatePayload, WhatsappBusinessTemplateHsmLimit } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* WhatsApp Business templates. Create, update, reads and count are local; `sendToReview`, `refreshTemplates`,
|
|
7
|
+
* `resume` and the delete of a template of a `whatsapp-business` connection call the provider (Meta, 360Dialog).
|
|
8
|
+
* `getById` answers `null` for an unknown id.
|
|
9
|
+
*/
|
|
10
|
+
export declare class WhatsappBusinessTemplatesApi extends BaseCrudApi<WhatsappBusinessTemplate, CreateWhatsappBusinessTemplatePayload, UpdateWhatsappBusinessTemplatePayload, ListQuery<WhatsappBusinessTemplate>, unknown> {
|
|
5
11
|
constructor(client: ApiClient);
|
|
12
|
+
/**
|
|
13
|
+
* Counts the templates matching the query.
|
|
14
|
+
* @permissions hsm.view
|
|
15
|
+
*/
|
|
16
|
+
count(query?: ListQuery<WhatsappBusinessTemplate>, headers?: Record<string, string>): Promise<{
|
|
17
|
+
count: number;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Reads the template limit of the plan of the account. Send the `accountId` of the current user: the route is
|
|
21
|
+
* outside the error handler of the backend, so an unknown id gets no answer (the request waits for the timeout).
|
|
22
|
+
* @permissions hsm.view
|
|
23
|
+
*/
|
|
24
|
+
getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<WhatsappBusinessTemplateHsmLimit>;
|
|
25
|
+
/**
|
|
26
|
+
* Deletes a template. On a `whatsapp-business` connection it goes to the provider (and answers what it answers);
|
|
27
|
+
* a draft of another connection type is deleted locally (answers the stored template). An unknown id answers 500.
|
|
28
|
+
* @permissions hsm.view OR hsm.destroy
|
|
29
|
+
*/
|
|
30
|
+
deleteById(id: string, headers?: Record<string, string>): Promise<unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* SENDS the template to Meta for approval (through the provider of the connection). An unknown or archived
|
|
33
|
+
* template answers 500 before anything is sent.
|
|
34
|
+
* @permissions hsm.view OR hsm.send OR hsm.send.before.expire
|
|
35
|
+
*/
|
|
36
|
+
sendToReview(id: string, headers?: Record<string, string>): Promise<unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Reads the templates of the connected `whatsapp-business` connections from the provider and syncs them (it may
|
|
39
|
+
* archive the local templates the provider no longer has). Resolves the text `'OK'`.
|
|
40
|
+
* @permissions hsm.view
|
|
41
|
+
*/
|
|
42
|
+
refreshTemplates(headers?: Record<string, string>): Promise<'OK'>;
|
|
43
|
+
/**
|
|
44
|
+
* Reads the template balance from 360Dialog. The backend looks for the 360Dialog connection on the whole platform,
|
|
45
|
+
* not only in the account, and calls 360Dialog when it finds one.
|
|
46
|
+
* @permissions hsm.view
|
|
47
|
+
*/
|
|
48
|
+
resume(headers?: Record<string, string>): Promise<Record<string, unknown>[]>;
|
|
6
49
|
}
|
|
7
50
|
//# sourceMappingURL=WhatsappBusinessTemplatesApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsappBusinessTemplatesApi.d.ts","sourceRoot":"","sources":["../../../src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,wBAAwB,EACxB,qCAAqC,EACrC,qCAAqC,
|
|
1
|
+
{"version":3,"file":"WhatsappBusinessTemplatesApi.d.ts","s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AAO,CAAC,IAAI,CAAC;IAIjE;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CAG7E"}
|
|
@@ -1,10 +1,62 @@
|
|
|
1
1
|
import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts
|
|
4
|
+
/**
|
|
5
|
+
* WhatsApp Business templates. Create, update, reads and count are local; `sendToReview`, `refreshTemplates`,
|
|
6
|
+
* `resume` and the delete of a template of a `whatsapp-business` connection call the provider (Meta, 360Dialog).
|
|
7
|
+
* `getById` answers `null` for an unknown id.
|
|
8
|
+
*/
|
|
4
9
|
var WhatsappBusinessTemplatesApi = class extends BaseCrudApi {
|
|
5
10
|
constructor(client) {
|
|
6
11
|
super(client, "/whatsapp-business-templates");
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Counts the templates matching the query.
|
|
15
|
+
* @permissions hsm.view
|
|
16
|
+
*/
|
|
17
|
+
count(query, headers) {
|
|
18
|
+
return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads the template limit of the plan of the account. Send the `accountId` of the current user: the route is
|
|
22
|
+
* outside the error handler of the backend, so an unknown id gets no answer (the request waits for the timeout).
|
|
23
|
+
* @permissions hsm.view
|
|
24
|
+
*/
|
|
25
|
+
getHsmLimit(accountId, headers) {
|
|
26
|
+
return this.client.get(`${this.basePath}/${accountId}/hsmLimit`, headers);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Deletes a template. On a `whatsapp-business` connection it goes to the provider (and answers what it answers);
|
|
30
|
+
* a draft of another connection type is deleted locally (answers the stored template). An unknown id answers 500.
|
|
31
|
+
* @permissions hsm.view OR hsm.destroy
|
|
32
|
+
*/
|
|
33
|
+
deleteById(id, headers) {
|
|
34
|
+
return super.deleteById(id, headers);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* SENDS the template to Meta for approval (through the provider of the connection). An unknown or archived
|
|
38
|
+
* template answers 500 before anything is sent.
|
|
39
|
+
* @permissions hsm.view OR hsm.send OR hsm.send.before.expire
|
|
40
|
+
*/
|
|
41
|
+
sendToReview(id, headers) {
|
|
42
|
+
return this.client.post(`${this.basePath}/${id}/send-to-review`, void 0, headers);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Reads the templates of the connected `whatsapp-business` connections from the provider and syncs them (it may
|
|
46
|
+
* archive the local templates the provider no longer has). Resolves the text `'OK'`.
|
|
47
|
+
* @permissions hsm.view
|
|
48
|
+
*/
|
|
49
|
+
refreshTemplates(headers) {
|
|
50
|
+
return this.client.post(`${this.basePath}/refresh-templates`, void 0, headers);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Reads the template balance from 360Dialog. The backend looks for the 360Dialog connection on the whole platform,
|
|
54
|
+
* not only in the account, and calls 360Dialog when it finds one.
|
|
55
|
+
* @permissions hsm.view
|
|
56
|
+
*/
|
|
57
|
+
resume(headers) {
|
|
58
|
+
return this.client.get(`${this.basePath}/resume`, headers);
|
|
59
|
+
}
|
|
8
60
|
};
|
|
9
61
|
|
|
10
62
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsappBusinessTemplatesApi.mjs","names":[],"sources":["../../../src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload,\n} from './types'\n\nexport class WhatsappBusinessTemplatesApi extends BaseCrudApi<\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/whatsapp-business-templates')\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WhatsappBusinessTemplatesApi.mjs","names":[],"sources":["../../../src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload,\n WhatsappBusinessTemplateHsmLimit,\n} from './types'\n\n/**\n * WhatsApp Business templates. Create, update, reads and count are local; `sendToReview`, `refreshTemplates`,\n * `resume` and the delete of a template of a `whatsapp-business` connection call the provider (Meta, 360Dialog).\n * `getById` answers `null` for an unknown id.\n */\nexport class WhatsappBusinessTemplatesApi extends BaseCrudApi<\n WhatsappBusinessTemplate,\n CreateWhatsappBusinessTemplatePayload,\n UpdateWhatsappBusinessTemplatePayload,\n ListQuery<WhatsappBusinessTemplate>,\n unknown\n> {\n constructor(client: ApiClient) {\n super(client, '/whatsapp-business-templates')\n }\n\n /**\n * Counts the templates matching the query.\n * @permissions hsm.view\n */\n count(\n query?: ListQuery<WhatsappBusinessTemplate>,\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 * Reads the template limit of the plan of the account. Send the `accountId` of the current user: the route is\n * outside the error handler of the backend, so an unknown id gets no answer (the request waits for the timeout).\n * @permissions hsm.view\n */\n getHsmLimit(\n accountId: string,\n headers?: Record<string, string>,\n ): Promise<WhatsappBusinessTemplateHsmLimit> {\n return this.client.get<WhatsappBusinessTemplateHsmLimit>(\n `${this.basePath}/${accountId}/hsmLimit`,\n headers,\n )\n }\n\n /**\n * Deletes a template. On a `whatsapp-business` connection it goes to the provider (and answers what it answers);\n * a draft of another connection type is deleted locally (answers the stored template). An unknown id answers 500.\n * @permissions hsm.view OR hsm.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<unknown> {\n return super.deleteById(id, headers)\n }\n\n /**\n * SENDS the template to Meta for approval (through the provider of the connection). An unknown or archived\n * template answers 500 before anything is sent.\n * @permissions hsm.view OR hsm.send OR hsm.send.before.expire\n */\n sendToReview(id: string, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown>(`${this.basePath}/${id}/send-to-review`, undefined, headers)\n }\n\n /**\n * Reads the templates of the connected `whatsapp-business` connections from the provider and syncs them (it may\n * archive the local templates the provider no longer has). Resolves the text `'OK'`.\n * @permissions hsm.view\n */\n refreshTemplates(headers?: Record<string, string>): Promise<'OK'> {\n return this.client.post<'OK'>(`${this.basePath}/refresh-templates`, undefined, headers)\n }\n\n /**\n * Reads the template balance from 360Dialog. The backend looks for the 360Dialog connection on the whole platform,\n * not only in the account, and calls 360Dialog when it finds one.\n * @permissions hsm.view\n */\n resume(headers?: Record<string, string>): Promise<Record<string, unknown>[]> {\n return this.client.get<Record<string, unknown>[]>(`${this.basePath}/resume`, headers)\n }\n}\n"],"mappings":";;;;;;;;AAeA,IAAa,+BAAb,cAAkD,YAMhD;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,+BAA+B;;;;;;CAO/C,MACE,OACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,YACE,WACA,SAC2C;AAC3C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,UAAU,YAC9B,QACD;;;;;;;CAQH,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,aAAa,IAAY,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,kBAAkB,QAAW,QAAQ;;;;;;;CAQ/F,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,GAAG,KAAK,SAAS,qBAAqB,QAAW,QAAQ;;;;;;;CAQzF,OAAO,SAAsE;AAC3E,SAAO,KAAK,OAAO,IAA+B,GAAG,KAAK,SAAS,UAAU,QAAQ"}
|
|
@@ -5,7 +5,8 @@ export type WhatsappBusinessTemplateComponentType = 'HEADER' | 'BODY' | 'FOOTER'
|
|
|
5
5
|
export type WhatsappBusinessTemplateHeaderFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT';
|
|
6
6
|
export type WhatsappBusinessTemplateButton = {
|
|
7
7
|
type: string;
|
|
8
|
-
|
|
8
|
+
/** Overwritten by the backend on `REQUEST_CONTACT_INFO` buttons. */
|
|
9
|
+
text?: string;
|
|
9
10
|
url?: string;
|
|
10
11
|
params?: string[];
|
|
11
12
|
phone_number?: string;
|
|
@@ -37,17 +38,49 @@ export type WhatsappBusinessTemplate = {
|
|
|
37
38
|
createdAt: string;
|
|
38
39
|
updatedAt: string;
|
|
39
40
|
deletedAt: string | null;
|
|
41
|
+
/** Only the listing includes it by default; `getById` answers it with `include: ['fileExample']`. */
|
|
42
|
+
fileExample?: WhatsappBusinessTemplateFileExample | null;
|
|
43
|
+
service?: Record<string, unknown>;
|
|
44
|
+
account?: Record<string, unknown>;
|
|
45
|
+
};
|
|
46
|
+
/** The media example of a template with a media header. */
|
|
47
|
+
export type WhatsappBusinessTemplateFileExample = Record<string, unknown>;
|
|
48
|
+
/** The media example sent on create/update (`base64Url` as a data URL). */
|
|
49
|
+
export type WhatsappBusinessTemplateFileExampleInput = {
|
|
50
|
+
fileName: string;
|
|
51
|
+
base64Url: string;
|
|
52
|
+
mimetype: string;
|
|
53
|
+
};
|
|
54
|
+
export type WhatsappBusinessTemplateHsmLimit = {
|
|
55
|
+
hsmLimit: number;
|
|
56
|
+
hsmUsedLimit: number;
|
|
57
|
+
/** The balance left (a number), or `true` when the account has no limit. */
|
|
58
|
+
hasLimit: number | boolean;
|
|
40
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Stored locally (nothing goes to Meta until `sendToReview`). `status` is `''` for a draft and `namespace` is `''`
|
|
62
|
+
* until Meta answers — both are required by the database (500 without them).
|
|
63
|
+
*/
|
|
41
64
|
export type CreateWhatsappBusinessTemplatePayload = {
|
|
42
65
|
name: string;
|
|
43
66
|
internalName: string;
|
|
67
|
+
status: string;
|
|
68
|
+
namespace: string;
|
|
69
|
+
fileExample?: WhatsappBusinessTemplateFileExampleInput;
|
|
44
70
|
components: WhatsappBusinessTemplateComponent[];
|
|
45
71
|
serviceId: string;
|
|
46
72
|
messageType: WhatsappBusinessTemplateMessageType;
|
|
47
73
|
language: WhatsappBusinessTemplateLanguage;
|
|
48
74
|
category: WhatsappBusinessTemplateCategory;
|
|
49
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* The backend validates the same 7 fields of the create on the update (`name`, `internalName`, `components`,
|
|
78
|
+
* `serviceId`, `messageType`, `language`, `category`), but ignores `name`.
|
|
79
|
+
*/
|
|
50
80
|
export type UpdateWhatsappBusinessTemplatePayload = {
|
|
81
|
+
status?: string;
|
|
82
|
+
namespace?: string;
|
|
83
|
+
fileExample?: WhatsappBusinessTemplateFileExampleInput;
|
|
51
84
|
name?: string;
|
|
52
85
|
internalName?: string;
|
|
53
86
|
components?: WhatsappBusinessTemplateComponent[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/whatsappBusinessTemplates/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mCAAmC,GAAG,WAAW,GAAG,aAAa,CAAA;AAE7E,MAAM,MAAM,gCAAgC,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpE,MAAM,MAAM,gCAAgC,GAAG,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAA;AAEzF,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,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,wCAAwC,CAAA;IACtD,UAAU,EAAE,iCAAiC,EAAE,CAAA;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,mCAAmC,CAAA;IAChD,QAAQ,EAAE,gCAAgC,CAAA;IAC1C,QAAQ,EAAE,gCAAgC,CAAA;CAC3C,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,wCAAwC,CAAA;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,iCAAiC,EAAE,CAAA;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,mCAAmC,CAAA;IACjD,QAAQ,CAAC,EAAE,gCAAgC,CAAA;IAC3C,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,CAAA"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { InteractiveMessagesApi } from './InteractiveMessagesApi'
|
|
3
|
+
import type { ApiClient } from '../../core/ApiClient'
|
|
4
|
+
|
|
5
|
+
// ── Mock client factory ──────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
function createMockClient(): ApiClient {
|
|
8
|
+
return {
|
|
9
|
+
setAccessToken: vi.fn().mockReturnThis(),
|
|
10
|
+
request: vi.fn(),
|
|
11
|
+
get: vi.fn(),
|
|
12
|
+
post: vi.fn(),
|
|
13
|
+
put: vi.fn(),
|
|
14
|
+
patch: vi.fn(),
|
|
15
|
+
delete: vi.fn(),
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ── Tests ────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
describe('InteractiveMessagesApi', () => {
|
|
22
|
+
let client: ReturnType<typeof createMockClient>
|
|
23
|
+
let api: InteractiveMessagesApi
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
client = createMockClient()
|
|
27
|
+
api = new InteractiveMessagesApi(client)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
describe('count', () => {
|
|
31
|
+
it('calls client.get with /interactive-messages/count when no query is provided', async () => {
|
|
32
|
+
vi.mocked(client.get).mockResolvedValue({ count: 4 })
|
|
33
|
+
await expect(api.count()).resolves.toEqual({ count: 4 })
|
|
34
|
+
expect(client.get).toHaveBeenCalledWith('/interactive-messages/count', undefined)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('serializes the query', async () => {
|
|
38
|
+
vi.mocked(client.get).mockResolvedValue({ count: 1 })
|
|
39
|
+
await api.count({ where: { name: 'QA' } })
|
|
40
|
+
const url = vi.mocked(client.get).mock.calls[0]?.[0] as string
|
|
41
|
+
expect(url).toContain('/interactive-messages/count?')
|
|
42
|
+
expect(url).toContain('where')
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('create posts the message to /interactive-messages', async () => {
|
|
47
|
+
const body = {
|
|
48
|
+
name: 'QA',
|
|
49
|
+
interactive: {
|
|
50
|
+
type: 'button' as const,
|
|
51
|
+
body: 'Oi',
|
|
52
|
+
action: { buttons: [{ type: 'reply' as const, reply: { id: '1', title: 'Sim' } }] },
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
vi.mocked(client.post).mockResolvedValue({ id: 'im-1' })
|
|
56
|
+
await api.create(body)
|
|
57
|
+
expect(client.post).toHaveBeenCalledWith('/interactive-messages', body, undefined)
|
|
58
|
+
})
|
|
59
|
+
})
|
|
@@ -18,6 +18,32 @@ export class InteractiveMessagesApi extends BaseCrudApi<
|
|
|
18
18
|
super(client, '/interactive-messages')
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Counts the interactive messages matching the query.
|
|
23
|
+
* @permissions interactive-messages.view OR interactive-messages.management.all.departments
|
|
24
|
+
*/
|
|
25
|
+
count(
|
|
26
|
+
query?: ListQuery<InteractiveMessage>,
|
|
27
|
+
headers?: Record<string, string>,
|
|
28
|
+
): Promise<{ count: number }> {
|
|
29
|
+
return this.client.get<{ count: number }>(
|
|
30
|
+
`${this.basePath}/count${this.toQueryString(query)}`,
|
|
31
|
+
headers,
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
|
|
37
|
+
* sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
|
|
38
|
+
* @permissions interactive-messages.create OR interactive-messages.management.all.departments
|
|
39
|
+
*/
|
|
40
|
+
override create(
|
|
41
|
+
body: CreateInteractiveMessagePayload,
|
|
42
|
+
headers?: Record<string, string>,
|
|
43
|
+
): Promise<InteractiveMessage> {
|
|
44
|
+
return super.create(body, headers)
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
/**
|
|
22
48
|
* Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
|
|
23
49
|
* @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
|