agentphone 1.0.2 → 1.0.4
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 +30 -2
- package/dist/cjs/api/resources/agents/client/Client.js +96 -2
- package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -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 +2 -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/CreateOutboundCallRequest.d.ts +2 -2
- 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 +2 -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 +30 -2
- package/dist/esm/api/resources/agents/client/Client.mjs +96 -2
- package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +2 -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 +2 -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/CreateOutboundCallRequest.d.mts +2 -2
- 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 +2 -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 +780 -114
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../core/index.js";
|
|
4
|
+
import * as AgentPhone from "../../../index.js";
|
|
5
|
+
export declare namespace MessagesClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class MessagesClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<MessagesClient.Options>;
|
|
12
|
+
constructor(options: MessagesClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Send an outbound message (SMS or iMessage) via the provider assigned to the number.
|
|
15
|
+
*
|
|
16
|
+
* @param {AgentPhone.SendMessageRequest} request
|
|
17
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await client.messages.sendMessage({
|
|
23
|
+
* agent_id: "agent_id",
|
|
24
|
+
* to_number: "to_number",
|
|
25
|
+
* body: "body"
|
|
26
|
+
* })
|
|
27
|
+
*/
|
|
28
|
+
sendMessage(request: AgentPhone.SendMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentPhone.SendMessageResponse>;
|
|
29
|
+
private __sendMessage;
|
|
30
|
+
/**
|
|
31
|
+
* Send a tapback reaction to a message (iMessage only).
|
|
32
|
+
*
|
|
33
|
+
* Reactions are an iMessage feature. Attempting to react to a message
|
|
34
|
+
* sent via an SMS/Twilio number will return a clear error.
|
|
35
|
+
*
|
|
36
|
+
* @param {AgentPhone.SendReactionRequest} request
|
|
37
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
38
|
+
*
|
|
39
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* await client.messages.sendReaction({
|
|
43
|
+
* message_id: "message_id",
|
|
44
|
+
* reaction: "reaction"
|
|
45
|
+
* })
|
|
46
|
+
*/
|
|
47
|
+
sendReaction(request: AgentPhone.SendReactionRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentPhone.SendReactionResponse>;
|
|
48
|
+
private __sendReaction;
|
|
49
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
+
var t = {};
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
+
t[p] = s[p];
|
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
+
t[p[i]] = s[p[i]];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.MessagesClient = void 0;
|
|
58
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
59
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
60
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
61
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
62
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
63
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
64
|
+
const AgentPhone = __importStar(require("../../../index.js"));
|
|
65
|
+
class MessagesClient {
|
|
66
|
+
constructor(options) {
|
|
67
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Send an outbound message (SMS or iMessage) via the provider assigned to the number.
|
|
71
|
+
*
|
|
72
|
+
* @param {AgentPhone.SendMessageRequest} request
|
|
73
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
74
|
+
*
|
|
75
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* await client.messages.sendMessage({
|
|
79
|
+
* agent_id: "agent_id",
|
|
80
|
+
* to_number: "to_number",
|
|
81
|
+
* body: "body"
|
|
82
|
+
* })
|
|
83
|
+
*/
|
|
84
|
+
sendMessage(request, requestOptions) {
|
|
85
|
+
return core.HttpResponsePromise.fromPromise(this.__sendMessage(request, requestOptions));
|
|
86
|
+
}
|
|
87
|
+
__sendMessage(request, requestOptions) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
90
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
91
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
92
|
+
const _response = yield core.fetcher({
|
|
93
|
+
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/messages"),
|
|
94
|
+
method: "POST",
|
|
95
|
+
headers: _headers,
|
|
96
|
+
contentType: "application/json",
|
|
97
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
98
|
+
requestType: "json",
|
|
99
|
+
body: request,
|
|
100
|
+
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,
|
|
101
|
+
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,
|
|
102
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
103
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
104
|
+
logging: this._options.logging,
|
|
105
|
+
});
|
|
106
|
+
if (_response.ok) {
|
|
107
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
108
|
+
}
|
|
109
|
+
if (_response.error.reason === "status-code") {
|
|
110
|
+
switch (_response.error.statusCode) {
|
|
111
|
+
case 422:
|
|
112
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
113
|
+
default:
|
|
114
|
+
throw new errors.AgentPhoneError({
|
|
115
|
+
statusCode: _response.error.statusCode,
|
|
116
|
+
body: _response.error.body,
|
|
117
|
+
rawResponse: _response.rawResponse,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/messages");
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Send a tapback reaction to a message (iMessage only).
|
|
126
|
+
*
|
|
127
|
+
* Reactions are an iMessage feature. Attempting to react to a message
|
|
128
|
+
* sent via an SMS/Twilio number will return a clear error.
|
|
129
|
+
*
|
|
130
|
+
* @param {AgentPhone.SendReactionRequest} request
|
|
131
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
132
|
+
*
|
|
133
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* await client.messages.sendReaction({
|
|
137
|
+
* message_id: "message_id",
|
|
138
|
+
* reaction: "reaction"
|
|
139
|
+
* })
|
|
140
|
+
*/
|
|
141
|
+
sendReaction(request, requestOptions) {
|
|
142
|
+
return core.HttpResponsePromise.fromPromise(this.__sendReaction(request, requestOptions));
|
|
143
|
+
}
|
|
144
|
+
__sendReaction(request, requestOptions) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
147
|
+
const { message_id: messageId } = request, _body = __rest(request, ["message_id"]);
|
|
148
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
149
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
150
|
+
const _response = yield core.fetcher({
|
|
151
|
+
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/messages/${core.url.encodePathParam(messageId)}/reactions`),
|
|
152
|
+
method: "POST",
|
|
153
|
+
headers: _headers,
|
|
154
|
+
contentType: "application/json",
|
|
155
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
156
|
+
requestType: "json",
|
|
157
|
+
body: _body,
|
|
158
|
+
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,
|
|
159
|
+
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,
|
|
160
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
161
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
162
|
+
logging: this._options.logging,
|
|
163
|
+
});
|
|
164
|
+
if (_response.ok) {
|
|
165
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
166
|
+
}
|
|
167
|
+
if (_response.error.reason === "status-code") {
|
|
168
|
+
switch (_response.error.statusCode) {
|
|
169
|
+
case 422:
|
|
170
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
171
|
+
default:
|
|
172
|
+
throw new errors.AgentPhoneError({
|
|
173
|
+
statusCode: _response.error.statusCode,
|
|
174
|
+
body: _response.error.body,
|
|
175
|
+
rawResponse: _response.rawResponse,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/messages/{message_id}/reactions");
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.MessagesClient = MessagesClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* agent_id: "agent_id",
|
|
5
|
+
* to_number: "to_number",
|
|
6
|
+
* body: "body"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface SendMessageRequest {
|
|
10
|
+
agent_id: string;
|
|
11
|
+
to_number: string;
|
|
12
|
+
body: string;
|
|
13
|
+
media_url?: string | null;
|
|
14
|
+
number_id?: string | null;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -11,7 +11,7 @@ export declare class NumbersClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<NumbersClient.Options>;
|
|
12
12
|
constructor(options: NumbersClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* List all phone numbers for this
|
|
14
|
+
* List all phone numbers for this account.
|
|
15
15
|
*
|
|
16
16
|
* @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
|
|
17
17
|
* @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -56,7 +56,7 @@ class NumbersClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* List all phone numbers for this
|
|
59
|
+
* List all phone numbers for this account.
|
|
60
60
|
*
|
|
61
61
|
* @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
|
|
62
62
|
* @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -11,7 +11,7 @@ export declare class UsageClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<UsageClient.Options>;
|
|
12
12
|
constructor(options: UsageClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Get usage statistics for the current
|
|
14
|
+
* Get usage statistics for the current account.
|
|
15
15
|
*
|
|
16
16
|
* Returns:
|
|
17
17
|
* - Phone number limits (used/limit/remaining)
|
|
@@ -56,7 +56,7 @@ class UsageClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Get usage statistics for the current
|
|
59
|
+
* Get usage statistics for the current account.
|
|
60
60
|
*
|
|
61
61
|
* Returns:
|
|
62
62
|
* - Phone number limits (used/limit/remaining)
|
|
@@ -11,7 +11,7 @@ export declare class WebhooksClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<WebhooksClient.Options>;
|
|
12
12
|
constructor(options: WebhooksClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Get the master webhook configuration for this
|
|
14
|
+
* Get the master webhook configuration for this account.
|
|
15
15
|
*
|
|
16
16
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
17
|
*
|
|
@@ -21,7 +21,7 @@ export declare class WebhooksClient {
|
|
|
21
21
|
getWebhook(requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse | null>;
|
|
22
22
|
private __getWebhook;
|
|
23
23
|
/**
|
|
24
|
-
* Register or update the webhook URL for this
|
|
24
|
+
* Register or update the webhook URL for this account.
|
|
25
25
|
*
|
|
26
26
|
* If a webhook already exists, it will be updated.
|
|
27
27
|
* A new secret is generated each time.
|
|
@@ -42,7 +42,7 @@ export declare class WebhooksClient {
|
|
|
42
42
|
createOrUpdateWebhook(request: AgentPhone.WebhookCreateRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse>;
|
|
43
43
|
private __createOrUpdateWebhook;
|
|
44
44
|
/**
|
|
45
|
-
* Remove the master webhook for this
|
|
45
|
+
* Remove the master webhook for this account.
|
|
46
46
|
*
|
|
47
47
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
48
|
*
|
|
@@ -52,7 +52,7 @@ export declare class WebhooksClient {
|
|
|
52
52
|
deleteWebhook(requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
53
53
|
private __deleteWebhook;
|
|
54
54
|
/**
|
|
55
|
-
* Get paginated webhook delivery attempts for all
|
|
55
|
+
* Get paginated webhook delivery attempts for all account webhooks.
|
|
56
56
|
*
|
|
57
57
|
* @param {AgentPhone.ListDeliveriesV1WebhooksDeliveriesGetRequest} request
|
|
58
58
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -65,7 +65,7 @@ export declare class WebhooksClient {
|
|
|
65
65
|
listDeliveries(request?: AgentPhone.ListDeliveriesV1WebhooksDeliveriesGetRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.PaginatedDeliveriesResponse>;
|
|
66
66
|
private __listDeliveries;
|
|
67
67
|
/**
|
|
68
|
-
* Aggregated delivery stats for the
|
|
68
|
+
* Aggregated delivery stats for the account's webhooks over the last N hours.
|
|
69
69
|
*
|
|
70
70
|
* @param {AgentPhone.DeliveryStatsV1WebhooksDeliveriesStatsGetRequest} request
|
|
71
71
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -92,7 +92,7 @@ export declare class WebhooksClient {
|
|
|
92
92
|
*
|
|
93
93
|
* Sends a fake message payload to the configured URL.
|
|
94
94
|
* Pass ?agentId=... to control which agent appears in the payload;
|
|
95
|
-
* otherwise the first agent in the
|
|
95
|
+
* otherwise the first agent in the account is used.
|
|
96
96
|
*
|
|
97
97
|
* @param {AgentPhone.TestWebhookV1WebhooksTestPostRequest} request
|
|
98
98
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -56,7 +56,7 @@ class WebhooksClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Get the master webhook configuration for this
|
|
59
|
+
* Get the master webhook configuration for this account.
|
|
60
60
|
*
|
|
61
61
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
62
|
*
|
|
@@ -96,7 +96,7 @@ class WebhooksClient {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Register or update the webhook URL for this
|
|
99
|
+
* Register or update the webhook URL for this account.
|
|
100
100
|
*
|
|
101
101
|
* If a webhook already exists, it will be updated.
|
|
102
102
|
* A new secret is generated each time.
|
|
@@ -155,7 +155,7 @@ class WebhooksClient {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* Remove the master webhook for this
|
|
158
|
+
* Remove the master webhook for this account.
|
|
159
159
|
*
|
|
160
160
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
161
161
|
*
|
|
@@ -195,7 +195,7 @@ class WebhooksClient {
|
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
|
-
* Get paginated webhook delivery attempts for all
|
|
198
|
+
* Get paginated webhook delivery attempts for all account webhooks.
|
|
199
199
|
*
|
|
200
200
|
* @param {AgentPhone.ListDeliveriesV1WebhooksDeliveriesGetRequest} request
|
|
201
201
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -252,7 +252,7 @@ class WebhooksClient {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
|
-
* Aggregated delivery stats for the
|
|
255
|
+
* Aggregated delivery stats for the account's webhooks over the last N hours.
|
|
256
256
|
*
|
|
257
257
|
* @param {AgentPhone.DeliveryStatsV1WebhooksDeliveriesStatsGetRequest} request
|
|
258
258
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -351,7 +351,7 @@ class WebhooksClient {
|
|
|
351
351
|
*
|
|
352
352
|
* Sends a fake message payload to the configured URL.
|
|
353
353
|
* Pass ?agentId=... to control which agent appears in the payload;
|
|
354
|
-
* otherwise the first agent in the
|
|
354
|
+
* otherwise the first agent in the account is used.
|
|
355
355
|
*
|
|
356
356
|
* @param {AgentPhone.TestWebhookV1WebhooksTestPostRequest} request
|
|
357
357
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4,10 +4,12 @@ export interface AgentResponse {
|
|
|
4
4
|
name: string;
|
|
5
5
|
description: string | null;
|
|
6
6
|
voiceMode: string;
|
|
7
|
+
modelTier?: string;
|
|
7
8
|
systemPrompt?: string | null;
|
|
8
9
|
beginMessage?: string | null;
|
|
9
10
|
voice: string;
|
|
10
11
|
transferNumber?: string | null;
|
|
12
|
+
voicemailMessage?: string | null;
|
|
11
13
|
createdAt: string;
|
|
12
14
|
numbers?: AgentPhone.AgentNumberResponse[] | null;
|
|
13
15
|
}
|
|
@@ -9,6 +9,8 @@ export * from "./AppRoutesConversationsConversationSummary.js";
|
|
|
9
9
|
export * from "./AttachNumberResponse.js";
|
|
10
10
|
export * from "./CallListResponse.js";
|
|
11
11
|
export * from "./CallSummary.js";
|
|
12
|
+
export * from "./ContactListResponse.js";
|
|
13
|
+
export * from "./ContactResponse.js";
|
|
12
14
|
export * from "./ConversationDetail.js";
|
|
13
15
|
export * from "./DailyUsagePoint.js";
|
|
14
16
|
export * from "./DailyUsageResponse.js";
|
|
@@ -26,6 +28,8 @@ export * from "./PhoneNumberListResponse.js";
|
|
|
26
28
|
export * from "./PhoneNumberResponse.js";
|
|
27
29
|
export * from "./PlanInfo.js";
|
|
28
30
|
export * from "./PlanLimits.js";
|
|
31
|
+
export * from "./SendMessageResponse.js";
|
|
32
|
+
export * from "./SendReactionResponse.js";
|
|
29
33
|
export * from "./UsageResponse.js";
|
|
30
34
|
export * from "./UsageStats.js";
|
|
31
35
|
export * from "./ValidationError.js";
|
|
@@ -25,6 +25,8 @@ __exportStar(require("./AppRoutesConversationsConversationSummary.js"), exports)
|
|
|
25
25
|
__exportStar(require("./AttachNumberResponse.js"), exports);
|
|
26
26
|
__exportStar(require("./CallListResponse.js"), exports);
|
|
27
27
|
__exportStar(require("./CallSummary.js"), exports);
|
|
28
|
+
__exportStar(require("./ContactListResponse.js"), exports);
|
|
29
|
+
__exportStar(require("./ContactResponse.js"), exports);
|
|
28
30
|
__exportStar(require("./ConversationDetail.js"), exports);
|
|
29
31
|
__exportStar(require("./DailyUsagePoint.js"), exports);
|
|
30
32
|
__exportStar(require("./DailyUsageResponse.js"), exports);
|
|
@@ -42,6 +44,8 @@ __exportStar(require("./PhoneNumberListResponse.js"), exports);
|
|
|
42
44
|
__exportStar(require("./PhoneNumberResponse.js"), exports);
|
|
43
45
|
__exportStar(require("./PlanInfo.js"), exports);
|
|
44
46
|
__exportStar(require("./PlanLimits.js"), exports);
|
|
47
|
+
__exportStar(require("./SendMessageResponse.js"), exports);
|
|
48
|
+
__exportStar(require("./SendReactionResponse.js"), exports);
|
|
45
49
|
__exportStar(require("./UsageResponse.js"), exports);
|
|
46
50
|
__exportStar(require("./UsageStats.js"), exports);
|
|
47
51
|
__exportStar(require("./ValidationError.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.4";
|