@ikatec/digisac-api-sdk 4.9.0 → 4.10.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 (283) hide show
  1. package/README.md +36 -12
  2. package/dist/apis/absence/AbsenceApi.cjs +12 -0
  3. package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
  4. package/dist/apis/absence/AbsenceApi.d.ts +9 -0
  5. package/dist/apis/absence/AbsenceApi.d.ts.map +1 -1
  6. package/dist/apis/absence/AbsenceApi.mjs +12 -0
  7. package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
  8. package/dist/apis/acceptanceTerms/AcceptanceTermsApi.cjs +8 -0
  9. package/dist/apis/acceptanceTerms/AcceptanceTermsApi.cjs.map +1 -1
  10. package/dist/apis/acceptanceTerms/AcceptanceTermsApi.d.ts +8 -1
  11. package/dist/apis/acceptanceTerms/AcceptanceTermsApi.d.ts.map +1 -1
  12. package/dist/apis/acceptanceTerms/AcceptanceTermsApi.mjs +8 -0
  13. package/dist/apis/acceptanceTerms/AcceptanceTermsApi.mjs.map +1 -1
  14. package/dist/apis/accounts/AccountsApi.cjs +5 -0
  15. package/dist/apis/accounts/AccountsApi.cjs.map +1 -1
  16. package/dist/apis/accounts/AccountsApi.d.ts +5 -0
  17. package/dist/apis/accounts/AccountsApi.d.ts.map +1 -1
  18. package/dist/apis/accounts/AccountsApi.mjs +5 -0
  19. package/dist/apis/accounts/AccountsApi.mjs.map +1 -1
  20. package/dist/apis/accounts/types.d.ts +2 -0
  21. package/dist/apis/accounts/types.d.ts.map +1 -1
  22. package/dist/apis/activityLog/ActivityLogApi.cjs +12 -0
  23. package/dist/apis/activityLog/ActivityLogApi.cjs.map +1 -1
  24. package/dist/apis/activityLog/ActivityLogApi.d.ts +8 -0
  25. package/dist/apis/activityLog/ActivityLogApi.d.ts.map +1 -1
  26. package/dist/apis/activityLog/ActivityLogApi.mjs +12 -0
  27. package/dist/apis/activityLog/ActivityLogApi.mjs.map +1 -1
  28. package/dist/apis/categories/CategoriesApi.cjs +7 -0
  29. package/dist/apis/categories/CategoriesApi.cjs.map +1 -1
  30. package/dist/apis/categories/CategoriesApi.d.ts +7 -1
  31. package/dist/apis/categories/CategoriesApi.d.ts.map +1 -1
  32. package/dist/apis/categories/CategoriesApi.mjs +7 -0
  33. package/dist/apis/categories/CategoriesApi.mjs.map +1 -1
  34. package/dist/apis/clientFeedback/ClientFeedbackApi.cjs +5 -1
  35. package/dist/apis/clientFeedback/ClientFeedbackApi.cjs.map +1 -1
  36. package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts +5 -1
  37. package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts.map +1 -1
  38. package/dist/apis/clientFeedback/ClientFeedbackApi.mjs +5 -1
  39. package/dist/apis/clientFeedback/ClientFeedbackApi.mjs.map +1 -1
  40. package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs +8 -0
  41. package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs.map +1 -1
  42. package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts +8 -1
  43. package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts.map +1 -1
  44. package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs +8 -0
  45. package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs.map +1 -1
  46. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs +7 -0
  47. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs.map +1 -1
  48. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts +7 -1
  49. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts.map +1 -1
  50. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs +7 -0
  51. package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs.map +1 -1
  52. package/dist/apis/contacts/ContactsApi.cjs +16 -3
  53. package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
  54. package/dist/apis/contacts/ContactsApi.d.ts +16 -5
  55. package/dist/apis/contacts/ContactsApi.d.ts.map +1 -1
  56. package/dist/apis/contacts/ContactsApi.mjs +16 -3
  57. package/dist/apis/contacts/ContactsApi.mjs.map +1 -1
  58. package/dist/apis/contacts/types.d.ts +6 -1
  59. package/dist/apis/contacts/types.d.ts.map +1 -1
  60. package/dist/apis/creditMovements/CreditMovementsApi.cjs +17 -0
  61. package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
  62. package/dist/apis/creditMovements/CreditMovementsApi.d.ts +11 -0
  63. package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
  64. package/dist/apis/creditMovements/CreditMovementsApi.mjs +17 -0
  65. package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
  66. package/dist/apis/customFields/CustomFieldsApi.cjs +7 -0
  67. package/dist/apis/customFields/CustomFieldsApi.cjs.map +1 -1
  68. package/dist/apis/customFields/CustomFieldsApi.d.ts +7 -1
  69. package/dist/apis/customFields/CustomFieldsApi.d.ts.map +1 -1
  70. package/dist/apis/customFields/CustomFieldsApi.mjs +7 -0
  71. package/dist/apis/customFields/CustomFieldsApi.mjs.map +1 -1
  72. package/dist/apis/departments/DepartmentsApi.cjs +21 -0
  73. package/dist/apis/departments/DepartmentsApi.cjs.map +1 -1
  74. package/dist/apis/departments/DepartmentsApi.d.ts +20 -2
  75. package/dist/apis/departments/DepartmentsApi.d.ts.map +1 -1
  76. package/dist/apis/departments/DepartmentsApi.mjs +21 -0
  77. package/dist/apis/departments/DepartmentsApi.mjs.map +1 -1
  78. package/dist/apis/departments/types.d.ts +5 -0
  79. package/dist/apis/departments/types.d.ts.map +1 -1
  80. package/dist/apis/distribution/DistributionApi.cjs +7 -0
  81. package/dist/apis/distribution/DistributionApi.cjs.map +1 -1
  82. package/dist/apis/distribution/DistributionApi.d.ts +7 -1
  83. package/dist/apis/distribution/DistributionApi.d.ts.map +1 -1
  84. package/dist/apis/distribution/DistributionApi.mjs +7 -0
  85. package/dist/apis/distribution/DistributionApi.mjs.map +1 -1
  86. package/dist/apis/files/FilesApi.cjs +49 -0
  87. package/dist/apis/files/FilesApi.cjs.map +1 -1
  88. package/dist/apis/files/FilesApi.d.ts +45 -2
  89. package/dist/apis/files/FilesApi.d.ts.map +1 -1
  90. package/dist/apis/files/FilesApi.mjs +49 -0
  91. package/dist/apis/files/FilesApi.mjs.map +1 -1
  92. package/dist/apis/files/types.d.ts +45 -7
  93. package/dist/apis/files/types.d.ts.map +1 -1
  94. package/dist/apis/holiday/HolidayApi.cjs +7 -0
  95. package/dist/apis/holiday/HolidayApi.cjs.map +1 -1
  96. package/dist/apis/holiday/HolidayApi.d.ts +7 -1
  97. package/dist/apis/holiday/HolidayApi.d.ts.map +1 -1
  98. package/dist/apis/holiday/HolidayApi.mjs +7 -0
  99. package/dist/apis/holiday/HolidayApi.mjs.map +1 -1
  100. package/dist/apis/integrations/IntegrationsApi.cjs +7 -0
  101. package/dist/apis/integrations/IntegrationsApi.cjs.map +1 -1
  102. package/dist/apis/integrations/IntegrationsApi.d.ts +7 -1
  103. package/dist/apis/integrations/IntegrationsApi.d.ts.map +1 -1
  104. package/dist/apis/integrations/IntegrationsApi.mjs +7 -0
  105. package/dist/apis/integrations/IntegrationsApi.mjs.map +1 -1
  106. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs +7 -0
  107. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs.map +1 -1
  108. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts +7 -1
  109. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts.map +1 -1
  110. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs +7 -0
  111. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs.map +1 -1
  112. package/dist/apis/kanbanBoards/KanbanBoardsApi.cjs +7 -0
  113. package/dist/apis/kanbanBoards/KanbanBoardsApi.cjs.map +1 -1
  114. package/dist/apis/kanbanBoards/KanbanBoardsApi.d.ts +7 -1
  115. package/dist/apis/kanbanBoards/KanbanBoardsApi.d.ts.map +1 -1
  116. package/dist/apis/kanbanBoards/KanbanBoardsApi.mjs +7 -0
  117. package/dist/apis/kanbanBoards/KanbanBoardsApi.mjs.map +1 -1
  118. package/dist/apis/kanbanCards/KanbanCardsApi.cjs +7 -0
  119. package/dist/apis/kanbanCards/KanbanCardsApi.cjs.map +1 -1
  120. package/dist/apis/kanbanCards/KanbanCardsApi.d.ts +7 -1
  121. package/dist/apis/kanbanCards/KanbanCardsApi.d.ts.map +1 -1
  122. package/dist/apis/kanbanCards/KanbanCardsApi.mjs +7 -0
  123. package/dist/apis/kanbanCards/KanbanCardsApi.mjs.map +1 -1
  124. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +8 -0
  125. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
  126. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +8 -1
  127. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
  128. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +8 -0
  129. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
  130. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +8 -0
  131. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
  132. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +8 -1
  133. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
  134. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +8 -0
  135. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
  136. package/dist/apis/messages/MessagesApi.cjs +23 -3
  137. package/dist/apis/messages/MessagesApi.cjs.map +1 -1
  138. package/dist/apis/messages/MessagesApi.d.ts +19 -3
  139. package/dist/apis/messages/MessagesApi.d.ts.map +1 -1
  140. package/dist/apis/messages/MessagesApi.mjs +23 -3
  141. package/dist/apis/messages/MessagesApi.mjs.map +1 -1
  142. package/dist/apis/messages/types.d.ts +3 -0
  143. package/dist/apis/messages/types.d.ts.map +1 -1
  144. package/dist/apis/notifications/NotificationsApi.cjs +7 -0
  145. package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
  146. package/dist/apis/notifications/NotificationsApi.d.ts +7 -1
  147. package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
  148. package/dist/apis/notifications/NotificationsApi.mjs +7 -0
  149. package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
  150. package/dist/apis/organizations/OrganizationsApi.cjs +7 -0
  151. package/dist/apis/organizations/OrganizationsApi.cjs.map +1 -1
  152. package/dist/apis/organizations/OrganizationsApi.d.ts +7 -1
  153. package/dist/apis/organizations/OrganizationsApi.d.ts.map +1 -1
  154. package/dist/apis/organizations/OrganizationsApi.mjs +7 -0
  155. package/dist/apis/organizations/OrganizationsApi.mjs.map +1 -1
  156. package/dist/apis/people/PeopleApi.cjs +7 -0
  157. package/dist/apis/people/PeopleApi.cjs.map +1 -1
  158. package/dist/apis/people/PeopleApi.d.ts +7 -1
  159. package/dist/apis/people/PeopleApi.d.ts.map +1 -1
  160. package/dist/apis/people/PeopleApi.mjs +7 -0
  161. package/dist/apis/people/PeopleApi.mjs.map +1 -1
  162. package/dist/apis/planAiHistory/PlanAiHistoryApi.cjs +16 -0
  163. package/dist/apis/planAiHistory/PlanAiHistoryApi.cjs.map +1 -1
  164. package/dist/apis/planAiHistory/PlanAiHistoryApi.d.ts +10 -0
  165. package/dist/apis/planAiHistory/PlanAiHistoryApi.d.ts.map +1 -1
  166. package/dist/apis/planAiHistory/PlanAiHistoryApi.mjs +16 -0
  167. package/dist/apis/planAiHistory/PlanAiHistoryApi.mjs.map +1 -1
  168. package/dist/apis/roles/RolesApi.cjs +7 -0
  169. package/dist/apis/roles/RolesApi.cjs.map +1 -1
  170. package/dist/apis/roles/RolesApi.d.ts +6 -1
  171. package/dist/apis/roles/RolesApi.d.ts.map +1 -1
  172. package/dist/apis/roles/RolesApi.mjs +7 -0
  173. package/dist/apis/roles/RolesApi.mjs.map +1 -1
  174. package/dist/apis/services/ServicesApi.cjs +68 -0
  175. package/dist/apis/services/ServicesApi.cjs.map +1 -1
  176. package/dist/apis/services/ServicesApi.d.ts +53 -1
  177. package/dist/apis/services/ServicesApi.d.ts.map +1 -1
  178. package/dist/apis/services/ServicesApi.mjs +68 -0
  179. package/dist/apis/services/ServicesApi.mjs.map +1 -1
  180. package/dist/apis/services/types.d.ts +15 -0
  181. package/dist/apis/services/types.d.ts.map +1 -1
  182. package/dist/apis/stickers/StickersApi.cjs +20 -0
  183. package/dist/apis/stickers/StickersApi.cjs.map +1 -1
  184. package/dist/apis/stickers/StickersApi.d.ts +15 -0
  185. package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
  186. package/dist/apis/stickers/StickersApi.mjs +20 -0
  187. package/dist/apis/stickers/StickersApi.mjs.map +1 -1
  188. package/dist/apis/tags/TagsApi.cjs +7 -0
  189. package/dist/apis/tags/TagsApi.cjs.map +1 -1
  190. package/dist/apis/tags/TagsApi.d.ts +7 -1
  191. package/dist/apis/tags/TagsApi.d.ts.map +1 -1
  192. package/dist/apis/tags/TagsApi.mjs +7 -0
  193. package/dist/apis/tags/TagsApi.mjs.map +1 -1
  194. package/dist/apis/timetable/TimetableApi.cjs +7 -0
  195. package/dist/apis/timetable/TimetableApi.cjs.map +1 -1
  196. package/dist/apis/timetable/TimetableApi.d.ts +7 -1
  197. package/dist/apis/timetable/TimetableApi.d.ts.map +1 -1
  198. package/dist/apis/timetable/TimetableApi.mjs +7 -0
  199. package/dist/apis/timetable/TimetableApi.mjs.map +1 -1
  200. package/dist/apis/users/UsersApi.cjs +8 -0
  201. package/dist/apis/users/UsersApi.cjs.map +1 -1
  202. package/dist/apis/users/UsersApi.d.ts +8 -1
  203. package/dist/apis/users/UsersApi.d.ts.map +1 -1
  204. package/dist/apis/users/UsersApi.mjs +8 -0
  205. package/dist/apis/users/UsersApi.mjs.map +1 -1
  206. package/dist/apis/users/types.d.ts +15 -0
  207. package/dist/apis/users/types.d.ts.map +1 -1
  208. package/dist/apis/webhooks/WebhooksApi.cjs +7 -0
  209. package/dist/apis/webhooks/WebhooksApi.cjs.map +1 -1
  210. package/dist/apis/webhooks/WebhooksApi.d.ts +7 -1
  211. package/dist/apis/webhooks/WebhooksApi.d.ts.map +1 -1
  212. package/dist/apis/webhooks/WebhooksApi.mjs +7 -0
  213. package/dist/apis/webhooks/WebhooksApi.mjs.map +1 -1
  214. package/dist/core/ApiClient.d.ts +14 -0
  215. package/dist/core/ApiClient.d.ts.map +1 -1
  216. package/dist/core/ArchivableCrudApi.cjs.map +1 -1
  217. package/dist/core/ArchivableCrudApi.d.ts +1 -1
  218. package/dist/core/ArchivableCrudApi.d.ts.map +1 -1
  219. package/dist/core/ArchivableCrudApi.mjs.map +1 -1
  220. package/dist/core/BaseApiClient.cjs +24 -3
  221. package/dist/core/BaseApiClient.cjs.map +1 -1
  222. package/dist/core/BaseApiClient.d.ts +14 -0
  223. package/dist/core/BaseApiClient.d.ts.map +1 -1
  224. package/dist/core/BaseApiClient.mjs +24 -3
  225. package/dist/core/BaseApiClient.mjs.map +1 -1
  226. package/dist/core/requestExternal.cjs +33 -0
  227. package/dist/core/requestExternal.cjs.map +1 -0
  228. package/dist/core/requestExternal.d.ts +9 -0
  229. package/dist/core/requestExternal.d.ts.map +1 -0
  230. package/dist/core/requestExternal.mjs +32 -0
  231. package/dist/core/requestExternal.mjs.map +1 -0
  232. package/package.json +1 -1
  233. package/src/apis/absence/AbsenceApi.ts +19 -0
  234. package/src/apis/acceptanceTerms/AcceptanceTermsApi.ts +13 -1
  235. package/src/apis/accounts/AccountsApi.ts +5 -0
  236. package/src/apis/accounts/types.ts +2 -0
  237. package/src/apis/activityLog/ActivityLogApi.ts +18 -0
  238. package/src/apis/categories/CategoriesApi.ts +12 -1
  239. package/src/apis/clientFeedback/ClientFeedbackApi.ts +5 -1
  240. package/src/apis/contactBlockLists/ContactBlockListsApi.ts +13 -1
  241. package/src/apis/contactBlockListsControls/ContactBlockListsControlsApi.ts +12 -1
  242. package/src/apis/contacts/ContactsApi.test.ts +20 -4
  243. package/src/apis/contacts/ContactsApi.ts +24 -5
  244. package/src/apis/contacts/types.ts +7 -1
  245. package/src/apis/creditMovements/CreditMovementsApi.ts +27 -0
  246. package/src/apis/customFields/CustomFieldsApi.ts +12 -1
  247. package/src/apis/departments/DepartmentsApi.test.ts +88 -0
  248. package/src/apis/departments/DepartmentsApi.ts +41 -2
  249. package/src/apis/departments/types.ts +6 -0
  250. package/src/apis/distribution/DistributionApi.ts +12 -1
  251. package/src/apis/files/FilesApi.test.ts +122 -0
  252. package/src/apis/files/FilesApi.ts +107 -2
  253. package/src/apis/files/types.ts +48 -7
  254. package/src/apis/holiday/HolidayApi.ts +16 -1
  255. package/src/apis/integrations/IntegrationsApi.ts +12 -1
  256. package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +12 -1
  257. package/src/apis/kanbanBoards/KanbanBoardsApi.ts +12 -1
  258. package/src/apis/kanbanCards/KanbanCardsApi.ts +12 -1
  259. package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +13 -1
  260. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +13 -1
  261. package/src/apis/messages/MessagesApi.test.ts +13 -7
  262. package/src/apis/messages/MessagesApi.ts +29 -3
  263. package/src/apis/messages/types.ts +3 -0
  264. package/src/apis/notifications/NotificationsApi.ts +12 -1
  265. package/src/apis/organizations/OrganizationsApi.ts +12 -1
  266. package/src/apis/payloads.test-d.ts +114 -0
  267. package/src/apis/people/PeopleApi.ts +16 -1
  268. package/src/apis/planAiHistory/PlanAiHistoryApi.ts +26 -0
  269. package/src/apis/roles/RolesApi.ts +10 -1
  270. package/src/apis/services/ServicesApi.test.ts +45 -0
  271. package/src/apis/services/ServicesApi.ts +91 -1
  272. package/src/apis/services/types.ts +16 -0
  273. package/src/apis/stickers/StickersApi.ts +32 -0
  274. package/src/apis/tags/TagsApi.ts +16 -1
  275. package/src/apis/timetable/TimetableApi.ts +12 -1
  276. package/src/apis/users/UsersApi.ts +17 -1
  277. package/src/apis/users/types.ts +11 -0
  278. package/src/apis/webhooks/WebhooksApi.ts +16 -1
  279. package/src/core/ApiClient.ts +24 -0
  280. package/src/core/ArchivableCrudApi.ts +2 -1
  281. package/src/core/BaseApiClient.test.ts +98 -0
  282. package/src/core/BaseApiClient.ts +49 -4
  283. package/src/core/requestExternal.ts +43 -0
