@replicer/sdk 0.2.0 → 0.3.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 +32 -2
- package/dist/chunk-CIXVIMX2.js +54 -0
- package/dist/index.cjs +52 -4
- package/dist/index.d.cts +173 -6
- package/dist/index.d.ts +173 -6
- package/dist/index.js +52 -4
- package/dist/tools.cjs +179 -0
- package/dist/tools.d.cts +79 -0
- package/dist/tools.d.ts +79 -0
- package/dist/tools.js +101 -0
- package/dist/{types-CmxwElVc.d.cts → types-DXQsrvOU.d.cts} +324 -5
- package/dist/{types-CmxwElVc.d.ts → types-DXQsrvOU.d.ts} +324 -5
- package/dist/webhooks.cjs +32 -20
- package/dist/webhooks.d.cts +5 -4
- package/dist/webhooks.d.ts +5 -4
- package/dist/webhooks.js +12 -45
- package/package.json +14 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CreatePhoneCallInput, E as EnqueueCallResponse, O as OkResponse,
|
|
2
|
-
export {
|
|
1
|
+
import { C as CreatePhoneCallInput, E as EnqueueCallResponse, S as SimulateInboundCallInput, a as SimulateInboundCallResponse, O as OkResponse, b as CancelCampaignPendingResponse, L as ListCallsParams, P as Page, c as Call, d as CreateCampaignInput, e as Campaign, G as GetCampaignResponse, f as ListCampaignsParams, g as StartCampaignResponse, h as PageParams, i as PhoneNumber, j as ProvisionInboundInput, k as ProvisionInboundResponse, I as ImportPhoneNumberInput, U as UpdatePhoneNumberInput, K as KnowledgeBaseCreateInput, l as KnowledgeBaseSourcesResponse, m as KnowledgeBaseResponse, n as KnowledgeBaseListResponse, o as KnowledgeBaseAddSourcesInput, p as KnowledgeBaseUpdateInput, q as PresignFileInput, r as PresignFileResponse, F as FailFileInput, s as UpdateSourceInput, t as UpdateChunkInput, u as KnowledgeBaseSourceDetail, v as PresignFileDownloadResponse, w as ListContactsParams, x as Contact, y as CreateContactInput, z as CreateContactResponse, A as ListAgentsParams, B as Agent, D as AgentDetail, H as CreateAgentInput, J as UpdateAgentInput, M as Calendar, N as CreateCalendarInput, Q as CalendarDetail, R as UpdateCalendarInput, T as CreateEventTypeInput, V as EventTypeDetail, W as UpdateEventTypeInput, X as ListCalendarEventsParams, Y as CalendarEvent, Z as CreateCalendarEventInput, _ as CreateCalendarEventResponse, $ as UpdateCalendarEventInput, a0 as ListMessagesParams, a1 as Message, a2 as SendSmsInput, a3 as SendMessageResponse, a4 as SendWhatsappInput, a5 as SendEmailInput, a6 as CreateTtsInput, a7 as CreateTtsResponse, a8 as ListTtsParams, a9 as TtsGeneration, aa as CreateWebhookEndpointInput, ab as WebhookEndpointWithSecret, ac as WebhookEndpoint, ad as UpdateWebhookEndpointInput, ae as TestWebhookEndpointInput, af as TestWebhookEndpointResponse, ag as ListWebhookDeliveriesParams, ah as WebhookDelivery, ai as ListWebhookDeliveryAttemptsParams, aj as WebhookDeliveryAttempt, ak as CreateAgentToolInput, al as AgentTool, am as ListAgentToolsParams, an as UpdateAgentToolInput, ao as TestAgentToolInput, ap as TestAgentToolResponse, aq as ListEventsParams, ar as WebhookEvent } from './types-DXQsrvOU.js';
|
|
2
|
+
export { as as AgentTemplate, at as AgentToolConfig, au as AgentType, av as AnyWebhookEvent, aw as ApiErrorCode, ax as CalendarAvailabilitySlot, ay as CalendarEventStatus, az as CalendarType, aA as CallDirection, aB as CallSentiment, aC as CallStatus, aD as CampaignListItem, aE as CampaignStatus, aF as CancelCallInput, aG as CancelCampaignPendingInput, aH as ContactIdentityConflict, aI as ContactIdentityType, aJ as Conversation, aK as ConversationChannel, aL as ConversationStatus, aM as CreateCampaignResponse, aN as DeleteKnowledgeBaseSourceParams, aO as DeletedResource, aP as DeprovisionInboundParams, aQ as DeprovisionInboundRemaining, aR as EventType, aS as EventTypeInput, aT as Int, aU as KnowledgeBaseChunk, aV as KnowledgeBaseRejectedUrl, aW as KnowledgeBaseSourceSummary, aX as KnowledgeBaseStatus, aY as KnowledgeBaseTextSource, aZ as KnowledgeSourceStatus, a_ as KnowledgeSourceType, a$ as MessageChannel, b0 as MessageDirection, b1 as MessageStatus, b2 as OptOut, b3 as OptOutSource, b4 as Pagination, b5 as PhoneNumberType, b6 as ToolCall, b7 as ToolCallResponse, b8 as TtsStatus, b9 as WebhookDeliveryErrorClass, ba as WebhookDeliveryStatus, bb as WebhookEndpointCreatedBy, bc as WebhookEndpointDisabledReason, bd as WebhookEventDataMap, be as WebhookEventEnvelope, bf as WebhookEventType, bg as WebhookTestData } from './types-DXQsrvOU.js';
|
|
3
3
|
|
|
4
4
|
declare const DEFAULT_BASE_URL = "https://api.replicer.ai";
|
|
5
5
|
interface ReplicerOptions {
|
|
@@ -17,6 +17,8 @@ declare class Replicer {
|
|
|
17
17
|
constructor(options: ReplicerOptions);
|
|
18
18
|
readonly call: {
|
|
19
19
|
createPhoneCall: (input: CreatePhoneCallInput) => Promise<EnqueueCallResponse>;
|
|
20
|
+
/** Test keys only: simulates an inbound call to the agent of one of your numbers; `call.ended` and `call.analyzed` follow with `livemode: false`. */
|
|
21
|
+
simulateInbound: (input: SimulateInboundCallInput) => Promise<SimulateInboundCallResponse>;
|
|
20
22
|
cancel: (call_id: string) => Promise<OkResponse>;
|
|
21
23
|
cancelCampaignPending: (campaign_id: string) => Promise<CancelCampaignPendingResponse>;
|
|
22
24
|
list: (params?: ListCallsParams) => Promise<Page<Call>>;
|
|
@@ -35,6 +37,10 @@ declare class Replicer {
|
|
|
35
37
|
list: (params?: PageParams) => Promise<Page<PhoneNumber>>;
|
|
36
38
|
provisionInbound: (input: ProvisionInboundInput) => Promise<ProvisionInboundResponse>;
|
|
37
39
|
deprovisionInbound: (id: string, trunk_id: string, rule_id: string) => Promise<OkResponse>;
|
|
40
|
+
/** Connects a number you own (SIP trunk or forwarding). Live keys only. Not idempotent: a number already connected → `409 conflict`. Search, purchase and release stay in the dashboard. */
|
|
41
|
+
import: (input: ImportPhoneNumberInput) => Promise<PhoneNumber>;
|
|
42
|
+
/** Sets (or clears, with `null`) the fallback number (inbound calls over the concurrent-call limit, or that the agent cannot take, are forwarded there) and/or the inbound agent. Live keys only. */
|
|
43
|
+
update: (id: string, input: UpdatePhoneNumberInput) => Promise<PhoneNumber>;
|
|
38
44
|
};
|
|
39
45
|
readonly knowledgeBase: {
|
|
40
46
|
create: (input: KnowledgeBaseCreateInput) => Promise<KnowledgeBaseSourcesResponse>;
|
|
@@ -58,11 +64,26 @@ declare class Replicer {
|
|
|
58
64
|
create: (input: CreateContactInput) => Promise<CreateContactResponse>;
|
|
59
65
|
};
|
|
60
66
|
readonly agent: {
|
|
61
|
-
list: (params?:
|
|
67
|
+
list: (params?: ListAgentsParams) => Promise<Page<Agent>>;
|
|
68
|
+
get: (id: string) => Promise<AgentDetail>;
|
|
69
|
+
/** Live keys only. Not idempotent. Basic agents only: workflow agents and AI-written prompts stay in the dashboard. */
|
|
70
|
+
create: (input: CreateAgentInput) => Promise<AgentDetail>;
|
|
71
|
+
/** Live keys only. */
|
|
72
|
+
update: (id: string, input: UpdateAgentInput) => Promise<AgentDetail>;
|
|
73
|
+
/** Live keys only. `409 agent_in_use` while a scheduled, running or paused campaign uses the agent. Reactivate with `update`. */
|
|
74
|
+
deactivate: (id: string) => Promise<AgentDetail>;
|
|
62
75
|
};
|
|
63
76
|
readonly calendar: {
|
|
64
77
|
/** Active calendars with their active event types: the source of `calendar_id` and `event_type_id`. */
|
|
65
78
|
listCalendars: (params?: PageParams) => Promise<Page<Calendar>>;
|
|
79
|
+
/** Creates a calendar, optionally with its event types and weekly hours. Not idempotent: a retried create makes a second calendar. */
|
|
80
|
+
create: (input: CreateCalendarInput) => Promise<CalendarDetail>;
|
|
81
|
+
/** Edits a calendar. `availability` replaces all weekly hours; `is_active: false` deactivates it (there is no delete). */
|
|
82
|
+
update: (id: string, input: UpdateCalendarInput) => Promise<CalendarDetail>;
|
|
83
|
+
/** Adds an event type to a calendar. Not idempotent. */
|
|
84
|
+
createEventType: (input: CreateEventTypeInput) => Promise<EventTypeDetail>;
|
|
85
|
+
/** Edits an event type; `is_active: false` deactivates it (there is no delete). */
|
|
86
|
+
updateEventType: (id: string, input: UpdateEventTypeInput) => Promise<EventTypeDetail>;
|
|
66
87
|
listEvents: (params?: ListCalendarEventsParams) => Promise<Page<CalendarEvent>>;
|
|
67
88
|
createEvent: (input: CreateCalendarEventInput) => Promise<CreateCalendarEventResponse>;
|
|
68
89
|
/** Reschedules a confirmed event (`start_time`) and/or edits customer fields, notes and metadata. */
|
|
@@ -100,6 +121,16 @@ declare class Replicer {
|
|
|
100
121
|
/** Sends the event of a delivery again (same event id and body) as a new delivery. Events from the last 30 days only. */
|
|
101
122
|
redeliver: (deliveryId: string) => Promise<WebhookDelivery>;
|
|
102
123
|
};
|
|
124
|
+
readonly agentTool: {
|
|
125
|
+
/** A signed API tool of an agent; requests are signed with the secret of `webhook_endpoint_id`. */
|
|
126
|
+
create: (input: CreateAgentToolInput) => Promise<AgentTool>;
|
|
127
|
+
list: (params: ListAgentToolsParams) => Promise<Page<AgentTool>>;
|
|
128
|
+
get: (id: string) => Promise<AgentTool>;
|
|
129
|
+
update: (id: string, input: UpdateAgentToolInput) => Promise<AgentTool>;
|
|
130
|
+
delete: (id: string) => Promise<OkResponse>;
|
|
131
|
+
/** Sends one signed sample call to the tool URL and reports the outcome. */
|
|
132
|
+
test: (id: string, input?: TestAgentToolInput) => Promise<TestAgentToolResponse>;
|
|
133
|
+
};
|
|
103
134
|
readonly event: {
|
|
104
135
|
/** Events of the last 30 days as delivered (each item is the parsed envelope). */
|
|
105
136
|
list: (params?: ListEventsParams) => Promise<Page<WebhookEvent<Record<string, unknown>>>>;
|
|
@@ -163,6 +194,14 @@ declare const ROUTES: readonly [{
|
|
|
163
194
|
readonly response: "EnqueueCallResponse";
|
|
164
195
|
readonly status: 202;
|
|
165
196
|
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [422, "idempotency_key_reuse"], readonly [429, "rate_limit_exceeded"], readonly [429, "rate_limited"], readonly [502, "bad_gateway"]];
|
|
197
|
+
}, {
|
|
198
|
+
readonly method: "POST";
|
|
199
|
+
readonly path: "/v1/simulate-inbound-call";
|
|
200
|
+
readonly sdk: "call.simulateInbound";
|
|
201
|
+
readonly request: "SimulateInboundCallInput";
|
|
202
|
+
readonly response: "SimulateInboundCallResponse";
|
|
203
|
+
readonly status: 201;
|
|
204
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "conflict"], readonly [422, "idempotency_key_reuse"], readonly [429, "rate_limit_exceeded"], readonly [429, "rate_limited"]];
|
|
166
205
|
}, {
|
|
167
206
|
readonly method: "POST";
|
|
168
207
|
readonly path: "/v1/cancel-call";
|
|
@@ -251,6 +290,22 @@ declare const ROUTES: readonly [{
|
|
|
251
290
|
readonly response: "OkResponse";
|
|
252
291
|
readonly status: 200;
|
|
253
292
|
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"], readonly [502, "bad_gateway"]];
|
|
293
|
+
}, {
|
|
294
|
+
readonly method: "PATCH";
|
|
295
|
+
readonly path: "/v1/update-phone-number/:id";
|
|
296
|
+
readonly sdk: "phoneNumber.update";
|
|
297
|
+
readonly request: "UpdatePhoneNumberInput";
|
|
298
|
+
readonly response: "PhoneNumber";
|
|
299
|
+
readonly status: 200;
|
|
300
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"], readonly [502, "bad_gateway"]];
|
|
301
|
+
}, {
|
|
302
|
+
readonly method: "POST";
|
|
303
|
+
readonly path: "/v1/import-phone-number";
|
|
304
|
+
readonly sdk: "phoneNumber.import";
|
|
305
|
+
readonly request: "ImportPhoneNumberInput";
|
|
306
|
+
readonly response: "PhoneNumber";
|
|
307
|
+
readonly status: 201;
|
|
308
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"], readonly [502, "bad_gateway"]];
|
|
254
309
|
}, {
|
|
255
310
|
readonly method: "POST";
|
|
256
311
|
readonly path: "/v1/create-knowledge-base";
|
|
@@ -391,10 +446,42 @@ declare const ROUTES: readonly [{
|
|
|
391
446
|
readonly method: "GET";
|
|
392
447
|
readonly path: "/v1/list-agents";
|
|
393
448
|
readonly sdk: "agent.list";
|
|
394
|
-
readonly request: "
|
|
449
|
+
readonly request: "ListAgentsParams";
|
|
395
450
|
readonly response: "Page<Agent>";
|
|
396
451
|
readonly status: 200;
|
|
397
452
|
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
|
|
453
|
+
}, {
|
|
454
|
+
readonly method: "GET";
|
|
455
|
+
readonly path: "/v1/get-agent/:id";
|
|
456
|
+
readonly sdk: "agent.get";
|
|
457
|
+
readonly request: "none";
|
|
458
|
+
readonly response: "AgentDetail";
|
|
459
|
+
readonly status: 200;
|
|
460
|
+
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
461
|
+
}, {
|
|
462
|
+
readonly method: "POST";
|
|
463
|
+
readonly path: "/v1/create-agent";
|
|
464
|
+
readonly sdk: "agent.create";
|
|
465
|
+
readonly request: "CreateAgentInput";
|
|
466
|
+
readonly response: "AgentDetail";
|
|
467
|
+
readonly status: 201;
|
|
468
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "quota_exceeded"], readonly [403, "test_mode_unsupported"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"]];
|
|
469
|
+
}, {
|
|
470
|
+
readonly method: "PATCH";
|
|
471
|
+
readonly path: "/v1/update-agent/:id";
|
|
472
|
+
readonly sdk: "agent.update";
|
|
473
|
+
readonly request: "UpdateAgentInput";
|
|
474
|
+
readonly response: "AgentDetail";
|
|
475
|
+
readonly status: 200;
|
|
476
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "quota_exceeded"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "agent_tool_name_conflict"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"]];
|
|
477
|
+
}, {
|
|
478
|
+
readonly method: "POST";
|
|
479
|
+
readonly path: "/v1/deactivate-agent/:id";
|
|
480
|
+
readonly sdk: "agent.deactivate";
|
|
481
|
+
readonly request: "none";
|
|
482
|
+
readonly response: "AgentDetail";
|
|
483
|
+
readonly status: 200;
|
|
484
|
+
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "agent_in_use"], readonly [429, "rate_limit_exceeded"]];
|
|
398
485
|
}, {
|
|
399
486
|
readonly method: "GET";
|
|
400
487
|
readonly path: "/v1/list-calendars";
|
|
@@ -403,6 +490,38 @@ declare const ROUTES: readonly [{
|
|
|
403
490
|
readonly response: "Page<Calendar>";
|
|
404
491
|
readonly status: 200;
|
|
405
492
|
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
|
|
493
|
+
}, {
|
|
494
|
+
readonly method: "POST";
|
|
495
|
+
readonly path: "/v1/create-calendar";
|
|
496
|
+
readonly sdk: "calendar.create";
|
|
497
|
+
readonly request: "CreateCalendarInput";
|
|
498
|
+
readonly response: "CalendarDetail";
|
|
499
|
+
readonly status: 201;
|
|
500
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
|
|
501
|
+
}, {
|
|
502
|
+
readonly method: "PATCH";
|
|
503
|
+
readonly path: "/v1/update-calendar/:id";
|
|
504
|
+
readonly sdk: "calendar.update";
|
|
505
|
+
readonly request: "UpdateCalendarInput";
|
|
506
|
+
readonly response: "CalendarDetail";
|
|
507
|
+
readonly status: 200;
|
|
508
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
509
|
+
}, {
|
|
510
|
+
readonly method: "POST";
|
|
511
|
+
readonly path: "/v1/create-event-type";
|
|
512
|
+
readonly sdk: "calendar.createEventType";
|
|
513
|
+
readonly request: "CreateEventTypeInput";
|
|
514
|
+
readonly response: "EventTypeDetail";
|
|
515
|
+
readonly status: 201;
|
|
516
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
|
|
517
|
+
}, {
|
|
518
|
+
readonly method: "PATCH";
|
|
519
|
+
readonly path: "/v1/update-event-type/:id";
|
|
520
|
+
readonly sdk: "calendar.updateEventType";
|
|
521
|
+
readonly request: "UpdateEventTypeInput";
|
|
522
|
+
readonly response: "EventTypeDetail";
|
|
523
|
+
readonly status: 200;
|
|
524
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
406
525
|
}, {
|
|
407
526
|
readonly method: "GET";
|
|
408
527
|
readonly path: "/v1/list-calendar-events";
|
|
@@ -538,7 +657,7 @@ declare const ROUTES: readonly [{
|
|
|
538
657
|
readonly request: "none";
|
|
539
658
|
readonly response: "OkResponse";
|
|
540
659
|
readonly status: 200;
|
|
541
|
-
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
660
|
+
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "webhook_endpoint_in_use"], readonly [429, "rate_limit_exceeded"]];
|
|
542
661
|
}, {
|
|
543
662
|
readonly method: "POST";
|
|
544
663
|
readonly path: "/v1/rotate-webhook-endpoint-secret/:id";
|
|
@@ -579,6 +698,54 @@ declare const ROUTES: readonly [{
|
|
|
579
698
|
readonly response: "WebhookDelivery";
|
|
580
699
|
readonly status: 201;
|
|
581
700
|
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "conflict"], readonly [409, "redelivery_limit"], readonly [409, "webhook_endpoint_key_revoked"], readonly [429, "rate_limit_exceeded"]];
|
|
701
|
+
}, {
|
|
702
|
+
readonly method: "POST";
|
|
703
|
+
readonly path: "/v1/create-agent-tool";
|
|
704
|
+
readonly sdk: "agentTool.create";
|
|
705
|
+
readonly request: "CreateAgentToolInput";
|
|
706
|
+
readonly response: "AgentTool";
|
|
707
|
+
readonly status: 201;
|
|
708
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "agent_tool_limit"], readonly [409, "agent_tool_name_conflict"], readonly [409, "agent_tool_name_taken"], readonly [409, "conflict"], readonly [422, "idempotency_key_reuse"], readonly [422, "validation_error"], readonly [429, "rate_limit_exceeded"]];
|
|
709
|
+
}, {
|
|
710
|
+
readonly method: "GET";
|
|
711
|
+
readonly path: "/v1/list-agent-tools";
|
|
712
|
+
readonly sdk: "agentTool.list";
|
|
713
|
+
readonly request: "ListAgentToolsParams";
|
|
714
|
+
readonly response: "Page<AgentTool>";
|
|
715
|
+
readonly status: 200;
|
|
716
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
717
|
+
}, {
|
|
718
|
+
readonly method: "GET";
|
|
719
|
+
readonly path: "/v1/get-agent-tool/:id";
|
|
720
|
+
readonly sdk: "agentTool.get";
|
|
721
|
+
readonly request: "none";
|
|
722
|
+
readonly response: "AgentTool";
|
|
723
|
+
readonly status: 200;
|
|
724
|
+
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
725
|
+
}, {
|
|
726
|
+
readonly method: "PATCH";
|
|
727
|
+
readonly path: "/v1/update-agent-tool/:id";
|
|
728
|
+
readonly sdk: "agentTool.update";
|
|
729
|
+
readonly request: "UpdateAgentToolInput";
|
|
730
|
+
readonly response: "AgentTool";
|
|
731
|
+
readonly status: 200;
|
|
732
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "agent_tool_limit"], readonly [409, "agent_tool_name_conflict"], readonly [409, "agent_tool_name_taken"], readonly [422, "validation_error"], readonly [429, "rate_limit_exceeded"]];
|
|
733
|
+
}, {
|
|
734
|
+
readonly method: "DELETE";
|
|
735
|
+
readonly path: "/v1/delete-agent-tool/:id";
|
|
736
|
+
readonly sdk: "agentTool.delete";
|
|
737
|
+
readonly request: "none";
|
|
738
|
+
readonly response: "OkResponse";
|
|
739
|
+
readonly status: 200;
|
|
740
|
+
readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
|
|
741
|
+
}, {
|
|
742
|
+
readonly method: "POST";
|
|
743
|
+
readonly path: "/v1/test-agent-tool/:id";
|
|
744
|
+
readonly sdk: "agentTool.test";
|
|
745
|
+
readonly request: "TestAgentToolInput";
|
|
746
|
+
readonly response: "TestAgentToolResponse";
|
|
747
|
+
readonly status: 200;
|
|
748
|
+
readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"], readonly [429, "rate_limited"]];
|
|
582
749
|
}, {
|
|
583
750
|
readonly method: "GET";
|
|
584
751
|
readonly path: "/v1/list-events";
|
|
@@ -599,4 +766,4 @@ declare const ROUTES: readonly [{
|
|
|
599
766
|
type RouteDef = (typeof ROUTES)[number];
|
|
600
767
|
type SdkMethodName = RouteDef['sdk'];
|
|
601
768
|
|
|
602
|
-
export { Agent, Calendar, CalendarEvent, Call, Campaign, CancelCampaignPendingResponse, Contact, CreateCalendarEventInput, CreateCalendarEventResponse, CreateCampaignInput, CreateContactInput, CreateContactResponse, CreatePhoneCallInput, CreateTtsInput, CreateTtsResponse, CreateWebhookEndpointInput, DEFAULT_BASE_URL, EnqueueCallResponse, FailFileInput, GetCampaignResponse, KnowledgeBaseAddSourcesInput, KnowledgeBaseCreateInput, KnowledgeBaseListResponse, KnowledgeBaseResponse, KnowledgeBaseSourceDetail, KnowledgeBaseSourcesResponse, KnowledgeBaseUpdateInput, ListCalendarEventsParams, ListCallsParams, ListCampaignsParams, ListContactsParams, ListEventsParams, ListMessagesParams, ListTtsParams, ListWebhookDeliveriesParams, ListWebhookDeliveryAttemptsParams, Message, OkResponse, Page, PageParams, PhoneNumber, PresignFileDownloadResponse, PresignFileInput, PresignFileResponse, ProvisionInboundInput, ProvisionInboundResponse, ROUTES, Replicer, ReplicerError, type ReplicerOptions, type RouteDef, type SdkMethodName, SendEmailInput, SendMessageResponse, SendSmsInput, SendWhatsappInput, StartCampaignResponse, TestWebhookEndpointInput, TestWebhookEndpointResponse, TtsGeneration, UpdateCalendarEventInput, UpdateChunkInput, UpdateSourceInput, UpdateWebhookEndpointInput, WebhookDelivery, WebhookDeliveryAttempt, WebhookEndpoint, WebhookEndpointWithSecret, WebhookEvent };
|
|
769
|
+
export { Agent, AgentDetail, AgentTool, Calendar, CalendarDetail, CalendarEvent, Call, Campaign, CancelCampaignPendingResponse, Contact, CreateAgentInput, CreateAgentToolInput, CreateCalendarEventInput, CreateCalendarEventResponse, CreateCalendarInput, CreateCampaignInput, CreateContactInput, CreateContactResponse, CreateEventTypeInput, CreatePhoneCallInput, CreateTtsInput, CreateTtsResponse, CreateWebhookEndpointInput, DEFAULT_BASE_URL, EnqueueCallResponse, EventTypeDetail, FailFileInput, GetCampaignResponse, ImportPhoneNumberInput, KnowledgeBaseAddSourcesInput, KnowledgeBaseCreateInput, KnowledgeBaseListResponse, KnowledgeBaseResponse, KnowledgeBaseSourceDetail, KnowledgeBaseSourcesResponse, KnowledgeBaseUpdateInput, ListAgentToolsParams, ListAgentsParams, ListCalendarEventsParams, ListCallsParams, ListCampaignsParams, ListContactsParams, ListEventsParams, ListMessagesParams, ListTtsParams, ListWebhookDeliveriesParams, ListWebhookDeliveryAttemptsParams, Message, OkResponse, Page, PageParams, PhoneNumber, PresignFileDownloadResponse, PresignFileInput, PresignFileResponse, ProvisionInboundInput, ProvisionInboundResponse, ROUTES, Replicer, ReplicerError, type ReplicerOptions, type RouteDef, type SdkMethodName, SendEmailInput, SendMessageResponse, SendSmsInput, SendWhatsappInput, SimulateInboundCallInput, SimulateInboundCallResponse, StartCampaignResponse, TestAgentToolInput, TestAgentToolResponse, TestWebhookEndpointInput, TestWebhookEndpointResponse, TtsGeneration, UpdateAgentInput, UpdateAgentToolInput, UpdateCalendarEventInput, UpdateCalendarInput, UpdateChunkInput, UpdateEventTypeInput, UpdatePhoneNumberInput, UpdateSourceInput, UpdateWebhookEndpointInput, WebhookDelivery, WebhookDeliveryAttempt, WebhookEndpoint, WebhookEndpointWithSecret, WebhookEvent };
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var ReplicerError = class extends Error {
|
|
|
35
35
|
// src/routes.ts
|
|
36
36
|
var ROUTES = [
|
|
37
37
|
{ method: "POST", path: "/v1/create-phone-call", sdk: "call.createPhoneCall", request: "CreatePhoneCallInput", response: "EnqueueCallResponse", status: 202, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [422, "idempotency_key_reuse"], [429, "rate_limit_exceeded"], [429, "rate_limited"], [502, "bad_gateway"]] },
|
|
38
|
+
{ method: "POST", path: "/v1/simulate-inbound-call", sdk: "call.simulateInbound", request: "SimulateInboundCallInput", response: "SimulateInboundCallResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "conflict"], [422, "idempotency_key_reuse"], [429, "rate_limit_exceeded"], [429, "rate_limited"]] },
|
|
38
39
|
{ method: "POST", path: "/v1/cancel-call", sdk: "call.cancel", request: "CancelCallInput", response: "OkResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
|
|
39
40
|
{ method: "POST", path: "/v1/cancel-campaign-pending", sdk: "call.cancelCampaignPending", request: "CancelCampaignPendingInput", response: "CancelCampaignPendingResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
40
41
|
{ method: "GET", path: "/v1/list-calls", sdk: "call.list", request: "ListCallsParams", response: "Page<Call>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
@@ -46,6 +47,8 @@ var ROUTES = [
|
|
|
46
47
|
{ method: "GET", path: "/v1/list-phone-numbers", sdk: "phoneNumber.list", request: "PageParams", response: "Page<PhoneNumber>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
47
48
|
{ method: "POST", path: "/v1/phone-numbers/inbound", sdk: "phoneNumber.provisionInbound", request: "ProvisionInboundInput", response: "ProvisionInboundResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
|
|
48
49
|
{ method: "DELETE", path: "/v1/phone-numbers/inbound/:id", sdk: "phoneNumber.deprovisionInbound", request: "DeprovisionInboundParams", response: "OkResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
|
|
50
|
+
{ method: "PATCH", path: "/v1/update-phone-number/:id", sdk: "phoneNumber.update", request: "UpdatePhoneNumberInput", response: "PhoneNumber", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
|
|
51
|
+
{ method: "POST", path: "/v1/import-phone-number", sdk: "phoneNumber.import", request: "ImportPhoneNumberInput", response: "PhoneNumber", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [409, "conflict"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
|
|
49
52
|
{ method: "POST", path: "/v1/create-knowledge-base", sdk: "knowledgeBase.create", request: "KnowledgeBaseCreateInput", response: "KnowledgeBaseSourcesResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "quota_exceeded"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
|
|
50
53
|
{ method: "GET", path: "/v1/get-knowledge-base/:id", sdk: "knowledgeBase.retrieve", request: "none", response: "KnowledgeBaseResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
|
|
51
54
|
{ method: "GET", path: "/v1/list-knowledge-bases", sdk: "knowledgeBase.list", request: "none", response: "KnowledgeBaseListResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
|
|
@@ -63,8 +66,16 @@ var ROUTES = [
|
|
|
63
66
|
{ method: "GET", path: "/v1/presign-knowledge-base-file-download/:id/:source_id", sdk: "knowledgeBase.presignFileDownload", request: "none", response: "PresignFileDownloadResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
|
|
64
67
|
{ method: "GET", path: "/v1/list-contacts", sdk: "contact.list", request: "ListContactsParams", response: "Page<Contact>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
65
68
|
{ method: "POST", path: "/v1/create-contact", sdk: "contact.create", request: "CreateContactInput", response: "CreateContactResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
66
|
-
{ method: "GET", path: "/v1/list-agents", sdk: "agent.list", request: "
|
|
69
|
+
{ method: "GET", path: "/v1/list-agents", sdk: "agent.list", request: "ListAgentsParams", response: "Page<Agent>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
70
|
+
{ method: "GET", path: "/v1/get-agent/:id", sdk: "agent.get", request: "none", response: "AgentDetail", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
71
|
+
{ method: "POST", path: "/v1/create-agent", sdk: "agent.create", request: "CreateAgentInput", response: "AgentDetail", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "quota_exceeded"], [403, "test_mode_unsupported"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
|
|
72
|
+
{ method: "PATCH", path: "/v1/update-agent/:id", sdk: "agent.update", request: "UpdateAgentInput", response: "AgentDetail", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "quota_exceeded"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "agent_tool_name_conflict"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
|
|
73
|
+
{ method: "POST", path: "/v1/deactivate-agent/:id", sdk: "agent.deactivate", request: "none", response: "AgentDetail", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "agent_in_use"], [429, "rate_limit_exceeded"]] },
|
|
67
74
|
{ method: "GET", path: "/v1/list-calendars", sdk: "calendar.listCalendars", request: "PageParams", response: "Page<Calendar>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
75
|
+
{ method: "POST", path: "/v1/create-calendar", sdk: "calendar.create", request: "CreateCalendarInput", response: "CalendarDetail", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
76
|
+
{ method: "PATCH", path: "/v1/update-calendar/:id", sdk: "calendar.update", request: "UpdateCalendarInput", response: "CalendarDetail", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
77
|
+
{ method: "POST", path: "/v1/create-event-type", sdk: "calendar.createEventType", request: "CreateEventTypeInput", response: "EventTypeDetail", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
78
|
+
{ method: "PATCH", path: "/v1/update-event-type/:id", sdk: "calendar.updateEventType", request: "UpdateEventTypeInput", response: "EventTypeDetail", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
68
79
|
{ method: "GET", path: "/v1/list-calendar-events", sdk: "calendar.listEvents", request: "ListCalendarEventsParams", response: "Page<CalendarEvent>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
69
80
|
{ method: "POST", path: "/v1/create-calendar-event", sdk: "calendar.createEvent", request: "CreateCalendarEventInput", response: "CreateCalendarEventResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
|
|
70
81
|
{ method: "PATCH", path: "/v1/update-calendar-event/:id", sdk: "calendar.updateEvent", request: "UpdateCalendarEventInput", response: "CalendarEvent", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
|
|
@@ -81,12 +92,18 @@ var ROUTES = [
|
|
|
81
92
|
{ method: "GET", path: "/v1/list-webhook-endpoints", sdk: "webhookEndpoint.list", request: "PageParams", response: "Page<WebhookEndpoint>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
82
93
|
{ method: "GET", path: "/v1/get-webhook-endpoint/:id", sdk: "webhookEndpoint.get", request: "none", response: "WebhookEndpoint", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
83
94
|
{ method: "PATCH", path: "/v1/update-webhook-endpoint/:id", sdk: "webhookEndpoint.update", request: "UpdateWebhookEndpointInput", response: "WebhookEndpoint", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "webhook_endpoint_key_revoked"], [409, "webhook_endpoint_admin_disabled"], [429, "rate_limit_exceeded"]] },
|
|
84
|
-
{ method: "DELETE", path: "/v1/delete-webhook-endpoint/:id", sdk: "webhookEndpoint.delete", request: "none", response: "OkResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
95
|
+
{ method: "DELETE", path: "/v1/delete-webhook-endpoint/:id", sdk: "webhookEndpoint.delete", request: "none", response: "OkResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "webhook_endpoint_in_use"], [429, "rate_limit_exceeded"]] },
|
|
85
96
|
{ method: "POST", path: "/v1/rotate-webhook-endpoint-secret/:id", sdk: "webhookEndpoint.rotateSecret", request: "none", response: "WebhookEndpointWithSecret", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [503, "service_unavailable"]] },
|
|
86
97
|
{ method: "POST", path: "/v1/test-webhook-endpoint/:id", sdk: "webhookEndpoint.test", request: "TestWebhookEndpointInput", response: "TestWebhookEndpointResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [429, "rate_limited"]] },
|
|
87
98
|
{ method: "GET", path: "/v1/list-webhook-deliveries", sdk: "webhookEndpoint.listDeliveries", request: "ListWebhookDeliveriesParams", response: "Page<WebhookDelivery>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
88
99
|
{ method: "GET", path: "/v1/list-webhook-delivery-attempts", sdk: "webhookEndpoint.listDeliveryAttempts", request: "ListWebhookDeliveryAttemptsParams", response: "Page<WebhookDeliveryAttempt>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
89
100
|
{ method: "POST", path: "/v1/redeliver-webhook-delivery/:id", sdk: "webhookEndpoint.redeliver", request: "none", response: "WebhookDelivery", status: 201, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [409, "redelivery_limit"], [409, "webhook_endpoint_key_revoked"], [429, "rate_limit_exceeded"]] },
|
|
101
|
+
{ method: "POST", path: "/v1/create-agent-tool", sdk: "agentTool.create", request: "CreateAgentToolInput", response: "AgentTool", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "agent_tool_limit"], [409, "agent_tool_name_conflict"], [409, "agent_tool_name_taken"], [409, "conflict"], [422, "idempotency_key_reuse"], [422, "validation_error"], [429, "rate_limit_exceeded"]] },
|
|
102
|
+
{ method: "GET", path: "/v1/list-agent-tools", sdk: "agentTool.list", request: "ListAgentToolsParams", response: "Page<AgentTool>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
103
|
+
{ method: "GET", path: "/v1/get-agent-tool/:id", sdk: "agentTool.get", request: "none", response: "AgentTool", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
104
|
+
{ method: "PATCH", path: "/v1/update-agent-tool/:id", sdk: "agentTool.update", request: "UpdateAgentToolInput", response: "AgentTool", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "agent_tool_limit"], [409, "agent_tool_name_conflict"], [409, "agent_tool_name_taken"], [422, "validation_error"], [429, "rate_limit_exceeded"]] },
|
|
105
|
+
{ method: "DELETE", path: "/v1/delete-agent-tool/:id", sdk: "agentTool.delete", request: "none", response: "OkResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
|
|
106
|
+
{ method: "POST", path: "/v1/test-agent-tool/:id", sdk: "agentTool.test", request: "TestAgentToolInput", response: "TestAgentToolResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"], [429, "rate_limited"]] },
|
|
90
107
|
{ method: "GET", path: "/v1/list-events", sdk: "event.list", request: "ListEventsParams", response: "Page<WebhookEventEnvelope>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
|
|
91
108
|
{ method: "GET", path: "/v1/get-event/:id", sdk: "event.get", request: "none", response: "WebhookEventEnvelope", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] }
|
|
92
109
|
];
|
|
@@ -112,6 +129,8 @@ var Replicer = class {
|
|
|
112
129
|
}
|
|
113
130
|
call = {
|
|
114
131
|
createPhoneCall: (input) => this.request("call.createPhoneCall", { body: input }),
|
|
132
|
+
/** Test keys only: simulates an inbound call to the agent of one of your numbers; `call.ended` and `call.analyzed` follow with `livemode: false`. */
|
|
133
|
+
simulateInbound: (input) => this.request("call.simulateInbound", { body: input }),
|
|
115
134
|
cancel: (call_id) => this.request("call.cancel", { body: { call_id } }),
|
|
116
135
|
cancelCampaignPending: (campaign_id) => this.request("call.cancelCampaignPending", { body: { campaign_id } }),
|
|
117
136
|
list: (params) => this.request("call.list", { query: params }),
|
|
@@ -129,7 +148,11 @@ var Replicer = class {
|
|
|
129
148
|
/** Your organization's phone numbers; `id` is the `from_number_id` for `call.createPhoneCall`. */
|
|
130
149
|
list: (params) => this.request("phoneNumber.list", { query: params }),
|
|
131
150
|
provisionInbound: (input) => this.request("phoneNumber.provisionInbound", { body: input }),
|
|
132
|
-
deprovisionInbound: (id, trunk_id, rule_id) => this.request("phoneNumber.deprovisionInbound", { params: { id }, query: { trunk_id, rule_id } })
|
|
151
|
+
deprovisionInbound: (id, trunk_id, rule_id) => this.request("phoneNumber.deprovisionInbound", { params: { id }, query: { trunk_id, rule_id } }),
|
|
152
|
+
/** Connects a number you own (SIP trunk or forwarding). Live keys only. Not idempotent: a number already connected → `409 conflict`. Search, purchase and release stay in the dashboard. */
|
|
153
|
+
import: (input) => this.request("phoneNumber.import", { body: input }),
|
|
154
|
+
/** Sets (or clears, with `null`) the fallback number (inbound calls over the concurrent-call limit, or that the agent cannot take, are forwarded there) and/or the inbound agent. Live keys only. */
|
|
155
|
+
update: (id, input) => this.request("phoneNumber.update", { params: { id }, body: input })
|
|
133
156
|
};
|
|
134
157
|
knowledgeBase = {
|
|
135
158
|
create: (input) => this.request("knowledgeBase.create", { body: input }),
|
|
@@ -172,11 +195,26 @@ var Replicer = class {
|
|
|
172
195
|
create: (input) => this.request("contact.create", { body: input })
|
|
173
196
|
};
|
|
174
197
|
agent = {
|
|
175
|
-
list: (params) => this.request("agent.list", { query: params })
|
|
198
|
+
list: (params) => this.request("agent.list", { query: params }),
|
|
199
|
+
get: (id) => this.request("agent.get", { params: { id } }),
|
|
200
|
+
/** Live keys only. Not idempotent. Basic agents only: workflow agents and AI-written prompts stay in the dashboard. */
|
|
201
|
+
create: (input) => this.request("agent.create", { body: input }),
|
|
202
|
+
/** Live keys only. */
|
|
203
|
+
update: (id, input) => this.request("agent.update", { params: { id }, body: input }),
|
|
204
|
+
/** Live keys only. `409 agent_in_use` while a scheduled, running or paused campaign uses the agent. Reactivate with `update`. */
|
|
205
|
+
deactivate: (id) => this.request("agent.deactivate", { params: { id }, body: {} })
|
|
176
206
|
};
|
|
177
207
|
calendar = {
|
|
178
208
|
/** Active calendars with their active event types: the source of `calendar_id` and `event_type_id`. */
|
|
179
209
|
listCalendars: (params) => this.request("calendar.listCalendars", { query: params }),
|
|
210
|
+
/** Creates a calendar, optionally with its event types and weekly hours. Not idempotent: a retried create makes a second calendar. */
|
|
211
|
+
create: (input) => this.request("calendar.create", { body: input }),
|
|
212
|
+
/** Edits a calendar. `availability` replaces all weekly hours; `is_active: false` deactivates it (there is no delete). */
|
|
213
|
+
update: (id, input) => this.request("calendar.update", { params: { id }, body: input }),
|
|
214
|
+
/** Adds an event type to a calendar. Not idempotent. */
|
|
215
|
+
createEventType: (input) => this.request("calendar.createEventType", { body: input }),
|
|
216
|
+
/** Edits an event type; `is_active: false` deactivates it (there is no delete). */
|
|
217
|
+
updateEventType: (id, input) => this.request("calendar.updateEventType", { params: { id }, body: input }),
|
|
180
218
|
listEvents: (params) => this.request("calendar.listEvents", { query: params }),
|
|
181
219
|
createEvent: (input) => this.request("calendar.createEvent", { body: input }),
|
|
182
220
|
/** Reschedules a confirmed event (`start_time`) and/or edits customer fields, notes and metadata. */
|
|
@@ -214,6 +252,16 @@ var Replicer = class {
|
|
|
214
252
|
/** Sends the event of a delivery again (same event id and body) as a new delivery. Events from the last 30 days only. */
|
|
215
253
|
redeliver: (deliveryId) => this.request("webhookEndpoint.redeliver", { params: { id: deliveryId }, body: {} })
|
|
216
254
|
};
|
|
255
|
+
agentTool = {
|
|
256
|
+
/** A signed API tool of an agent; requests are signed with the secret of `webhook_endpoint_id`. */
|
|
257
|
+
create: (input) => this.request("agentTool.create", { body: input }),
|
|
258
|
+
list: (params) => this.request("agentTool.list", { query: params }),
|
|
259
|
+
get: (id) => this.request("agentTool.get", { params: { id } }),
|
|
260
|
+
update: (id, input) => this.request("agentTool.update", { params: { id }, body: input }),
|
|
261
|
+
delete: (id) => this.request("agentTool.delete", { params: { id } }),
|
|
262
|
+
/** Sends one signed sample call to the tool URL and reports the outcome. */
|
|
263
|
+
test: (id, input) => this.request("agentTool.test", { params: { id }, body: input ?? {} })
|
|
264
|
+
};
|
|
217
265
|
event = {
|
|
218
266
|
/** Events of the last 30 days as delivered (each item is the parsed envelope). */
|
|
219
267
|
list: (params) => this.request("event.list", { query: params }),
|
package/dist/tools.cjs
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/tools.ts
|
|
21
|
+
var tools_exports = {};
|
|
22
|
+
__export(tools_exports, {
|
|
23
|
+
DEFAULT_TOOL_TOLERANCE_SECONDS: () => DEFAULT_TOOL_TOLERANCE_SECONDS,
|
|
24
|
+
TOOL_CALL_ID_HEADER: () => TOOL_CALL_ID_HEADER,
|
|
25
|
+
TOOL_NAME_HEADER: () => TOOL_NAME_HEADER,
|
|
26
|
+
TOOL_SIGNATURE_HEADER: () => TOOL_SIGNATURE_HEADER,
|
|
27
|
+
ToolSignatureError: () => ToolSignatureError,
|
|
28
|
+
createToolCallProcessor: () => createToolCallProcessor,
|
|
29
|
+
createToolHandler: () => createToolHandler,
|
|
30
|
+
handleToolCall: () => handleToolCall,
|
|
31
|
+
verifyToolCall: () => verifyToolCall
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(tools_exports);
|
|
34
|
+
|
|
35
|
+
// src/signature.ts
|
|
36
|
+
var import_node_crypto = require("crypto");
|
|
37
|
+
var SIGNATURE_HEADER = "Replicer-Signature";
|
|
38
|
+
var DEFAULT_TOLERANCE_SECONDS = 300;
|
|
39
|
+
var HEX_SHA256 = /^[0-9a-f]{64}$/i;
|
|
40
|
+
var UNIX_SECONDS = /^\d{1,12}$/;
|
|
41
|
+
function parseHeader(header) {
|
|
42
|
+
let timestamp = null;
|
|
43
|
+
const signatures = [];
|
|
44
|
+
for (const part of header.split(",")) {
|
|
45
|
+
const eq = part.indexOf("=");
|
|
46
|
+
if (eq <= 0) continue;
|
|
47
|
+
const key = part.slice(0, eq).trim();
|
|
48
|
+
const value = part.slice(eq + 1).trim();
|
|
49
|
+
if (key === "t") {
|
|
50
|
+
if (timestamp !== null || !UNIX_SECONDS.test(value)) return null;
|
|
51
|
+
timestamp = Number(value);
|
|
52
|
+
} else if (key === "v1" && HEX_SHA256.test(value)) {
|
|
53
|
+
signatures.push(Buffer.from(value, "hex"));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (timestamp === null || signatures.length === 0) return null;
|
|
57
|
+
return { timestamp, signatures };
|
|
58
|
+
}
|
|
59
|
+
function sign(secret, timestamp, payload) {
|
|
60
|
+
return (0, import_node_crypto.createHmac)("sha256", secret).update(`${timestamp}.`).update(payload).digest();
|
|
61
|
+
}
|
|
62
|
+
function verifySignatureHeader(input) {
|
|
63
|
+
if (!input || typeof input.header !== "string") return false;
|
|
64
|
+
const payload = input.payload;
|
|
65
|
+
if (typeof payload !== "string" && !(payload instanceof Uint8Array)) return false;
|
|
66
|
+
const secrets = [input.secret, ...Array.isArray(input.secrets) ? input.secrets : []].filter((s) => typeof s === "string" && s !== "");
|
|
67
|
+
if (secrets.length === 0) return false;
|
|
68
|
+
const parsed = parseHeader(input.header);
|
|
69
|
+
if (!parsed) return false;
|
|
70
|
+
const tolerance = typeof input.toleranceSeconds === "number" && Number.isFinite(input.toleranceSeconds) && input.toleranceSeconds >= 0 ? input.toleranceSeconds : DEFAULT_TOLERANCE_SECONDS;
|
|
71
|
+
const nowMs = (input.now ?? /* @__PURE__ */ new Date()).getTime();
|
|
72
|
+
if (!Number.isFinite(nowMs)) return false;
|
|
73
|
+
if (Math.abs(nowMs / 1e3 - parsed.timestamp) > tolerance) return false;
|
|
74
|
+
let match = false;
|
|
75
|
+
for (const secret of secrets) {
|
|
76
|
+
const expected = sign(secret, parsed.timestamp, payload);
|
|
77
|
+
for (const received of parsed.signatures) {
|
|
78
|
+
if ((0, import_node_crypto.timingSafeEqual)(expected, received)) match = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return match;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/tools.ts
|
|
85
|
+
var TOOL_SIGNATURE_HEADER = SIGNATURE_HEADER;
|
|
86
|
+
var TOOL_CALL_ID_HEADER = "Replicer-Tool-Call-Id";
|
|
87
|
+
var TOOL_NAME_HEADER = "Replicer-Tool-Name";
|
|
88
|
+
var DEFAULT_TOOL_TOLERANCE_SECONDS = DEFAULT_TOLERANCE_SECONDS;
|
|
89
|
+
var ToolSignatureError = class extends Error {
|
|
90
|
+
constructor(message) {
|
|
91
|
+
super(message);
|
|
92
|
+
this.name = "ToolSignatureError";
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
function verifyToolCall(input) {
|
|
96
|
+
if (!verifySignatureHeader(input)) {
|
|
97
|
+
throw new ToolSignatureError("Invalid tool call signature");
|
|
98
|
+
}
|
|
99
|
+
const text = typeof input.payload === "string" ? input.payload : new TextDecoder().decode(input.payload);
|
|
100
|
+
let parsed;
|
|
101
|
+
try {
|
|
102
|
+
parsed = JSON.parse(text);
|
|
103
|
+
} catch {
|
|
104
|
+
throw new ToolSignatureError("Tool call payload is not valid JSON");
|
|
105
|
+
}
|
|
106
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
107
|
+
throw new ToolSignatureError("Tool call payload is not a JSON object");
|
|
108
|
+
}
|
|
109
|
+
const call = parsed;
|
|
110
|
+
if (call.object !== "tool_call" || typeof call.tool?.name !== "string") {
|
|
111
|
+
throw new ToolSignatureError("Payload is not a tool call");
|
|
112
|
+
}
|
|
113
|
+
return call;
|
|
114
|
+
}
|
|
115
|
+
function readHeader(headers, name) {
|
|
116
|
+
if (typeof headers.get === "function") {
|
|
117
|
+
return headers.get(name) ?? void 0;
|
|
118
|
+
}
|
|
119
|
+
const wanted = name.toLowerCase();
|
|
120
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
121
|
+
if (key.toLowerCase() === wanted) return Array.isArray(value) ? value.join(",") : value;
|
|
122
|
+
}
|
|
123
|
+
return void 0;
|
|
124
|
+
}
|
|
125
|
+
function createToolCallProcessor(options) {
|
|
126
|
+
return async ({ rawBody, headers, now }) => {
|
|
127
|
+
let call;
|
|
128
|
+
try {
|
|
129
|
+
call = verifyToolCall({
|
|
130
|
+
payload: rawBody,
|
|
131
|
+
header: readHeader(headers, SIGNATURE_HEADER),
|
|
132
|
+
secret: options.secret,
|
|
133
|
+
secrets: options.secrets,
|
|
134
|
+
toleranceSeconds: options.toleranceSeconds,
|
|
135
|
+
now
|
|
136
|
+
});
|
|
137
|
+
} catch {
|
|
138
|
+
return { status: 401, body: { error: "Invalid signature", code: "invalid_signature" } };
|
|
139
|
+
}
|
|
140
|
+
const fn = Object.prototype.hasOwnProperty.call(options.tools, call.tool.name) ? options.tools[call.tool.name] : void 0;
|
|
141
|
+
if (!fn) {
|
|
142
|
+
return { status: 404, body: { error: "Unknown tool", code: "unknown_tool" } };
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const result = await fn(call.arguments, call);
|
|
146
|
+
return { status: 200, body: { result: result === void 0 ? null : result } };
|
|
147
|
+
} catch (error) {
|
|
148
|
+
try {
|
|
149
|
+
options.onError?.(error, call);
|
|
150
|
+
} catch {
|
|
151
|
+
}
|
|
152
|
+
return { status: 500, body: { error: "Tool failed", code: "tool_error" } };
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function handleToolCall(input) {
|
|
157
|
+
const { rawBody, headers, now, ...options } = input;
|
|
158
|
+
return createToolCallProcessor(options)({ rawBody, headers, now });
|
|
159
|
+
}
|
|
160
|
+
function createToolHandler(options) {
|
|
161
|
+
const process = createToolCallProcessor(options);
|
|
162
|
+
return async (request) => {
|
|
163
|
+
const rawBody = new Uint8Array(await request.arrayBuffer());
|
|
164
|
+
const { status, body } = await process({ rawBody, headers: request.headers });
|
|
165
|
+
return new Response(JSON.stringify(body), { status, headers: { "Content-Type": "application/json" } });
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
169
|
+
0 && (module.exports = {
|
|
170
|
+
DEFAULT_TOOL_TOLERANCE_SECONDS,
|
|
171
|
+
TOOL_CALL_ID_HEADER,
|
|
172
|
+
TOOL_NAME_HEADER,
|
|
173
|
+
TOOL_SIGNATURE_HEADER,
|
|
174
|
+
ToolSignatureError,
|
|
175
|
+
createToolCallProcessor,
|
|
176
|
+
createToolHandler,
|
|
177
|
+
handleToolCall,
|
|
178
|
+
verifyToolCall
|
|
179
|
+
});
|