@ikatec/digisac-api-sdk 4.10.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.
Files changed (104) hide show
  1. package/dist/apis/categories/types.d.ts +1 -0
  2. package/dist/apis/categories/types.d.ts.map +1 -1
  3. package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs +28 -0
  4. package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs.map +1 -1
  5. package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts +24 -0
  6. package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts.map +1 -1
  7. package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs +28 -0
  8. package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs.map +1 -1
  9. package/dist/apis/contactBlockLists/types.d.ts +6 -1
  10. package/dist/apis/contactBlockLists/types.d.ts.map +1 -1
  11. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs +31 -1
  12. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs.map +1 -1
  13. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts +28 -2
  14. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts.map +1 -1
  15. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs +31 -1
  16. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs.map +1 -1
  17. package/dist/apis/contactBlockListsControls/types.d.ts +7 -0
  18. package/dist/apis/contactBlockListsControls/types.d.ts.map +1 -1
  19. package/dist/apis/distribution/DistributionApi.cjs +25 -0
  20. package/dist/apis/distribution/DistributionApi.cjs.map +1 -1
  21. package/dist/apis/distribution/DistributionApi.d.ts +20 -1
  22. package/dist/apis/distribution/DistributionApi.d.ts.map +1 -1
  23. package/dist/apis/distribution/DistributionApi.mjs +25 -0
  24. package/dist/apis/distribution/DistributionApi.mjs.map +1 -1
  25. package/dist/apis/distribution/types.d.ts +18 -1
  26. package/dist/apis/distribution/types.d.ts.map +1 -1
  27. package/dist/apis/integrations/IntegrationsApi.cjs +17 -0
  28. package/dist/apis/integrations/IntegrationsApi.cjs.map +1 -1
  29. package/dist/apis/integrations/IntegrationsApi.d.ts +15 -2
  30. package/dist/apis/integrations/IntegrationsApi.d.ts.map +1 -1
  31. package/dist/apis/integrations/IntegrationsApi.mjs +17 -0
  32. package/dist/apis/integrations/IntegrationsApi.mjs.map +1 -1
  33. package/dist/apis/integrations/types.d.ts +15 -6
  34. package/dist/apis/integrations/types.d.ts.map +1 -1
  35. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs +15 -0
  36. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs.map +1 -1
  37. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts +13 -0
  38. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts.map +1 -1
  39. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs +15 -0
  40. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs.map +1 -1
  41. package/dist/apis/interactiveMessages/types.d.ts +8 -2
  42. package/dist/apis/interactiveMessages/types.d.ts.map +1 -1
  43. package/dist/apis/me/MeApi.cjs +36 -29
  44. package/dist/apis/me/MeApi.cjs.map +1 -1
  45. package/dist/apis/me/MeApi.d.ts +33 -22
  46. package/dist/apis/me/MeApi.d.ts.map +1 -1
  47. package/dist/apis/me/MeApi.mjs +36 -29
  48. package/dist/apis/me/MeApi.mjs.map +1 -1
  49. package/dist/apis/me/types.d.ts +67 -4
  50. package/dist/apis/me/types.d.ts.map +1 -1
  51. package/dist/apis/transcripts/TranscriptsApi.cjs +12 -2
  52. package/dist/apis/transcripts/TranscriptsApi.cjs.map +1 -1
  53. package/dist/apis/transcripts/TranscriptsApi.d.ts +11 -5
  54. package/dist/apis/transcripts/TranscriptsApi.d.ts.map +1 -1
  55. package/dist/apis/transcripts/TranscriptsApi.mjs +12 -2
  56. package/dist/apis/transcripts/TranscriptsApi.mjs.map +1 -1
  57. package/dist/apis/transcripts/types.d.ts +4 -0
  58. package/dist/apis/transcripts/types.d.ts.map +1 -1
  59. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs +52 -0
  60. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
  61. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +45 -2
  62. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
  63. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +52 -0
  64. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs.map +1 -1
  65. package/dist/apis/whatsappBusinessTemplates/types.d.ts +34 -1
  66. package/dist/apis/whatsappBusinessTemplates/types.d.ts.map +1 -1
  67. package/dist/core/BaseCrudApi.cjs +3 -1
  68. package/dist/core/BaseCrudApi.cjs.map +1 -1
  69. package/dist/core/BaseCrudApi.d.ts +6 -4
  70. package/dist/core/BaseCrudApi.d.ts.map +1 -1
  71. package/dist/core/BaseCrudApi.mjs +3 -1
  72. package/dist/core/BaseCrudApi.mjs.map +1 -1
  73. package/dist/core/types.d.ts +1 -1
  74. package/dist/core/types.d.ts.map +1 -1
  75. package/package.json +1 -1
  76. package/src/apis/categories/types.ts +1 -0
  77. package/src/apis/contactBlockLists/ContactBlockListsApi.test.ts +57 -0
  78. package/src/apis/contactBlockLists/ContactBlockListsApi.ts +44 -0
  79. package/src/apis/contactBlockLists/types.ts +6 -1
  80. package/src/apis/contactBlockListsControls/ContactBlockListsControlsApi.test.ts +48 -0
  81. package/src/apis/contactBlockListsControls/ContactBlockListsControlsApi.ts +49 -2
  82. package/src/apis/contactBlockListsControls/types.ts +7 -0
  83. package/src/apis/distribution/DistributionApi.test.ts +65 -0
  84. package/src/apis/distribution/DistributionApi.ts +39 -1
  85. package/src/apis/distribution/types.ts +17 -1
  86. package/src/apis/integrations/IntegrationsApi.test.ts +42 -0
  87. package/src/apis/integrations/IntegrationsApi.ts +35 -2
  88. package/src/apis/integrations/types.ts +25 -6
  89. package/src/apis/interactiveMessages/InteractiveMessagesApi.test.ts +59 -0
  90. package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +26 -0
  91. package/src/apis/interactiveMessages/types.ts +8 -2
  92. package/src/apis/me/MeApi.test.ts +44 -0
  93. package/src/apis/me/MeApi.ts +83 -28
  94. package/src/apis/me/types.ts +75 -4
  95. package/src/apis/payloads.test-d.ts +94 -2
  96. package/src/apis/transcripts/TranscriptsApi.test.ts +14 -21
  97. package/src/apis/transcripts/TranscriptsApi.ts +15 -6
  98. package/src/apis/transcripts/types.ts +4 -0
  99. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.test.ts +86 -0
  100. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts +75 -1
  101. package/src/apis/whatsappBusinessTemplates/types.ts +38 -1
  102. package/src/core/BaseCrudApi.test-d.ts +11 -1
  103. package/src/core/BaseCrudApi.ts +15 -6
  104. package/src/core/types.ts +4 -2
