@ikatec/digisac-api-sdk 4.11.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/apis/absence/AbsenceApi.cjs +46 -2
  2. package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
  3. package/dist/apis/absence/AbsenceApi.d.ts +38 -4
  4. package/dist/apis/absence/AbsenceApi.d.ts.map +1 -1
  5. package/dist/apis/absence/AbsenceApi.mjs +46 -2
  6. package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
  7. package/dist/apis/absence/types.d.ts +51 -2
  8. package/dist/apis/absence/types.d.ts.map +1 -1
  9. package/dist/apis/activityLog/ActivityLogApi.cjs +10 -1
  10. package/dist/apis/activityLog/ActivityLogApi.cjs.map +1 -1
  11. package/dist/apis/activityLog/ActivityLogApi.d.ts +10 -3
  12. package/dist/apis/activityLog/ActivityLogApi.d.ts.map +1 -1
  13. package/dist/apis/activityLog/ActivityLogApi.mjs +10 -1
  14. package/dist/apis/activityLog/ActivityLogApi.mjs.map +1 -1
  15. package/dist/apis/activityLog/types.d.ts +48 -8
  16. package/dist/apis/activityLog/types.d.ts.map +1 -1
  17. package/dist/apis/categories/types.d.ts +1 -0
  18. package/dist/apis/categories/types.d.ts.map +1 -1
  19. package/dist/apis/creditMovements/CreditMovementsApi.cjs +31 -2
  20. package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
  21. package/dist/apis/creditMovements/CreditMovementsApi.d.ts +21 -3
  22. package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
  23. package/dist/apis/creditMovements/CreditMovementsApi.mjs +31 -2
  24. package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
  25. package/dist/apis/creditMovements/types.d.ts +73 -2
  26. package/dist/apis/creditMovements/types.d.ts.map +1 -1
  27. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs +15 -0
  28. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs.map +1 -1
  29. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts +13 -0
  30. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts.map +1 -1
  31. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs +15 -0
  32. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs.map +1 -1
  33. package/dist/apis/interactiveMessages/types.d.ts +8 -2
  34. package/dist/apis/interactiveMessages/types.d.ts.map +1 -1
  35. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +27 -0
  36. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
  37. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +22 -1
  38. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
  39. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +27 -0
  40. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
  41. package/dist/apis/knowledgeBase/types.d.ts +56 -2
  42. package/dist/apis/knowledgeBase/types.d.ts.map +1 -1
  43. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +26 -0
  44. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
  45. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +24 -0
  46. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
  47. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +26 -0
  48. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
  49. package/dist/apis/knowledgeBaseItem/types.d.ts +23 -6
  50. package/dist/apis/knowledgeBaseItem/types.d.ts.map +1 -1
  51. package/dist/apis/me/MeApi.cjs +36 -29
  52. package/dist/apis/me/MeApi.cjs.map +1 -1
  53. package/dist/apis/me/MeApi.d.ts +33 -22
  54. package/dist/apis/me/MeApi.d.ts.map +1 -1
  55. package/dist/apis/me/MeApi.mjs +36 -29
  56. package/dist/apis/me/MeApi.mjs.map +1 -1
  57. package/dist/apis/me/types.d.ts +67 -4
  58. package/dist/apis/me/types.d.ts.map +1 -1
  59. package/dist/apis/notifications/NotificationsApi.cjs +50 -2
  60. package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
  61. package/dist/apis/notifications/NotificationsApi.d.ts +41 -3
  62. package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
  63. package/dist/apis/notifications/NotificationsApi.mjs +50 -2
  64. package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
  65. package/dist/apis/notifications/types.d.ts +54 -8
  66. package/dist/apis/notifications/types.d.ts.map +1 -1
  67. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
  68. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +4 -1
  69. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
  70. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
  71. package/dist/apis/serviceAccessManagement/types.d.ts +3 -0
  72. package/dist/apis/serviceAccessManagement/types.d.ts.map +1 -1
  73. package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
  74. package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -1
  75. package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
  76. package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
  77. package/dist/apis/stickerUsers/types.d.ts +4 -0
  78. package/dist/apis/stickerUsers/types.d.ts.map +1 -1
  79. package/dist/apis/stickers/StickersApi.cjs +27 -3
  80. package/dist/apis/stickers/StickersApi.cjs.map +1 -1
  81. package/dist/apis/stickers/StickersApi.d.ts +24 -4
  82. package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
  83. package/dist/apis/stickers/StickersApi.mjs +27 -3
  84. package/dist/apis/stickers/StickersApi.mjs.map +1 -1
  85. package/dist/apis/stickers/types.d.ts +28 -4
  86. package/dist/apis/stickers/types.d.ts.map +1 -1
  87. package/dist/apis/transcripts/TranscriptsApi.cjs +12 -2
  88. package/dist/apis/transcripts/TranscriptsApi.cjs.map +1 -1
  89. package/dist/apis/transcripts/TranscriptsApi.d.ts +11 -5
  90. package/dist/apis/transcripts/TranscriptsApi.d.ts.map +1 -1
  91. package/dist/apis/transcripts/TranscriptsApi.mjs +12 -2
  92. package/dist/apis/transcripts/TranscriptsApi.mjs.map +1 -1
  93. package/dist/apis/transcripts/types.d.ts +4 -0
  94. package/dist/apis/transcripts/types.d.ts.map +1 -1
  95. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs +51 -0
  96. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
  97. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +44 -2
  98. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
  99. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +51 -0
  100. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs.map +1 -1
  101. package/dist/apis/whatsappBusinessTemplates/types.d.ts +34 -1
  102. package/dist/apis/whatsappBusinessTemplates/types.d.ts.map +1 -1
  103. package/package.json +1 -1
  104. package/src/apis/absence/AbsenceApi.test.ts +65 -0
  105. package/src/apis/absence/AbsenceApi.ts +77 -4
  106. package/src/apis/absence/types.ts +53 -2
  107. package/src/apis/activityLog/ActivityLogApi.test.ts +44 -0
  108. package/src/apis/activityLog/ActivityLogApi.ts +22 -3
  109. package/src/apis/activityLog/types.ts +47 -8
  110. package/src/apis/categories/types.ts +1 -0
  111. package/src/apis/creditMovements/CreditMovementsApi.test.ts +88 -0
  112. package/src/apis/creditMovements/CreditMovementsApi.ts +73 -2
  113. package/src/apis/creditMovements/types.ts +74 -2
  114. package/src/apis/interactiveMessages/InteractiveMessagesApi.test.ts +59 -0
  115. package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +26 -0
  116. package/src/apis/interactiveMessages/types.ts +8 -2
  117. package/src/apis/knowledgeBase/KnowledgeBaseApi.test.ts +54 -0
  118. package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +61 -1
  119. package/src/apis/knowledgeBase/types.ts +62 -2
  120. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.test.ts +57 -0
  121. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +45 -0
  122. package/src/apis/knowledgeBaseItem/types.ts +23 -6
  123. package/src/apis/me/MeApi.test.ts +45 -1
  124. package/src/apis/me/MeApi.ts +83 -28
  125. package/src/apis/me/types.ts +75 -4
  126. package/src/apis/notifications/NotificationsApi.test.ts +74 -0
  127. package/src/apis/notifications/NotificationsApi.ts +88 -3
  128. package/src/apis/notifications/types.ts +65 -7
  129. package/src/apis/payloads.test-d.ts +82 -2
  130. package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +4 -1
  131. package/src/apis/serviceAccessManagement/types.ts +3 -0
  132. package/src/apis/stickerUsers/StickerUsersApi.ts +3 -1
  133. package/src/apis/stickerUsers/types.ts +4 -0
  134. package/src/apis/stickers/StickersApi.test.ts +58 -0
  135. package/src/apis/stickers/StickersApi.ts +46 -4
  136. package/src/apis/stickers/types.ts +29 -4
  137. package/src/apis/transcripts/TranscriptsApi.test.ts +14 -21
  138. package/src/apis/transcripts/TranscriptsApi.ts +15 -6
  139. package/src/apis/transcripts/types.ts +4 -0
  140. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.test.ts +86 -0
  141. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts +74 -1
  142. package/src/apis/whatsappBusinessTemplates/types.ts +38 -1