@@ -0,0 +1,122 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2
+ import { FilesApi } from './FilesApi'
3
+ import type { ApiClient } from '../../core/ApiClient'
4
+ import { ApiConnectionError, ApiError } from '../../core/errors'
5
+ import type { CreateToUploadResult } from './types'
6
+
7
+ // ── Mock client factory ──────────────────────────────────────────────
8
+
9
+ function createMockClient(): ApiClient {
10
+ return {
11
+ setAccessToken: vi.fn().mockReturnThis(),
12
+ request: vi.fn(),
13
+ get: vi.fn(),
14
+ post: vi.fn(),
15
+ put: vi.fn(),
16
+ patch: vi.fn(),
17
+ delete: vi.fn(),
18
+ }
19
+ }
20
+
21
+ const URL_TO_UPLOAD = 'https://storage.example.com/acc-1/file-1.plain?X-Amz-Signature=abc'
22
+
23
+ // ── Tests ────────────────────────────────────────────────────────────
24
+
25
+ describe('FilesApi', () => {
26
+ let client: ReturnType<typeof createMockClient>
27
+ let api: FilesApi
28
+
29
+ beforeEach(() => {
30
+ client = createMockClient()
31
+ api = new FilesApi(client)
32
+ })
33
+
34
+ afterEach(() => {
35
+ vi.restoreAllMocks()
36
+ })
37
+
38
+ describe('createToUpload', () => {
39
+ it('calls client.post with /files/create-to-upload and body', async () => {
40
+ const created: CreateToUploadResult = {
41
+ urlToUpload: URL_TO_UPLOAD,
42
+ id: 'file-1',
43
+ name: 'report.txt',
44
+ mimetype: 'text/plain',
45
+ }
46
+ vi.mocked(client.post).mockResolvedValue(created)
47
+ const body = { name: 'report.txt', mimetype: 'text/plain', attachedType: 'campaign.file' }
48
+ const result = await api.createToUpload(body)
49
+ expect(client.post).toHaveBeenCalledWith('/files/create-to-upload', body, undefined)
50
+ expect(result).toEqual(created)
51
+ })
52
+ })
53
+
54
+ describe('upload', () => {
55
+ it('sends through client.requestExternal when the client has it', async () => {
56
+ const requestExternal = vi.fn().mockResolvedValue(new Response(null, { status: 200 }))
57
+ const fetchSpy = vi.spyOn(globalThis, 'fetch')
58
+ api = new FilesApi({ ...client, requestExternal })
59
+ await api.upload(URL_TO_UPLOAD, 'content', 'text/plain')
60
+ expect(requestExternal).toHaveBeenCalledWith('PUT', URL_TO_UPLOAD, 'content', {
61
+ 'Content-Type': 'text/plain',
62
+ })
63
+ expect(fetchSpy).not.toHaveBeenCalled()
64
+ })
65
+
66
+ it('without client.requestExternal, PUTs the content to the signed URL with the global fetch', async () => {
67
+ const spy = vi
68
+ .spyOn(globalThis, 'fetch')
69
+ .mockResolvedValue(new Response(null, { status: 200 }))
70
+ await api.upload(URL_TO_UPLOAD, 'content', 'text/plain')
71
+ expect(spy).toHaveBeenCalledWith(URL_TO_UPLOAD, {
72
+ method: 'PUT',
73
+ headers: { 'Content-Type': 'text/plain' },
74
+ body: 'content',
75
+ })
76
+ expect(client.request).not.toHaveBeenCalled()
77
+ })
78
+
79
+ it('throws ApiError when the storage refuses the upload', async () => {
80
+ vi.spyOn(globalThis, 'fetch').mockResolvedValue(
81
+ new Response('<Error><Code>SignatureDoesNotMatch</Code></Error>', {
82
+ status: 403,
83
+ statusText: 'Forbidden',
84
+ }),
85
+ )
86
+ const captured = await api.upload(URL_TO_UPLOAD, 'content', 'text/plain').catch((e) => e)
87
+ expect(captured).toBeInstanceOf(ApiError)
88
+ expect((captured as ApiError).status).toBe(403)
89
+ expect((captured as ApiError).body).toBe('<Error><Code>SignatureDoesNotMatch</Code></Error>')
90
+ })
91
+
92
+ it('throws ApiConnectionError when the request fails', async () => {
93
+ vi.spyOn(globalThis, 'fetch').mockRejectedValue(new TypeError('fetch failed'))
94
+ await expect(api.upload(URL_TO_UPLOAD, 'content', 'text/plain')).rejects.toBeInstanceOf(
95
+ ApiConnectionError,
96
+ )
97
+ })
98
+ })
99
+
100
+ describe('deleteById', () => {
101
+ it('calls client.delete with /files/:id and resolves { success }', async () => {
102
+ vi.mocked(client.delete).mockResolvedValue({ success: true })
103
+ const result = await api.deleteById('file-1')
104
+ expect(client.delete).toHaveBeenCalledWith('/files/file-1', undefined)
105
+ expect(result).toEqual({ success: true })
106
+ })
107
+ })
108
+
109
+ describe('deprecated reads and update (no backend route)', () => {
110
+ it('still call the same paths', async () => {
111
+ await api.getById('file-1')
112
+ await api.getMany({ where: { id: 'file-1' } })
113
+ await api.updateById('file-1', { name: 'x' })
114
+ expect(client.get).toHaveBeenCalledWith('/files/file-1', undefined)
115
+ expect(client.get).toHaveBeenCalledWith(
116
+ `/files?query=${encodeURIComponent(JSON.stringify({ where: { id: 'file-1' } }))}`,
117
+ undefined,
118
+ )
119
+ expect(client.put).toHaveBeenCalledWith('/files/file-1', { name: 'x' }, undefined)
120
+ })
121
+ })
122
+ })
@@ -1,9 +1,114 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
2
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
- import type { File, CreateFilePayload, UpdateFilePayload } from './types'
3
+ import { requestExternal } from '../../core/requestExternal'
4
+ import type { GetByIdQuery, ListQuery, Paginated } from '../../core/types'
5
+ import type {
6
+ File,
7
+ CreateFilePayload,
8
+ UpdateFilePayload,
9
+ CreateToUploadPayload,
10
+ CreateToUploadResult,
11
+ DeleteFileResult,
12
+ } from './types'
4
13
 