@@ -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
- * Returns the currently authenticated user, including their roles, departments, and timetable.
7
- * @permissions users.view
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
- /** Returns the account associated with the currently authenticated user. */
13
- getAccount(headers) {
14
- return this.client.get("/me/account", headers);
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
- * Returns credit and usage amounts for the current account.
18
- * Excludes Digisac's own internal credit amounts.
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
- * If a new password is provided, it is validated against the last 6 password history entries
33
- * and all existing access tokens for the user are revoked.
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
- /** Updates account-level settings such as name, settings object, wizard progress, and default department. */
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 a OneSignal push notification token for the current user.
59
- * Used to enable push notifications on mobile/web clients.
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 event,
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, including their roles, departments, and timetable.\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User> {\n return this.client.get<User>('/me', headers)\n }\n\n /** Returns the account associated with the currently authenticated user. */\n getAccount(headers?: Record<string, string>): Promise<Account> {\n return this.client.get<Account>('/me/account', headers)\n }\n\n /**\n * Returns credit and usage amounts for the current account.\n * Excludes Digisac's own internal credit amounts.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<Record<string, unknown>> {\n return this.client.get<Record<string, unknown>>('/me/get-account-amounts', headers)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account.\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.\n * If a new password is provided, it is validated against the last 6 password history entries\n * and all existing access tokens for the user are revoked.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /** Updates account-level settings such as name, settings object, wizard progress, and default department. */\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`).\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead.\n */\n updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, 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.\n * Returns the updated account.\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 a OneSignal push notification token for the current user.\n * Used to enable push notifications on mobile/web clients.\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 and emits a takeover event,\n * which signals other connected sessions to yield control to this one.\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`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;AAYA,IAAa,QAAb,cAA2B,QAAQ;;;;;CAKjC,MAAM,SAAiD;AACrD,SAAO,KAAK,OAAO,IAAU,OAAO,QAAQ;;;CAI9C,WAAW,SAAoD;AAC7D,SAAO,KAAK,OAAO,IAAa,eAAe,QAAQ;;;;;;CAOzD,kBAAkB,SAAoE;AACpF,SAAO,KAAK,OAAO,IAA6B,2BAA2B,QAAQ;;;;;;CAOrF,kBAAkB,SAA4D;AAC5E,SAAO,KAAK,OAAO,IAAqB,iCAAiC,QAAQ;;;;;;;CAQnF,SAAS,MAAuB,SAAiD;AAC/E,SAAO,KAAK,OAAO,IAA2B,OAAO,MAAM,QAAQ;;;CAIrE,cAAc,MAA8B,SAAoD;AAC9F,SAAO,KAAK,OAAO,IAAqC,eAAe,MAAM,QAAQ;;;;;;;CAQvF,aAAa,MAA6B,SAAiD;AACzF,SAAO,KAAK,OAAO,IAAiC,cAAc,MAAM,QAAQ;;;;;;CAOlF,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,SAAoD;AAClE,SAAO,KAAK,OAAO,KAAc,yBAAyB,QAAW,QAAQ"}
1
+ {"version":3,"file":"MeApi.mjs","names":[],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n AccountAmounts,\n AccountAmountsQuery,\n MeAccountQuery,\n MeQuery,\n MeStatusResponse,\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\n/**\n * A query object always has an array or an object among its values; the headers only have strings (a header that\n * comes as `undefined` at runtime stays a header). That tells the two apart in the methods that took only the\n * headers before and now take a query first.\n */\nfunction splitQueryAndHeaders<TQuery extends object>(\n queryOrHeaders: TQuery | Record<string, string> | undefined,\n headers: Record<string, string> | undefined,\n): [TQuery | undefined, Record<string, string> | undefined] {\n const isQuery =\n !!queryOrHeaders &&\n Object.values(queryOrHeaders).some((value) => typeof value === 'object' && value !== null)\n return isQuery\n ? [queryOrHeaders as TQuery, headers]\n : [undefined, queryOrHeaders as Record<string, string> | undefined]\n}\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user. Without `include`, the user comes without relations (roles,\n * departments, timetable, account).\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User>\n getMe(query: MeQuery, headers?: Record<string, string>): Promise<User>\n getMe(\n queryOrHeaders?: MeQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<User> {\n const [query, sent] = splitQueryAndHeaders<MeQuery>(queryOrHeaders, headers)\n return this.client.get<User>(`/me${this.toQueryString(query)}`, sent)\n }\n\n /**\n * Returns the account of the current user. Send `where.id` with the `accountId` of the user (what the web app\n * does): without it, the route answers 500.\n */\n getAccount(headers?: Record<string, string>): Promise<Account>\n getAccount(query: MeAccountQuery, headers?: Record<string, string>): Promise<Account>\n getAccount(\n queryOrHeaders?: MeAccountQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<Account> {\n const [query, sent] = splitQueryAndHeaders<MeAccountQuery>(queryOrHeaders, headers)\n return this.client.get<Account>(`/me/account${this.toQueryString(query)}`, sent)\n }\n\n /**\n * Returns the amounts of the current account named in `filter` (services and/or users). The credit amounts are\n * never answered here. An account without credits control answers 400.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<AccountAmounts>\n getAccountAmounts(\n query: AccountAmountsQuery,\n headers?: Record<string, string>,\n ): Promise<AccountAmounts>\n getAccountAmounts(\n queryOrHeaders?: AccountAmountsQuery | Record<string, string>,\n headers?: Record<string, string>,\n ): Promise<AccountAmounts> {\n const [query, sent] = splitQueryAndHeaders<AccountAmountsQuery>(queryOrHeaders, headers)\n const queryString = query ? this.toQueryString({ filter: query.filter.join(',') }) : ''\n return this.client.get<AccountAmounts>(`/me/get-account-amounts${queryString}`, sent)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account. Calls Agnus (an external\n * service) and, for accounts without credits control, reports the consumption to it first.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences (`data` and `preferences`\n * replace the stored objects). A new `password` needs `currentPassword` and a recent login, is validated against\n * the last 6 passwords, and revokes the access tokens with an expiration — including the one of this request.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /**\n * Updates account-level settings such as name, settings object, wizard progress, and default department. It\n * applies to the whole account; the default department is required while the tickets are enabled.\n */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`) for a `client`.\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead. Resolves the status fields of the user.\n */\n updateStatus(\n body: UpdateMeStatusPayload,\n headers?: Record<string, string>,\n ): Promise<MeStatusResponse> {\n return this.client.put<MeStatusResponse, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire, and notifies the\n * billing webhook. Returns the updated account; an account not in a grace period answers 400.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers the push notification tokens of the current user (`data` replaces the whole `data` of the user).\n * Resolves with no body.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client (`'web'` by default) and emits a takeover\n * event, which signals other connected sessions to yield control to this one. Resolves with no body.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`. Resolves the text `'OK'`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<'OK'> {\n return this.client.post<'OK'>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;;;;;;AAsBA,SAAS,qBACP,gBACA,SAC0D;AAI1D,QAFE,CAAC,CAAC,kBACF,OAAO,OAAO,eAAe,CAAC,MAAM,UAAU,OAAO,UAAU,YAAY,UAAU,KAAK,GAExF,CAAC,gBAA0B,QAAQ,GACnC,CAAC,QAAW,eAAqD;;AAGvE,IAAa,QAAb,cAA2B,QAAQ;CAQjC,MACE,gBACA,SACe;EACf,MAAM,CAAC,OAAO,QAAQ,qBAA8B,gBAAgB,QAAQ;AAC5E,SAAO,KAAK,OAAO,IAAU,MAAM,KAAK,cAAc,MAAM,IAAI,KAAK;;CASvE,WACE,gBACA,SACkB;EAClB,MAAM,CAAC,OAAO,QAAQ,qBAAqC,gBAAgB,QAAQ;AACnF,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"}
@@ -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
- client?: string;
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
- client?: string;
77
+ /** Defaults to `'web'`. */
78
+ client?: MeClient;
25
79
  };
26
80
  export type SetOtpSecretKeyPayload = {
27
81
  secretKey: string;
28
82
  };
29
- export type RegisterTokenPayload = Record<string, unknown>;
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,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACnC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA"}
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,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,qFAAqF;AACrF,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAA;AAEpC,+EAA+E;AAC/E,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,CACN,OAAO,GACP,aAAa,GACb,WAAW,GACX,SAAS,GACT,aAAa,GACb,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAChB,EAAE,CAAA;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAED,4GAA4G;AAC5G,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG,eAAe,CAAA;AAEvE,+GAA+G;AAC/G,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,oBAAoB,EAAE,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,UAAU,CAAA;IAClB,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,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
- /** Triggers audio transcription for a message by dispatching an async job, and marks it as transcribing. */
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.client.get(`${this.basePath}/${id}`, headers);
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'\nimport type { HasGetById } from '../../core/types'\nimport type { TranscriptResponse } from './types'\n\nexport class TranscriptsApi extends BaseApi implements HasGetById<TranscriptResponse> {\n private readonly basePath = '/transcripts'\n\n /** Triggers audio transcription for a message by dispatching an async job, and marks it as transcribing. */\n getById(id: string, headers?: Record<string, string>): Promise<TranscriptResponse> {\n return this.client.get<TranscriptResponse>(`${this.basePath}/${id}`, headers)\n }\n}\n"],"mappings":";;;;AAIA,IAAa,iBAAb,cAAoCA,6BAAkD;CACpF,AAAiB,WAAW;;CAG5B,QAAQ,IAAY,SAA+D;AACjF,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ"}
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
- import type { HasGetById } from '../../core/types';
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
- /** Triggers audio transcription for a message by dispatching an async job, and marks it as transcribing. */
7
- getById(id: string, headers?: Record<string, string>): Promise<TranscriptResponse>;
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;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,qBAAa,cAAe,SAAQ,OAAQ,YAAW,UAAU,CAAC,kBAAkB,CAAC;IACnF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAE1C,4GAA4G;IAC5G,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAGnF"}
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
- /** Triggers audio transcription for a message by dispatching an async job, and marks it as transcribing. */
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.client.get(`${this.basePath}/${id}`, headers);
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'\nimport type { HasGetById } from '../../core/types'\nimport type { TranscriptResponse } from './types'\n\nexport class TranscriptsApi extends BaseApi implements HasGetById<TranscriptResponse> {\n private readonly basePath = '/transcripts'\n\n /** Triggers audio transcription for a message by dispatching an async job, and marks it as transcribing. */\n getById(id: string, headers?: Record<string, string>): Promise<TranscriptResponse> {\n return this.client.get<TranscriptResponse>(`${this.basePath}/${id}`, headers)\n }\n}\n"],"mappings":";;;AAIA,IAAa,iBAAb,cAAoC,QAAkD;CACpF,AAAiB,WAAW;;CAG5B,QAAQ,IAAY,SAA+D;AACjF,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ"}
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":";;;;AAQA,IAAa,+BAAb,cAAkDA,qCAIhD;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,+BAA+B"}
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
- export declare class WhatsappBusinessTemplatesApi extends BaseCrudApi<WhatsappBusinessTemplate, CreateWhatsappBusinessTemplatePayload, UpdateWhatsappBusinessTemplatePayload> {
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,EACtC,MAAM,SAAS,CAAA;AAEhB,qBAAa,4BAA6B,SAAQ,WAAW,CAC3D,wBAAwB,EACxB,qCAAqC,EACrC,qCAAqC,CACtC;gBACa,MAAM,EAAE,SAAS;CAG9B"}
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,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,wBAAwB,EACxB,qCAAqC,EACrC,qCAAqC,EACrC,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,WAAW,CAC3D,wBAAwB,EACxB,qCAAqC,EACrC,qCAAqC,EACrC,SAAS,CAAC,wBAAwB,CAAC,EACnC,OAAO,CACR;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,KAAK,CACH,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,CAAC,EAC3C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAO7B;;;;OAIG;IACH,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,gCAAgC,CAAC;IAO5C;;;;OAIG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAInF;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5E;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,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":";;;AAQA,IAAa,+BAAb,cAAkD,YAIhD;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,+BAA+B"}
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"}