@@ -3,9 +3,10 @@ const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
3
3
 
4
4
  //#region src/apis/stickers/StickersApi.ts
5
5
  /**
6
- * Stickers of the account. The backend serves `GET /stickers` and `POST /stickers` (plus
7
- * `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`); there is
8
- * no read by id, update nor `DELETE /stickers/:id`.
6
+ * Stickers of the account: every user of the account sees them. The backend serves `GET /stickers`,
7
+ * `POST /stickers`, `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`;
8
+ * there is no read by id, update nor `DELETE /stickers/:id`. The list accepts only the `file` include.
9
+ * @permissions stickers.send (list) · stickers.management (create, exist, add, remove)
9
10
  */
10
11
  var StickersApi = class extends require_core_BaseCrudApi.BaseCrudApi {
11
12
  constructor(client) {
@@ -26,6 +27,29 @@ var StickersApi = class extends require_core_BaseCrudApi.BaseCrudApi {
26
27
  deleteById(id, headers) {
27
28
  return super.deleteById(id, headers);
28
29
  }
30
+ /**
31
+ * Finds the sticker of the account that came from the message, or from the file of `fileChecksum` or
32
+ * `filehash`. Resolves `{ stickerId }`, or `{}` when there is none; without `messageId` it answers 500
33
+ * `Invalid message ID`.
34
+ */
35
+ exist(query, headers) {
36
+ return this.client.get(`${this.basePath}/exist${this.toQueryString(query)}`, headers);
37
+ }
38
+ /**
39
+ * Turns the file of a message of the account into a sticker (`type: 'added'`). Idempotent: a sticker that
40
+ * already came from the message (or its file) is answered as is, and a removed one is restored. A message
41
+ * without file answers 500 `Message or file not found`.
42
+ */
43
+ add(messageId, headers) {
44
+ return this.client.post(`${this.basePath}/add`, { messageId }, headers);
45
+ }
46
+ /**
47
+ * Removes a sticker of the account (soft delete; its file stays in the storage) and clears it from the
48
+ * recent stickers of every user. Resolves the text `'OK'`, or `false` when there is no such sticker.
49
+ */
50
+ remove(stickerId, headers) {
51
+ return this.client.delete(`${this.basePath}/remove/${stickerId}`, headers);
52
+ }
29
53
  };
30
54
 
31
55
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"StickersApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/stickers/StickersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery } from '../../core/types'\nimport type { Sticker, CreateStickerPayload, UpdateStickerPayload } from './types'\n\n/**\n * Stickers of the account. The backend serves `GET /stickers` and `POST /stickers` (plus\n * `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`); there is\n * no read by id, update nor `DELETE /stickers/:id`.\n */\nexport class StickersApi extends BaseCrudApi<Sticker, CreateStickerPayload, UpdateStickerPayload> {\n constructor(client: ApiClient) {\n super(client, '/stickers')\n }\n\n /** @deprecated Not served: the backend has no GET /stickers/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<Sticker>,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /stickers/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateStickerPayload,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.updateById(id, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /stickers/:id (it removes a sticker by\n * `DELETE /stickers/remove/:stickerId`), so this route answers 404.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Sticker> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;CAI5B,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;;;;CAO5C,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"StickersApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/stickers/StickersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery } from '../../core/types'\nimport type {\n Sticker,\n CreateStickerPayload,\n UpdateStickerPayload,\n StickerExistQuery,\n} from './types'\n\n/**\n * Stickers of the account: every user of the account sees them. The backend serves `GET /stickers`,\n * `POST /stickers`, `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`;\n * there is no read by id, update nor `DELETE /stickers/:id`. The list accepts only the `file` include.\n * @permissions stickers.send (list) · stickers.management (create, exist, add, remove)\n */\nexport class StickersApi extends BaseCrudApi<Sticker, CreateStickerPayload, UpdateStickerPayload> {\n constructor(client: ApiClient) {\n super(client, '/stickers')\n }\n\n /** @deprecated Not served: the backend has no GET /stickers/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<Sticker>,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /stickers/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateStickerPayload,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.updateById(id, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /stickers/:id (it removes a sticker by\n * `DELETE /stickers/remove/:stickerId`), so this route answers 404.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Sticker> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Finds the sticker of the account that came from the message, or from the file of `fileChecksum` or\n * `filehash`. Resolves `{ stickerId }`, or `{}` when there is none; without `messageId` it answers 500\n * `Invalid message ID`.\n */\n exist(\n query: StickerExistQuery,\n headers?: Record<string, string>,\n ): Promise<{ stickerId?: string }> {\n return this.client.get<{ stickerId?: string }>(\n `${this.basePath}/exist${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Turns the file of a message of the account into a sticker (`type: 'added'`). Idempotent: a sticker that\n * already came from the message (or its file) is answered as is, and a removed one is restored. A message\n * without file answers 500 `Message or file not found`.\n */\n add(messageId: string, headers?: Record<string, string>): Promise<Sticker> {\n return this.client.post<Sticker, { messageId: string }>(\n `${this.basePath}/add`,\n { messageId },\n headers,\n )\n }\n\n /**\n * Removes a sticker of the account (soft delete; its file stays in the storage) and clears it from the\n * recent stickers of every user. Resolves the text `'OK'`, or `false` when there is no such sticker.\n */\n remove(stickerId: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.delete<'OK' | false>(`${this.basePath}/remove/${stickerId}`, headers)\n }\n}\n"],"mappings":";;;;;;;;;;AAgBA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;CAI5B,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;;;;CAO5C,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,MACE,OACA,SACiC;AACjC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,IAAI,WAAmB,SAAoD;AACzE,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,OACjB,EAAE,WAAW,EACb,QACD;;;;;;CAOH,OAAO,WAAmB,SAAyD;AACjF,SAAO,KAAK,OAAO,OAAqB,GAAG,KAAK,SAAS,UAAU,aAAa,QAAQ"}
@@ -1,11 +1,12 @@
1
1
  import type { ApiClient } from '../../core/ApiClient';
2
2
  import { BaseCrudApi } from '../../core/BaseCrudApi';
3
3
  import type { GetByIdQuery } from '../../core/types';
4
- import type { Sticker, CreateStickerPayload, UpdateStickerPayload } from './types';
4
+ import type { Sticker, CreateStickerPayload, UpdateStickerPayload, StickerExistQuery } from './types';
5
5
  /**
6
- * Stickers of the account. The backend serves `GET /stickers` and `POST /stickers` (plus
7
- * `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`); there is
8
- * no read by id, update nor `DELETE /stickers/:id`.
6
+ * Stickers of the account: every user of the account sees them. The backend serves `GET /stickers`,
7
+ * `POST /stickers`, `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`;
8
+ * there is no read by id, update nor `DELETE /stickers/:id`. The list accepts only the `file` include.
9
+ * @permissions stickers.send (list) · stickers.management (create, exist, add, remove)
9
10
  */
10
11
  export declare class StickersApi extends BaseCrudApi<Sticker, CreateStickerPayload, UpdateStickerPayload> {
11
12
  constructor(client: ApiClient);
@@ -18,5 +19,24 @@ export declare class StickersApi extends BaseCrudApi<Sticker, CreateStickerPaylo
18
19
  * `DELETE /stickers/remove/:stickerId`), so this route answers 404.
19
20
  */
20
21
  deleteById(id: string, headers?: Record<string, string>): Promise<Sticker>;
22
+ /**
23
+ * Finds the sticker of the account that came from the message, or from the file of `fileChecksum` or
24
+ * `filehash`. Resolves `{ stickerId }`, or `{}` when there is none; without `messageId` it answers 500
25
+ * `Invalid message ID`.
26
+ */
27
+ exist(query: StickerExistQuery, headers?: Record<string, string>): Promise<{
28
+ stickerId?: string;
29
+ }>;
30
+ /**
31
+ * Turns the file of a message of the account into a sticker (`type: 'added'`). Idempotent: a sticker that
32
+ * already came from the message (or its file) is answered as is, and a removed one is restored. A message
33
+ * without file answers 500 `Message or file not found`.
34
+ */
35
+ add(messageId: string, headers?: Record<string, string>): Promise<Sticker>;
36
+ /**
37
+ * Removes a sticker of the account (soft delete; its file stays in the storage) and clears it from the
38
+ * recent stickers of every user. Resolves the text `'OK'`, or `false` when there is no such sticker.
39
+ */
40
+ remove(stickerId: string, headers?: Record<string, string>): Promise<'OK' | false>;
21
41
  }
22
42
  //# sourceMappingURL=StickersApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StickersApi.d.ts","sourceRoot":"","sources":["../../../src/apis/stickers/StickersApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAElF;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,WAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,CAAC;gBACnF,MAAM,EAAE,SAAS;IAI7B,+FAA+F;IACtF,OAAO,CACd,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC;IAInB,+FAA+F;IACtF,UAAU,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC;IAInB;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAGpF"}
1
+ {"version":3,"file":"StickersApi.d.ts","sourceRoot":"","sources":["../../../src/apis/stickers/StickersApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EACV,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,WAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,CAAC;gBACnF,MAAM,EAAE,SAAS;IAI7B,+FAA+F;IACtF,OAAO,CACd,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC;IAInB,+FAA+F;IACtF,UAAU,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC;IAInB;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAInF;;;;OAIG;IACH,KAAK,CACH,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAOlC;;;;OAIG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ1E;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;CAGnF"}
@@ -2,9 +2,10 @@ import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
2
2
 
3
3
  //#region src/apis/stickers/StickersApi.ts
4
4
  /**
5
- * Stickers of the account. The backend serves `GET /stickers` and `POST /stickers` (plus
6
- * `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`); there is
7
- * no read by id, update nor `DELETE /stickers/:id`.
5
+ * Stickers of the account: every user of the account sees them. The backend serves `GET /stickers`,
6
+ * `POST /stickers`, `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`;
7
+ * there is no read by id, update nor `DELETE /stickers/:id`. The list accepts only the `file` include.
8
+ * @permissions stickers.send (list) · stickers.management (create, exist, add, remove)
8
9
  */
9
10
  var StickersApi = class extends BaseCrudApi {
10
11
  constructor(client) {
@@ -25,6 +26,29 @@ var StickersApi = class extends BaseCrudApi {
25
26
  deleteById(id, headers) {
26
27
  return super.deleteById(id, headers);
27
28
  }
29
+ /**
30
+ * Finds the sticker of the account that came from the message, or from the file of `fileChecksum` or
31
+ * `filehash`. Resolves `{ stickerId }`, or `{}` when there is none; without `messageId` it answers 500
32
+ * `Invalid message ID`.
33
+ */
34
+ exist(query, headers) {
35
+ return this.client.get(`${this.basePath}/exist${this.toQueryString(query)}`, headers);
36
+ }
37
+ /**
38
+ * Turns the file of a message of the account into a sticker (`type: 'added'`). Idempotent: a sticker that
39
+ * already came from the message (or its file) is answered as is, and a removed one is restored. A message
40
+ * without file answers 500 `Message or file not found`.
41
+ */
42
+ add(messageId, headers) {
43
+ return this.client.post(`${this.basePath}/add`, { messageId }, headers);
44
+ }
45
+ /**
46
+ * Removes a sticker of the account (soft delete; its file stays in the storage) and clears it from the
47
+ * recent stickers of every user. Resolves the text `'OK'`, or `false` when there is no such sticker.
48
+ */
49
+ remove(stickerId, headers) {
50
+ return this.client.delete(`${this.basePath}/remove/${stickerId}`, headers);
51
+ }
28
52
  };
29
53
 
30
54
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"StickersApi.mjs","names":[],"sources":["../../../src/apis/stickers/StickersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery } from '../../core/types'\nimport type { Sticker, CreateStickerPayload, UpdateStickerPayload } from './types'\n\n/**\n * Stickers of the account. The backend serves `GET /stickers` and `POST /stickers` (plus\n * `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`); there is\n * no read by id, update nor `DELETE /stickers/:id`.\n */\nexport class StickersApi extends BaseCrudApi<Sticker, CreateStickerPayload, UpdateStickerPayload> {\n constructor(client: ApiClient) {\n super(client, '/stickers')\n }\n\n /** @deprecated Not served: the backend has no GET /stickers/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<Sticker>,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /stickers/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateStickerPayload,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.updateById(id, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /stickers/:id (it removes a sticker by\n * `DELETE /stickers/remove/:stickerId`), so this route answers 404.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Sticker> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;AAUA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;CAI5B,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;;;;CAO5C,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"StickersApi.mjs","names":[],"sources":["../../../src/apis/stickers/StickersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery } from '../../core/types'\nimport type {\n Sticker,\n CreateStickerPayload,\n UpdateStickerPayload,\n StickerExistQuery,\n} from './types'\n\n/**\n * Stickers of the account: every user of the account sees them. The backend serves `GET /stickers`,\n * `POST /stickers`, `GET /stickers/exist`, `POST /stickers/add` and `DELETE /stickers/remove/:stickerId`;\n * there is no read by id, update nor `DELETE /stickers/:id`. The list accepts only the `file` include.\n * @permissions stickers.send (list) · stickers.management (create, exist, add, remove)\n */\nexport class StickersApi extends BaseCrudApi<Sticker, CreateStickerPayload, UpdateStickerPayload> {\n constructor(client: ApiClient) {\n super(client, '/stickers')\n }\n\n /** @deprecated Not served: the backend has no GET /stickers/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<Sticker>,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /stickers/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateStickerPayload,\n headers?: Record<string, string>,\n ): Promise<Sticker> {\n return super.updateById(id, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /stickers/:id (it removes a sticker by\n * `DELETE /stickers/remove/:stickerId`), so this route answers 404.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Sticker> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Finds the sticker of the account that came from the message, or from the file of `fileChecksum` or\n * `filehash`. Resolves `{ stickerId }`, or `{}` when there is none; without `messageId` it answers 500\n * `Invalid message ID`.\n */\n exist(\n query: StickerExistQuery,\n headers?: Record<string, string>,\n ): Promise<{ stickerId?: string }> {\n return this.client.get<{ stickerId?: string }>(\n `${this.basePath}/exist${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Turns the file of a message of the account into a sticker (`type: 'added'`). Idempotent: a sticker that\n * already came from the message (or its file) is answered as is, and a removed one is restored. A message\n * without file answers 500 `Message or file not found`.\n */\n add(messageId: string, headers?: Record<string, string>): Promise<Sticker> {\n return this.client.post<Sticker, { messageId: string }>(\n `${this.basePath}/add`,\n { messageId },\n headers,\n )\n }\n\n /**\n * Removes a sticker of the account (soft delete; its file stays in the storage) and clears it from the\n * recent stickers of every user. Resolves the text `'OK'`, or `false` when there is no such sticker.\n */\n remove(stickerId: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.delete<'OK' | false>(`${this.basePath}/remove/${stickerId}`, headers)\n }\n}\n"],"mappings":";;;;;;;;;AAgBA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;CAI5B,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;;;;CAO5C,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,MACE,OACA,SACiC;AACjC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,IAAI,WAAmB,SAAoD;AACzE,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,OACjB,EAAE,WAAW,EACb,QACD;;;;;;CAOH,OAAO,WAAmB,SAAyD;AACjF,SAAO,KAAK,OAAO,OAAqB,GAAG,KAAK,SAAS,UAAU,aAAa,QAAQ"}
@@ -1,7 +1,10 @@
1
+ import type { File } from '../files/types';
1
2
  import type { User } from '../users/types';
3
+ /** A sticker of the account (every user of the account sees it). */
2
4
  export type Sticker = {
3
5
  id: string;
4
- type: string;
6
+ /** `'created'` (uploaded with `create`) or `'added'` (taken from a message with `add`). */
7
+ type: 'created' | 'added' | (string & {});
5
8
  originFileChecksum: string | null;
6
9
  originFilehash: string | null;
7
10
  originMessageId: string | null;
@@ -9,17 +12,38 @@ export type Sticker = {
9
12
  accountId: string;
10
13
  createdAt: string;
11
14
  updatedAt: string;
12
- deletedAt: string | null;
15
+ deletedAt?: string | null;
16
+ /** @deprecated Not served: the backend only serves the `file` include. */
13
17
  user?: User;
18
+ /** The image (webp) of the sticker. */
19
+ file?: File;
14
20
  };
15
- export type StickerRelationships = 'user';
21
+ /** The backend serves only `file` (`user` is dropped). */
22
+ export type StickerRelationships = 'user' | 'file';
23
+ /**
24
+ * Uploads an image as a sticker: the backend converts it to a 512x512 webp (413 when it ends up too large:
25
+ * 100KB static, 500KB animated). `base64` without the `data:...;base64,` prefix.
26
+ */
16
27
  export type CreateStickerPayload = {
17
- type: string;
28
+ base64: string;
29
+ /** The name of the file (`<name>.webp`). */
30
+ name: string;
31
+ /** @deprecated Ignored by the backend: a created sticker is always `'created'`. */
32
+ type?: string;
33
+ /** @deprecated Ignored by the backend: use `add` to take a sticker from a message. */
18
34
  originMessageId?: string;
35
+ /** @deprecated Ignored by the backend. */
19
36
  originFileChecksum?: string;
37
+ /** @deprecated Ignored by the backend. */
20
38
  originFilehash?: string;
21
39
  };
22
40
  export type UpdateStickerPayload = {
23
41
  type?: string;
24
42
  };
43
+ /** Query of `exist`: finds a sticker of the account by the message or by the file it came from. */
44
+ export type StickerExistQuery = {
45
+ messageId: string;
46
+ fileChecksum?: string;
47
+ filehash?: string;
48
+ };
25
49
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/stickers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/stickers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,oEAAoE;AACpE,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,2FAA2F;IAC3F,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACzC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEzB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,uCAAuC;IACvC,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAA;AAElD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,0CAA0C;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,0CAA0C;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,mGAAmG;AACnG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,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,61 @@ 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 (an external call, when there is a 360Dialog connection).
55
+ * @permissions hsm.view
56
+ */
57
+ resume(headers) {
58
+ return this.client.get(`${this.basePath}/resume`, headers);
59
+ }
9
60
  };
10
61
 
11
62
  //#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 (an external call, when there is a 360Dialog connection).\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;;;;;;CAOzF,OAAO,SAAsE;AAC3E,SAAO,KAAK,OAAO,IAA+B,GAAG,KAAK,SAAS,UAAU,QAAQ"}
@@ -1,7 +1,49 @@
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 (an external call, when there is a 360Dialog connection).
45
+ * @permissions hsm.view
46
+ */
47
+ resume(headers?: Record<string, string>): Promise<Record<string, unknown>[]>;
6
48
  }
7
49
  //# 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;;;OAGG;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,61 @@
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 (an external call, when there is a 360Dialog connection).
54
+ * @permissions hsm.view
55
+ */
56
+ resume(headers) {
57
+ return this.client.get(`${this.basePath}/resume`, headers);
58
+ }
8
59
  };
9
60
 
10
61
  //#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 (an external call, when there is a 360Dialog connection).\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;;;;;;CAOzF,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
- text: string;
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[];