5
- export class FilesApi extends BaseCrudApi<File, CreateFilePayload, UpdateFilePayload> {
14
+ /**
15
+ * Files of the account. The backend serves `POST /files` (the record only, no content),
16
+ * `POST /files/create-to-upload` (record + signed URL to upload the content), `POST
17
+ * /files/duplicate-file`, `DELETE /files/:id` and the signed download `GET
18
+ * /files/:accountId/:filename`; there is no list, read by id nor update.
19
+ */
20
+ export class FilesApi extends BaseCrudApi<
21
+ File,
22
+ CreateFilePayload,
23
+ UpdateFilePayload,
24
+ ListQuery<File>,
25
+ DeleteFileResult
26
+ > {
6
27
  constructor(client: ApiClient) {
7
28
  super(client, '/files')
8
29
  }
30
+
31
+ /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */
32
+ override getMany(
33
+ query: ListQuery<File> & { paginate: false },
34
+ headers?: Record<string, string>,
35
+ ): Promise<File[]>
36
+ /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */
37
+ override getMany(
38
+ query?: ListQuery<File> & { paginate?: true },
39
+ headers?: Record<string, string>,
40
+ ): Promise<Paginated<File>>
41
+ /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */
42
+ override getMany(
43
+ query?: ListQuery<File>,
44
+ headers?: Record<string, string>,
45
+ ): Promise<Paginated<File> | File[]>
46
+ override getMany(
47
+ query?: ListQuery<File>,
48
+ headers?: Record<string, string>,
49
+ ): Promise<Paginated<File> | File[]> {
50
+ return super.getMany(query, headers)
51
+ }
52
+
53
+ /** @deprecated Not served: the backend has no GET /files, so this route answers 404. */
54
+ override getOne(query?: ListQuery<File>, headers?: Record<string, string>): Promise<File | null> {
55
+ return super.getOne(query, headers)
56
+ }
57
+
58
+ /** @deprecated Not served: the backend has no GET /files/:id, so this route answers 404. */
59
+ override getById(
60
+ id: string,
61
+ query?: GetByIdQuery<File>,
62
+ headers?: Record<string, string>,
63
+ ): Promise<File> {
64
+ return super.getById(id, query, headers)
65
+ }
66
+
67
+ /** @deprecated Not served: the backend has no PUT /files/:id, so this route answers 404. */
68
+ override updateById(
69
+ id: string,
70
+ body: UpdateFilePayload,
71
+ headers?: Record<string, string>,
72
+ ): Promise<File> {
73
+ return super.updateById(id, body, headers)
74
+ }
75
+
76
+ /**
77
+ * Deletes a file. Resolves `{ success: true }`, also for an unknown id; a file of another
78
+ * account answers 403.
79
+ */
80
+ override deleteById(id: string, headers?: Record<string, string>): Promise<DeleteFileResult> {
81
+ return super.deleteById(id, headers)
82
+ }
83
+
84
+ /**
85
+ * Creates the record of a file and returns the signed URL to upload its content: send the
86
+ * content with {@link upload}. An audio that must be converted (a voice message for the
87
+ * connection) is sent in `base64` instead, and then no `urlToUpload` is returned. `name` and
88
+ * `mimetype` are required (500 without them; an audio without `name` is named `recording`).
89
+ */
90
+ createToUpload(
91
+ body: CreateToUploadPayload,
92
+ headers?: Record<string, string>,
93
+ ): Promise<CreateToUploadResult> {
94
+ return this.client.post<CreateToUploadResult, CreateToUploadPayload>(
95
+ `${this.basePath}/create-to-upload`,
96
+ body,
97
+ headers,
98
+ )
99
+ }
100
+
101
+ /**
102
+ * Uploads the content of a file to the `urlToUpload` returned by {@link createToUpload}. The URL
103
+ * is signed by the storage, so the request goes straight to it, without the API token (the
104
+ * storage refuses an `Authorization` header). `mimetype` must be the one sent to
105
+ * `createToUpload`. Sent through `client.requestExternal` (the global `fetch` for a client
106
+ * without it). A non-2xx answer of the storage throws `ApiError`.
107
+ */
108
+ async upload(urlToUpload: string, content: BodyInit, mimetype: string): Promise<void> {
109
+ const headers = { 'Content-Type': mimetype }
110
+ await (this.client.requestExternal
111
+ ? this.client.requestExternal('PUT', urlToUpload, content, headers)
112
+ : requestExternal('PUT', urlToUpload, content, headers))
113
+ }
9
114
  }
@@ -23,22 +23,32 @@ export type FileStorage =
23
23
 
24
24
  export type File = {
25
25
  id: string
26
+ /** Signed URL to download the content. */
26
27
  url: string
27
28
  name: string | null
29
+ /** Name of the file in the storage (`<id>.<extension>`). */
30
+ publicFilename: string | null
28
31
  checksum: string | null
29
32
  mimetype: string
30
33
  extension: string
31
- isEncrypted: boolean
32
- iv: string | null
33
- attachedId: string | null
34
- attachedType: string | null
35
- storage: FileStorage
36
34
  data: FileData
37
35
  accountId: string
38
- serviceId: string | null
39
36
  createdAt: string
40
37
  updatedAt: string
41
- deletedAt: string | null
38
+ /** @deprecated Never answered: the file transformer leaves it out. */
39
+ isEncrypted?: boolean
40
+ /** @deprecated Never answered: the file transformer leaves it out. */
41
+ iv?: string | null
42
+ /** @deprecated Never answered: the file transformer leaves it out. */
43
+ attachedId?: string | null
44
+ /** @deprecated Never answered: the file transformer leaves it out. */
45
+ attachedType?: string | null
46
+ /** @deprecated Never answered: the file transformer leaves it out. */
47
+ storage?: FileStorage
48
+ /** @deprecated Never answered: the file transformer leaves it out. */
49
+ serviceId?: string | null
50
+ /** @deprecated Never answered: the file transformer leaves it out. */
51
+ deletedAt?: string | null
42
52
  }
43
53
 
44
54
  export type CreateFilePayload = {
@@ -56,3 +66,34 @@ export type UpdateFilePayload = {
56
66
  attachedId?: string | null
57
67
  attachedType?: string | null
58
68
  }
69
+
70
+ /** Body of `FilesApi.createToUpload`. */
71
+ export type CreateToUploadPayload = {
72
+ /** File name (commas are replaced by spaces). Required, except for an audio. */
73
+ name?: string
74
+ mimetype: string
75
+ /** What the file is attached to, e.g. `'message.file'` (default), `'campaign.file'`, `'quickreply.file'`. */
76
+ attachedType?: string
77
+ /** Connection that will send the file (used to decide the audio conversion). */
78
+ serviceId?: string
79
+ /** Audio sent as a voice message (default `true`). */
80
+ isPtt?: boolean
81
+ /** Audio sent as a document, with no conversion (default `false`). */
82
+ sendAsDocument?: boolean
83
+ /** Content of an audio that must be converted (required in that case). */
84
+ base64?: string
85
+ }
86
+
87
+ /** Result of `FilesApi.createToUpload`. */
88
+ export type CreateToUploadResult = {
89
+ /** Signed URL to send the content to (`FilesApi.upload`); absent when the audio was converted. */
90
+ urlToUpload?: string
91
+ id: string
92
+ name: string
93
+ mimetype: string
94
+ }
95
+
96
+ /** Result of `FilesApi.deleteById`. */
97
+ export type DeleteFileResult = {
98
+ success: boolean
99
+ }
@@ -1,9 +1,24 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type { Holiday, CreateHolidayPayload, UpdateHolidayPayload } from './types'
4
5
 
5
- export class HolidayApi extends BaseCrudApi<Holiday, CreateHolidayPayload, UpdateHolidayPayload> {
6
+ export class HolidayApi extends BaseCrudApi<
7
+ Holiday,
8
+ CreateHolidayPayload,
9
+ UpdateHolidayPayload,
10
+ ListQuery<Holiday>,
11
+ 'OK'
12
+ > {
6
13
  constructor(client: ApiClient) {
7
14
  super(client, '/holiday')
8
15
  }
16
+
17
+ /**
18
+ * Deletes a holiday. Resolves the text `'OK'`.
19
+ * @permissions holidays.view OR holidays.destroy
20
+ */
21
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
22
+ return super.deleteById(id, headers)
23
+ }
9
24
  }
@@ -1,13 +1,24 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type { Integration, CreateIntegrationPayload, UpdateIntegrationPayload } from './types'
4
5
 
5
6
  export class IntegrationsApi extends BaseCrudApi<
6
7
  Integration,
7
8
  CreateIntegrationPayload,
8
- UpdateIntegrationPayload
9
+ UpdateIntegrationPayload,
10
+ ListQuery<Integration>,
11
+ 'OK'
9
12
  > {
10
13
  constructor(client: ApiClient) {
11
14
  super(client, '/integrations')
12
15
  }
16
+
17
+ /**
18
+ * Deletes an integration. Resolves the text `'OK'`; an unknown id answers 500.
19
+ * @permissions integrations.view OR integrations.destroy
20
+ */
21
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
22
+ return super.deleteById(id, headers)
23
+ }
13
24
  }
@@ -1,4 +1,5 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type {
4
5
  InteractiveMessage,
@@ -9,9 +10,19 @@ import type {
9
10
  export class InteractiveMessagesApi extends BaseCrudApi<
10
11
  InteractiveMessage,
11
12
  CreateInteractiveMessagePayload,
12
- UpdateInteractiveMessagePayload
13
+ UpdateInteractiveMessagePayload,
14
+ ListQuery<InteractiveMessage>,
15
+ 'OK'
13
16
  > {
14
17
  constructor(client: ApiClient) {
15
18
  super(client, '/interactive-messages')
16
19
  }
20
+
21
+ /**
22
+ * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
23
+ * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
24
+ */
25
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
26
+ return super.deleteById(id, headers)
27
+ }
17
28
  }
@@ -1,13 +1,24 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type { KanbanBoard, CreateKanbanBoardPayload, UpdateKanbanBoardPayload } from './types'
4
5
 
5
6
  export class KanbanBoardsApi extends BaseCrudApi<
6
7
  KanbanBoard,
7
8
  CreateKanbanBoardPayload,
8
- UpdateKanbanBoardPayload
9
+ UpdateKanbanBoardPayload,
10
+ ListQuery<KanbanBoard>,
11
+ 'OK'
9
12
  > {
10
13
  constructor(client: ApiClient) {
11
14
  super(client, '/kanban-boards')
12
15
  }
16
+
17
+ /**
18
+ * Deletes a board with its columns. Resolves the text `'OK'`; an unknown id answers 500.
19
+ * @permissions kanban.boards.destroy
20
+ */
21
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
22
+ return super.deleteById(id, headers)
23
+ }
13
24
  }
@@ -1,4 +1,5 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type {
4
5
  KanbanCard,
@@ -10,12 +11,22 @@ import type {
10
11
  export class KanbanCardsApi extends BaseCrudApi<
11
12
  KanbanCard,
12
13
  CreateKanbanCardPayload,
13
- UpdateKanbanCardPayload
14
+ UpdateKanbanCardPayload,
15
+ ListQuery<KanbanCard>,
16
+ 'OK'
14
17
  > {
15
18
  constructor(client: ApiClient) {
16
19
  super(client, '/kanban-cards')
17
20
  }
18
21
 
22
+ /**
23
+ * Deletes a card. Resolves the text `'OK'`.
24
+ * @permissions kanban.cards.move
25
+ */
26
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
27
+ return super.deleteById(id, headers)
28
+ }
29
+
19
30
  /**
20
31
  * Moves a card within its column or to another column (see {@link ReorderKanbanCardPayload}).
21
32
  * Resolves to the card with its new `position` and `columnId`.
@@ -1,13 +1,25 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type { KnowledgeBase, CreateKnowledgeBasePayload, UpdateKnowledgeBasePayload } from './types'
4
5
 
5
6
  export class KnowledgeBaseApi extends BaseCrudApi<
6
7
  KnowledgeBase,
7
8
  CreateKnowledgeBasePayload,
8
- UpdateKnowledgeBasePayload
9
+ UpdateKnowledgeBasePayload,
10
+ ListQuery<KnowledgeBase>,
11
+ false
9
12
  > {
10
13
  constructor(client: ApiClient) {
11
14
  super(client, '/knowledge-base')
12
15
  }
16
+
17
+ /**
18
+ * Deletes a knowledge base. Resolves `false` even when it deleted (the backend answers nothing
19
+ * from the deletion), so do not read it as the result: check with `getById`. An unknown id
20
+ * answers 500.
21
+ */
22
+ override deleteById(id: string, headers?: Record<string, string>): Promise<false> {
23
+ return super.deleteById(id, headers)
24
+ }
13
25
  }
@@ -1,4 +1,5 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type {
4
5
  KnowledgeBaseItem,
@@ -9,9 +10,20 @@ import type {
9
10
  export class KnowledgeBaseItemApi extends BaseCrudApi<
10
11
  KnowledgeBaseItem,
11
12
  CreateKnowledgeBaseItemPayload,
12
- UpdateKnowledgeBaseItemPayload
13
+ UpdateKnowledgeBaseItemPayload,
14
+ ListQuery<KnowledgeBaseItem>,
15
+ false
13
16
  > {
14
17
  constructor(client: ApiClient) {
15
18
  super(client, '/knowledge-base-item')
16
19
  }
20
+
21
+ /**
22
+ * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when
23
+ * it deleted (the backend answers nothing from the deletion), so do not read it as the result:
24
+ * check with `getById`.
25
+ */
26
+ override deleteById(id: string, headers?: Record<string, string>): Promise<false> {
27
+ return super.deleteById(id, headers)
28
+ }
17
29
  }
@@ -153,18 +153,24 @@ describe('MessagesApi', () => {
153
153
  // ── updateById ───────────────────────────────────────────────────
154
154
 
155
155
  describe('updateById', () => {
156
- it('calls client.put with /messages/:id and body', async () => {
157
- vi.mocked(client.put).mockResolvedValue(message)
158
- const result = await api.updateById('msg-1', { text: 'Updated' })
159
- expect(client.put).toHaveBeenCalledWith('/messages/msg-1', { text: 'Updated' }, undefined)
156
+ it('calls client.patch with /messages/:id and body (the backend has no PUT)', async () => {
157
+ vi.mocked(client.patch).mockResolvedValue(message)
158
+ const body = { text: 'Updated', contactId: 'ct-1', mentionedList: ['5511999999999'] }
159
+ const result = await api.updateById('msg-1', body)
160
+ expect(client.patch).toHaveBeenCalledWith('/messages/msg-1', body, undefined)
161
+ expect(client.put).not.toHaveBeenCalled()
160
162
  expect(result).toEqual(message)
161
163
  })
162
164
 
163
165
  it('forwards custom headers', async () => {
164
- vi.mocked(client.put).mockResolvedValue(message)
166
+ vi.mocked(client.patch).mockResolvedValue(message)
165
167
  const headers = { 'If-Match': 'etag' }
166
- await api.updateById('msg-1', { text: 'x' }, headers)
167
- expect(client.put).toHaveBeenCalledWith('/messages/msg-1', { text: 'x' }, headers)
168
+ await api.updateById('msg-1', { text: 'x', contactId: 'ct-1' }, headers)
169
+ expect(client.patch).toHaveBeenCalledWith(
170
+ '/messages/msg-1',
171
+ { text: 'x', contactId: 'ct-1' },
172
+ headers,
173
+ )
168
174
  })
169
175
  })
170
176
 
@@ -23,6 +23,28 @@ export class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, Upda
23
23
  super(client, '/messages')
24
24
  }
25
25
 
26
+ /**
27
+ * Edits the text (or the file) of a message sent by the account, up to 15 minutes after it was
28
+ * sent (403 `Cannot edit message` after that). `contactId` is required (without it the route
29
+ * answers 500), and `text` or `file` (400 without both). Sent as `PATCH /messages/:id`.
30
+ * @permissions messages.update
31
+ */
32
+ override updateById(
33
+ id: string,
34
+ body: UpdateMessagePayload,
35
+ headers?: Record<string, string>,
36
+ ): Promise<Message> {
37
+ return this.client.patch<Message, UpdateMessagePayload>(`${this.basePath}/${id}`, body, headers)
38
+ }
39
+
40
+ /**
41
+ * @deprecated Not served: the backend has no DELETE /messages/:id, so this route answers 404.
42
+ * Use {@link bulkDestroy}.
43
+ */
44
+ override deleteById(id: string, headers?: Record<string, string>): Promise<Message> {
45
+ return super.deleteById(id, headers)
46
+ }
47
+
26
48
  /** Forwards one or more messages to one or more contacts (max 20 messages to 5 contacts). */
27
49
  forward(
28
50
  body: ForwardMessagesPayload,
@@ -102,8 +124,9 @@ export class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, Upda
102
124
  }
103
125
 
104
126
  /**
105
- * Triggers an AI-generated summary for the conversation associated with the given message.
106
- * Resolves to `'OK'`.
127
+ * Regenerates an existing AI summary: `id` is the id of the message of `type: 'summary'`. When
128
+ * there is no such message (or the AI limit was reached) nothing is done and it still resolves
129
+ * `'OK'`. To summarize the open ticket of a contact, use `ContactsApi.summarizeTicket`.
107
130
  */
108
131
  summarize(id: string, headers?: Record<string, string>): Promise<string> {
109
132
  return this.client.post<string>(`${this.basePath}/${id}/summarize`, undefined, headers)
@@ -122,7 +145,10 @@ export class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, Upda
122
145
  )
123
146
  }
124
147
 
125
- /** Re-downloads and syncs the file attachment for a message from the messaging service. */
148
+ /**
149
+ * Re-downloads and syncs the file attachment for a message from the messaging service. Resolves
150
+ * what the driver answers; an unknown message answers 500.
151
+ */
126
152
  syncFile(id: string, headers?: Record<string, string>): Promise<unknown> {
127
153
  return this.client.post<unknown>(`${this.basePath}/${id}/sync-file`, undefined, headers)
128
154
  }
@@ -203,7 +203,10 @@ export type UpdateMessagePayload = {
203
203
  text?: string
204
204
  file?: unknown
205
205
  fileId?: string
206
+ /** Required by the backend (500 without it), although optional here for compatibility. */
206
207
  contactId?: string
208
+ /** `idFromService` of the contacts mentioned in a group message. */
209
+ mentionedList?: string[]
207
210
  number?: string
208
211
  origin?: 'user' | 'bot'
209
212
  hsm?: unknown
@@ -1,13 +1,24 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type { Notification, CreateNotificationPayload, UpdateNotificationPayload } from './types'
4
5
 
5
6
  export class NotificationsApi extends BaseCrudApi<
6
7
  Notification,
7
8
  CreateNotificationPayload,
8
- UpdateNotificationPayload
9
+ UpdateNotificationPayload,
10
+ ListQuery<Notification>,
11
+ 'OK'
9
12
  > {
10
13
  constructor(client: ApiClient) {
11
14
  super(client, '/notifications')
12
15
  }
16
+
17
+ /**
18
+ * Deletes a notification. Resolves the text `'OK'`; an unknown id answers 500. The route checks
19
+ * no permission.
20
+ */
21
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
22
+ return super.deleteById(id, headers)
23
+ }
13
24
  }
@@ -1,13 +1,24 @@
1
1
  import type { ApiClient } from '../../core/ApiClient'
2
+ import type { ListQuery } from '../../core/types'
2
3
  import { BaseCrudApi } from '../../core/BaseCrudApi'
3
4
  import type { Organization, CreateOrganizationPayload, UpdateOrganizationPayload } from './types'
4
5
 
5
6
  export class OrganizationsApi extends BaseCrudApi<
6
7
  Organization,
7
8
  CreateOrganizationPayload,
8
- UpdateOrganizationPayload
9
+ UpdateOrganizationPayload,
10
+ ListQuery<Organization>,
11
+ 'OK'
9
12
  > {
10
13
  constructor(client: ApiClient) {
11
14
  super(client, '/organizations')
12
15
  }
16
+
17
+ /**
18
+ * Deletes an organization. Resolves the text `'OK'`.
19
+ * @permissions organizations.view OR organizations.destroy
20
+ */
21
+ override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
22
+ return super.deleteById(id, headers)
23
+ }
13
24
  }