agentphone 1.0.2 → 1.0.3
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +18 -8
- package/dist/cjs/api/resources/agentWebhooks/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/agentWebhooks/client/Client.js +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +20 -2
- package/dist/cjs/api/resources/agents/client/Client.js +56 -2
- package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -0
- package/dist/cjs/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.d.ts +11 -0
- package/dist/cjs/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.js +3 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +1 -0
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/calls/client/Client.d.ts +27 -3
- package/dist/cjs/api/resources/calls/client/Client.js +68 -4
- package/dist/cjs/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.ts +8 -0
- package/dist/cjs/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.d.ts +9 -0
- package/dist/cjs/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +94 -0
- package/dist/cjs/api/resources/contacts/client/Client.js +341 -0
- package/dist/cjs/api/resources/contacts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/contacts/client/index.js +17 -0
- package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +13 -0
- package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.js +3 -0
- package/dist/cjs/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.js +3 -0
- package/dist/cjs/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.js +3 -0
- package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.js +3 -0
- package/dist/cjs/api/resources/contacts/client/requests/UpdateContactRequest.d.ts +13 -0
- package/dist/cjs/api/resources/contacts/client/requests/UpdateContactRequest.js +3 -0
- package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +5 -0
- package/dist/cjs/api/resources/contacts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/contacts/index.d.ts +1 -0
- package/dist/cjs/api/resources/contacts/index.js +17 -0
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/conversations/client/Client.js +1 -1
- package/dist/cjs/api/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/index.js +5 -1
- package/dist/cjs/api/resources/messages/client/Client.d.ts +49 -0
- package/dist/cjs/api/resources/messages/client/Client.js +183 -0
- package/dist/cjs/api/resources/messages/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/client/index.js +17 -0
- package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +15 -0
- package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.js +3 -0
- package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.d.ts +11 -0
- package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.js +3 -0
- package/dist/cjs/api/resources/messages/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/messages/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/messages/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/index.js +17 -0
- package/dist/cjs/api/resources/numbers/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/numbers/client/Client.js +1 -1
- package/dist/cjs/api/resources/usage/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/usage/client/Client.js +1 -1
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/webhooks/client/Client.js +6 -6
- package/dist/cjs/api/types/AgentNumberResponse.d.ts +1 -0
- package/dist/cjs/api/types/AgentResponse.d.ts +1 -0
- package/dist/cjs/api/types/CallSummary.d.ts +1 -1
- package/dist/cjs/api/types/ContactListResponse.d.ts +6 -0
- package/dist/cjs/api/types/ContactListResponse.js +3 -0
- package/dist/cjs/api/types/ContactResponse.d.ts +9 -0
- package/dist/cjs/api/types/ContactResponse.js +3 -0
- package/dist/cjs/api/types/MessageInConversation.d.ts +2 -0
- package/dist/cjs/api/types/MessageResponse.d.ts +2 -0
- package/dist/cjs/api/types/PhoneNumberResponse.d.ts +1 -0
- package/dist/cjs/api/types/SendMessageResponse.d.ts +7 -0
- package/dist/cjs/api/types/SendMessageResponse.js +3 -0
- package/dist/cjs/api/types/SendReactionResponse.d.ts +6 -0
- package/dist/cjs/api/types/SendReactionResponse.js +3 -0
- package/dist/cjs/api/types/WebhookCreateRequest.d.ts +1 -0
- package/dist/cjs/api/types/WebhookResponse.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +10 -0
- package/dist/esm/api/resources/agentWebhooks/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/agentWebhooks/client/Client.mjs +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +20 -2
- package/dist/esm/api/resources/agents/client/Client.mjs +56 -2
- package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +1 -0
- package/dist/esm/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.d.mts +11 -0
- package/dist/esm/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.mjs +2 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +1 -0
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/calls/client/Client.d.mts +27 -3
- package/dist/esm/api/resources/calls/client/Client.mjs +68 -4
- package/dist/esm/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.mts +8 -0
- package/dist/esm/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.d.mts +9 -0
- package/dist/esm/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/contacts/client/Client.d.mts +94 -0
- package/dist/esm/api/resources/contacts/client/Client.mjs +304 -0
- package/dist/esm/api/resources/contacts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/contacts/client/index.mjs +1 -0
- package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +13 -0
- package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.mjs +2 -0
- package/dist/esm/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.mjs +2 -0
- package/dist/esm/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.mjs +2 -0
- package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.mjs +2 -0
- package/dist/esm/api/resources/contacts/client/requests/UpdateContactRequest.d.mts +13 -0
- package/dist/esm/api/resources/contacts/client/requests/UpdateContactRequest.mjs +2 -0
- package/dist/esm/api/resources/contacts/client/requests/index.d.mts +5 -0
- package/dist/esm/api/resources/contacts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/contacts/index.d.mts +1 -0
- package/dist/esm/api/resources/contacts/index.mjs +1 -0
- package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/conversations/client/Client.mjs +1 -1
- package/dist/esm/api/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/index.mjs +4 -0
- package/dist/esm/api/resources/messages/client/Client.d.mts +49 -0
- package/dist/esm/api/resources/messages/client/Client.mjs +146 -0
- package/dist/esm/api/resources/messages/client/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/client/index.mjs +1 -0
- package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +15 -0
- package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.mjs +2 -0
- package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.d.mts +11 -0
- package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.mjs +2 -0
- package/dist/esm/api/resources/messages/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/messages/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/messages/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/index.mjs +1 -0
- package/dist/esm/api/resources/numbers/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/numbers/client/Client.mjs +1 -1
- package/dist/esm/api/resources/usage/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/usage/client/Client.mjs +1 -1
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/webhooks/client/Client.mjs +6 -6
- package/dist/esm/api/types/AgentNumberResponse.d.mts +1 -0
- package/dist/esm/api/types/AgentResponse.d.mts +1 -0
- package/dist/esm/api/types/CallSummary.d.mts +1 -1
- package/dist/esm/api/types/ContactListResponse.d.mts +6 -0
- package/dist/esm/api/types/ContactListResponse.mjs +2 -0
- package/dist/esm/api/types/ContactResponse.d.mts +9 -0
- package/dist/esm/api/types/ContactResponse.mjs +2 -0
- package/dist/esm/api/types/MessageInConversation.d.mts +2 -0
- package/dist/esm/api/types/MessageResponse.d.mts +2 -0
- package/dist/esm/api/types/PhoneNumberResponse.d.mts +1 -0
- package/dist/esm/api/types/SendMessageResponse.d.mts +7 -0
- package/dist/esm/api/types/SendMessageResponse.mjs +2 -0
- package/dist/esm/api/types/SendReactionResponse.d.mts +6 -0
- package/dist/esm/api/types/SendReactionResponse.mjs +2 -0
- package/dist/esm/api/types/WebhookCreateRequest.d.mts +1 -0
- package/dist/esm/api/types/WebhookResponse.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +737 -126
package/dist/esm/Client.mjs
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { AgentsClient } from "./api/resources/agents/client/Client.mjs";
|
|
3
3
|
import { AgentWebhooksClient } from "./api/resources/agentWebhooks/client/Client.mjs";
|
|
4
4
|
import { CallsClient } from "./api/resources/calls/client/Client.mjs";
|
|
5
|
+
import { ContactsClient } from "./api/resources/contacts/client/Client.mjs";
|
|
5
6
|
import { ConversationsClient } from "./api/resources/conversations/client/Client.mjs";
|
|
7
|
+
import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
|
|
6
8
|
import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
|
|
7
9
|
import { UsageClient } from "./api/resources/usage/client/Client.mjs";
|
|
8
10
|
import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
|
|
@@ -27,6 +29,10 @@ export class AgentPhoneClient {
|
|
|
27
29
|
var _a;
|
|
28
30
|
return ((_a = this._agentWebhooks) !== null && _a !== void 0 ? _a : (this._agentWebhooks = new AgentWebhooksClient(this._options)));
|
|
29
31
|
}
|
|
32
|
+
get contacts() {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new ContactsClient(this._options)));
|
|
35
|
+
}
|
|
30
36
|
get conversations() {
|
|
31
37
|
var _a;
|
|
32
38
|
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new ConversationsClient(this._options)));
|
|
@@ -39,4 +45,8 @@ export class AgentPhoneClient {
|
|
|
39
45
|
var _a;
|
|
40
46
|
return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new UsageClient(this._options)));
|
|
41
47
|
}
|
|
48
|
+
get messages() {
|
|
49
|
+
var _a;
|
|
50
|
+
return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new MessagesClient(this._options)));
|
|
51
|
+
}
|
|
42
52
|
}
|
|
@@ -28,7 +28,7 @@ export declare class AgentWebhooksClient {
|
|
|
28
28
|
/**
|
|
29
29
|
* Register or update a webhook URL for a specific agent.
|
|
30
30
|
*
|
|
31
|
-
* When set, this agent's events are delivered here instead of the
|
|
31
|
+
* When set, this agent's events are delivered here instead of the account default webhook.
|
|
32
32
|
*
|
|
33
33
|
* @param {AgentPhone.CreateOrUpdateAgentWebhookV1AgentsAgentIdWebhookPostRequest} request
|
|
34
34
|
* @param {AgentWebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -73,7 +73,7 @@ export class AgentWebhooksClient {
|
|
|
73
73
|
/**
|
|
74
74
|
* Register or update a webhook URL for a specific agent.
|
|
75
75
|
*
|
|
76
|
-
* When set, this agent's events are delivered here instead of the
|
|
76
|
+
* When set, this agent's events are delivered here instead of the account default webhook.
|
|
77
77
|
*
|
|
78
78
|
* @param {AgentPhone.CreateOrUpdateAgentWebhookV1AgentsAgentIdWebhookPostRequest} request
|
|
79
79
|
* @param {AgentWebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -11,7 +11,7 @@ export declare class AgentsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
|
|
12
12
|
constructor(options: AgentsClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* List all agents for this
|
|
14
|
+
* List all agents for this account.
|
|
15
15
|
*
|
|
16
16
|
* @param {AgentPhone.ListAgentsV1AgentsGetRequest} request
|
|
17
17
|
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -98,7 +98,7 @@ export declare class AgentsClient {
|
|
|
98
98
|
/**
|
|
99
99
|
* Attach an existing phone number to an agent.
|
|
100
100
|
*
|
|
101
|
-
* The number must belong to the same
|
|
101
|
+
* The number must belong to the same account and not be released.
|
|
102
102
|
*
|
|
103
103
|
* @param {AgentPhone.AttachNumberRequest} request
|
|
104
104
|
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -113,6 +113,24 @@ export declare class AgentsClient {
|
|
|
113
113
|
*/
|
|
114
114
|
attachNumberToAgent(request: AgentPhone.AttachNumberRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.AttachNumberResponse>;
|
|
115
115
|
private __attachNumberToAgent;
|
|
116
|
+
/**
|
|
117
|
+
* Detach a phone number from an agent (sets agentId to null).
|
|
118
|
+
*
|
|
119
|
+
* The number remains active and can be re-attached to any agent.
|
|
120
|
+
*
|
|
121
|
+
* @param {AgentPhone.DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest} request
|
|
122
|
+
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
123
|
+
*
|
|
124
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* await client.agents.detachNumberFromAgent({
|
|
128
|
+
* agent_id: "agent_id",
|
|
129
|
+
* number_id: "number_id"
|
|
130
|
+
* })
|
|
131
|
+
*/
|
|
132
|
+
detachNumberFromAgent(request: AgentPhone.DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
133
|
+
private __detachNumberFromAgent;
|
|
116
134
|
/**
|
|
117
135
|
* List all conversations for an agent.
|
|
118
136
|
*
|
|
@@ -31,7 +31,7 @@ export class AgentsClient {
|
|
|
31
31
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* List all agents for this
|
|
34
|
+
* List all agents for this account.
|
|
35
35
|
*
|
|
36
36
|
* @param {AgentPhone.ListAgentsV1AgentsGetRequest} request
|
|
37
37
|
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -307,7 +307,7 @@ export class AgentsClient {
|
|
|
307
307
|
/**
|
|
308
308
|
* Attach an existing phone number to an agent.
|
|
309
309
|
*
|
|
310
|
-
* The number must belong to the same
|
|
310
|
+
* The number must belong to the same account and not be released.
|
|
311
311
|
*
|
|
312
312
|
* @param {AgentPhone.AttachNumberRequest} request
|
|
313
313
|
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -361,6 +361,60 @@ export class AgentsClient {
|
|
|
361
361
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/agents/{agent_id}/numbers");
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Detach a phone number from an agent (sets agentId to null).
|
|
366
|
+
*
|
|
367
|
+
* The number remains active and can be re-attached to any agent.
|
|
368
|
+
*
|
|
369
|
+
* @param {AgentPhone.DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest} request
|
|
370
|
+
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
371
|
+
*
|
|
372
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* await client.agents.detachNumberFromAgent({
|
|
376
|
+
* agent_id: "agent_id",
|
|
377
|
+
* number_id: "number_id"
|
|
378
|
+
* })
|
|
379
|
+
*/
|
|
380
|
+
detachNumberFromAgent(request, requestOptions) {
|
|
381
|
+
return core.HttpResponsePromise.fromPromise(this.__detachNumberFromAgent(request, requestOptions));
|
|
382
|
+
}
|
|
383
|
+
__detachNumberFromAgent(request, requestOptions) {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
386
|
+
const { agent_id: agentId, number_id: numberId } = request;
|
|
387
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
388
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
389
|
+
const _response = yield core.fetcher({
|
|
390
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/agents/${core.url.encodePathParam(agentId)}/numbers/${core.url.encodePathParam(numberId)}`),
|
|
391
|
+
method: "DELETE",
|
|
392
|
+
headers: _headers,
|
|
393
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
394
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
395
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
396
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
397
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
398
|
+
logging: this._options.logging,
|
|
399
|
+
});
|
|
400
|
+
if (_response.ok) {
|
|
401
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
402
|
+
}
|
|
403
|
+
if (_response.error.reason === "status-code") {
|
|
404
|
+
switch (_response.error.statusCode) {
|
|
405
|
+
case 422:
|
|
406
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
407
|
+
default:
|
|
408
|
+
throw new errors.AgentPhoneError({
|
|
409
|
+
statusCode: _response.error.statusCode,
|
|
410
|
+
body: _response.error.body,
|
|
411
|
+
rawResponse: _response.rawResponse,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/agents/{agent_id}/numbers/{number_id}");
|
|
416
|
+
});
|
|
417
|
+
}
|
|
364
418
|
/**
|
|
365
419
|
* List all conversations for an agent.
|
|
366
420
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { AttachNumberRequest } from "./AttachNumberRequest.mjs";
|
|
2
2
|
export type { CreateAgentRequest } from "./CreateAgentRequest.mjs";
|
|
3
3
|
export type { DeleteAgentV1AgentsAgentIdDeleteRequest } from "./DeleteAgentV1AgentsAgentIdDeleteRequest.mjs";
|
|
4
|
+
export type { DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest } from "./DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.mjs";
|
|
4
5
|
export type { GetAgentV1AgentsAgentIdGetRequest } from "./GetAgentV1AgentsAgentIdGetRequest.mjs";
|
|
5
6
|
export type { ListAgentCallsV1AgentsAgentIdCallsGetRequest } from "./ListAgentCallsV1AgentsAgentIdCallsGetRequest.mjs";
|
|
6
7
|
export type { ListAgentConversationsV1AgentsAgentIdConversationsGetRequest } from "./ListAgentConversationsV1AgentsAgentIdConversationsGetRequest.mjs";
|
|
@@ -11,7 +11,7 @@ export declare class CallsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<CallsClient.Options>;
|
|
12
12
|
constructor(options: CallsClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* List all calls for this
|
|
14
|
+
* List all calls for this account.
|
|
15
15
|
*
|
|
16
16
|
* @param {AgentPhone.ListCallsV1CallsGetRequest} request
|
|
17
17
|
* @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -31,7 +31,7 @@ export declare class CallsClient {
|
|
|
31
31
|
* to use as caller ID; if omitted, the first assigned number is used.
|
|
32
32
|
*
|
|
33
33
|
* Flow:
|
|
34
|
-
* 1. Validates the agent belongs to your
|
|
34
|
+
* 1. Validates the agent belongs to your account and has a phone number
|
|
35
35
|
* 2. Initiates a call from the agent's number to the destination
|
|
36
36
|
* 3. When recipient answers, speaks the initial greeting (if provided)
|
|
37
37
|
* 4. Listens for recipient's speech and sends to your webhook
|
|
@@ -58,7 +58,7 @@ export declare class CallsClient {
|
|
|
58
58
|
* expires 30 seconds after creation.
|
|
59
59
|
*
|
|
60
60
|
* Flow:
|
|
61
|
-
* 1. Validates the agent belongs to your
|
|
61
|
+
* 1. Validates the agent belongs to your account
|
|
62
62
|
* 2. Creates a web call and returns an access token
|
|
63
63
|
* 3. Your client calls `webClient.startCall({ accessToken })` to connect
|
|
64
64
|
* 4. Call lifecycle (transcripts, webhooks) works the same as phone calls
|
|
@@ -109,6 +109,30 @@ export declare class CallsClient {
|
|
|
109
109
|
*/
|
|
110
110
|
getCallTranscript(request: AgentPhone.GetCallTranscriptV1CallsCallIdTranscriptGetRequest, requestOptions?: CallsClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
111
111
|
private __getCallTranscript;
|
|
112
|
+
/**
|
|
113
|
+
* Stream a call's transcript via Server-Sent Events.
|
|
114
|
+
*
|
|
115
|
+
* On connect the server replays all existing transcript turns from the
|
|
116
|
+
* database, then streams new turns in real time as they arrive from the
|
|
117
|
+
* voice provider. A ``: heartbeat`` comment is sent every 15 s to keep
|
|
118
|
+
* proxies alive. The stream closes after sending an ``ended`` event
|
|
119
|
+
* when the call completes (or immediately after replay if the call has
|
|
120
|
+
* already ended).
|
|
121
|
+
*
|
|
122
|
+
* Works for both live and completed calls — same URL either way.
|
|
123
|
+
*
|
|
124
|
+
* @param {AgentPhone.StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest} request
|
|
125
|
+
* @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
126
|
+
*
|
|
127
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* await client.calls.streamCallTranscript({
|
|
131
|
+
* call_id: "call_id"
|
|
132
|
+
* })
|
|
133
|
+
*/
|
|
134
|
+
streamCallTranscript(request: AgentPhone.StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest, requestOptions?: CallsClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
135
|
+
private __streamCallTranscript;
|
|
112
136
|
/**
|
|
113
137
|
* List all calls for a specific phone number.
|
|
114
138
|
*
|
|
@@ -20,7 +20,7 @@ export class CallsClient {
|
|
|
20
20
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* List all calls for this
|
|
23
|
+
* List all calls for this account.
|
|
24
24
|
*
|
|
25
25
|
* @param {AgentPhone.ListCallsV1CallsGetRequest} request
|
|
26
26
|
* @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -36,10 +36,14 @@ export class CallsClient {
|
|
|
36
36
|
__listCalls() {
|
|
37
37
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
38
38
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
|
-
const { limit, offset } = request;
|
|
39
|
+
const { limit, offset, status, direction, type: type_, search } = request;
|
|
40
40
|
const _queryParams = {
|
|
41
41
|
limit,
|
|
42
42
|
offset,
|
|
43
|
+
status,
|
|
44
|
+
direction,
|
|
45
|
+
type: type_,
|
|
46
|
+
search,
|
|
43
47
|
};
|
|
44
48
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
45
49
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -80,7 +84,7 @@ export class CallsClient {
|
|
|
80
84
|
* to use as caller ID; if omitted, the first assigned number is used.
|
|
81
85
|
*
|
|
82
86
|
* Flow:
|
|
83
|
-
* 1. Validates the agent belongs to your
|
|
87
|
+
* 1. Validates the agent belongs to your account and has a phone number
|
|
84
88
|
* 2. Initiates a call from the agent's number to the destination
|
|
85
89
|
* 3. When recipient answers, speaks the initial greeting (if provided)
|
|
86
90
|
* 4. Listens for recipient's speech and sends to your webhook
|
|
@@ -145,7 +149,7 @@ export class CallsClient {
|
|
|
145
149
|
* expires 30 seconds after creation.
|
|
146
150
|
*
|
|
147
151
|
* Flow:
|
|
148
|
-
* 1. Validates the agent belongs to your
|
|
152
|
+
* 1. Validates the agent belongs to your account
|
|
149
153
|
* 2. Creates a web call and returns an access token
|
|
150
154
|
* 3. Your client calls `webClient.startCall({ accessToken })` to connect
|
|
151
155
|
* 4. Call lifecycle (transcripts, webhooks) works the same as phone calls
|
|
@@ -306,6 +310,66 @@ export class CallsClient {
|
|
|
306
310
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/calls/{call_id}/transcript");
|
|
307
311
|
});
|
|
308
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Stream a call's transcript via Server-Sent Events.
|
|
315
|
+
*
|
|
316
|
+
* On connect the server replays all existing transcript turns from the
|
|
317
|
+
* database, then streams new turns in real time as they arrive from the
|
|
318
|
+
* voice provider. A ``: heartbeat`` comment is sent every 15 s to keep
|
|
319
|
+
* proxies alive. The stream closes after sending an ``ended`` event
|
|
320
|
+
* when the call completes (or immediately after replay if the call has
|
|
321
|
+
* already ended).
|
|
322
|
+
*
|
|
323
|
+
* Works for both live and completed calls — same URL either way.
|
|
324
|
+
*
|
|
325
|
+
* @param {AgentPhone.StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest} request
|
|
326
|
+
* @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
327
|
+
*
|
|
328
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* await client.calls.streamCallTranscript({
|
|
332
|
+
* call_id: "call_id"
|
|
333
|
+
* })
|
|
334
|
+
*/
|
|
335
|
+
streamCallTranscript(request, requestOptions) {
|
|
336
|
+
return core.HttpResponsePromise.fromPromise(this.__streamCallTranscript(request, requestOptions));
|
|
337
|
+
}
|
|
338
|
+
__streamCallTranscript(request, requestOptions) {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
340
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
341
|
+
const { call_id: callId } = request;
|
|
342
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
343
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
344
|
+
const _response = yield core.fetcher({
|
|
345
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/calls/${core.url.encodePathParam(callId)}/transcript/stream`),
|
|
346
|
+
method: "GET",
|
|
347
|
+
headers: _headers,
|
|
348
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
349
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
350
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
351
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
352
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
353
|
+
logging: this._options.logging,
|
|
354
|
+
});
|
|
355
|
+
if (_response.ok) {
|
|
356
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
357
|
+
}
|
|
358
|
+
if (_response.error.reason === "status-code") {
|
|
359
|
+
switch (_response.error.statusCode) {
|
|
360
|
+
case 422:
|
|
361
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
362
|
+
default:
|
|
363
|
+
throw new errors.AgentPhoneError({
|
|
364
|
+
statusCode: _response.error.statusCode,
|
|
365
|
+
body: _response.error.body,
|
|
366
|
+
rawResponse: _response.rawResponse,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/calls/{call_id}/transcript/stream");
|
|
371
|
+
});
|
|
372
|
+
}
|
|
309
373
|
/**
|
|
310
374
|
* List all calls for a specific phone number.
|
|
311
375
|
*
|
|
@@ -5,4 +5,12 @@
|
|
|
5
5
|
export interface ListCallsV1CallsGetRequest {
|
|
6
6
|
limit?: number;
|
|
7
7
|
offset?: number;
|
|
8
|
+
/** Filter by status: completed, in-progress, failed */
|
|
9
|
+
status?: string | null;
|
|
10
|
+
/** Filter by direction: inbound, outbound */
|
|
11
|
+
direction?: string | null;
|
|
12
|
+
/** Filter by type: pstn, web */
|
|
13
|
+
type?: string | null;
|
|
14
|
+
/** Search fromNumber or toNumber (contains) */
|
|
15
|
+
search?: string | null;
|
|
8
16
|
}
|
|
@@ -4,3 +4,4 @@ export type { GetCallTranscriptV1CallsCallIdTranscriptGetRequest } from "./GetCa
|
|
|
4
4
|
export type { GetCallV1CallsCallIdGetRequest } from "./GetCallV1CallsCallIdGetRequest.mjs";
|
|
5
5
|
export type { ListCallsForNumberV1NumbersNumberIdCallsGetRequest } from "./ListCallsForNumberV1NumbersNumberIdCallsGetRequest.mjs";
|
|
6
6
|
export type { ListCallsV1CallsGetRequest } from "./ListCallsV1CallsGetRequest.mjs";
|
|
7
|
+
export type { StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest } from "./StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.mjs";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as AgentPhone from "../../../index.mjs";
|
|
5
|
+
export declare namespace ContactsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ContactsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<ContactsClient.Options>;
|
|
12
|
+
constructor(options: ContactsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* List all contacts for this account.
|
|
15
|
+
*
|
|
16
|
+
* Optional `search` query filters by name or phone number (case-insensitive contains).
|
|
17
|
+
*
|
|
18
|
+
* @param {AgentPhone.ListContactsV1ContactsGetRequest} request
|
|
19
|
+
* @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
20
|
+
*
|
|
21
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await client.contacts.listContacts()
|
|
25
|
+
*/
|
|
26
|
+
listContacts(request?: AgentPhone.ListContactsV1ContactsGetRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactListResponse>;
|
|
27
|
+
private __listContacts;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new contact.
|
|
30
|
+
*
|
|
31
|
+
* Phone number is normalized to E.164 format. Returns 409 if a contact
|
|
32
|
+
* with this phone number already exists for the project.
|
|
33
|
+
*
|
|
34
|
+
* @param {AgentPhone.CreateContactRequest} request
|
|
35
|
+
* @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
36
|
+
*
|
|
37
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* await client.contacts.createContact({
|
|
41
|
+
* phoneNumber: "phoneNumber",
|
|
42
|
+
* name: "name"
|
|
43
|
+
* })
|
|
44
|
+
*/
|
|
45
|
+
createContact(request: AgentPhone.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactResponse>;
|
|
46
|
+
private __createContact;
|
|
47
|
+
/**
|
|
48
|
+
* Get a single contact by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param {AgentPhone.GetContactV1ContactsContactIdGetRequest} request
|
|
51
|
+
* @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.contacts.getContact({
|
|
57
|
+
* contact_id: "contact_id"
|
|
58
|
+
* })
|
|
59
|
+
*/
|
|
60
|
+
getContact(request: AgentPhone.GetContactV1ContactsContactIdGetRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactResponse>;
|
|
61
|
+
private __getContact;
|
|
62
|
+
/**
|
|
63
|
+
* Delete a contact.
|
|
64
|
+
*
|
|
65
|
+
* @param {AgentPhone.DeleteContactV1ContactsContactIdDeleteRequest} request
|
|
66
|
+
* @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
|
+
*
|
|
68
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* await client.contacts.deleteContact({
|
|
72
|
+
* contact_id: "contact_id"
|
|
73
|
+
* })
|
|
74
|
+
*/
|
|
75
|
+
deleteContact(request: AgentPhone.DeleteContactV1ContactsContactIdDeleteRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
76
|
+
private __deleteContact;
|
|
77
|
+
/**
|
|
78
|
+
* Update a contact's fields.
|
|
79
|
+
*
|
|
80
|
+
* If phoneNumber is updated, it's re-normalized and checked for uniqueness (409 on conflict).
|
|
81
|
+
*
|
|
82
|
+
* @param {AgentPhone.UpdateContactRequest} request
|
|
83
|
+
* @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
84
|
+
*
|
|
85
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* await client.contacts.updateContact({
|
|
89
|
+
* contact_id: "contact_id"
|
|
90
|
+
* })
|
|
91
|
+
*/
|
|
92
|
+
updateContact(request: AgentPhone.UpdateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactResponse>;
|
|
93
|
+
private __updateContact;
|
|
94
|
+
}
|