@ikatec/digisac-api-sdk 4.9.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -12
- package/dist/apis/absence/AbsenceApi.cjs +12 -0
- package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
- package/dist/apis/absence/AbsenceApi.d.ts +9 -0
- package/dist/apis/absence/AbsenceApi.d.ts.map +1 -1
- package/dist/apis/absence/AbsenceApi.mjs +12 -0
- package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
- package/dist/apis/acceptanceTerms/AcceptanceTermsApi.cjs +8 -0
- package/dist/apis/acceptanceTerms/AcceptanceTermsApi.cjs.map +1 -1
- package/dist/apis/acceptanceTerms/AcceptanceTermsApi.d.ts +8 -1
- package/dist/apis/acceptanceTerms/AcceptanceTermsApi.d.ts.map +1 -1
- package/dist/apis/acceptanceTerms/AcceptanceTermsApi.mjs +8 -0
- package/dist/apis/acceptanceTerms/AcceptanceTermsApi.mjs.map +1 -1
- package/dist/apis/accounts/AccountsApi.cjs +5 -0
- package/dist/apis/accounts/AccountsApi.cjs.map +1 -1
- package/dist/apis/accounts/AccountsApi.d.ts +5 -0
- package/dist/apis/accounts/AccountsApi.d.ts.map +1 -1
- package/dist/apis/accounts/AccountsApi.mjs +5 -0
- package/dist/apis/accounts/AccountsApi.mjs.map +1 -1
- package/dist/apis/accounts/types.d.ts +2 -0
- package/dist/apis/accounts/types.d.ts.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.cjs +12 -0
- package/dist/apis/activityLog/ActivityLogApi.cjs.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.d.ts +8 -0
- package/dist/apis/activityLog/ActivityLogApi.d.ts.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.mjs +12 -0
- package/dist/apis/activityLog/ActivityLogApi.mjs.map +1 -1
- package/dist/apis/categories/CategoriesApi.cjs +7 -0
- package/dist/apis/categories/CategoriesApi.cjs.map +1 -1
- package/dist/apis/categories/CategoriesApi.d.ts +7 -1
- package/dist/apis/categories/CategoriesApi.d.ts.map +1 -1
- package/dist/apis/categories/CategoriesApi.mjs +7 -0
- package/dist/apis/categories/CategoriesApi.mjs.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.cjs +5 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.cjs.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts +5 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.mjs +5 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.mjs.map +1 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs +36 -0
- package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs.map +1 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts +32 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts.map +1 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs +36 -0
- package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs.map +1 -1
- package/dist/apis/contactBlockLists/types.d.ts +6 -1
- package/dist/apis/contactBlockLists/types.d.ts.map +1 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs +37 -0
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs.map +1 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts +33 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts.map +1 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs +37 -0
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs.map +1 -1
- package/dist/apis/contactBlockListsControls/types.d.ts +7 -0
- package/dist/apis/contactBlockListsControls/types.d.ts.map +1 -1
- package/dist/apis/contacts/ContactsApi.cjs +16 -3
- package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.d.ts +16 -5
- package/dist/apis/contacts/ContactsApi.d.ts.map +1 -1
- package/dist/apis/contacts/ContactsApi.mjs +16 -3
- package/dist/apis/contacts/ContactsApi.mjs.map +1 -1
- package/dist/apis/contacts/types.d.ts +6 -1
- package/dist/apis/contacts/types.d.ts.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.cjs +17 -0
- package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.d.ts +11 -0
- package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.mjs +17 -0
- package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
- package/dist/apis/customFields/CustomFieldsApi.cjs +7 -0
- package/dist/apis/customFields/CustomFieldsApi.cjs.map +1 -1
- package/dist/apis/customFields/CustomFieldsApi.d.ts +7 -1
- package/dist/apis/customFields/CustomFieldsApi.d.ts.map +1 -1
- package/dist/apis/customFields/CustomFieldsApi.mjs +7 -0
- package/dist/apis/customFields/CustomFieldsApi.mjs.map +1 -1
- package/dist/apis/departments/DepartmentsApi.cjs +21 -0
- package/dist/apis/departments/DepartmentsApi.cjs.map +1 -1
- package/dist/apis/departments/DepartmentsApi.d.ts +20 -2
- package/dist/apis/departments/DepartmentsApi.d.ts.map +1 -1
- package/dist/apis/departments/DepartmentsApi.mjs +21 -0
- package/dist/apis/departments/DepartmentsApi.mjs.map +1 -1
- package/dist/apis/departments/types.d.ts +5 -0
- package/dist/apis/departments/types.d.ts.map +1 -1
- package/dist/apis/distribution/DistributionApi.cjs +32 -0
- package/dist/apis/distribution/DistributionApi.cjs.map +1 -1
- package/dist/apis/distribution/DistributionApi.d.ts +26 -1
- package/dist/apis/distribution/DistributionApi.d.ts.map +1 -1
- package/dist/apis/distribution/DistributionApi.mjs +32 -0
- package/dist/apis/distribution/DistributionApi.mjs.map +1 -1
- package/dist/apis/distribution/types.d.ts +18 -1
- package/dist/apis/distribution/types.d.ts.map +1 -1
- package/dist/apis/files/FilesApi.cjs +49 -0
- package/dist/apis/files/FilesApi.cjs.map +1 -1
- package/dist/apis/files/FilesApi.d.ts +45 -2
- package/dist/apis/files/FilesApi.d.ts.map +1 -1
- package/dist/apis/files/FilesApi.mjs +49 -0
- package/dist/apis/files/FilesApi.mjs.map +1 -1
- package/dist/apis/files/types.d.ts +45 -7
- package/dist/apis/files/types.d.ts.map +1 -1
- package/dist/apis/holiday/HolidayApi.cjs +7 -0
- package/dist/apis/holiday/HolidayApi.cjs.map +1 -1
- package/dist/apis/holiday/HolidayApi.d.ts +7 -1
- package/dist/apis/holiday/HolidayApi.d.ts.map +1 -1
- package/dist/apis/holiday/HolidayApi.mjs +7 -0
- package/dist/apis/holiday/HolidayApi.mjs.map +1 -1
- package/dist/apis/integrations/IntegrationsApi.cjs +24 -0
- package/dist/apis/integrations/IntegrationsApi.cjs.map +1 -1
- package/dist/apis/integrations/IntegrationsApi.d.ts +21 -2
- package/dist/apis/integrations/IntegrationsApi.d.ts.map +1 -1
- package/dist/apis/integrations/IntegrationsApi.mjs +24 -0
- package/dist/apis/integrations/IntegrationsApi.mjs.map +1 -1
- package/dist/apis/integrations/types.d.ts +15 -6
- package/dist/apis/integrations/types.d.ts.map +1 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs +7 -0
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs.map +1 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts +7 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts.map +1 -1
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs +7 -0
- package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs.map +1 -1
- package/dist/apis/kanbanBoards/KanbanBoardsApi.cjs +7 -0
- package/dist/apis/kanbanBoards/KanbanBoardsApi.cjs.map +1 -1
- package/dist/apis/kanbanBoards/KanbanBoardsApi.d.ts +7 -1
- package/dist/apis/kanbanBoards/KanbanBoardsApi.d.ts.map +1 -1
- package/dist/apis/kanbanBoards/KanbanBoardsApi.mjs +7 -0
- package/dist/apis/kanbanBoards/KanbanBoardsApi.mjs.map +1 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.cjs +7 -0
- package/dist/apis/kanbanCards/KanbanCardsApi.cjs.map +1 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.d.ts +7 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.d.ts.map +1 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.mjs +7 -0
- package/dist/apis/kanbanCards/KanbanCardsApi.mjs.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +8 -0
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +8 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +8 -0
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +8 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +8 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +8 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
- package/dist/apis/messages/MessagesApi.cjs +23 -3
- package/dist/apis/messages/MessagesApi.cjs.map +1 -1
- package/dist/apis/messages/MessagesApi.d.ts +19 -3
- package/dist/apis/messages/MessagesApi.d.ts.map +1 -1
- package/dist/apis/messages/MessagesApi.mjs +23 -3
- package/dist/apis/messages/MessagesApi.mjs.map +1 -1
- package/dist/apis/messages/types.d.ts +3 -0
- package/dist/apis/messages/types.d.ts.map +1 -1
- package/dist/apis/notifications/NotificationsApi.cjs +7 -0
- package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
- package/dist/apis/notifications/NotificationsApi.d.ts +7 -1
- package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
- package/dist/apis/notifications/NotificationsApi.mjs +7 -0
- package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
- package/dist/apis/organizations/OrganizationsApi.cjs +7 -0
- package/dist/apis/organizations/OrganizationsApi.cjs.map +1 -1
- package/dist/apis/organizations/OrganizationsApi.d.ts +7 -1
- package/dist/apis/organizations/OrganizationsApi.d.ts.map +1 -1
- package/dist/apis/organizations/OrganizationsApi.mjs +7 -0
- package/dist/apis/organizations/OrganizationsApi.mjs.map +1 -1
- package/dist/apis/people/PeopleApi.cjs +7 -0
- package/dist/apis/people/PeopleApi.cjs.map +1 -1
- package/dist/apis/people/PeopleApi.d.ts +7 -1
- package/dist/apis/people/PeopleApi.d.ts.map +1 -1
- package/dist/apis/people/PeopleApi.mjs +7 -0
- package/dist/apis/people/PeopleApi.mjs.map +1 -1
- package/dist/apis/planAiHistory/PlanAiHistoryApi.cjs +16 -0
- package/dist/apis/planAiHistory/PlanAiHistoryApi.cjs.map +1 -1
- package/dist/apis/planAiHistory/PlanAiHistoryApi.d.ts +10 -0
- package/dist/apis/planAiHistory/PlanAiHistoryApi.d.ts.map +1 -1
- package/dist/apis/planAiHistory/PlanAiHistoryApi.mjs +16 -0
- package/dist/apis/planAiHistory/PlanAiHistoryApi.mjs.map +1 -1
- package/dist/apis/roles/RolesApi.cjs +7 -0
- package/dist/apis/roles/RolesApi.cjs.map +1 -1
- package/dist/apis/roles/RolesApi.d.ts +6 -1
- package/dist/apis/roles/RolesApi.d.ts.map +1 -1
- package/dist/apis/roles/RolesApi.mjs +7 -0
- package/dist/apis/roles/RolesApi.mjs.map +1 -1
- package/dist/apis/services/ServicesApi.cjs +68 -0
- package/dist/apis/services/ServicesApi.cjs.map +1 -1
- package/dist/apis/services/ServicesApi.d.ts +53 -1
- package/dist/apis/services/ServicesApi.d.ts.map +1 -1
- package/dist/apis/services/ServicesApi.mjs +68 -0
- package/dist/apis/services/ServicesApi.mjs.map +1 -1
- package/dist/apis/services/types.d.ts +15 -0
- package/dist/apis/services/types.d.ts.map +1 -1
- package/dist/apis/stickers/StickersApi.cjs +20 -0
- package/dist/apis/stickers/StickersApi.cjs.map +1 -1
- package/dist/apis/stickers/StickersApi.d.ts +15 -0
- package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
- package/dist/apis/stickers/StickersApi.mjs +20 -0
- package/dist/apis/stickers/StickersApi.mjs.map +1 -1
- package/dist/apis/tags/TagsApi.cjs +7 -0
- package/dist/apis/tags/TagsApi.cjs.map +1 -1
- package/dist/apis/tags/TagsApi.d.ts +7 -1
- package/dist/apis/tags/TagsApi.d.ts.map +1 -1
- package/dist/apis/tags/TagsApi.mjs +7 -0
- package/dist/apis/tags/TagsApi.mjs.map +1 -1
- package/dist/apis/timetable/TimetableApi.cjs +7 -0
- package/dist/apis/timetable/TimetableApi.cjs.map +1 -1
- package/dist/apis/timetable/TimetableApi.d.ts +7 -1
- package/dist/apis/timetable/TimetableApi.d.ts.map +1 -1
- package/dist/apis/timetable/TimetableApi.mjs +7 -0
- package/dist/apis/timetable/TimetableApi.mjs.map +1 -1
- package/dist/apis/users/UsersApi.cjs +8 -0
- package/dist/apis/users/UsersApi.cjs.map +1 -1
- package/dist/apis/users/UsersApi.d.ts +8 -1
- package/dist/apis/users/UsersApi.d.ts.map +1 -1
- package/dist/apis/users/UsersApi.mjs +8 -0
- package/dist/apis/users/UsersApi.mjs.map +1 -1
- package/dist/apis/users/types.d.ts +15 -0
- package/dist/apis/users/types.d.ts.map +1 -1
- package/dist/apis/webhooks/WebhooksApi.cjs +7 -0
- package/dist/apis/webhooks/WebhooksApi.cjs.map +1 -1
- package/dist/apis/webhooks/WebhooksApi.d.ts +7 -1
- package/dist/apis/webhooks/WebhooksApi.d.ts.map +1 -1
- package/dist/apis/webhooks/WebhooksApi.mjs +7 -0
- package/dist/apis/webhooks/WebhooksApi.mjs.map +1 -1
- package/dist/core/ApiClient.d.ts +14 -0
- package/dist/core/ApiClient.d.ts.map +1 -1
- package/dist/core/ArchivableCrudApi.cjs.map +1 -1
- package/dist/core/ArchivableCrudApi.d.ts +1 -1
- package/dist/core/ArchivableCrudApi.d.ts.map +1 -1
- package/dist/core/ArchivableCrudApi.mjs.map +1 -1
- package/dist/core/BaseApiClient.cjs +24 -3
- package/dist/core/BaseApiClient.cjs.map +1 -1
- package/dist/core/BaseApiClient.d.ts +14 -0
- package/dist/core/BaseApiClient.d.ts.map +1 -1
- package/dist/core/BaseApiClient.mjs +24 -3
- package/dist/core/BaseApiClient.mjs.map +1 -1
- package/dist/core/BaseCrudApi.cjs +3 -1
- package/dist/core/BaseCrudApi.cjs.map +1 -1
- package/dist/core/BaseCrudApi.d.ts +6 -4
- package/dist/core/BaseCrudApi.d.ts.map +1 -1
- package/dist/core/BaseCrudApi.mjs +3 -1
- package/dist/core/BaseCrudApi.mjs.map +1 -1
- package/dist/core/requestExternal.cjs +33 -0
- package/dist/core/requestExternal.cjs.map +1 -0
- package/dist/core/requestExternal.d.ts +9 -0
- package/dist/core/requestExternal.d.ts.map +1 -0
- package/dist/core/requestExternal.mjs +32 -0
- package/dist/core/requestExternal.mjs.map +1 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/absence/AbsenceApi.ts +19 -0
- package/src/apis/acceptanceTerms/AcceptanceTermsApi.ts +13 -1
- package/src/apis/accounts/AccountsApi.ts +5 -0
- package/src/apis/accounts/types.ts +2 -0
- package/src/apis/activityLog/ActivityLogApi.ts +18 -0
- package/src/apis/categories/CategoriesApi.ts +12 -1
- package/src/apis/clientFeedback/ClientFeedbackApi.ts +5 -1
- package/src/apis/contactBlockLists/ContactBlockListsApi.test.ts +57 -0
- package/src/apis/contactBlockLists/ContactBlockListsApi.ts +57 -1
- package/src/apis/contactBlockLists/types.ts +6 -1
- package/src/apis/contactBlockListsControls/ContactBlockListsControlsApi.test.ts +48 -0
- package/src/apis/contactBlockListsControls/ContactBlockListsControlsApi.ts +59 -1
- package/src/apis/contactBlockListsControls/types.ts +7 -0
- package/src/apis/contacts/ContactsApi.test.ts +20 -4
- package/src/apis/contacts/ContactsApi.ts +24 -5
- package/src/apis/contacts/types.ts +7 -1
- package/src/apis/creditMovements/CreditMovementsApi.ts +27 -0
- package/src/apis/customFields/CustomFieldsApi.ts +12 -1
- package/src/apis/departments/DepartmentsApi.test.ts +88 -0
- package/src/apis/departments/DepartmentsApi.ts +41 -2
- package/src/apis/departments/types.ts +6 -0
- package/src/apis/distribution/DistributionApi.test.ts +65 -0
- package/src/apis/distribution/DistributionApi.ts +50 -1
- package/src/apis/distribution/types.ts +17 -1
- package/src/apis/files/FilesApi.test.ts +122 -0
- package/src/apis/files/FilesApi.ts +107 -2
- package/src/apis/files/types.ts +48 -7
- package/src/apis/holiday/HolidayApi.ts +16 -1
- package/src/apis/integrations/IntegrationsApi.test.ts +42 -0
- package/src/apis/integrations/IntegrationsApi.ts +46 -2
- package/src/apis/integrations/types.ts +25 -6
- package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +12 -1
- package/src/apis/kanbanBoards/KanbanBoardsApi.ts +12 -1
- package/src/apis/kanbanCards/KanbanCardsApi.ts +12 -1
- package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +13 -1
- package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +13 -1
- package/src/apis/messages/MessagesApi.test.ts +13 -7
- package/src/apis/messages/MessagesApi.ts +29 -3
- package/src/apis/messages/types.ts +3 -0
- package/src/apis/notifications/NotificationsApi.ts +12 -1
- package/src/apis/organizations/OrganizationsApi.ts +12 -1
- package/src/apis/payloads.test-d.ts +172 -0
- package/src/apis/people/PeopleApi.ts +16 -1
- package/src/apis/planAiHistory/PlanAiHistoryApi.ts +26 -0
- package/src/apis/roles/RolesApi.ts +10 -1
- package/src/apis/services/ServicesApi.test.ts +45 -0
- package/src/apis/services/ServicesApi.ts +91 -1
- package/src/apis/services/types.ts +16 -0
- package/src/apis/stickers/StickersApi.ts +32 -0
- package/src/apis/tags/TagsApi.ts +16 -1
- package/src/apis/timetable/TimetableApi.ts +12 -1
- package/src/apis/users/UsersApi.ts +17 -1
- package/src/apis/users/types.ts +11 -0
- package/src/apis/webhooks/WebhooksApi.ts +16 -1
- package/src/core/ApiClient.ts +24 -0
- package/src/core/ArchivableCrudApi.ts +2 -1
- package/src/core/BaseApiClient.test.ts +98 -0
- package/src/core/BaseApiClient.ts +49 -4
- package/src/core/BaseCrudApi.test-d.ts +11 -1
- package/src/core/BaseCrudApi.ts +15 -6
- package/src/core/requestExternal.ts +43 -0
- package/src/core/types.ts +4 -2
|
@@ -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<
|
|
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
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { IntegrationsApi } from './IntegrationsApi'
|
|
3
|
+
import type { ApiClient } from '../../core/ApiClient'
|
|
4
|
+
|
|
5
|
+
// ── Mock client factory ──────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
function createMockClient(): ApiClient {
|
|
8
|
+
return {
|
|
9
|
+
setAccessToken: vi.fn().mockReturnThis(),
|
|
10
|
+
request: vi.fn(),
|
|
11
|
+
get: vi.fn(),
|
|
12
|
+
post: vi.fn(),
|
|
13
|
+
put: vi.fn(),
|
|
14
|
+
patch: vi.fn(),
|
|
15
|
+
delete: vi.fn(),
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ── Tests ────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
describe('IntegrationsApi', () => {
|
|
22
|
+
let client: ReturnType<typeof createMockClient>
|
|
23
|
+
let api: IntegrationsApi
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
client = createMockClient()
|
|
27
|
+
api = new IntegrationsApi(client)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('create posts to /integrations and resolves the empty object the route answers', async () => {
|
|
31
|
+
vi.mocked(client.post).mockResolvedValue({})
|
|
32
|
+
const body = { type: 'menu_button', url: 'https://example.com', icon: '', text: 'QA' }
|
|
33
|
+
await expect(api.create(body)).resolves.toEqual({})
|
|
34
|
+
expect(client.post).toHaveBeenCalledWith('/integrations', body, undefined)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('updateById puts to /integrations/:id and resolves the empty object', async () => {
|
|
38
|
+
vi.mocked(client.put).mockResolvedValue({})
|
|
39
|
+
await expect(api.updateById('int-1', { text: 'QA 2' })).resolves.toEqual({})
|
|
40
|
+
expect(client.put).toHaveBeenCalledWith('/integrations/int-1', { text: 'QA 2' }, undefined)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
@@ -1,13 +1,57 @@
|
|
|
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 {
|
|
4
|
+
import type {
|
|
5
|
+
Integration,
|
|
6
|
+
CreateIntegrationPayload,
|
|
7
|
+
UpdateIntegrationPayload,
|
|
8
|
+
IntegrationWriteResponse,
|
|
9
|
+
} from './types'
|
|
4
10
|
|
|
11
|
+
/** Integrations of the account (buttons and events of the UI). `getById` answers `null` for an unknown id. */
|
|
5
12
|
export class IntegrationsApi extends BaseCrudApi<
|
|
6
13
|
Integration,
|
|
7
14
|
CreateIntegrationPayload,
|
|
8
|
-
UpdateIntegrationPayload
|
|
15
|
+
UpdateIntegrationPayload,
|
|
16
|
+
ListQuery<Integration>,
|
|
17
|
+
'OK',
|
|
18
|
+
IntegrationWriteResponse,
|
|
19
|
+
IntegrationWriteResponse
|
|
9
20
|
> {
|
|
10
21
|
constructor(client: ApiClient) {
|
|
11
22
|
super(client, '/integrations')
|
|
12
23
|
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates an integration. Resolves `{}` — also when the type is unique (`event_ticket_transfer`,
|
|
27
|
+
* `event_ticket_closed`), already exists in the account and nothing is created. Find the integration with
|
|
28
|
+
* `getMany` (e.g. by `text`).
|
|
29
|
+
* @permissions integrations.create
|
|
30
|
+
*/
|
|
31
|
+
override create(
|
|
32
|
+
body: CreateIntegrationPayload,
|
|
33
|
+
headers?: Record<string, string>,
|
|
34
|
+
): Promise<IntegrationWriteResponse> {
|
|
35
|
+
return super.create(body, headers)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Updates an integration. Resolves `{}`; read it again with `getById`. An unknown id answers 500.
|
|
40
|
+
* @permissions integrations.view OR integrations.update
|
|
41
|
+
*/
|
|
42
|
+
override updateById(
|
|
43
|
+
id: string,
|
|
44
|
+
body: UpdateIntegrationPayload,
|
|
45
|
+
headers?: Record<string, string>,
|
|
46
|
+
): Promise<IntegrationWriteResponse> {
|
|
47
|
+
return super.updateById(id, body, headers)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Deletes an integration. Resolves the text `'OK'`; an unknown id answers 500.
|
|
52
|
+
* @permissions integrations.view OR integrations.destroy
|
|
53
|
+
*/
|
|
54
|
+
override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {
|
|
55
|
+
return super.deleteById(id, headers)
|
|
56
|
+
}
|
|
13
57
|
}
|
|
@@ -1,27 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types the UI shows: buttons (`menu_button` in the header, `context_menu_button_*` in the contact and
|
|
3
|
+
* message menus) and events that open the integration when a ticket is transferred or closed (unique per
|
|
4
|
+
* account). The backend accepts any string.
|
|
5
|
+
*/
|
|
6
|
+
export type IntegrationType =
|
|
7
|
+
| 'menu_button'
|
|
8
|
+
| 'context_menu_button_contact_modal'
|
|
9
|
+
| 'context_menu_button_contact_side_list'
|
|
10
|
+
| 'context_menu_button_message'
|
|
11
|
+
| 'event_ticket_transfer'
|
|
12
|
+
| 'event_ticket_closed'
|
|
13
|
+
| (string & {})
|
|
14
|
+
|
|
15
|
+
export type IntegrationSize = 'sm' | 'md' | 'lg' | (string & {})
|
|
16
|
+
|
|
1
17
|
export type Integration = {
|
|
2
18
|
id: string
|
|
3
|
-
type:
|
|
19
|
+
type: IntegrationType
|
|
4
20
|
url: string | null
|
|
5
21
|
icon: string | null
|
|
6
22
|
text: string | null
|
|
7
|
-
size:
|
|
23
|
+
size: IntegrationSize | null
|
|
8
24
|
accountId: string
|
|
9
25
|
createdAt: string
|
|
10
26
|
updatedAt: string
|
|
11
27
|
}
|
|
12
28
|
|
|
29
|
+
/** What `create` and `updateById` resolve to: an empty object. */
|
|
30
|
+
export type IntegrationWriteResponse = Record<string, never>
|
|
31
|
+
|
|
13
32
|
export type CreateIntegrationPayload = {
|
|
14
|
-
type:
|
|
33
|
+
type: IntegrationType
|
|
15
34
|
url?: string
|
|
16
35
|
icon?: string
|
|
17
36
|
text?: string
|
|
18
|
-
size?:
|
|
37
|
+
size?: IntegrationSize
|
|
19
38
|
}
|
|
20
39
|
|
|
21
40
|
export type UpdateIntegrationPayload = {
|
|
22
|
-
type?:
|
|
41
|
+
type?: IntegrationType
|
|
23
42
|
url?: string | null
|
|
24
43
|
icon?: string | null
|
|
25
44
|
text?: string | null
|
|
26
|
-
size?:
|
|
45
|
+
size?: IntegrationSize | null
|
|
27
46
|
}
|
|
@@ -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.
|
|
157
|
-
vi.mocked(client.
|
|
158
|
-
const
|
|
159
|
-
|
|
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.
|
|
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.
|
|
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
|
-
*
|
|
106
|
-
*
|
|
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
|
-
/**
|
|
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
|
}
|
|
@@ -46,6 +46,33 @@ import type { Ticket, TicketTransfer, TicketsCount, TicketsCounts } from './tick
|
|
|
46
46
|
import { TimetableApi } from './timetable/TimetableApi'
|
|
47
47
|
import { UsersApi } from './users/UsersApi'
|
|
48
48
|
|
|
49
|
+
import { AcceptanceTermsApi } from './acceptanceTerms/AcceptanceTermsApi'
|
|
50
|
+
import { CategoriesApi } from './categories/CategoriesApi'
|
|
51
|
+
import { ContactBlockListsApi } from './contactBlockLists/ContactBlockListsApi'
|
|
52
|
+
import { ContactBlockListsControlsApi } from './contactBlockListsControls/ContactBlockListsControlsApi'
|
|
53
|
+
import type { SummarizeTicketResult } from './contacts/types'
|
|
54
|
+
import { CustomFieldsApi } from './customFields/CustomFieldsApi'
|
|
55
|
+
import { DepartmentsApi } from './departments/DepartmentsApi'
|
|
56
|
+
import type { Department } from './departments/types'
|
|
57
|
+
import type { Distribution } from './distribution/types'
|
|
58
|
+
import type { ContactBlockList } from './contactBlockLists/types'
|
|
59
|
+
import { DistributionApi } from './distribution/DistributionApi'
|
|
60
|
+
import { FilesApi } from './files/FilesApi'
|
|
61
|
+
import type { CreateToUploadResult, DeleteFileResult, File } from './files/types'
|
|
62
|
+
import { HolidayApi } from './holiday/HolidayApi'
|
|
63
|
+
import { IntegrationsApi } from './integrations/IntegrationsApi'
|
|
64
|
+
import { KanbanBoardsApi } from './kanbanBoards/KanbanBoardsApi'
|
|
65
|
+
import { KanbanCardsApi } from './kanbanCards/KanbanCardsApi'
|
|
66
|
+
import { KnowledgeBaseApi } from './knowledgeBase/KnowledgeBaseApi'
|
|
67
|
+
import { KnowledgeBaseItemApi } from './knowledgeBaseItem/KnowledgeBaseItemApi'
|
|
68
|
+
import { MessagesApi } from './messages/MessagesApi'
|
|
69
|
+
import { NotificationsApi } from './notifications/NotificationsApi'
|
|
70
|
+
import { OrganizationsApi } from './organizations/OrganizationsApi'
|
|
71
|
+
import { PeopleApi } from './people/PeopleApi'
|
|
72
|
+
import { ServicesApi } from './services/ServicesApi'
|
|
73
|
+
import type { UpdateUserPayload } from './users/types'
|
|
74
|
+
import { WebhooksApi } from './webhooks/WebhooksApi'
|
|
75
|
+
|
|
49
76
|
declare const client: ApiClient
|
|
50
77
|
|
|
51
78
|
// ── roles: the backend drops `permissionIds` in silence ─────────────
|
|
@@ -497,3 +524,148 @@ expectType<number | string | undefined>(listed.config.minInterval)
|
|
|
497
524
|
expectType<CampaignMessage[] | undefined>(listed.messages)
|
|
498
525
|
declare const campaignContact: CampaignContact
|
|
499
526
|
expectType<string | null>(campaignContact.contactNumber)
|
|
527
|
+
|
|
528
|
+
// ── deleteById: what each route really answers ───────────────────────
|
|
529
|
+
|
|
530
|
+
expectType<Promise<'OK'>>(new DepartmentsApi(client).deleteById('d-1'))
|
|
531
|
+
expectType<Promise<'OK'>>(new UsersApi(client).deleteById('u-1'))
|
|
532
|
+
expectType<Promise<'OK'>>(new TagsApi(client).deleteById('t-1'))
|
|
533
|
+
expectType<Promise<'OK'>>(new KanbanBoardsApi(client).deleteById('b-1'))
|
|
534
|
+
expectType<Promise<'OK'>>(new KanbanCardsApi(client).deleteById('c-1'))
|
|
535
|
+
expectType<Promise<'OK'>>(new WebhooksApi(client).deleteById('w-1'))
|
|
536
|
+
expectType<Promise<'OK'>>(new CategoriesApi(client).deleteById('c-1'))
|
|
537
|
+
expectType<Promise<'OK'>>(new IntegrationsApi(client).deleteById('i-1'))
|
|
538
|
+
expectType<Promise<'OK'>>(new InteractiveMessagesApi(client).deleteById('i-1'))
|
|
539
|
+
expectType<Promise<'OK'>>(new NotificationsApi(client).deleteById('n-1'))
|
|
540
|
+
expectType<Promise<'OK'>>(new CustomFieldsApi(client).deleteById('f-1'))
|
|
541
|
+
expectType<Promise<'OK'>>(new HolidayApi(client).deleteById('h-1'))
|
|
542
|
+
expectType<Promise<'OK'>>(new PeopleApi(client).deleteById('p-1'))
|
|
543
|
+
expectType<Promise<'OK'>>(new OrganizationsApi(client).deleteById('o-1'))
|
|
544
|
+
expectType<Promise<'OK'>>(new TimetableApi(client).deleteById('t-1'))
|
|
545
|
+
expectType<Promise<'OK'>>(new ContactBlockListsApi(client).deleteById('l-1'))
|
|
546
|
+
expectType<Promise<'OK'>>(new ContactBlockListsControlsApi(client).deleteById('c-1'))
|
|
547
|
+
expectType<Promise<boolean>>(new RolesApi(client).deleteById('r-1'))
|
|
548
|
+
expectType<Promise<void>>(new AcceptanceTermsApi(client).deleteById('t-1'))
|
|
549
|
+
expectType<Promise<void>>(new DistributionApi(client).deleteById('d-1'))
|
|
550
|
+
|
|
551
|
+
// ── create/updateById: what each route really answers (QARC-1008) ─────
|
|
552
|
+
|
|
553
|
+
expectType<Promise<Distribution | undefined>>(
|
|
554
|
+
new DistributionApi(client).create({
|
|
555
|
+
name: 'd',
|
|
556
|
+
maxNum: 1,
|
|
557
|
+
redistributeAll: false,
|
|
558
|
+
departments: [{ id: 'dep-1' }],
|
|
559
|
+
}),
|
|
560
|
+
)
|
|
561
|
+
expectType<Promise<Distribution | Department[]>>(
|
|
562
|
+
new DistributionApi(client).updateById('d-1', {
|
|
563
|
+
name: 'd',
|
|
564
|
+
roles: [{ id: 'r-1' }],
|
|
565
|
+
departments: [],
|
|
566
|
+
}),
|
|
567
|
+
)
|
|
568
|
+
expectType<Promise<Record<string, never>>>(
|
|
569
|
+
new IntegrationsApi(client).create({ type: 'menu_button', text: 'x' }),
|
|
570
|
+
)
|
|
571
|
+
expectType<Promise<Record<string, never>>>(
|
|
572
|
+
new IntegrationsApi(client).updateById('i-1', { text: 'x' }),
|
|
573
|
+
)
|
|
574
|
+
expectType<Promise<void>>(
|
|
575
|
+
new ContactBlockListsControlsApi(client).create({
|
|
576
|
+
reason: 'r',
|
|
577
|
+
servicesIds: ['s-1'],
|
|
578
|
+
contactBlockListsIds: ['l-1'],
|
|
579
|
+
action: 'block',
|
|
580
|
+
revertExceptions: false,
|
|
581
|
+
}),
|
|
582
|
+
)
|
|
583
|
+
expectType<Promise<{ count: number }>>(
|
|
584
|
+
new ContactBlockListsApi(client).count({ where: { name: 'x' } }),
|
|
585
|
+
)
|
|
586
|
+
expectType<Promise<{ count: number }>>(new ContactBlockListsControlsApi(client).count())
|
|
587
|
+
expectType<Promise<Paginated<ContactBlockList>>>(
|
|
588
|
+
new ContactBlockListsApi(client).getMany({ include: ['importFile'] }),
|
|
589
|
+
)
|
|
590
|
+
expectError(
|
|
591
|
+
new DistributionApi(client).create({
|
|
592
|
+
name: 'd',
|
|
593
|
+
maxNum: 1,
|
|
594
|
+
redistributeAll: false,
|
|
595
|
+
departments: ['dep-1'],
|
|
596
|
+
}),
|
|
597
|
+
)
|
|
598
|
+
expectError(
|
|
599
|
+
new ContactBlockListsControlsApi(client).create({
|
|
600
|
+
reason: 'r',
|
|
601
|
+
servicesIds: [],
|
|
602
|
+
contactBlockListsIds: [],
|
|
603
|
+
action: 'remove',
|
|
604
|
+
}),
|
|
605
|
+
)
|
|
606
|
+
expectType<Promise<false>>(new KnowledgeBaseApi(client).deleteById('k-1'))
|
|
607
|
+
expectType<Promise<false>>(new KnowledgeBaseItemApi(client).deleteById('k-1'))
|
|
608
|
+
expectType<Promise<DeleteFileResult>>(new FilesApi(client).deleteById('f-1'))
|
|
609
|
+
|
|
610
|
+
// ── services: archive through POST /:id/archive, with the type ───────
|
|
611
|
+
|
|
612
|
+
const services = new ServicesApi(client)
|
|
613
|
+
expectType<Promise<Record<string, never>>>(
|
|
614
|
+
services.archiveWithValidation('s-1', { archive: true, type: 'sms-wavy' }),
|
|
615
|
+
)
|
|
616
|
+
expectError(services.archiveWithValidation('s-1', { archive: true }))
|
|
617
|
+
expectType<Promise<'OK'>>(services.takeover('s-1'))
|
|
618
|
+
expectType<Promise<'OK'>>(services.logout('s-1'))
|
|
619
|
+
expectType<Promise<'OK'>>(services.shutdown('s-1'))
|
|
620
|
+
expectType<Promise<'OK'>>(services.start('s-1'))
|
|
621
|
+
expectType<Promise<'OK'>>(services.restart('s-1'))
|
|
622
|
+
expectAssignable<UpdateServicePayload>({ type: 'whatsapp', name: 'x', archivedAt: null })
|
|
623
|
+
|
|
624
|
+
// ── contacts, departments, messages, users ──────────────────────────
|
|
625
|
+
|
|
626
|
+
const contactsApi = new ContactsApi(client)
|
|
627
|
+
expectType<Promise<SummarizeTicketResult>>(contactsApi.summarizeTicket('c-1'))
|
|
628
|
+
expectType<Promise<string>>(contactsApi.exportTemplate({ serviceType: 'whatsapp' }))
|
|
629
|
+
expectType<Promise<Department>>(
|
|
630
|
+
new DepartmentsApi(client).archiveWithValidation('d-1', { archive: true }),
|
|
631
|
+
)
|
|
632
|
+
expectError(new DepartmentsApi(client).archiveWithValidation('d-1', {}))
|
|
633
|
+
new MessagesApi(client).updateById('m-1', { text: 'x', contactId: 'c-1', mentionedList: ['5511'] })
|
|
634
|
+
expectAssignable<UpdateUserPayload>({ restrictedServices: [{ value: 's-1' }], password: 'x' })
|
|
635
|
+
expectNotAssignable<UpdateUserPayload>({ restrictedServices: ['s-1'] })
|
|
636
|
+
|
|
637
|
+
// ── files: upload through a signed URL ──────────────────────────────
|
|
638
|
+
|
|
639
|
+
const files = new FilesApi(client)
|
|
640
|
+
expectType<Promise<CreateToUploadResult>>(
|
|
641
|
+
files.createToUpload({ name: 'a.txt', mimetype: 'text/plain' }),
|
|
642
|
+
)
|
|
643
|
+
expectError(files.createToUpload({ name: 'a.txt' }))
|
|
644
|
+
expectType<Promise<void>>(files.upload('https://storage/x', 'content', 'text/plain'))
|
|
645
|
+
expectAssignable<File>({
|
|
646
|
+
id: 'f-1',
|
|
647
|
+
url: 'https://x',
|
|
648
|
+
name: 'a.txt',
|
|
649
|
+
publicFilename: 'f-1.txt',
|
|
650
|
+
checksum: null,
|
|
651
|
+
mimetype: 'text/plain',
|
|
652
|
+
extension: 'txt',
|
|
653
|
+
data: {},
|
|
654
|
+
accountId: 'a-1',
|
|
655
|
+
createdAt: '2026-01-01T00:00:00Z',
|
|
656
|
+
updatedAt: '2026-01-01T00:00:00Z',
|
|
657
|
+
})
|
|
658
|
+
|
|
659
|
+
// ── a custom ApiClient without requestRaw is still an ApiClient ──────
|
|
660
|
+
|
|
661
|
+
expectAssignable<ApiClient>({
|
|
662
|
+
setAccessToken() {
|
|
663
|
+
return this
|
|
664
|
+
},
|
|
665
|
+
request: async <T>() => undefined as T,
|
|
666
|
+
get: async <T>() => undefined as T,
|
|
667
|
+
post: async <T>() => undefined as T,
|
|
668
|
+
put: async <T>() => undefined as T,
|
|
669
|
+
patch: async <T>() => undefined as T,
|
|
670
|
+
delete: async <T>() => undefined as T,
|
|
671
|
+
})
|