@ikatec/digisac-api-sdk 4.8.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.
- 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 +8 -0
- package/dist/apis/contactBlockLists/ContactBlockListsApi.cjs.map +1 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts +8 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.d.ts.map +1 -1
- package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs +8 -0
- package/dist/apis/contactBlockLists/ContactBlockListsApi.mjs.map +1 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs +7 -0
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.cjs.map +1 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts +7 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.d.ts.map +1 -1
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs +7 -0
- package/dist/apis/contactBlockListsControls/ContactBlockListsControlsApi.mjs.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 +7 -0
- package/dist/apis/distribution/DistributionApi.cjs.map +1 -1
- package/dist/apis/distribution/DistributionApi.d.ts +7 -1
- package/dist/apis/distribution/DistributionApi.d.ts.map +1 -1
- package/dist/apis/distribution/DistributionApi.mjs +7 -0
- package/dist/apis/distribution/DistributionApi.mjs.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 +7 -0
- package/dist/apis/integrations/IntegrationsApi.cjs.map +1 -1
- package/dist/apis/integrations/IntegrationsApi.d.ts +7 -1
- package/dist/apis/integrations/IntegrationsApi.d.ts.map +1 -1
- package/dist/apis/integrations/IntegrationsApi.mjs +7 -0
- package/dist/apis/integrations/IntegrationsApi.mjs.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/interactiveMessages/types.d.ts +61 -3
- package/dist/apis/interactiveMessages/types.d.ts.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 +68 -1
- 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/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/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.ts +13 -1
- package/src/apis/contactBlockListsControls/ContactBlockListsControlsApi.ts +12 -1
- 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.ts +12 -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.ts +12 -1
- package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +12 -1
- package/src/apis/interactiveMessages/types.ts +67 -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 +275 -0
- package/src/apis/payloads.test.ts +41 -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 +63 -1
- 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/requestExternal.ts +43 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsApi.mjs","names":[],"sources":["../../../src/apis/tags/TagsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ContactsSelection } from '../contacts/types'\nimport type {\n AttachTagsToDepartmentsPayload,\n CreateTagPayload,\n Tag,\n TagContactsLinkResult,\n UpdateTagPayload,\n} from './types'\n\nexport class TagsApi extends BaseCrudApi
|
|
1
|
+
{"version":3,"file":"TagsApi.mjs","names":[],"sources":["../../../src/apis/tags/TagsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ContactsSelection } from '../contacts/types'\nimport type {\n AttachTagsToDepartmentsPayload,\n CreateTagPayload,\n Tag,\n TagContactsLinkResult,\n UpdateTagPayload,\n} from './types'\n\nexport class TagsApi extends BaseCrudApi<\n Tag,\n CreateTagPayload,\n UpdateTagPayload,\n ListQuery<Tag>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/tags')\n }\n\n /**\n * Deletes a tag. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions tags.view OR tags.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Adds the tag to every contact of the account that matches the selection. Resolves to `'OK'`,\n * or `false` when every contact already had the tag.\n * @permissions tags.view\n */\n attachContacts(\n id: string,\n body: ContactsSelection,\n headers?: Record<string, string>,\n ): Promise<TagContactsLinkResult> {\n return this.client.post<TagContactsLinkResult, ContactsSelection>(\n `${this.basePath}/${id}/contacts`,\n body,\n headers,\n )\n }\n\n /**\n * Removes the tag from every contact of the account that matches the selection. Resolves to\n * `'OK'`, or `false` when no contact had the tag.\n * @permissions tags.view OR tags.destroy\n */\n detachContacts(\n id: string,\n body: ContactsSelection,\n headers?: Record<string, string>,\n ): Promise<TagContactsLinkResult> {\n return this.client.request<TagContactsLinkResult, ContactsSelection>(\n 'DELETE',\n `${this.basePath}/${id}/contacts`,\n body,\n headers,\n )\n }\n\n /**\n * Links several tags to the given departments. Resolves to `'OK'`. A tag without departments\n * is already available to all of them and is left unchanged.\n * @permissions tags.view\n */\n attachManyToDepartments(\n body: AttachTagsToDepartmentsPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, AttachTagsToDepartmentsPayload>(\n `${this.basePath}/attach-many-departments`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;AAYA,IAAa,UAAb,cAA6B,YAM3B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,QAAQ;;;;;;CAOxB,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,eACE,IACA,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,YACvB,MACA,QACD;;;;;;;CAQH,eACE,IACA,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,GAAG,GAAG,YACvB,MACA,QACD;;;;;;;CAQH,wBACE,MACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,2BACjB,MACA,QACD"}
|
|
@@ -6,6 +6,13 @@ var TimetableApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
6
6
|
constructor(client) {
|
|
7
7
|
super(client, "/timetable");
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Deletes a timetable. Resolves the text `'OK'`.
|
|
11
|
+
* @permissions timetables.view OR timetables.destroy
|
|
12
|
+
*/
|
|
13
|
+
deleteById(id, headers) {
|
|
14
|
+
return super.deleteById(id, headers);
|
|
15
|
+
}
|
|
9
16
|
};
|
|
10
17
|
|
|
11
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimetableApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/timetable/TimetableApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Timetable, CreateTimetablePayload, UpdateTimetablePayload } from './types'\n\nexport class TimetableApi extends BaseCrudApi<\n Timetable,\n CreateTimetablePayload,\n UpdateTimetablePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/timetable')\n }\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"TimetableApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/timetable/TimetableApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Timetable, CreateTimetablePayload, UpdateTimetablePayload } from './types'\n\nexport class TimetableApi extends BaseCrudApi<\n Timetable,\n CreateTimetablePayload,\n UpdateTimetablePayload,\n ListQuery<Timetable>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/timetable')\n }\n\n /**\n * Deletes a timetable. Resolves the text `'OK'`.\n * @permissions timetables.view OR timetables.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AAKA,IAAa,eAAb,cAAkCA,qCAMhC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;CAO7B,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -1,7 +1,13 @@
|
|
|
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 { Timetable, CreateTimetablePayload, UpdateTimetablePayload } from './types';
|
|
4
|
-
export declare class TimetableApi extends BaseCrudApi<Timetable, CreateTimetablePayload, UpdateTimetablePayload> {
|
|
5
|
+
export declare class TimetableApi extends BaseCrudApi<Timetable, CreateTimetablePayload, UpdateTimetablePayload, ListQuery<Timetable>, 'OK'> {
|
|
5
6
|
constructor(client: ApiClient);
|
|
7
|
+
/**
|
|
8
|
+
* Deletes a timetable. Resolves the text `'OK'`.
|
|
9
|
+
* @permissions timetables.view OR timetables.destroy
|
|
10
|
+
*/
|
|
11
|
+
deleteById(id: string, headers?: Record<string, string>): Promise<'OK'>;
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=TimetableApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimetableApi.d.ts","sourceRoot":"","sources":["../../../src/apis/timetable/TimetableApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAExF,qBAAa,YAAa,SAAQ,WAAW,CAC3C,SAAS,EACT,sBAAsB,EACtB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"TimetableApi.d.ts","sourceRoot":"","sources":["../../../src/apis/timetable/TimetableApi.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,EAAE,SAAS,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAExF,qBAAa,YAAa,SAAQ,WAAW,CAC3C,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,SAAS,CAAC,SAAS,CAAC,EACpB,IAAI,CACL;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjF"}
|
|
@@ -5,6 +5,13 @@ var TimetableApi = class extends BaseCrudApi {
|
|
|
5
5
|
constructor(client) {
|
|
6
6
|
super(client, "/timetable");
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Deletes a timetable. Resolves the text `'OK'`.
|
|
10
|
+
* @permissions timetables.view OR timetables.destroy
|
|
11
|
+
*/
|
|
12
|
+
deleteById(id, headers) {
|
|
13
|
+
return super.deleteById(id, headers);
|
|
14
|
+
}
|
|
8
15
|
};
|
|
9
16
|
|
|
10
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimetableApi.mjs","names":[],"sources":["../../../src/apis/timetable/TimetableApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Timetable, CreateTimetablePayload, UpdateTimetablePayload } from './types'\n\nexport class TimetableApi extends BaseCrudApi<\n Timetable,\n CreateTimetablePayload,\n UpdateTimetablePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/timetable')\n }\n}\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TimetableApi.mjs","names":[],"sources":["../../../src/apis/timetable/TimetableApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Timetable, CreateTimetablePayload, UpdateTimetablePayload } from './types'\n\nexport class TimetableApi extends BaseCrudApi<\n Timetable,\n CreateTimetablePayload,\n UpdateTimetablePayload,\n ListQuery<Timetable>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/timetable')\n }\n\n /**\n * Deletes a timetable. Resolves the text `'OK'`.\n * @permissions timetables.view OR timetables.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AAKA,IAAa,eAAb,cAAkC,YAMhC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;CAO7B,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -7,6 +7,14 @@ var UsersApi = class extends require_core_ArchivableCrudApi.ArchivableCrudApi {
|
|
|
7
7
|
super(client, "/users");
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
+
* Deletes a user (removes it as the default user of the contacts and deletes its webhooks first).
|
|
11
|
+
* Resolves the text `'OK'`.
|
|
12
|
+
* @permissions users.destroy
|
|
13
|
+
*/
|
|
14
|
+
deleteById(id, headers) {
|
|
15
|
+
return super.deleteById(id, headers);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
10
18
|
* Archives or restores a user through the dedicated route used by the UI, which also
|
|
11
19
|
* sets the user offline and ends its sessions. The route enforces the business rules that
|
|
12
20
|
* {@link archive}/{@link unarchive} (a plain `PUT { archivedAt }`) skip:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersApi.cjs","names":["ArchivableCrudApi"],"sources":["../../../src/apis/users/UsersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { ArchivableCrudApi } from '../../core/ArchivableCrudApi'\nimport type { Contact } from '../contacts/types'\nimport type {\n ArchiveUserPayload,\n BulkUsersStatusPayload,\n BulkUsersStatusPreview,\n BulkUsersStatusResult,\n CreateUserPayload,\n EnableUserAccessResult,\n ExportUsersPayload,\n ImportUsersPayload,\n ImportUsersResult,\n TogglePinContactPayload,\n TogglePinContactResult,\n UpdateUserPayload,\n User,\n ValidateUserImportPayload,\n ValidateUserImportResult,\n} from './types'\n\nexport class UsersApi extends ArchivableCrudApi
|
|
1
|
+
{"version":3,"file":"UsersApi.cjs","names":["ArchivableCrudApi"],"sources":["../../../src/apis/users/UsersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { ArchivableCrudApi } from '../../core/ArchivableCrudApi'\nimport type { Contact } from '../contacts/types'\nimport type {\n ArchiveUserPayload,\n BulkUsersStatusPayload,\n BulkUsersStatusPreview,\n BulkUsersStatusResult,\n CreateUserPayload,\n EnableUserAccessResult,\n ExportUsersPayload,\n ImportUsersPayload,\n ImportUsersResult,\n TogglePinContactPayload,\n TogglePinContactResult,\n UpdateUserPayload,\n User,\n ValidateUserImportPayload,\n ValidateUserImportResult,\n} from './types'\n\nexport class UsersApi extends ArchivableCrudApi<\n User,\n CreateUserPayload,\n UpdateUserPayload,\n ListQuery<User>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/users')\n }\n\n /**\n * Deletes a user (removes it as the default user of the contacts and deletes its webhooks first).\n * Resolves the text `'OK'`.\n * @permissions users.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Archives or restores a user through the dedicated route used by the UI, which also\n * sets the user offline and ends its sessions. The route enforces the business rules that\n * {@link archive}/{@link unarchive} (a plain `PUT { archivedAt }`) skip:\n * - archiving refuses (403) a user referenced by a bot or with open tickets;\n * - restoring refuses (402) when the plan has no free user slot.\n * @permissions users.view OR users.archive\n */\n archiveWithValidation(\n id: string,\n body: ArchiveUserPayload,\n headers?: Record<string, string>,\n ): Promise<User> {\n return this.client.post<User, ArchiveUserPayload>(\n `${this.basePath}/${id}/archive`,\n body,\n headers,\n )\n }\n\n /**\n * Previews a bulk archive/unarchive without changing anything.\n * @permissions users.archive\n */\n previewBulkStatus(\n body: BulkUsersStatusPayload,\n headers?: Record<string, string>,\n ): Promise<BulkUsersStatusPreview> {\n return this.client.post<BulkUsersStatusPreview, BulkUsersStatusPayload>(\n `${this.basePath}/bulk-status/preview`,\n body,\n headers,\n )\n }\n\n /**\n * Archives or unarchives up to 100 users at once.\n * @permissions users.archive\n */\n bulkStatus(\n body: BulkUsersStatusPayload,\n headers?: Record<string, string>,\n ): Promise<BulkUsersStatusResult> {\n return this.client.post<BulkUsersStatusResult, BulkUsersStatusPayload>(\n `${this.basePath}/bulk-status`,\n body,\n headers,\n )\n }\n\n /**\n * Exports the users of the account as CSV. Resolves to the CSV text.\n * @permissions users.export\n */\n exportCsv(body: ExportUsersPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, ExportUsersPayload>(`${this.basePath}/export`, body, headers)\n }\n\n /**\n * Validates a CSV file previously uploaded through `FilesApi` before importing it.\n * @permissions users.create\n */\n validateImport(\n body: ValidateUserImportPayload,\n headers?: Record<string, string>,\n ): Promise<ValidateUserImportResult> {\n return this.client.post<ValidateUserImportResult, ValidateUserImportPayload>(\n `${this.basePath}/import/validate`,\n body,\n headers,\n )\n }\n\n /**\n * Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs\n * in the background (the route answers `202 Accepted`).\n * @permissions users.create\n */\n startImport(\n body: ImportUsersPayload,\n headers?: Record<string, string>,\n ): Promise<ImportUsersResult> {\n return this.client.post<ImportUsersResult, ImportUsersPayload>(\n `${this.basePath}/import`,\n body,\n headers,\n )\n }\n\n /**\n * Turns off the two-factor authentication (OTP) of a user.\n * @permissions users.update AND myAccount.update\n */\n disableOtpAuth(id: string, headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>(`${this.basePath}/${id}/disable-otp-auth`, undefined, headers)\n }\n\n /**\n * Clears the login throttling of a user blocked by too many failed attempts.\n * @permissions users.update\n */\n enableAccess(id: string, headers?: Record<string, string>): Promise<EnableUserAccessResult> {\n return this.client.post<EnableUserAccessResult>(\n `${this.basePath}/${id}/enable-access`,\n undefined,\n headers,\n )\n }\n\n /**\n * Returns the contacts pinned by the logged user.\n * @permissions contacts.pin\n */\n getPinnedContacts(headers?: Record<string, string>): Promise<Contact[]> {\n return this.client.get<Contact[]>(`${this.basePath}/pin`, headers)\n }\n\n /**\n * Pins the contact for the logged user, or unpins it when already pinned. A user can pin\n * up to 3 contacts. Resolves to the created link rows when pinning, or to the number of\n * removed links when unpinning.\n * @permissions contacts.pin\n */\n togglePinContact(\n body: TogglePinContactPayload,\n headers?: Record<string, string>,\n ): Promise<TogglePinContactResult> {\n return this.client.patch<TogglePinContactResult, TogglePinContactPayload>(\n `${this.basePath}/pin`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAsBA,IAAa,WAAb,cAA8BA,iDAM5B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,SAAS;;;;;;;CAQzB,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;;;;CAWtC,sBACE,IACA,MACA,SACe;AACf,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,WACvB,MACA,QACD;;;;;;CAOH,kBACE,MACA,SACiC;AACjC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,uBACjB,MACA,QACD;;;;;;CAOH,WACE,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,eACjB,MACA,QACD;;;;;;CAOH,UAAU,MAA0B,SAAmD;AACrF,SAAO,KAAK,OAAO,KAAiC,GAAG,KAAK,SAAS,UAAU,MAAM,QAAQ;;;;;;CAO/F,eACE,MACA,SACmC;AACnC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;;CAQH,YACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,UACjB,MACA,QACD;;;;;;CAOH,eAAe,IAAY,SAAiD;AAC1E,SAAO,KAAK,OAAO,KAAW,GAAG,KAAK,SAAS,GAAG,GAAG,oBAAoB,QAAW,QAAQ;;;;;;CAO9F,aAAa,IAAY,SAAmE;AAC1F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,iBACvB,QACA,QACD;;;;;;CAOH,kBAAkB,SAAsD;AACtE,SAAO,KAAK,OAAO,IAAe,GAAG,KAAK,SAAS,OAAO,QAAQ;;;;;;;;CASpE,iBACE,MACA,SACiC;AACjC,SAAO,KAAK,OAAO,MACjB,GAAG,KAAK,SAAS,OACjB,MACA,QACD"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
|
+
import type { ListQuery } from '../../core/types';
|
|
2
3
|
import { ArchivableCrudApi } from '../../core/ArchivableCrudApi';
|
|
3
4
|
import type { Contact } from '../contacts/types';
|
|
4
5
|
import type { ArchiveUserPayload, BulkUsersStatusPayload, BulkUsersStatusPreview, BulkUsersStatusResult, CreateUserPayload, EnableUserAccessResult, ExportUsersPayload, ImportUsersPayload, ImportUsersResult, TogglePinContactPayload, TogglePinContactResult, UpdateUserPayload, User, ValidateUserImportPayload, ValidateUserImportResult } from './types';
|
|
5
|
-
export declare class UsersApi extends ArchivableCrudApi<User, CreateUserPayload, UpdateUserPayload> {
|
|
6
|
+
export declare class UsersApi extends ArchivableCrudApi<User, CreateUserPayload, UpdateUserPayload, ListQuery<User>, 'OK'> {
|
|
6
7
|
constructor(client: ApiClient);
|
|
8
|
+
/**
|
|
9
|
+
* Deletes a user (removes it as the default user of the contacts and deletes its webhooks first).
|
|
10
|
+
* Resolves the text `'OK'`.
|
|
11
|
+
* @permissions users.destroy
|
|
12
|
+
*/
|
|
13
|
+
deleteById(id: string, headers?: Record<string, string>): Promise<'OK'>;
|
|
7
14
|
/**
|
|
8
15
|
* Archives or restores a user through the dedicated route used by the UI, which also
|
|
9
16
|
* sets the user offline and ends its sessions. The route enforces the business rules that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersApi.d.ts","sourceRoot":"","sources":["../../../src/apis/users/UsersApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EAC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,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,sBAAsB,CAAC;CAOnC"}
|
|
@@ -6,6 +6,14 @@ var UsersApi = class extends ArchivableCrudApi {
|
|
|
6
6
|
super(client, "/users");
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
+
* Deletes a user (removes it as the default user of the contacts and deletes its webhooks first).
|
|
10
|
+
* Resolves the text `'OK'`.
|
|
11
|
+
* @permissions users.destroy
|
|
12
|
+
*/
|
|
13
|
+
deleteById(id, headers) {
|
|
14
|
+
return super.deleteById(id, headers);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
9
17
|
* Archives or restores a user through the dedicated route used by the UI, which also
|
|
10
18
|
* sets the user offline and ends its sessions. The route enforces the business rules that
|
|
11
19
|
* {@link archive}/{@link unarchive} (a plain `PUT { archivedAt }`) skip:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersApi.mjs","names":[],"sources":["../../../src/apis/users/UsersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { ArchivableCrudApi } from '../../core/ArchivableCrudApi'\nimport type { Contact } from '../contacts/types'\nimport type {\n ArchiveUserPayload,\n BulkUsersStatusPayload,\n BulkUsersStatusPreview,\n BulkUsersStatusResult,\n CreateUserPayload,\n EnableUserAccessResult,\n ExportUsersPayload,\n ImportUsersPayload,\n ImportUsersResult,\n TogglePinContactPayload,\n TogglePinContactResult,\n UpdateUserPayload,\n User,\n ValidateUserImportPayload,\n ValidateUserImportResult,\n} from './types'\n\nexport class UsersApi extends ArchivableCrudApi
|
|
1
|
+
{"version":3,"file":"UsersApi.mjs","names":[],"sources":["../../../src/apis/users/UsersApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { ArchivableCrudApi } from '../../core/ArchivableCrudApi'\nimport type { Contact } from '../contacts/types'\nimport type {\n ArchiveUserPayload,\n BulkUsersStatusPayload,\n BulkUsersStatusPreview,\n BulkUsersStatusResult,\n CreateUserPayload,\n EnableUserAccessResult,\n ExportUsersPayload,\n ImportUsersPayload,\n ImportUsersResult,\n TogglePinContactPayload,\n TogglePinContactResult,\n UpdateUserPayload,\n User,\n ValidateUserImportPayload,\n ValidateUserImportResult,\n} from './types'\n\nexport class UsersApi extends ArchivableCrudApi<\n User,\n CreateUserPayload,\n UpdateUserPayload,\n ListQuery<User>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/users')\n }\n\n /**\n * Deletes a user (removes it as the default user of the contacts and deletes its webhooks first).\n * Resolves the text `'OK'`.\n * @permissions users.destroy\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Archives or restores a user through the dedicated route used by the UI, which also\n * sets the user offline and ends its sessions. The route enforces the business rules that\n * {@link archive}/{@link unarchive} (a plain `PUT { archivedAt }`) skip:\n * - archiving refuses (403) a user referenced by a bot or with open tickets;\n * - restoring refuses (402) when the plan has no free user slot.\n * @permissions users.view OR users.archive\n */\n archiveWithValidation(\n id: string,\n body: ArchiveUserPayload,\n headers?: Record<string, string>,\n ): Promise<User> {\n return this.client.post<User, ArchiveUserPayload>(\n `${this.basePath}/${id}/archive`,\n body,\n headers,\n )\n }\n\n /**\n * Previews a bulk archive/unarchive without changing anything.\n * @permissions users.archive\n */\n previewBulkStatus(\n body: BulkUsersStatusPayload,\n headers?: Record<string, string>,\n ): Promise<BulkUsersStatusPreview> {\n return this.client.post<BulkUsersStatusPreview, BulkUsersStatusPayload>(\n `${this.basePath}/bulk-status/preview`,\n body,\n headers,\n )\n }\n\n /**\n * Archives or unarchives up to 100 users at once.\n * @permissions users.archive\n */\n bulkStatus(\n body: BulkUsersStatusPayload,\n headers?: Record<string, string>,\n ): Promise<BulkUsersStatusResult> {\n return this.client.post<BulkUsersStatusResult, BulkUsersStatusPayload>(\n `${this.basePath}/bulk-status`,\n body,\n headers,\n )\n }\n\n /**\n * Exports the users of the account as CSV. Resolves to the CSV text.\n * @permissions users.export\n */\n exportCsv(body: ExportUsersPayload, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, ExportUsersPayload>(`${this.basePath}/export`, body, headers)\n }\n\n /**\n * Validates a CSV file previously uploaded through `FilesApi` before importing it.\n * @permissions users.create\n */\n validateImport(\n body: ValidateUserImportPayload,\n headers?: Record<string, string>,\n ): Promise<ValidateUserImportResult> {\n return this.client.post<ValidateUserImportResult, ValidateUserImportPayload>(\n `${this.basePath}/import/validate`,\n body,\n headers,\n )\n }\n\n /**\n * Starts the import of a CSV file previously uploaded through `FilesApi`. The import runs\n * in the background (the route answers `202 Accepted`).\n * @permissions users.create\n */\n startImport(\n body: ImportUsersPayload,\n headers?: Record<string, string>,\n ): Promise<ImportUsersResult> {\n return this.client.post<ImportUsersResult, ImportUsersPayload>(\n `${this.basePath}/import`,\n body,\n headers,\n )\n }\n\n /**\n * Turns off the two-factor authentication (OTP) of a user.\n * @permissions users.update AND myAccount.update\n */\n disableOtpAuth(id: string, headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>(`${this.basePath}/${id}/disable-otp-auth`, undefined, headers)\n }\n\n /**\n * Clears the login throttling of a user blocked by too many failed attempts.\n * @permissions users.update\n */\n enableAccess(id: string, headers?: Record<string, string>): Promise<EnableUserAccessResult> {\n return this.client.post<EnableUserAccessResult>(\n `${this.basePath}/${id}/enable-access`,\n undefined,\n headers,\n )\n }\n\n /**\n * Returns the contacts pinned by the logged user.\n * @permissions contacts.pin\n */\n getPinnedContacts(headers?: Record<string, string>): Promise<Contact[]> {\n return this.client.get<Contact[]>(`${this.basePath}/pin`, headers)\n }\n\n /**\n * Pins the contact for the logged user, or unpins it when already pinned. A user can pin\n * up to 3 contacts. Resolves to the created link rows when pinning, or to the number of\n * removed links when unpinning.\n * @permissions contacts.pin\n */\n togglePinContact(\n body: TogglePinContactPayload,\n headers?: Record<string, string>,\n ): Promise<TogglePinContactResult> {\n return this.client.patch<TogglePinContactResult,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@ -63,7 +63,12 @@ export type CreateUserPayload = {
|
|
|
63
63
|
isClientUser?: boolean;
|
|
64
64
|
roles?: string[];
|
|
65
65
|
departments?: string[];
|
|
66
|
+
/** @deprecated Not read by the backend: restrict the connections with `restrictedServices`. */
|
|
66
67
|
services?: string[];
|
|
68
|
+
/** Connections the user cannot access, as `{ value: serviceId }`. */
|
|
69
|
+
restrictedServices?: {
|
|
70
|
+
value: string;
|
|
71
|
+
}[];
|
|
67
72
|
scheduleId?: string;
|
|
68
73
|
};
|
|
69
74
|
export type UpdateUserPayload = {
|
|
@@ -74,7 +79,17 @@ export type UpdateUserPayload = {
|
|
|
74
79
|
isClientUser?: boolean;
|
|
75
80
|
roles?: string[];
|
|
76
81
|
departments?: string[];
|
|
82
|
+
/** @deprecated Not read by the backend: restrict the connections with `restrictedServices`. */
|
|
77
83
|
services?: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Connections the user cannot access, as `{ value: serviceId }`. Every update without it (and
|
|
86
|
+
* every update of an admin) clears the restrictions of the user.
|
|
87
|
+
*/
|
|
88
|
+
restrictedServices?: {
|
|
89
|
+
value: string;
|
|
90
|
+
}[];
|
|
91
|
+
/** New password of the user. */
|
|
92
|
+
password?: string;
|
|
78
93
|
timetableId?: string | null;
|
|
79
94
|
preferences?: UserPreferences;
|
|
80
95
|
language?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/users/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,C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AAA;QACrB,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,OAAO,EAAE;QACP,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,OAAO,CAAA;SAAE,EAAE,CAAA;QAC5C,eAAe,EAAE,MAAM,EAAE,CAAA;QACzB,aAAa,EAAE,MAAM,EAAE,CAAA;KACxB,CAAA;IACD,IAAI,EAAE,qBAAqB,CAAA;IAC3B,6DAA6D;IAC7D,uBAAuB,EAAE,qBAAqB,CAAA;CAC/C,CAAA;AAED,qCAAqC;AACrC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,cAAc,CAAA;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,8FAA8F;AAC9F,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,4EAA4E;AAC5E,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,EAAE,GAAG,MAAM,CAAA"}
|
|
@@ -6,6 +6,13 @@ var WebhooksApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
6
6
|
constructor(client) {
|
|
7
7
|
super(client, "/me/webhooks");
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Deletes a webhook. Resolves the text `'OK'`; an unknown id answers 500.
|
|
11
|
+
* @permissions settingsApi.update
|
|
12
|
+
*/
|
|
13
|
+
deleteById(id, headers) {
|
|
14
|
+
return super.deleteById(id, headers);
|
|
15
|
+
}
|
|
9
16
|
};
|
|
10
17
|
|
|
11
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhooksApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/webhooks/WebhooksApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Webhook, CreateWebhookPayload, UpdateWebhookPayload } from './types'\n\nexport class WebhooksApi extends BaseCrudApi
|
|
1
|
+
{"version":3,"file":"WebhooksApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/webhooks/WebhooksApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Webhook, CreateWebhookPayload, UpdateWebhookPayload } from './types'\n\nexport class WebhooksApi extends BaseCrudApi<\n Webhook,\n CreateWebhookPayload,\n UpdateWebhookPayload,\n ListQuery<Webhook>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/me/webhooks')\n }\n\n /**\n * Deletes a webhook. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions settingsApi.update\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AAKA,IAAa,cAAb,cAAiCA,qCAM/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,eAAe;;;;;;CAO/B,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -1,7 +1,13 @@
|
|
|
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 { Webhook, CreateWebhookPayload, UpdateWebhookPayload } from './types';
|
|
4
|
-
export declare class WebhooksApi extends BaseCrudApi<Webhook, CreateWebhookPayload, UpdateWebhookPayload> {
|
|
5
|
+
export declare class WebhooksApi extends BaseCrudApi<Webhook, CreateWebhookPayload, UpdateWebhookPayload, ListQuery<Webhook>, 'OK'> {
|
|
5
6
|
constructor(client: ApiClient);
|
|
7
|
+
/**
|
|
8
|
+
* Deletes a webhook. Resolves the text `'OK'`; an unknown id answers 500.
|
|
9
|
+
* @permissions settingsApi.update
|
|
10
|
+
*/
|
|
11
|
+
deleteById(id: string, headers?: Record<string, string>): Promise<'OK'>;
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=WebhooksApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhooksApi.d.ts","sourceRoot":"","sources":["../../../src/apis/webhooks/WebhooksApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAElF,qBAAa,WAAY,SAAQ,WAAW,
|
|
1
|
+
{"version":3,"file":"WebhooksApi.d.ts","sourceRoot":"","sources":["../../../src/apis/webhooks/WebhooksApi.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,EAAE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAElF,qBAAa,WAAY,SAAQ,WAAW,CAC1C,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,CAAC,OAAO,CAAC,EAClB,IAAI,CACL;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjF"}
|
|
@@ -5,6 +5,13 @@ var WebhooksApi = class extends BaseCrudApi {
|
|
|
5
5
|
constructor(client) {
|
|
6
6
|
super(client, "/me/webhooks");
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Deletes a webhook. Resolves the text `'OK'`; an unknown id answers 500.
|
|
10
|
+
* @permissions settingsApi.update
|
|
11
|
+
*/
|
|
12
|
+
deleteById(id, headers) {
|
|
13
|
+
return super.deleteById(id, headers);
|
|
14
|
+
}
|
|
8
15
|
};
|
|
9
16
|
|
|
10
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhooksApi.mjs","names":[],"sources":["../../../src/apis/webhooks/WebhooksApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Webhook, CreateWebhookPayload, UpdateWebhookPayload } from './types'\n\nexport class WebhooksApi extends BaseCrudApi
|
|
1
|
+
{"version":3,"file":"WebhooksApi.mjs","names":[],"sources":["../../../src/apis/webhooks/WebhooksApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Webhook, CreateWebhookPayload, UpdateWebhookPayload } from './types'\n\nexport class WebhooksApi extends BaseCrudApi<\n Webhook,\n CreateWebhookPayload,\n UpdateWebhookPayload,\n ListQuery<Webhook>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/me/webhooks')\n }\n\n /**\n * Deletes a webhook. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions settingsApi.update\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AAKA,IAAa,cAAb,cAAiC,YAM/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,eAAe;;;;;;CAO/B,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
package/dist/core/ApiClient.d.ts
CHANGED
|
@@ -10,5 +10,19 @@ export interface ApiClient {
|
|
|
10
10
|
put<TResponse = unknown, TBody = unknown>(endpoint: string, body?: TBody, headers?: Record<string, string>): Promise<TResponse>;
|
|
11
11
|
patch<TResponse = unknown, TBody = unknown>(endpoint: string, body?: TBody, headers?: Record<string, string>): Promise<TResponse>;
|
|
12
12
|
delete<TResponse = unknown>(endpoint: string, headers?: Record<string, string>): Promise<TResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Like {@link request}, but resolves the raw `Response` of a successful (2xx) call instead of
|
|
15
|
+
* the parsed body, for the routes whose headers matter (`Content-Type`, `Content-Disposition`)
|
|
16
|
+
* or whose body is binary (xlsx, pdf, files). Non-2xx still throws the `ApiError` subclass.
|
|
17
|
+
* Optional: a custom client without it cannot call the API methods that need the raw response.
|
|
18
|
+
*/
|
|
19
|
+
requestRaw?<TBody = unknown>(method: HttpMethod, endpoint: string, body?: TBody, headers?: Record<string, string>): Promise<Response>;
|
|
20
|
+
/**
|
|
21
|
+
* Sends a request to an absolute URL outside the API (e.g. the signed storage URL of
|
|
22
|
+
* `FilesApi.upload`): no base URL, no `Authorization` header and no JSON serialization, `body`
|
|
23
|
+
* goes as is. Resolves the raw `Response` of a 2xx answer; non-2xx throws the `ApiError`
|
|
24
|
+
* subclass. Optional: without it, the API methods that need it send through the global `fetch`.
|
|
25
|
+
*/
|
|
26
|
+
requestExternal?(method: HttpMethod, url: string, body?: BodyInit, headers?: Record<string, string>): Promise<Response>;
|
|
13
27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version":3,"file":"ArchivableCrudApi.cjs","names":["BaseCrudApi"],"sources":["../../src/core/ArchivableCrudApi.ts"],"sourcesContent":["import type { ApiClient } from './ApiClient'\nimport { BaseCrudApi } from './BaseCrudApi'\nimport type { ListQuery } from './types'\n\n/**\n * CRUD base for resources that support soft-delete via an `archivedAt` timestamp\n * (PUT `${basePath}/${id}` with `{ archivedAt }`). Adds `archive`/`unarchive` on\n * top of {@link BaseCrudApi}.\n *\n * Only extend this for resources whose archive write mechanism is `archivedAt`.\n * Resources that archive through a different field (e.g. cards use `isArchived`)\n * or a dedicated endpoint (e.g. ticket-topics POST `/archive`) must NOT use this\n * base and should implement `archive`/`unarchive` themselves.\n */\nexport class ArchivableCrudApi<\n TResponse,\n TCreate,\n TUpdate extends { archivedAt?: string | null } = TCreate & { archivedAt?: string | null },\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n> extends BaseCrudApi<TResponse, TCreate, TUpdate, TQuery> {\n constructor(client: ApiClient, basePath: string) {\n super(client, basePath)\n }\n\n /**\n * Archives a resource (soft-delete) by setting `archivedAt` to the current time.\n * @permissions $resourceName.update\n */\n archive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: new Date().toISOString() } as TUpdate, headers)\n }\n\n /**\n * Restores a previously archived resource by clearing `archivedAt`.\n * @permissions $resourceName.update\n */\n unarchive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: null } as TUpdate, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,oBAAb,
|
|
1
|
+
{"version":3,"file":"ArchivableCrudApi.cjs","names":["BaseCrudApi"],"sources":["../../src/core/ArchivableCrudApi.ts"],"sourcesContent":["import type { ApiClient } from './ApiClient'\nimport { BaseCrudApi } from './BaseCrudApi'\nimport type { ListQuery } from './types'\n\n/**\n * CRUD base for resources that support soft-delete via an `archivedAt` timestamp\n * (PUT `${basePath}/${id}` with `{ archivedAt }`). Adds `archive`/`unarchive` on\n * top of {@link BaseCrudApi}.\n *\n * Only extend this for resources whose archive write mechanism is `archivedAt`.\n * Resources that archive through a different field (e.g. cards use `isArchived`)\n * or a dedicated endpoint (e.g. ticket-topics POST `/archive`) must NOT use this\n * base and should implement `archive`/`unarchive` themselves.\n */\nexport class ArchivableCrudApi<\n TResponse,\n TCreate,\n TUpdate extends { archivedAt?: string | null } = TCreate & { archivedAt?: string | null },\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n TDeleteResponse = TResponse,\n> extends BaseCrudApi<TResponse, TCreate, TUpdate, TQuery, TDeleteResponse> {\n constructor(client: ApiClient, basePath: string) {\n super(client, basePath)\n }\n\n /**\n * Archives a resource (soft-delete) by setting `archivedAt` to the current time.\n * @permissions $resourceName.update\n */\n archive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: new Date().toISOString() } as TUpdate, headers)\n }\n\n /**\n * Restores a previously archived resource by clearing `archivedAt`.\n * @permissions $resourceName.update\n */\n unarchive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: null } as TUpdate, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,oBAAb,cAMUA,qCAAkE;CAC1E,YAAY,QAAmB,UAAkB;AAC/C,QAAM,QAAQ,SAAS;;;;;;CAOzB,QAAQ,IAAY,SAAsD;AACxE,SAAO,KAAK,WAAW,IAAI,EAAE,6BAAY,IAAI,MAAM,EAAC,aAAa,EAAE,EAAa,QAAQ;;;;;;CAO1F,UAAU,IAAY,SAAsD;AAC1E,SAAO,KAAK,WAAW,IAAI,EAAE,YAAY,MAAM,EAAa,QAAQ"}
|
|
@@ -15,7 +15,7 @@ export declare class ArchivableCrudApi<TResponse, TCreate, TUpdate extends {
|
|
|
15
15
|
archivedAt?: string | null;
|
|
16
16
|
} = TCreate & {
|
|
17
17
|
archivedAt?: string | null;
|
|
18
|
-
}, TQuery extends ListQuery<TResponse> = ListQuery<TResponse
|
|
18
|
+
}, TQuery extends ListQuery<TResponse> = ListQuery<TResponse>, TDeleteResponse = TResponse> extends BaseCrudApi<TResponse, TCreate, TUpdate, TQuery, TDeleteResponse> {
|
|
19
19
|
constructor(client: ApiClient, basePath: string);
|
|
20
20
|
/**
|
|
21
21
|
* Archives a resource (soft-delete) by setting `archivedAt` to the current time.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchivableCrudApi.d.ts","sourceRoot":"","sources":["../../src/core/ArchivableCrudApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC5B,SAAS,EACT,OAAO,EACP,OAAO,SAAS;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,OAAO,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACzF,MAAM,SAAS,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"ArchivableCrudApi.d.ts","sourceRoot":"","sources":["../../src/core/ArchivableCrudApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC5B,SAAS,EACT,OAAO,EACP,OAAO,SAAS;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,OAAO,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACzF,MAAM,SAAS,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,EAC1D,eAAe,GAAG,SAAS,CAC3B,SAAQ,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC;gBAC7D,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM;IAI/C;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAIzE;;;OAGG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;CAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchivableCrudApi.mjs","names":[],"sources":["../../src/core/ArchivableCrudApi.ts"],"sourcesContent":["import type { ApiClient } from './ApiClient'\nimport { BaseCrudApi } from './BaseCrudApi'\nimport type { ListQuery } from './types'\n\n/**\n * CRUD base for resources that support soft-delete via an `archivedAt` timestamp\n * (PUT `${basePath}/${id}` with `{ archivedAt }`). Adds `archive`/`unarchive` on\n * top of {@link BaseCrudApi}.\n *\n * Only extend this for resources whose archive write mechanism is `archivedAt`.\n * Resources that archive through a different field (e.g. cards use `isArchived`)\n * or a dedicated endpoint (e.g. ticket-topics POST `/archive`) must NOT use this\n * base and should implement `archive`/`unarchive` themselves.\n */\nexport class ArchivableCrudApi<\n TResponse,\n TCreate,\n TUpdate extends { archivedAt?: string | null } = TCreate & { archivedAt?: string | null },\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n> extends BaseCrudApi<TResponse, TCreate, TUpdate, TQuery> {\n constructor(client: ApiClient, basePath: string) {\n super(client, basePath)\n }\n\n /**\n * Archives a resource (soft-delete) by setting `archivedAt` to the current time.\n * @permissions $resourceName.update\n */\n archive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: new Date().toISOString() } as TUpdate, headers)\n }\n\n /**\n * Restores a previously archived resource by clearing `archivedAt`.\n * @permissions $resourceName.update\n */\n unarchive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: null } as TUpdate, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAa,oBAAb,
|
|
1
|
+
{"version":3,"file":"ArchivableCrudApi.mjs","names":[],"sources":["../../src/core/ArchivableCrudApi.ts"],"sourcesContent":["import type { ApiClient } from './ApiClient'\nimport { BaseCrudApi } from './BaseCrudApi'\nimport type { ListQuery } from './types'\n\n/**\n * CRUD base for resources that support soft-delete via an `archivedAt` timestamp\n * (PUT `${basePath}/${id}` with `{ archivedAt }`). Adds `archive`/`unarchive` on\n * top of {@link BaseCrudApi}.\n *\n * Only extend this for resources whose archive write mechanism is `archivedAt`.\n * Resources that archive through a different field (e.g. cards use `isArchived`)\n * or a dedicated endpoint (e.g. ticket-topics POST `/archive`) must NOT use this\n * base and should implement `archive`/`unarchive` themselves.\n */\nexport class ArchivableCrudApi<\n TResponse,\n TCreate,\n TUpdate extends { archivedAt?: string | null } = TCreate & { archivedAt?: string | null },\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n TDeleteResponse = TResponse,\n> extends BaseCrudApi<TResponse, TCreate, TUpdate, TQuery, TDeleteResponse> {\n constructor(client: ApiClient, basePath: string) {\n super(client, basePath)\n }\n\n /**\n * Archives a resource (soft-delete) by setting `archivedAt` to the current time.\n * @permissions $resourceName.update\n */\n archive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: new Date().toISOString() } as TUpdate, headers)\n }\n\n /**\n * Restores a previously archived resource by clearing `archivedAt`.\n * @permissions $resourceName.update\n */\n unarchive(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.updateById(id, { archivedAt: null } as TUpdate, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAa,oBAAb,cAMU,YAAkE;CAC1E,YAAY,QAAmB,UAAkB;AAC/C,QAAM,QAAQ,SAAS;;;;;;CAOzB,QAAQ,IAAY,SAAsD;AACxE,SAAO,KAAK,WAAW,IAAI,EAAE,6BAAY,IAAI,MAAM,EAAC,aAAa,EAAE,EAAa,QAAQ;;;;;;CAO1F,UAAU,IAAY,SAAsD;AAC1E,SAAO,KAAK,WAAW,IAAI,EAAE,YAAY,MAAM,EAAa,QAAQ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_core_errors = require('./errors.cjs');
|
|
3
3
|
const require_core_queryString = require('./queryString.cjs');
|
|
4
|
+
const require_core_requestExternal = require('./requestExternal.cjs');
|
|
4
5
|
|
|
5
6
|
//#region src/core/BaseApiClient.ts
|
|
6
7
|
var BaseApiClient = class {
|
|
@@ -17,6 +18,28 @@ var BaseApiClient = class {
|
|
|
17
18
|
return this;
|
|
18
19
|
}
|
|
19
20
|
async request(method, endpoint, body, headers) {
|
|
21
|
+
return this.handleResponse(await this.send(method, endpoint, body, headers));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sends the request and resolves the raw `Response` of a 2xx answer (headers and body
|
|
25
|
+
* untouched, so a binary body can be read with `arrayBuffer()`). Non-2xx throws the
|
|
26
|
+
* `ApiError` subclass, as {@link request} does.
|
|
27
|
+
*/
|
|
28
|
+
async requestRaw(method, endpoint, body, headers) {
|
|
29
|
+
const response = await this.send(method, endpoint, body, headers);
|
|
30
|
+
if (!response.ok) throw require_core_errors.ApiError.fromResponse(response.status, response.statusText, response.headers, await this.readErrorBody(response));
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sends a request to an absolute URL outside the API, without the base URL, the access token
|
|
35
|
+
* and the JSON serialization. Resolves the raw `Response` of a 2xx answer; non-2xx throws the
|
|
36
|
+
* `ApiError` subclass. Override it to intercept those requests as well.
|
|
37
|
+
*/
|
|
38
|
+
requestExternal(method, url, body, headers) {
|
|
39
|
+
return require_core_requestExternal.requestExternal(method, url, body, headers);
|
|
40
|
+
}
|
|
41
|
+
/** Builds and sends the request; a network failure is thrown as `ApiConnectionError`. */
|
|
42
|
+
async send(method, endpoint, body, headers) {
|
|
20
43
|
const url = `${this.baseUrl}/${endpoint.replace(/^\//, "")}`;
|
|
21
44
|
const init = {
|
|
22
45
|
method,
|
|
@@ -27,13 +50,11 @@ var BaseApiClient = class {
|
|
|
27
50
|
},
|
|
28
51
|
...body !== void 0 && { body: JSON.stringify(body) }
|
|
29
52
|
};
|
|
30
|
-
let response;
|
|
31
53
|
try {
|
|
32
|
-
|
|
54
|
+
return await fetch(url, init);
|
|
33
55
|
} catch (error) {
|
|
34
56
|
throw new require_core_errors.ApiConnectionError(`Request to ${method} ${url} failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
35
57
|
}
|
|
36
|
-
return this.handleResponse(response);
|
|
37
58
|
}
|
|
38
59
|
async handleResponse(response) {
|
|
39
60
|
if (!response.ok) throw require_core_errors.ApiError.fromResponse(response.status, response.statusText, response.headers, await this.readErrorBody(response));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseApiClient.cjs","names":["DEFAULT_QUERY_FORMAT","
|
|
1
|
+
{"version":3,"file":"BaseApiClient.cjs","names":["DEFAULT_QUERY_FORMAT","ApiError","requestExternal","ApiConnectionError"],"sources":["../../src/core/BaseApiClient.ts"],"sourcesContent":["import type { ApiClient, HttpMethod } from './ApiClient'\nimport { ApiConnectionError, ApiError } from './errors'\nimport { DEFAULT_QUERY_FORMAT, type QueryFormat } from './queryString'\nimport { requestExternal } from './requestExternal'\n\nexport interface BaseApiClientOptions {\n /** How list/get queries are serialized in the URL. Defaults to `'json'`. */\n queryFormat?: QueryFormat\n}\n\nexport class BaseApiClient implements ApiClient {\n protected readonly baseUrl: string\n protected accessToken: string | null = null\n public readonly queryFormat: QueryFormat\n\n constructor(baseUrl: string, accessToken?: string, options: BaseApiClientOptions = {}) {\n this.baseUrl = baseUrl.replace(/\\/$/, '')\n this.accessToken = accessToken || null\n this.queryFormat = options.queryFormat ?? DEFAULT_QUERY_FORMAT\n }\n\n setAccessToken(accessToken: string): this {\n this.accessToken = accessToken\n return this\n }\n\n async request<TResponse = unknown, TBody = unknown>(\n method: HttpMethod,\n endpoint: string,\n body?: TBody,\n headers?: Record<string, string>,\n ): Promise<TResponse> {\n return this.handleResponse<TResponse>(await this.send(method, endpoint, body, headers))\n }\n\n /**\n * Sends the request and resolves the raw `Response` of a 2xx answer (headers and body\n * untouched, so a binary body can be read with `arrayBuffer()`). Non-2xx throws the\n * `ApiError` subclass, as {@link request} does.\n */\n async requestRaw<TBody = unknown>(\n method: HttpMethod,\n endpoint: string,\n body?: TBody,\n headers?: Record<string, string>,\n ): Promise<Response> {\n const response = await this.send(method, endpoint, body, headers)\n if (!response.ok) {\n throw ApiError.fromResponse(\n response.status,\n response.statusText,\n response.headers,\n await this.readErrorBody(response),\n )\n }\n return response\n }\n\n /**\n * Sends a request to an absolute URL outside the API, without the base URL, the access token\n * and the JSON serialization. Resolves the raw `Response` of a 2xx answer; non-2xx throws the\n * `ApiError` subclass. Override it to intercept those requests as well.\n */\n requestExternal(\n method: HttpMethod,\n url: string,\n body?: BodyInit,\n headers?: Record<string, string>,\n ): Promise<Response> {\n return requestExternal(method, url, body, headers)\n }\n\n /** Builds and sends the request; a network failure is thrown as `ApiConnectionError`. */\n protected async send<TBody = unknown>(\n method: HttpMethod,\n endpoint: string,\n body?: TBody,\n headers?: Record<string, string>,\n ): Promise<Response> {\n const url = `${this.baseUrl}/${endpoint.replace(/^\\//, '')}`\n const init: RequestInit = {\n method,\n headers: {\n 'Content-Type': 'application/json',\n ...(this.accessToken && { Authorization: `Bearer ${this.accessToken}` }),\n ...headers,\n },\n ...(body !== undefined && { body: JSON.stringify(body) }),\n }\n\n try {\n return await fetch(url, init)\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n throw new ApiConnectionError(`Request to ${method} ${url} failed: ${reason}`, {\n cause: error,\n })\n }\n }\n\n protected async handleResponse<TResponse>(response: Response): Promise<TResponse> {\n if (!response.ok) {\n throw ApiError.fromResponse(\n response.status,\n response.statusText,\n response.headers,\n await this.readErrorBody(response),\n )\n }\n\n // 204 No Content never has a body; short-circuit before reading the stream.\n if (response.status === 204) {\n return undefined as unknown as TResponse\n }\n\n // Read body as text once and treat an empty body as \"no content\" regardless of\n // Content-Type. Servers sometimes return 200 with Content-Type: application/json\n // and an empty body (e.g. POST endpoints whose framework keeps the default JSON\n // content-type even when nothing is written). `response.json()` would throw\n // \"Unexpected end of input\" in that case.\n const text = await response.text()\n if (!text) {\n return undefined as unknown as TResponse\n }\n\n const contentType = response.headers.get('Content-Type')\n const isJson = contentType?.includes('application/json') ?? false\n\n if (isJson) {\n return JSON.parse(text) as TResponse\n }\n\n try {\n return JSON.parse(text) as TResponse\n } catch {\n return text as unknown as TResponse\n }\n }\n\n /** Reads an error body: parsed JSON when possible, the raw text otherwise, `undefined` when empty. */\n protected async readErrorBody(response: Response): Promise<unknown> {\n let text: string\n try {\n text = await response.text()\n } catch {\n return undefined\n }\n if (!text) {\n return undefined\n }\n try {\n return JSON.parse(text)\n } catch {\n return text\n }\n }\n\n get<TResponse = unknown>(endpoint: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.request<TResponse>('GET', endpoint, undefined, headers)\n }\n\n post<TResponse = unknown, TBody = unknown>(\n endpoint: string,\n body?: TBody,\n headers?: Record<string, string>,\n ): Promise<TResponse> {\n return this.request<TResponse, TBody>('POST', endpoint, body, headers)\n }\n\n put<TResponse = unknown, TBody = unknown>(\n endpoint: string,\n body?: TBody,\n headers?: Record<string, string>,\n ): Promise<TResponse> {\n return this.request<TResponse, TBody>('PUT', endpoint, body, headers)\n }\n\n patch<TResponse = unknown, TBody = unknown>(\n endpoint: string,\n body?: TBody,\n headers?: Record<string, string>,\n ): Promise<TResponse> {\n return this.request<TResponse, TBody>('PATCH', endpoint, body, headers)\n }\n\n delete<TResponse = unknown>(\n endpoint: string,\n headers?: Record<string, string>,\n ): Promise<TResponse> {\n return this.request<TResponse>('DELETE', endpoint, undefined, headers)\n }\n}\n"],"mappings":";;;;;;AAUA,IAAa,gBAAb,MAAgD;CAC9C,AAAmB;CACnB,AAAU,cAA6B;CACvC,AAAgB;CAEhB,YAAY,SAAiB,aAAsB,UAAgC,EAAE,EAAE;AACrF,OAAK,UAAU,QAAQ,QAAQ,OAAO,GAAG;AACzC,OAAK,cAAc,eAAe;AAClC,OAAK,cAAc,QAAQ,eAAeA;;CAG5C,eAAe,aAA2B;AACxC,OAAK,cAAc;AACnB,SAAO;;CAGT,MAAM,QACJ,QACA,UACA,MACA,SACoB;AACpB,SAAO,KAAK,eAA0B,MAAM,KAAK,KAAK,QAAQ,UAAU,MAAM,QAAQ,CAAC;;;;;;;CAQzF,MAAM,WACJ,QACA,UACA,MACA,SACmB;EACnB,MAAM,WAAW,MAAM,KAAK,KAAK,QAAQ,UAAU,MAAM,QAAQ;AACjE,MAAI,CAAC,SAAS,GACZ,OAAMC,6BAAS,aACb,SAAS,QACT,SAAS,YACT,SAAS,SACT,MAAM,KAAK,cAAc,SAAS,CACnC;AAEH,SAAO;;;;;;;CAQT,gBACE,QACA,KACA,MACA,SACmB;AACnB,SAAOC,6CAAgB,QAAQ,KAAK,MAAM,QAAQ;;;CAIpD,MAAgB,KACd,QACA,UACA,MACA,SACmB;EACnB,MAAM,MAAM,GAAG,KAAK,QAAQ,GAAG,SAAS,QAAQ,OAAO,GAAG;EAC1D,MAAM,OAAoB;GACxB;GACA,SAAS;IACP,gBAAgB;IAChB,GAAI,KAAK,eAAe,EAAE,eAAe,UAAU,KAAK,eAAe;IACvE,GAAG;IACJ;GACD,GAAI,SAAS,UAAa,EAAE,MAAM,KAAK,UAAU,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baseUrl: string, accessToken?: string, options?: BaseApiClientOptions);
|
|
12
12
|
setAccessToken(accessToken: string): this;
|
|
13
13
|
request<TResponse = unknown, TBody = unknown>(method: HttpMethod, endpoint: string, body?: TBody, headers?: Record<string, string>): Promise<TResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Sends the request and resolves the raw `Response` of a 2xx answer (headers and body
|
|
16
|
+
* untouched, so a binary body can be read with `arrayBuffer()`). Non-2xx throws the
|
|
17
|
+
* `ApiError` subclass, as {@link request} does.
|
|
18
|
+
*/
|
|
19
|
+
requestRaw<TBody = unknown>(method: HttpMethod, endpoint: string, body?: TBody, headers?: Record<string, string>): Promise<Response>;
|
|
20
|
+
/**
|
|
21
|
+
* Sends a request to an absolute URL outside the API, without the base URL, the access token
|
|
22
|
+
* and the JSON serialization. Resolves the raw `Response` of a 2xx answer; non-2xx throws the
|
|
23
|
+
* `ApiError` subclass. Override it to intercept those requests as well.
|
|
24
|
+
*/
|
|
25
|
+
requestExternal(method: HttpMethod, url: string, body?: BodyInit, headers?: Record<string, string>): Promise<Response>;
|
|
26
|
+
/** Builds and sends the request; a network failure is thrown as `ApiConnectionError`. */
|
|
27
|
+
protected send<TBody = unknown>(method: HttpMethod, endpoint: string, body?: TBody, headers?: Record<string, string>): Promise<Response>;
|
|
14
28
|
protected handleResponse<TResponse>(response: Response): Promise<TResponse>;
|
|
15
29
|
/** Reads an error body: parsed JSON when possible, the raw text otherwise, `undefined` when empty. */
|
|
16
30
|
protected readErrorBody(response: Response): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseApiClient.d.ts","sourceRoot":"","sources":["../../src/core/BaseApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"BaseApiClient.d.ts","sourceRoot":"","sources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E,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC;CAGtB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiConnectionError, ApiError } from "./errors.mjs";
|
|
2
2
|
import { DEFAULT_QUERY_FORMAT } from "./queryString.mjs";
|
|
3
|
+
import { requestExternal } from "./requestExternal.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/core/BaseApiClient.ts
|
|
5
6
|
var BaseApiClient = class {
|
|
@@ -16,6 +17,28 @@ var BaseApiClient = class {
|
|
|
16
17
|
return this;
|
|
17
18
|
}
|
|
18
19
|
async request(method, endpoint, body, headers) {
|
|
20
|
+
return this.handleResponse(await this.send(method, endpoint, body, headers));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sends the request and resolves the raw `Response` of a 2xx answer (headers and body
|
|
24
|
+
* untouched, so a binary body can be read with `arrayBuffer()`). Non-2xx throws the
|
|
25
|
+
* `ApiError` subclass, as {@link request} does.
|
|
26
|
+
*/
|
|
27
|
+
async requestRaw(method, endpoint, body, headers) {
|
|
28
|
+
const response = await this.send(method, endpoint, body, headers);
|
|
29
|
+
if (!response.ok) throw ApiError.fromResponse(response.status, response.statusText, response.headers, await this.readErrorBody(response));
|
|
30
|
+
return response;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sends a request to an absolute URL outside the API, without the base URL, the access token
|
|
34
|
+
* and the JSON serialization. Resolves the raw `Response` of a 2xx answer; non-2xx throws the
|
|
35
|
+
* `ApiError` subclass. Override it to intercept those requests as well.
|
|
36
|
+
*/
|
|
37
|
+
requestExternal(method, url, body, headers) {
|
|
38
|
+
return requestExternal(method, url, body, headers);
|
|
39
|
+
}
|
|
40
|
+
/** Builds and sends the request; a network failure is thrown as `ApiConnectionError`. */
|
|
41
|
+
async send(method, endpoint, body, headers) {
|
|
19
42
|
const url = `${this.baseUrl}/${endpoint.replace(/^\//, "")}`;
|
|
20
43
|
const init = {
|
|
21
44
|
method,
|
|
@@ -26,13 +49,11 @@ var BaseApiClient = class {
|
|
|
26
49
|
},
|
|
27
50
|
...body !== void 0 && { body: JSON.stringify(body) }
|
|
28
51
|
};
|
|
29
|
-
let response;
|
|
30
52
|
try {
|
|
31
|
-
|
|
53
|
+
return await fetch(url, init);
|
|
32
54
|
} catch (error) {
|
|
33
55
|
throw new ApiConnectionError(`Request to ${method} ${url} failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
34
56
|
}
|
|
35
|
-
return this.handleResponse(response);
|
|
36
57
|
}
|
|
37
58
|
async handleResponse(response) {
|
|
38
59
|
if (!response.ok) throw ApiError.fromResponse(response.status, response.statusText, response.headers, await this.readErrorBody(response));
|