@getsupervisor/agents-studio-sdk 1.17.0 → 1.19.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/CHANGELOG.md +41 -0
- package/dist/index.cjs +150 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -7
- package/dist/index.d.ts +100 -7
- package/dist/index.js +149 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -49,6 +49,7 @@ type components = {
|
|
|
49
49
|
ToolResourceReloadResponse: external['components/schemas.yaml']['ToolResourceReloadResponse'];
|
|
50
50
|
ToolConnectionRequest: external['components/schemas.yaml']['ToolConnectionRequest'];
|
|
51
51
|
ToolConnectionResponse: external['components/schemas.yaml']['ToolConnectionResponse'];
|
|
52
|
+
ToolConnectionAuth: external['components/schemas.yaml']['ToolConnectionAuth'];
|
|
52
53
|
ExecuteToolRequest: external['components/schemas.yaml']['ExecuteToolRequest'];
|
|
53
54
|
ExecuteToolResponse: external['components/schemas.yaml']['ExecuteToolResponse'];
|
|
54
55
|
CatalogItemLinks: external['components/schemas.yaml']['CatalogItemLinks'];
|
|
@@ -59,6 +60,16 @@ type components = {
|
|
|
59
60
|
WorkspaceEnableRequest: external['components/schemas.yaml']['WorkspaceEnableRequest'];
|
|
60
61
|
WorkspaceEnableResponse: external['components/schemas.yaml']['WorkspaceEnableResponse'];
|
|
61
62
|
ErrorResponse: external['components/schemas.yaml']['ErrorResponse'];
|
|
63
|
+
WebhookSummary: external['components/schemas.yaml']['WebhookSummary'];
|
|
64
|
+
WebhookDetail: external['components/schemas.yaml']['WebhookDetail'];
|
|
65
|
+
WebhookListResponse: external['components/schemas.yaml']['WebhookListResponse'];
|
|
66
|
+
CreateWebhookRequest: external['components/schemas.yaml']['CreateWebhookRequest'];
|
|
67
|
+
UpdateWebhookRequest: external['components/schemas.yaml']['UpdateWebhookRequest'];
|
|
68
|
+
EventSubscriptionSummary: external['components/schemas.yaml']['EventSubscriptionSummary'];
|
|
69
|
+
EventSubscriptionDetail: external['components/schemas.yaml']['EventSubscriptionDetail'];
|
|
70
|
+
EventSubscriptionListResponse: external['components/schemas.yaml']['EventSubscriptionListResponse'];
|
|
71
|
+
CreateEventSubscriptionRequest: external['components/schemas.yaml']['CreateEventSubscriptionRequest'];
|
|
72
|
+
UpdateEventSubscriptionRequest: external['components/schemas.yaml']['UpdateEventSubscriptionRequest'];
|
|
62
73
|
};
|
|
63
74
|
responses: never;
|
|
64
75
|
parameters: {
|
|
@@ -83,6 +94,8 @@ type components = {
|
|
|
83
94
|
SearchParam: external['components/parameters.yaml']['SearchParam'];
|
|
84
95
|
FilterParam: external['components/parameters.yaml']['FilterParam'];
|
|
85
96
|
OrParam: external['components/parameters.yaml']['OrParam'];
|
|
97
|
+
WebhookId: external['components/parameters.yaml']['WebhookId'];
|
|
98
|
+
SubscriptionId: external['components/parameters.yaml']['SubscriptionId'];
|
|
86
99
|
};
|
|
87
100
|
requestBodies: never;
|
|
88
101
|
headers: never;
|
|
@@ -206,6 +219,24 @@ type external = {
|
|
|
206
219
|
'paths/voices/voices.yaml': {
|
|
207
220
|
get: unknown;
|
|
208
221
|
};
|
|
222
|
+
'paths/webhooks/webhook-by-id.yaml': {
|
|
223
|
+
get: unknown;
|
|
224
|
+
patch: unknown;
|
|
225
|
+
delete: unknown;
|
|
226
|
+
};
|
|
227
|
+
'paths/webhooks/webhook-subscription-by-id.yaml': {
|
|
228
|
+
get: unknown;
|
|
229
|
+
patch: unknown;
|
|
230
|
+
delete: unknown;
|
|
231
|
+
};
|
|
232
|
+
'paths/webhooks/webhook-subscriptions.yaml': {
|
|
233
|
+
get: unknown;
|
|
234
|
+
post: unknown;
|
|
235
|
+
};
|
|
236
|
+
'paths/webhooks/webhooks.yaml': {
|
|
237
|
+
get: unknown;
|
|
238
|
+
post: unknown;
|
|
239
|
+
};
|
|
209
240
|
'paths/workspaces/workspace-enable.yaml': {
|
|
210
241
|
post: unknown;
|
|
211
242
|
};
|
|
@@ -383,9 +414,20 @@ type ToolResourceListResponse = components['schemas']['ToolResourceListResponse'
|
|
|
383
414
|
type ToolResourceUploadRequest = components['schemas']['ToolResourceUploadRequest'];
|
|
384
415
|
type ToolResourceUploadResponse = components['schemas']['ToolResourceUploadResponse'];
|
|
385
416
|
type ToolResourceReloadResponse = components['schemas']['ToolResourceReloadResponse'];
|
|
417
|
+
type ToolConnectionAuth = components['schemas']['ToolConnectionAuth'];
|
|
386
418
|
type ToolConnectionRequest = components['schemas']['ToolConnectionRequest'];
|
|
387
419
|
type ToolConnectionResponse = components['schemas']['ToolConnectionResponse'];
|
|
388
420
|
type ErrorResponse = components['schemas']['ErrorResponse'];
|
|
421
|
+
type WebhookSummary = components['schemas']['WebhookSummary'];
|
|
422
|
+
type WebhookDetail = components['schemas']['WebhookDetail'];
|
|
423
|
+
type WebhookListResponse = components['schemas']['WebhookListResponse'];
|
|
424
|
+
type CreateWebhookRequest = components['schemas']['CreateWebhookRequest'];
|
|
425
|
+
type UpdateWebhookRequest = components['schemas']['UpdateWebhookRequest'];
|
|
426
|
+
type EventSubscriptionSummary = components['schemas']['EventSubscriptionSummary'];
|
|
427
|
+
type EventSubscriptionDetail = components['schemas']['EventSubscriptionDetail'];
|
|
428
|
+
type EventSubscriptionListResponse = components['schemas']['EventSubscriptionListResponse'];
|
|
429
|
+
type CreateEventSubscriptionRequest = components['schemas']['CreateEventSubscriptionRequest'];
|
|
430
|
+
type UpdateEventSubscriptionRequest = components['schemas']['UpdateEventSubscriptionRequest'];
|
|
389
431
|
|
|
390
432
|
declare class HttpError extends Error {
|
|
391
433
|
status: number;
|
|
@@ -630,6 +672,9 @@ declare function createCatalogsApi(cfg: ClientConfig & {
|
|
|
630
672
|
remove(itemId: string): Promise<void>;
|
|
631
673
|
};
|
|
632
674
|
|
|
675
|
+
type IdempotentRequestOptions = {
|
|
676
|
+
idempotencyKey?: string;
|
|
677
|
+
};
|
|
633
678
|
type ListToolsOptions = ListQueryOptions & {
|
|
634
679
|
agentType?: 'chat' | 'voice';
|
|
635
680
|
};
|
|
@@ -647,8 +692,8 @@ declare function createToolsApi(cfg: ClientConfig & {
|
|
|
647
692
|
uploadResource(toolId: string, payload: UploadToolResourcePayload): Promise<ToolResourceUploadResponse>;
|
|
648
693
|
deleteResource(toolId: string, resourceId: string): Promise<void>;
|
|
649
694
|
reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
|
|
650
|
-
execute(toolId: string, payload: ExecuteToolRequest): Promise<ExecuteToolResponse>;
|
|
651
|
-
connect(toolId: string, payload: ToolConnectionRequest): Promise<ToolConnectionResponse>;
|
|
695
|
+
execute(toolId: string, payload: ExecuteToolRequest, options?: IdempotentRequestOptions): Promise<ExecuteToolResponse>;
|
|
696
|
+
connect(toolId: string, payload: ToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ToolConnectionResponse>;
|
|
652
697
|
};
|
|
653
698
|
|
|
654
699
|
type ListVoicesOptions = ListQueryOptions & {
|
|
@@ -665,6 +710,22 @@ declare function createVoicesApi(cfg: ClientConfig & {
|
|
|
665
710
|
list(options?: ListVoicesOptions): Promise<PaginatedResult<VoiceListResponse, ListVoicesOptions>>;
|
|
666
711
|
};
|
|
667
712
|
|
|
713
|
+
type ListWebhooksOptions = Pick<ListQueryOptions, 'page' | 'limit' | 'sort' | 'fields' | 'include' | 'search' | 'filter'>;
|
|
714
|
+
declare function createWebhooksApi(cfg: ClientConfig & {
|
|
715
|
+
retry?: RetryPolicy;
|
|
716
|
+
}): {
|
|
717
|
+
list(options?: ListWebhooksOptions): Promise<PaginatedResult<WebhookListResponse, ListWebhooksOptions>>;
|
|
718
|
+
create(payload: CreateWebhookRequest): Promise<WebhookDetail>;
|
|
719
|
+
get(webhookId: string): Promise<WebhookDetail>;
|
|
720
|
+
update(webhookId: string, payload: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
721
|
+
delete(webhookId: string): Promise<void>;
|
|
722
|
+
listSubscriptions(webhookId: string, options?: ListWebhooksOptions): Promise<PaginatedResult<EventSubscriptionListResponse, ListWebhooksOptions>>;
|
|
723
|
+
createSubscription(webhookId: string, payload: CreateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
724
|
+
getSubscription(webhookId: string, subscriptionId: string): Promise<EventSubscriptionDetail>;
|
|
725
|
+
updateSubscription(webhookId: string, subscriptionId: string, payload: UpdateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
726
|
+
deleteSubscription(webhookId: string, subscriptionId: string): Promise<void>;
|
|
727
|
+
};
|
|
728
|
+
|
|
668
729
|
type ListWorkspacePhonesOptions = ListQueryOptions & {
|
|
669
730
|
channel?: WorkspacePhoneChannel;
|
|
670
731
|
};
|
|
@@ -773,8 +834,12 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
773
834
|
})): Promise<ToolResourceUploadResponse>;
|
|
774
835
|
deleteResource(toolId: string, resourceId: string): Promise<void>;
|
|
775
836
|
reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
|
|
776
|
-
execute(toolId: string, payload: ExecuteToolRequest
|
|
777
|
-
|
|
837
|
+
execute(toolId: string, payload: ExecuteToolRequest, options?: {
|
|
838
|
+
idempotencyKey?: string;
|
|
839
|
+
}): Promise<ExecuteToolResponse>;
|
|
840
|
+
connect(toolId: string, payload: ToolConnectionRequest, options?: {
|
|
841
|
+
idempotencyKey?: string;
|
|
842
|
+
}): Promise<ToolConnectionResponse>;
|
|
778
843
|
};
|
|
779
844
|
catalogs: {
|
|
780
845
|
list(options?: ListCatalogItemsOptions): Promise<PaginatedResult<CatalogItemListResponse, ListCatalogItemsOptions>>;
|
|
@@ -786,6 +851,18 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
786
851
|
list(options?: ListVoicesOptions): Promise<PaginatedResult<VoiceListResponse, ListVoicesOptions>>;
|
|
787
852
|
};
|
|
788
853
|
apiKeys: ApiKeysApi;
|
|
854
|
+
webhooks: {
|
|
855
|
+
list(options?: ListWebhooksOptions): Promise<PaginatedResult<WebhookListResponse, ListWebhooksOptions>>;
|
|
856
|
+
create(payload: CreateWebhookRequest): Promise<WebhookDetail>;
|
|
857
|
+
get(webhookId: string): Promise<WebhookDetail>;
|
|
858
|
+
update(webhookId: string, payload: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
859
|
+
delete(webhookId: string): Promise<void>;
|
|
860
|
+
listSubscriptions(webhookId: string, options?: ListWebhooksOptions): Promise<PaginatedResult<EventSubscriptionListResponse, ListWebhooksOptions>>;
|
|
861
|
+
createSubscription(webhookId: string, payload: CreateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
862
|
+
getSubscription(webhookId: string, subscriptionId: string): Promise<EventSubscriptionDetail>;
|
|
863
|
+
updateSubscription(webhookId: string, subscriptionId: string, payload: UpdateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
864
|
+
deleteSubscription(webhookId: string, subscriptionId: string): Promise<void>;
|
|
865
|
+
};
|
|
789
866
|
};
|
|
790
867
|
};
|
|
791
868
|
agents: {
|
|
@@ -850,8 +927,12 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
850
927
|
})): Promise<ToolResourceUploadResponse>;
|
|
851
928
|
deleteResource(toolId: string, resourceId: string): Promise<void>;
|
|
852
929
|
reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
|
|
853
|
-
execute(toolId: string, payload: ExecuteToolRequest
|
|
854
|
-
|
|
930
|
+
execute(toolId: string, payload: ExecuteToolRequest, options?: {
|
|
931
|
+
idempotencyKey?: string;
|
|
932
|
+
}): Promise<ExecuteToolResponse>;
|
|
933
|
+
connect(toolId: string, payload: ToolConnectionRequest, options?: {
|
|
934
|
+
idempotencyKey?: string;
|
|
935
|
+
}): Promise<ToolConnectionResponse>;
|
|
855
936
|
};
|
|
856
937
|
catalogs: {
|
|
857
938
|
list(options?: ListCatalogItemsOptions): Promise<PaginatedResult<CatalogItemListResponse, ListCatalogItemsOptions>>;
|
|
@@ -863,6 +944,18 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
863
944
|
list(options?: ListVoicesOptions): Promise<PaginatedResult<VoiceListResponse, ListVoicesOptions>>;
|
|
864
945
|
};
|
|
865
946
|
apiKeys: ApiKeysApi;
|
|
947
|
+
webhooks: {
|
|
948
|
+
list(options?: ListWebhooksOptions): Promise<PaginatedResult<WebhookListResponse, ListWebhooksOptions>>;
|
|
949
|
+
create(payload: CreateWebhookRequest): Promise<WebhookDetail>;
|
|
950
|
+
get(webhookId: string): Promise<WebhookDetail>;
|
|
951
|
+
update(webhookId: string, payload: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
952
|
+
delete(webhookId: string): Promise<void>;
|
|
953
|
+
listSubscriptions(webhookId: string, options?: ListWebhooksOptions): Promise<PaginatedResult<EventSubscriptionListResponse, ListWebhooksOptions>>;
|
|
954
|
+
createSubscription(webhookId: string, payload: CreateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
955
|
+
getSubscription(webhookId: string, subscriptionId: string): Promise<EventSubscriptionDetail>;
|
|
956
|
+
updateSubscription(webhookId: string, subscriptionId: string, payload: UpdateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
957
|
+
deleteSubscription(webhookId: string, subscriptionId: string): Promise<void>;
|
|
958
|
+
};
|
|
866
959
|
};
|
|
867
960
|
|
|
868
961
|
type QueryParamPrimitive = string | number | boolean;
|
|
@@ -888,4 +981,4 @@ declare function createHttp(cfg: ClientConfig & {
|
|
|
888
981
|
resolveAccessToken: () => string;
|
|
889
982
|
};
|
|
890
983
|
|
|
891
|
-
export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateInstructionRequest, type ErrorResponse, type ExecuteToolRequest, type ExecuteToolResponse, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentInstructionsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCatalogItemsOptions, type ListQueryOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWorkspacePhonesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateInstructionRequest, type VoiceListResponse, type VoiceSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, bindAgentBlueprints, bindAgentInstructions, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentInstructionsApi, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWorkspacesApi };
|
|
984
|
+
export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateEventSubscriptionRequest, type CreateInstructionRequest, type CreateWebhookRequest, type ErrorResponse, type EventSubscriptionDetail, type EventSubscriptionListResponse, type EventSubscriptionSummary, type ExecuteToolRequest, type ExecuteToolResponse, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentInstructionsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCatalogItemsOptions, type ListQueryOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWebhooksOptions, type ListWorkspacePhonesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionAuth, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateEventSubscriptionRequest, type UpdateInstructionRequest, type UpdateWebhookRequest, type VoiceListResponse, type VoiceSummary, type WebhookDetail, type WebhookListResponse, type WebhookSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, bindAgentBlueprints, bindAgentInstructions, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentInstructionsApi, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWebhooksApi, createWorkspacesApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ type components = {
|
|
|
49
49
|
ToolResourceReloadResponse: external['components/schemas.yaml']['ToolResourceReloadResponse'];
|
|
50
50
|
ToolConnectionRequest: external['components/schemas.yaml']['ToolConnectionRequest'];
|
|
51
51
|
ToolConnectionResponse: external['components/schemas.yaml']['ToolConnectionResponse'];
|
|
52
|
+
ToolConnectionAuth: external['components/schemas.yaml']['ToolConnectionAuth'];
|
|
52
53
|
ExecuteToolRequest: external['components/schemas.yaml']['ExecuteToolRequest'];
|
|
53
54
|
ExecuteToolResponse: external['components/schemas.yaml']['ExecuteToolResponse'];
|
|
54
55
|
CatalogItemLinks: external['components/schemas.yaml']['CatalogItemLinks'];
|
|
@@ -59,6 +60,16 @@ type components = {
|
|
|
59
60
|
WorkspaceEnableRequest: external['components/schemas.yaml']['WorkspaceEnableRequest'];
|
|
60
61
|
WorkspaceEnableResponse: external['components/schemas.yaml']['WorkspaceEnableResponse'];
|
|
61
62
|
ErrorResponse: external['components/schemas.yaml']['ErrorResponse'];
|
|
63
|
+
WebhookSummary: external['components/schemas.yaml']['WebhookSummary'];
|
|
64
|
+
WebhookDetail: external['components/schemas.yaml']['WebhookDetail'];
|
|
65
|
+
WebhookListResponse: external['components/schemas.yaml']['WebhookListResponse'];
|
|
66
|
+
CreateWebhookRequest: external['components/schemas.yaml']['CreateWebhookRequest'];
|
|
67
|
+
UpdateWebhookRequest: external['components/schemas.yaml']['UpdateWebhookRequest'];
|
|
68
|
+
EventSubscriptionSummary: external['components/schemas.yaml']['EventSubscriptionSummary'];
|
|
69
|
+
EventSubscriptionDetail: external['components/schemas.yaml']['EventSubscriptionDetail'];
|
|
70
|
+
EventSubscriptionListResponse: external['components/schemas.yaml']['EventSubscriptionListResponse'];
|
|
71
|
+
CreateEventSubscriptionRequest: external['components/schemas.yaml']['CreateEventSubscriptionRequest'];
|
|
72
|
+
UpdateEventSubscriptionRequest: external['components/schemas.yaml']['UpdateEventSubscriptionRequest'];
|
|
62
73
|
};
|
|
63
74
|
responses: never;
|
|
64
75
|
parameters: {
|
|
@@ -83,6 +94,8 @@ type components = {
|
|
|
83
94
|
SearchParam: external['components/parameters.yaml']['SearchParam'];
|
|
84
95
|
FilterParam: external['components/parameters.yaml']['FilterParam'];
|
|
85
96
|
OrParam: external['components/parameters.yaml']['OrParam'];
|
|
97
|
+
WebhookId: external['components/parameters.yaml']['WebhookId'];
|
|
98
|
+
SubscriptionId: external['components/parameters.yaml']['SubscriptionId'];
|
|
86
99
|
};
|
|
87
100
|
requestBodies: never;
|
|
88
101
|
headers: never;
|
|
@@ -206,6 +219,24 @@ type external = {
|
|
|
206
219
|
'paths/voices/voices.yaml': {
|
|
207
220
|
get: unknown;
|
|
208
221
|
};
|
|
222
|
+
'paths/webhooks/webhook-by-id.yaml': {
|
|
223
|
+
get: unknown;
|
|
224
|
+
patch: unknown;
|
|
225
|
+
delete: unknown;
|
|
226
|
+
};
|
|
227
|
+
'paths/webhooks/webhook-subscription-by-id.yaml': {
|
|
228
|
+
get: unknown;
|
|
229
|
+
patch: unknown;
|
|
230
|
+
delete: unknown;
|
|
231
|
+
};
|
|
232
|
+
'paths/webhooks/webhook-subscriptions.yaml': {
|
|
233
|
+
get: unknown;
|
|
234
|
+
post: unknown;
|
|
235
|
+
};
|
|
236
|
+
'paths/webhooks/webhooks.yaml': {
|
|
237
|
+
get: unknown;
|
|
238
|
+
post: unknown;
|
|
239
|
+
};
|
|
209
240
|
'paths/workspaces/workspace-enable.yaml': {
|
|
210
241
|
post: unknown;
|
|
211
242
|
};
|
|
@@ -383,9 +414,20 @@ type ToolResourceListResponse = components['schemas']['ToolResourceListResponse'
|
|
|
383
414
|
type ToolResourceUploadRequest = components['schemas']['ToolResourceUploadRequest'];
|
|
384
415
|
type ToolResourceUploadResponse = components['schemas']['ToolResourceUploadResponse'];
|
|
385
416
|
type ToolResourceReloadResponse = components['schemas']['ToolResourceReloadResponse'];
|
|
417
|
+
type ToolConnectionAuth = components['schemas']['ToolConnectionAuth'];
|
|
386
418
|
type ToolConnectionRequest = components['schemas']['ToolConnectionRequest'];
|
|
387
419
|
type ToolConnectionResponse = components['schemas']['ToolConnectionResponse'];
|
|
388
420
|
type ErrorResponse = components['schemas']['ErrorResponse'];
|
|
421
|
+
type WebhookSummary = components['schemas']['WebhookSummary'];
|
|
422
|
+
type WebhookDetail = components['schemas']['WebhookDetail'];
|
|
423
|
+
type WebhookListResponse = components['schemas']['WebhookListResponse'];
|
|
424
|
+
type CreateWebhookRequest = components['schemas']['CreateWebhookRequest'];
|
|
425
|
+
type UpdateWebhookRequest = components['schemas']['UpdateWebhookRequest'];
|
|
426
|
+
type EventSubscriptionSummary = components['schemas']['EventSubscriptionSummary'];
|
|
427
|
+
type EventSubscriptionDetail = components['schemas']['EventSubscriptionDetail'];
|
|
428
|
+
type EventSubscriptionListResponse = components['schemas']['EventSubscriptionListResponse'];
|
|
429
|
+
type CreateEventSubscriptionRequest = components['schemas']['CreateEventSubscriptionRequest'];
|
|
430
|
+
type UpdateEventSubscriptionRequest = components['schemas']['UpdateEventSubscriptionRequest'];
|
|
389
431
|
|
|
390
432
|
declare class HttpError extends Error {
|
|
391
433
|
status: number;
|
|
@@ -630,6 +672,9 @@ declare function createCatalogsApi(cfg: ClientConfig & {
|
|
|
630
672
|
remove(itemId: string): Promise<void>;
|
|
631
673
|
};
|
|
632
674
|
|
|
675
|
+
type IdempotentRequestOptions = {
|
|
676
|
+
idempotencyKey?: string;
|
|
677
|
+
};
|
|
633
678
|
type ListToolsOptions = ListQueryOptions & {
|
|
634
679
|
agentType?: 'chat' | 'voice';
|
|
635
680
|
};
|
|
@@ -647,8 +692,8 @@ declare function createToolsApi(cfg: ClientConfig & {
|
|
|
647
692
|
uploadResource(toolId: string, payload: UploadToolResourcePayload): Promise<ToolResourceUploadResponse>;
|
|
648
693
|
deleteResource(toolId: string, resourceId: string): Promise<void>;
|
|
649
694
|
reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
|
|
650
|
-
execute(toolId: string, payload: ExecuteToolRequest): Promise<ExecuteToolResponse>;
|
|
651
|
-
connect(toolId: string, payload: ToolConnectionRequest): Promise<ToolConnectionResponse>;
|
|
695
|
+
execute(toolId: string, payload: ExecuteToolRequest, options?: IdempotentRequestOptions): Promise<ExecuteToolResponse>;
|
|
696
|
+
connect(toolId: string, payload: ToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ToolConnectionResponse>;
|
|
652
697
|
};
|
|
653
698
|
|
|
654
699
|
type ListVoicesOptions = ListQueryOptions & {
|
|
@@ -665,6 +710,22 @@ declare function createVoicesApi(cfg: ClientConfig & {
|
|
|
665
710
|
list(options?: ListVoicesOptions): Promise<PaginatedResult<VoiceListResponse, ListVoicesOptions>>;
|
|
666
711
|
};
|
|
667
712
|
|
|
713
|
+
type ListWebhooksOptions = Pick<ListQueryOptions, 'page' | 'limit' | 'sort' | 'fields' | 'include' | 'search' | 'filter'>;
|
|
714
|
+
declare function createWebhooksApi(cfg: ClientConfig & {
|
|
715
|
+
retry?: RetryPolicy;
|
|
716
|
+
}): {
|
|
717
|
+
list(options?: ListWebhooksOptions): Promise<PaginatedResult<WebhookListResponse, ListWebhooksOptions>>;
|
|
718
|
+
create(payload: CreateWebhookRequest): Promise<WebhookDetail>;
|
|
719
|
+
get(webhookId: string): Promise<WebhookDetail>;
|
|
720
|
+
update(webhookId: string, payload: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
721
|
+
delete(webhookId: string): Promise<void>;
|
|
722
|
+
listSubscriptions(webhookId: string, options?: ListWebhooksOptions): Promise<PaginatedResult<EventSubscriptionListResponse, ListWebhooksOptions>>;
|
|
723
|
+
createSubscription(webhookId: string, payload: CreateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
724
|
+
getSubscription(webhookId: string, subscriptionId: string): Promise<EventSubscriptionDetail>;
|
|
725
|
+
updateSubscription(webhookId: string, subscriptionId: string, payload: UpdateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
726
|
+
deleteSubscription(webhookId: string, subscriptionId: string): Promise<void>;
|
|
727
|
+
};
|
|
728
|
+
|
|
668
729
|
type ListWorkspacePhonesOptions = ListQueryOptions & {
|
|
669
730
|
channel?: WorkspacePhoneChannel;
|
|
670
731
|
};
|
|
@@ -773,8 +834,12 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
773
834
|
})): Promise<ToolResourceUploadResponse>;
|
|
774
835
|
deleteResource(toolId: string, resourceId: string): Promise<void>;
|
|
775
836
|
reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
|
|
776
|
-
execute(toolId: string, payload: ExecuteToolRequest
|
|
777
|
-
|
|
837
|
+
execute(toolId: string, payload: ExecuteToolRequest, options?: {
|
|
838
|
+
idempotencyKey?: string;
|
|
839
|
+
}): Promise<ExecuteToolResponse>;
|
|
840
|
+
connect(toolId: string, payload: ToolConnectionRequest, options?: {
|
|
841
|
+
idempotencyKey?: string;
|
|
842
|
+
}): Promise<ToolConnectionResponse>;
|
|
778
843
|
};
|
|
779
844
|
catalogs: {
|
|
780
845
|
list(options?: ListCatalogItemsOptions): Promise<PaginatedResult<CatalogItemListResponse, ListCatalogItemsOptions>>;
|
|
@@ -786,6 +851,18 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
786
851
|
list(options?: ListVoicesOptions): Promise<PaginatedResult<VoiceListResponse, ListVoicesOptions>>;
|
|
787
852
|
};
|
|
788
853
|
apiKeys: ApiKeysApi;
|
|
854
|
+
webhooks: {
|
|
855
|
+
list(options?: ListWebhooksOptions): Promise<PaginatedResult<WebhookListResponse, ListWebhooksOptions>>;
|
|
856
|
+
create(payload: CreateWebhookRequest): Promise<WebhookDetail>;
|
|
857
|
+
get(webhookId: string): Promise<WebhookDetail>;
|
|
858
|
+
update(webhookId: string, payload: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
859
|
+
delete(webhookId: string): Promise<void>;
|
|
860
|
+
listSubscriptions(webhookId: string, options?: ListWebhooksOptions): Promise<PaginatedResult<EventSubscriptionListResponse, ListWebhooksOptions>>;
|
|
861
|
+
createSubscription(webhookId: string, payload: CreateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
862
|
+
getSubscription(webhookId: string, subscriptionId: string): Promise<EventSubscriptionDetail>;
|
|
863
|
+
updateSubscription(webhookId: string, subscriptionId: string, payload: UpdateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
864
|
+
deleteSubscription(webhookId: string, subscriptionId: string): Promise<void>;
|
|
865
|
+
};
|
|
789
866
|
};
|
|
790
867
|
};
|
|
791
868
|
agents: {
|
|
@@ -850,8 +927,12 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
850
927
|
})): Promise<ToolResourceUploadResponse>;
|
|
851
928
|
deleteResource(toolId: string, resourceId: string): Promise<void>;
|
|
852
929
|
reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
|
|
853
|
-
execute(toolId: string, payload: ExecuteToolRequest
|
|
854
|
-
|
|
930
|
+
execute(toolId: string, payload: ExecuteToolRequest, options?: {
|
|
931
|
+
idempotencyKey?: string;
|
|
932
|
+
}): Promise<ExecuteToolResponse>;
|
|
933
|
+
connect(toolId: string, payload: ToolConnectionRequest, options?: {
|
|
934
|
+
idempotencyKey?: string;
|
|
935
|
+
}): Promise<ToolConnectionResponse>;
|
|
855
936
|
};
|
|
856
937
|
catalogs: {
|
|
857
938
|
list(options?: ListCatalogItemsOptions): Promise<PaginatedResult<CatalogItemListResponse, ListCatalogItemsOptions>>;
|
|
@@ -863,6 +944,18 @@ declare function createClient(initialCfg: ClientConfig & {
|
|
|
863
944
|
list(options?: ListVoicesOptions): Promise<PaginatedResult<VoiceListResponse, ListVoicesOptions>>;
|
|
864
945
|
};
|
|
865
946
|
apiKeys: ApiKeysApi;
|
|
947
|
+
webhooks: {
|
|
948
|
+
list(options?: ListWebhooksOptions): Promise<PaginatedResult<WebhookListResponse, ListWebhooksOptions>>;
|
|
949
|
+
create(payload: CreateWebhookRequest): Promise<WebhookDetail>;
|
|
950
|
+
get(webhookId: string): Promise<WebhookDetail>;
|
|
951
|
+
update(webhookId: string, payload: UpdateWebhookRequest): Promise<WebhookDetail>;
|
|
952
|
+
delete(webhookId: string): Promise<void>;
|
|
953
|
+
listSubscriptions(webhookId: string, options?: ListWebhooksOptions): Promise<PaginatedResult<EventSubscriptionListResponse, ListWebhooksOptions>>;
|
|
954
|
+
createSubscription(webhookId: string, payload: CreateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
955
|
+
getSubscription(webhookId: string, subscriptionId: string): Promise<EventSubscriptionDetail>;
|
|
956
|
+
updateSubscription(webhookId: string, subscriptionId: string, payload: UpdateEventSubscriptionRequest): Promise<EventSubscriptionDetail>;
|
|
957
|
+
deleteSubscription(webhookId: string, subscriptionId: string): Promise<void>;
|
|
958
|
+
};
|
|
866
959
|
};
|
|
867
960
|
|
|
868
961
|
type QueryParamPrimitive = string | number | boolean;
|
|
@@ -888,4 +981,4 @@ declare function createHttp(cfg: ClientConfig & {
|
|
|
888
981
|
resolveAccessToken: () => string;
|
|
889
982
|
};
|
|
890
983
|
|
|
891
|
-
export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateInstructionRequest, type ErrorResponse, type ExecuteToolRequest, type ExecuteToolResponse, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentInstructionsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCatalogItemsOptions, type ListQueryOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWorkspacePhonesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateInstructionRequest, type VoiceListResponse, type VoiceSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, bindAgentBlueprints, bindAgentInstructions, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentInstructionsApi, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWorkspacesApi };
|
|
984
|
+
export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateEventSubscriptionRequest, type CreateInstructionRequest, type CreateWebhookRequest, type ErrorResponse, type EventSubscriptionDetail, type EventSubscriptionListResponse, type EventSubscriptionSummary, type ExecuteToolRequest, type ExecuteToolResponse, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentInstructionsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCatalogItemsOptions, type ListQueryOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWebhooksOptions, type ListWorkspacePhonesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionAuth, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateEventSubscriptionRequest, type UpdateInstructionRequest, type UpdateWebhookRequest, type VoiceListResponse, type VoiceSummary, type WebhookDetail, type WebhookListResponse, type WebhookSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, bindAgentBlueprints, bindAgentInstructions, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentInstructionsApi, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWebhooksApi, createWorkspacesApi };
|
package/dist/index.js
CHANGED
|
@@ -1093,6 +1093,27 @@ function createCatalogsApi(cfg) {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
|
|
1095
1095
|
// src/api/tools.ts
|
|
1096
|
+
var IDEMPOTENCY_HEADER = "Idempotency-Key";
|
|
1097
|
+
var generateIdempotencyKey = (explicit) => {
|
|
1098
|
+
if (explicit && explicit.length > 0) {
|
|
1099
|
+
return explicit;
|
|
1100
|
+
}
|
|
1101
|
+
const globalRef = globalThis;
|
|
1102
|
+
const cryptoRef = globalRef?.crypto;
|
|
1103
|
+
if (cryptoRef?.randomUUID) {
|
|
1104
|
+
return cryptoRef.randomUUID();
|
|
1105
|
+
}
|
|
1106
|
+
if (cryptoRef?.getRandomValues) {
|
|
1107
|
+
const buffer = new Uint8Array(16);
|
|
1108
|
+
cryptoRef.getRandomValues(buffer);
|
|
1109
|
+
return Array.from(
|
|
1110
|
+
buffer,
|
|
1111
|
+
(byte) => byte.toString(16).padStart(2, "0")
|
|
1112
|
+
).join("");
|
|
1113
|
+
}
|
|
1114
|
+
const randomChunk = () => Math.random().toString(36).slice(2, 10);
|
|
1115
|
+
return `idemp_${Date.now().toString(36)}_${randomChunk()}${randomChunk()}`;
|
|
1116
|
+
};
|
|
1096
1117
|
var isFormData = (value) => {
|
|
1097
1118
|
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
1098
1119
|
};
|
|
@@ -1175,18 +1196,26 @@ function createToolsApi(cfg) {
|
|
|
1175
1196
|
);
|
|
1176
1197
|
return res.json();
|
|
1177
1198
|
},
|
|
1178
|
-
async execute(toolId, payload) {
|
|
1199
|
+
async execute(toolId, payload, options = {}) {
|
|
1200
|
+
const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
|
|
1179
1201
|
const res = await doFetch(`${base}/v1/tools/${toolId}/execute`, {
|
|
1180
1202
|
method: "POST",
|
|
1181
|
-
headers:
|
|
1203
|
+
headers: {
|
|
1204
|
+
...jsonHeaders,
|
|
1205
|
+
[IDEMPOTENCY_HEADER]: idempotencyKey
|
|
1206
|
+
},
|
|
1182
1207
|
body: JSON.stringify(payload)
|
|
1183
1208
|
});
|
|
1184
1209
|
return res.json();
|
|
1185
1210
|
},
|
|
1186
|
-
async connect(toolId, payload) {
|
|
1187
|
-
const
|
|
1211
|
+
async connect(toolId, payload, options = {}) {
|
|
1212
|
+
const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
|
|
1213
|
+
const res = await doFetch(`${base}/v1/tools/${toolId}/connections`, {
|
|
1188
1214
|
method: "POST",
|
|
1189
|
-
headers:
|
|
1215
|
+
headers: {
|
|
1216
|
+
...jsonHeaders,
|
|
1217
|
+
[IDEMPOTENCY_HEADER]: idempotencyKey
|
|
1218
|
+
},
|
|
1190
1219
|
body: JSON.stringify(payload)
|
|
1191
1220
|
});
|
|
1192
1221
|
return res.json();
|
|
@@ -1232,6 +1261,117 @@ function createVoicesApi(cfg) {
|
|
|
1232
1261
|
};
|
|
1233
1262
|
}
|
|
1234
1263
|
|
|
1264
|
+
// src/api/webhooks.ts
|
|
1265
|
+
function createWebhooksApi(cfg) {
|
|
1266
|
+
const { base, doFetch } = createHttp(cfg);
|
|
1267
|
+
const jsonHeaders = { "content-type": "application/json" };
|
|
1268
|
+
const fetchWebhooksPage = async (options = {}) => {
|
|
1269
|
+
const query = serializeListOptions({
|
|
1270
|
+
page: options.page,
|
|
1271
|
+
limit: options.limit,
|
|
1272
|
+
sort: options.sort,
|
|
1273
|
+
fields: options.fields,
|
|
1274
|
+
include: options.include,
|
|
1275
|
+
search: options.search,
|
|
1276
|
+
filter: options.filter
|
|
1277
|
+
});
|
|
1278
|
+
const res = await doFetch(`${base}/v1/webhooks`, {
|
|
1279
|
+
method: "GET",
|
|
1280
|
+
query
|
|
1281
|
+
});
|
|
1282
|
+
return res.json();
|
|
1283
|
+
};
|
|
1284
|
+
return {
|
|
1285
|
+
async list(options = {}) {
|
|
1286
|
+
const normalized = { ...options ?? {} };
|
|
1287
|
+
const response = await fetchWebhooksPage(normalized);
|
|
1288
|
+
return attachPaginator(response, fetchWebhooksPage, normalized);
|
|
1289
|
+
},
|
|
1290
|
+
async create(payload) {
|
|
1291
|
+
const res = await doFetch(`${base}/v1/webhooks`, {
|
|
1292
|
+
method: "POST",
|
|
1293
|
+
headers: jsonHeaders,
|
|
1294
|
+
body: JSON.stringify(payload)
|
|
1295
|
+
});
|
|
1296
|
+
return res.json();
|
|
1297
|
+
},
|
|
1298
|
+
async get(webhookId) {
|
|
1299
|
+
const res = await doFetch(`${base}/v1/webhooks/${webhookId}`, {
|
|
1300
|
+
method: "GET"
|
|
1301
|
+
});
|
|
1302
|
+
return res.json();
|
|
1303
|
+
},
|
|
1304
|
+
async update(webhookId, payload) {
|
|
1305
|
+
const res = await doFetch(`${base}/v1/webhooks/${webhookId}`, {
|
|
1306
|
+
method: "PATCH",
|
|
1307
|
+
headers: jsonHeaders,
|
|
1308
|
+
body: JSON.stringify(payload)
|
|
1309
|
+
});
|
|
1310
|
+
return res.json();
|
|
1311
|
+
},
|
|
1312
|
+
async delete(webhookId) {
|
|
1313
|
+
await doFetch(`${base}/v1/webhooks/${webhookId}`, { method: "DELETE" });
|
|
1314
|
+
},
|
|
1315
|
+
// Subscriptions
|
|
1316
|
+
async listSubscriptions(webhookId, options = {}) {
|
|
1317
|
+
const fetchPage = async (opts) => {
|
|
1318
|
+
const query = serializeListOptions({
|
|
1319
|
+
page: opts.page,
|
|
1320
|
+
limit: opts.limit,
|
|
1321
|
+
sort: opts.sort,
|
|
1322
|
+
fields: opts.fields,
|
|
1323
|
+
include: opts.include,
|
|
1324
|
+
search: opts.search,
|
|
1325
|
+
filter: opts.filter
|
|
1326
|
+
});
|
|
1327
|
+
const res = await doFetch(
|
|
1328
|
+
`${base}/v1/webhooks/${webhookId}/subscriptions`,
|
|
1329
|
+
{ method: "GET", query }
|
|
1330
|
+
);
|
|
1331
|
+
return res.json();
|
|
1332
|
+
};
|
|
1333
|
+
const normalized = { ...options ?? {} };
|
|
1334
|
+
const response = await fetchPage(normalized);
|
|
1335
|
+
return attachPaginator(response, fetchPage, normalized);
|
|
1336
|
+
},
|
|
1337
|
+
async createSubscription(webhookId, payload) {
|
|
1338
|
+
const res = await doFetch(
|
|
1339
|
+
`${base}/v1/webhooks/${webhookId}/subscriptions`,
|
|
1340
|
+
{
|
|
1341
|
+
method: "POST",
|
|
1342
|
+
headers: jsonHeaders,
|
|
1343
|
+
body: JSON.stringify(payload)
|
|
1344
|
+
}
|
|
1345
|
+
);
|
|
1346
|
+
return res.json();
|
|
1347
|
+
},
|
|
1348
|
+
async getSubscription(webhookId, subscriptionId) {
|
|
1349
|
+
const res = await doFetch(
|
|
1350
|
+
`${base}/v1/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1351
|
+
{ method: "GET" }
|
|
1352
|
+
);
|
|
1353
|
+
return res.json();
|
|
1354
|
+
},
|
|
1355
|
+
async updateSubscription(webhookId, subscriptionId, payload) {
|
|
1356
|
+
const res = await doFetch(
|
|
1357
|
+
`${base}/v1/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1358
|
+
{
|
|
1359
|
+
method: "PATCH",
|
|
1360
|
+
headers: jsonHeaders,
|
|
1361
|
+
body: JSON.stringify(payload)
|
|
1362
|
+
}
|
|
1363
|
+
);
|
|
1364
|
+
return res.json();
|
|
1365
|
+
},
|
|
1366
|
+
async deleteSubscription(webhookId, subscriptionId) {
|
|
1367
|
+
await doFetch(
|
|
1368
|
+
`${base}/v1/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1369
|
+
{ method: "DELETE" }
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1235
1375
|
// src/api/workspaces.ts
|
|
1236
1376
|
function createWorkspacesApi(cfg) {
|
|
1237
1377
|
const { base, doFetch } = createHttp(cfg);
|
|
@@ -1313,6 +1453,7 @@ function createClient(initialCfg) {
|
|
|
1313
1453
|
const voicesApi = createVoicesApi(runtimeCfg);
|
|
1314
1454
|
const apiKeysApi = createApiKeysApi(runtimeCfg);
|
|
1315
1455
|
const catalogsApi = createCatalogsApi(runtimeCfg);
|
|
1456
|
+
const webhooksApi = createWebhooksApi(runtimeCfg);
|
|
1316
1457
|
const agentsApi = createAgentsApi(runtimeCfg, {
|
|
1317
1458
|
instructionsApi,
|
|
1318
1459
|
tagsApi,
|
|
@@ -1367,7 +1508,8 @@ function createClient(initialCfg) {
|
|
|
1367
1508
|
tools: createToolsApi(runtimeCfg),
|
|
1368
1509
|
catalogs: catalogsApi,
|
|
1369
1510
|
voices: voicesApi,
|
|
1370
|
-
apiKeys: apiKeysApi
|
|
1511
|
+
apiKeys: apiKeysApi,
|
|
1512
|
+
webhooks: webhooksApi
|
|
1371
1513
|
};
|
|
1372
1514
|
return {
|
|
1373
1515
|
...apis,
|
|
@@ -1450,6 +1592,7 @@ export {
|
|
|
1450
1592
|
createHttp,
|
|
1451
1593
|
createToolsApi,
|
|
1452
1594
|
createVoicesApi,
|
|
1595
|
+
createWebhooksApi,
|
|
1453
1596
|
createWorkspacesApi
|
|
1454
1597
|
};
|
|
1455
1598
|
//# sourceMappingURL=index.js.map
|