agentphone 1.0.11 → 1.0.13
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 +10 -10
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +6 -6
- package/dist/cjs/Client.js +26 -26
- package/dist/cjs/api/resources/agents/client/Client.js +11 -11
- package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +71 -0
- package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.js +66 -0
- package/dist/cjs/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.ts +2 -0
- package/dist/cjs/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.ts +2 -0
- package/dist/cjs/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.ts +2 -1
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +71 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +66 -0
- package/dist/cjs/api/resources/calls/client/Client.js +16 -5
- package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +2 -0
- package/dist/cjs/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.ts +2 -1
- package/dist/cjs/api/resources/contacts/client/Client.js +2 -3
- package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts +2 -1
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +5 -3
- package/dist/cjs/api/resources/conversations/client/Client.js +7 -6
- package/dist/cjs/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.ts +2 -1
- package/dist/cjs/api/resources/index.d.ts +4 -4
- package/dist/cjs/api/resources/index.js +5 -5
- package/dist/cjs/api/resources/numbers/client/Client.js +18 -7
- package/dist/cjs/api/resources/numbers/client/requests/CreateNumberRequest.d.ts +2 -0
- package/dist/cjs/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.ts +2 -0
- package/dist/cjs/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.ts +2 -1
- package/dist/cjs/api/resources/registration/client/Client.d.ts +61 -0
- package/dist/cjs/api/resources/{agentSignup → registration}/client/Client.js +44 -69
- package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.d.ts +61 -0
- package/dist/cjs/api/resources/registration/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +61 -0
- package/dist/cjs/api/resources/{integrations → subAccounts}/client/Client.js +99 -106
- package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.ts +9 -0
- package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.ts +9 -0
- package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.ts +11 -0
- package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.js +3 -0
- package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +7 -4
- package/dist/cjs/api/resources/webhooks/client/Client.js +14 -9
- package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.ts +14 -0
- package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.ts +8 -0
- package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/types/AgentResponse.d.ts +2 -0
- package/dist/cjs/api/{resources/agentSignup/client/requests → types}/AgentSignUpRequest.d.ts +0 -6
- package/dist/cjs/api/types/AgentSignUpRequest.js +3 -0
- package/dist/cjs/api/types/AgentVerifyRequest.d.ts +4 -0
- package/dist/cjs/api/types/AgentVerifyRequest.js +3 -0
- package/dist/cjs/api/types/AppRoutesConversationsConversationSummary.d.ts +6 -0
- package/dist/cjs/api/types/ConversationDetail.d.ts +5 -0
- package/dist/cjs/api/types/FieldWarning.d.ts +6 -0
- package/dist/cjs/api/types/FieldWarning.js +3 -0
- package/dist/cjs/api/types/GroupParticipant.d.ts +7 -0
- package/dist/cjs/api/types/GroupParticipant.js +3 -0
- package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
- package/dist/cjs/api/types/RegistrationResponse.d.ts +8 -0
- package/dist/cjs/api/types/RegistrationResponse.js +3 -0
- package/dist/cjs/api/types/index.d.ts +5 -0
- package/dist/cjs/api/types/index.js +5 -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 -6
- package/dist/esm/Client.mjs +10 -10
- package/dist/esm/api/resources/agents/client/Client.mjs +12 -12
- package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +71 -0
- package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.mjs +66 -0
- package/dist/esm/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.mts +2 -0
- package/dist/esm/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.mts +2 -0
- package/dist/esm/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.mts +2 -1
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +71 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +66 -0
- package/dist/esm/api/resources/calls/client/Client.mjs +17 -6
- package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +2 -0
- package/dist/esm/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.mts +2 -1
- package/dist/esm/api/resources/contacts/client/Client.mjs +3 -4
- package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.mts +2 -1
- package/dist/esm/api/resources/conversations/client/Client.d.mts +5 -3
- package/dist/esm/api/resources/conversations/client/Client.mjs +8 -7
- package/dist/esm/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.mts +2 -1
- package/dist/esm/api/resources/index.d.mts +4 -4
- package/dist/esm/api/resources/index.mjs +4 -4
- package/dist/esm/api/resources/numbers/client/Client.mjs +19 -8
- package/dist/esm/api/resources/numbers/client/requests/CreateNumberRequest.d.mts +2 -0
- package/dist/esm/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.mts +2 -0
- package/dist/esm/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.mts +2 -1
- package/dist/esm/api/resources/registration/client/Client.d.mts +61 -0
- package/dist/esm/api/resources/registration/client/Client.mjs +108 -0
- package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.d.mts +61 -0
- package/dist/esm/api/resources/registration/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/subAccounts/client/Client.d.mts +61 -0
- package/dist/esm/api/resources/{integrations → subAccounts}/client/Client.mjs +97 -104
- package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.mts +9 -0
- package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.mts +9 -0
- package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.mts +11 -0
- package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.mjs +2 -0
- package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +7 -4
- package/dist/esm/api/resources/webhooks/client/Client.mjs +15 -10
- package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.mts +14 -0
- package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.mts +8 -0
- package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
- package/dist/esm/api/types/AgentResponse.d.mts +2 -0
- package/dist/esm/api/{resources/agentSignup/client/requests → types}/AgentSignUpRequest.d.mts +0 -6
- package/dist/esm/api/types/AgentSignUpRequest.mjs +2 -0
- package/dist/esm/api/types/AgentVerifyRequest.d.mts +4 -0
- package/dist/esm/api/types/AgentVerifyRequest.mjs +2 -0
- package/dist/esm/api/types/AppRoutesConversationsConversationSummary.d.mts +6 -0
- package/dist/esm/api/types/ConversationDetail.d.mts +5 -0
- package/dist/esm/api/types/FieldWarning.d.mts +6 -0
- package/dist/esm/api/types/FieldWarning.mjs +2 -0
- package/dist/esm/api/types/GroupParticipant.d.mts +7 -0
- package/dist/esm/api/types/GroupParticipant.mjs +2 -0
- package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
- package/dist/esm/api/types/RegistrationResponse.d.mts +8 -0
- package/dist/esm/api/types/RegistrationResponse.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +5 -0
- package/dist/esm/api/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +188 -277
- package/dist/cjs/api/resources/agentSignup/client/Client.d.ts +0 -50
- package/dist/cjs/api/resources/agentSignup/client/requests/AgentVerifyRequest.d.ts +0 -11
- package/dist/cjs/api/resources/agentSignup/client/requests/index.d.ts +0 -2
- package/dist/cjs/api/resources/integrations/client/Client.d.ts +0 -64
- package/dist/cjs/api/resources/integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.d.ts +0 -9
- package/dist/cjs/api/resources/integrations/client/requests/index.d.ts +0 -1
- package/dist/esm/api/resources/agentSignup/client/Client.d.mts +0 -50
- package/dist/esm/api/resources/agentSignup/client/Client.mjs +0 -133
- package/dist/esm/api/resources/agentSignup/client/requests/AgentVerifyRequest.d.mts +0 -11
- package/dist/esm/api/resources/agentSignup/client/requests/index.d.mts +0 -2
- package/dist/esm/api/resources/integrations/client/Client.d.mts +0 -64
- package/dist/esm/api/resources/integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.d.mts +0 -9
- package/dist/esm/api/resources/integrations/client/requests/index.d.mts +0 -1
- /package/dist/cjs/api/resources/{agentSignup → registration}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{agentSignup → registration}/client/index.js +0 -0
- /package/dist/cjs/api/resources/{agentSignup/client/requests/AgentSignUpRequest.js → registration/client/requests/RegistrationRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agentSignup → registration}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{agentSignup → registration}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{agentSignup → registration}/index.js +0 -0
- /package/dist/cjs/api/resources/{integrations → subAccounts}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{integrations → subAccounts}/client/index.js +0 -0
- /package/dist/cjs/api/resources/{agentSignup/client/requests/AgentVerifyRequest.js → subAccounts/client/requests/CreateSubAccountRequest.js} +0 -0
- /package/dist/cjs/api/resources/{integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.js → subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.js} +0 -0
- /package/dist/cjs/api/resources/{integrations → subAccounts}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{integrations → subAccounts}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{integrations → subAccounts}/index.js +0 -0
- /package/dist/esm/api/resources/{agentSignup → registration}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{agentSignup → registration}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/{agentSignup/client/requests/AgentSignUpRequest.mjs → registration/client/requests/RegistrationRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agentSignup → registration}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{agentSignup → registration}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{agentSignup → registration}/index.mjs +0 -0
- /package/dist/esm/api/resources/{integrations → subAccounts}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{integrations → subAccounts}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/{agentSignup/client/requests/AgentVerifyRequest.mjs → subAccounts/client/requests/CreateSubAccountRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.mjs → subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{integrations → subAccounts}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{integrations → subAccounts}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{integrations → subAccounts}/index.mjs +0 -0
|
@@ -42,6 +42,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
43
|
});
|
|
44
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
|
+
};
|
|
45
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
57
|
exports.CallsClient = void 0;
|
|
47
58
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
@@ -72,9 +83,8 @@ class CallsClient {
|
|
|
72
83
|
__listCalls() {
|
|
73
84
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
74
85
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
-
const {
|
|
86
|
+
const { offset, status, direction, type: type_, search, "X-Sub-Account-Id": subAccountId } = request;
|
|
76
87
|
const _queryParams = {
|
|
77
|
-
limit,
|
|
78
88
|
offset,
|
|
79
89
|
status,
|
|
80
90
|
direction,
|
|
@@ -82,7 +92,7 @@ class CallsClient {
|
|
|
82
92
|
search,
|
|
83
93
|
};
|
|
84
94
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
85
|
-
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);
|
|
95
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
86
96
|
const _response = yield core.fetcher({
|
|
87
97
|
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.Production, "v1/calls"),
|
|
88
98
|
method: "GET",
|
|
@@ -143,8 +153,9 @@ class CallsClient {
|
|
|
143
153
|
__createOutboundCall(request, requestOptions) {
|
|
144
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
155
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
156
|
+
const { "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["X-Sub-Account-Id"]);
|
|
146
157
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
147
|
-
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);
|
|
158
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
148
159
|
const _response = yield core.fetcher({
|
|
149
160
|
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.Production, "v1/calls"),
|
|
150
161
|
method: "POST",
|
|
@@ -152,7 +163,7 @@ class CallsClient {
|
|
|
152
163
|
contentType: "application/json",
|
|
153
164
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
154
165
|
requestType: "json",
|
|
155
|
-
body:
|
|
166
|
+
body: _body,
|
|
156
167
|
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,
|
|
157
168
|
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,
|
|
158
169
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface CreateOutboundCallRequest {
|
|
9
|
+
/** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
|
|
10
|
+
"X-Sub-Account-Id"?: string;
|
|
9
11
|
/** Agent ID to make the call from */
|
|
10
12
|
agentId: string;
|
|
11
13
|
/** Phone number to call (E.164 format) */
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* {}
|
|
4
4
|
*/
|
|
5
5
|
export interface ListCallsV1CallsGetRequest {
|
|
6
|
-
limit?: number;
|
|
7
6
|
offset?: number;
|
|
8
7
|
/** Filter by status: completed, in-progress, failed */
|
|
9
8
|
status?: string | null;
|
|
@@ -13,4 +12,6 @@ export interface ListCallsV1CallsGetRequest {
|
|
|
13
12
|
type?: string | null;
|
|
14
13
|
/** Search fromNumber or toNumber (contains) */
|
|
15
14
|
search?: string | null;
|
|
15
|
+
/** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
|
|
16
|
+
"X-Sub-Account-Id"?: string;
|
|
16
17
|
}
|
|
@@ -85,14 +85,13 @@ class ContactsClient {
|
|
|
85
85
|
__listContacts() {
|
|
86
86
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
87
87
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
88
|
-
const {
|
|
88
|
+
const { limit, offset, "X-Sub-Account-Id": subAccountId } = request;
|
|
89
89
|
const _queryParams = {
|
|
90
|
-
search,
|
|
91
90
|
limit,
|
|
92
91
|
offset,
|
|
93
92
|
};
|
|
94
93
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
95
|
-
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);
|
|
94
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
96
95
|
const _response = yield core.fetcher({
|
|
97
96
|
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.Production, "v1/contacts"),
|
|
98
97
|
method: "GET",
|
package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* {}
|
|
4
4
|
*/
|
|
5
5
|
export interface ListContactsV1ContactsGetRequest {
|
|
6
|
-
search?: string | null;
|
|
7
6
|
limit?: number;
|
|
8
7
|
offset?: number;
|
|
8
|
+
/** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
|
|
9
|
+
"X-Sub-Account-Id"?: string;
|
|
9
10
|
}
|
|
@@ -83,9 +83,11 @@ export declare class ConversationsClient {
|
|
|
83
83
|
/**
|
|
84
84
|
* Show a typing indicator in the conversation (iMessage only).
|
|
85
85
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* Works for both 1:1 and group chats: a group id is itself a valid typing
|
|
87
|
+
* target, so every participant sees the indicator. Best-effort: the
|
|
88
|
+
* indicator may be silently dropped if the chat has no recent activity, the
|
|
89
|
+
* recipient isn't on iMessage, or it's RCS-routed (RCS carries no composing
|
|
90
|
+
* state). Auto-expires after a few seconds; no "stop typing" call needed.
|
|
89
91
|
*
|
|
90
92
|
* @param {AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest} request
|
|
91
93
|
* @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -86,13 +86,12 @@ class ConversationsClient {
|
|
|
86
86
|
__listConversations() {
|
|
87
87
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
88
88
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
89
|
-
const {
|
|
89
|
+
const { offset, "X-Sub-Account-Id": subAccountId } = request;
|
|
90
90
|
const _queryParams = {
|
|
91
|
-
limit,
|
|
92
91
|
offset,
|
|
93
92
|
};
|
|
94
93
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
95
|
-
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);
|
|
94
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
96
95
|
const _response = yield core.fetcher({
|
|
97
96
|
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.Production, "v1/conversations"),
|
|
98
97
|
method: "GET",
|
|
@@ -301,9 +300,11 @@ class ConversationsClient {
|
|
|
301
300
|
/**
|
|
302
301
|
* Show a typing indicator in the conversation (iMessage only).
|
|
303
302
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
303
|
+
* Works for both 1:1 and group chats: a group id is itself a valid typing
|
|
304
|
+
* target, so every participant sees the indicator. Best-effort: the
|
|
305
|
+
* indicator may be silently dropped if the chat has no recent activity, the
|
|
306
|
+
* recipient isn't on iMessage, or it's RCS-routed (RCS carries no composing
|
|
307
|
+
* state). Auto-expires after a few seconds; no "stop typing" call needed.
|
|
307
308
|
*
|
|
308
309
|
* @param {AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest} request
|
|
309
310
|
* @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export * from "./agentSignup/client/requests/index.js";
|
|
2
|
-
export * as agentSignup from "./agentSignup/index.js";
|
|
3
1
|
export * from "./agents/client/requests/index.js";
|
|
4
2
|
export * as agents from "./agents/index.js";
|
|
5
3
|
export * from "./agentWebhooks/client/requests/index.js";
|
|
@@ -12,12 +10,14 @@ export * from "./contacts/client/requests/index.js";
|
|
|
12
10
|
export * as contacts from "./contacts/index.js";
|
|
13
11
|
export * from "./conversations/client/requests/index.js";
|
|
14
12
|
export * as conversations from "./conversations/index.js";
|
|
15
|
-
export * from "./integrations/client/requests/index.js";
|
|
16
|
-
export * as integrations from "./integrations/index.js";
|
|
17
13
|
export * from "./messages/client/requests/index.js";
|
|
18
14
|
export * as messages from "./messages/index.js";
|
|
19
15
|
export * from "./numbers/client/requests/index.js";
|
|
20
16
|
export * as numbers from "./numbers/index.js";
|
|
17
|
+
export * from "./registration/client/requests/index.js";
|
|
18
|
+
export * as registration from "./registration/index.js";
|
|
19
|
+
export * from "./subAccounts/client/requests/index.js";
|
|
20
|
+
export * as subAccounts from "./subAccounts/index.js";
|
|
21
21
|
export * from "./usage/client/requests/index.js";
|
|
22
22
|
export * as usage from "./usage/index.js";
|
|
23
23
|
export * from "./usage/types/index.js";
|
|
@@ -36,9 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.webhooks = exports.usage = exports.
|
|
40
|
-
__exportStar(require("./agentSignup/client/requests/index.js"), exports);
|
|
41
|
-
exports.agentSignup = __importStar(require("./agentSignup/index.js"));
|
|
39
|
+
exports.webhooks = exports.usage = exports.subAccounts = exports.registration = exports.numbers = exports.messages = exports.conversations = exports.contacts = exports.contactCards = exports.calls = exports.agentWebhooks = exports.agents = void 0;
|
|
42
40
|
__exportStar(require("./agents/client/requests/index.js"), exports);
|
|
43
41
|
exports.agents = __importStar(require("./agents/index.js"));
|
|
44
42
|
__exportStar(require("./agentWebhooks/client/requests/index.js"), exports);
|
|
@@ -51,12 +49,14 @@ __exportStar(require("./contacts/client/requests/index.js"), exports);
|
|
|
51
49
|
exports.contacts = __importStar(require("./contacts/index.js"));
|
|
52
50
|
__exportStar(require("./conversations/client/requests/index.js"), exports);
|
|
53
51
|
exports.conversations = __importStar(require("./conversations/index.js"));
|
|
54
|
-
__exportStar(require("./integrations/client/requests/index.js"), exports);
|
|
55
|
-
exports.integrations = __importStar(require("./integrations/index.js"));
|
|
56
52
|
__exportStar(require("./messages/client/requests/index.js"), exports);
|
|
57
53
|
exports.messages = __importStar(require("./messages/index.js"));
|
|
58
54
|
__exportStar(require("./numbers/client/requests/index.js"), exports);
|
|
59
55
|
exports.numbers = __importStar(require("./numbers/index.js"));
|
|
56
|
+
__exportStar(require("./registration/client/requests/index.js"), exports);
|
|
57
|
+
exports.registration = __importStar(require("./registration/index.js"));
|
|
58
|
+
__exportStar(require("./subAccounts/client/requests/index.js"), exports);
|
|
59
|
+
exports.subAccounts = __importStar(require("./subAccounts/index.js"));
|
|
60
60
|
__exportStar(require("./usage/client/requests/index.js"), exports);
|
|
61
61
|
exports.usage = __importStar(require("./usage/index.js"));
|
|
62
62
|
__exportStar(require("./usage/types/index.js"), exports);
|
|
@@ -42,6 +42,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
43
|
});
|
|
44
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
|
+
};
|
|
45
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
57
|
exports.NumbersClient = void 0;
|
|
47
58
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
@@ -72,13 +83,12 @@ class NumbersClient {
|
|
|
72
83
|
__listNumbers() {
|
|
73
84
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
74
85
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
-
const {
|
|
86
|
+
const { offset, "X-Sub-Account-Id": subAccountId } = request;
|
|
76
87
|
const _queryParams = {
|
|
77
|
-
limit,
|
|
78
88
|
offset,
|
|
79
89
|
};
|
|
80
90
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
81
|
-
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);
|
|
91
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
82
92
|
const _response = yield core.fetcher({
|
|
83
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.Production, "v1/numbers"),
|
|
84
94
|
method: "GET",
|
|
@@ -131,8 +141,9 @@ class NumbersClient {
|
|
|
131
141
|
__createNumber() {
|
|
132
142
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
133
143
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
144
|
+
const { "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["X-Sub-Account-Id"]);
|
|
134
145
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
135
|
-
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);
|
|
146
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
136
147
|
const _response = yield core.fetcher({
|
|
137
148
|
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.Production, "v1/numbers"),
|
|
138
149
|
method: "POST",
|
|
@@ -140,7 +151,7 @@ class NumbersClient {
|
|
|
140
151
|
contentType: "application/json",
|
|
141
152
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
142
153
|
requestType: "json",
|
|
143
|
-
body:
|
|
154
|
+
body: _body,
|
|
144
155
|
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,
|
|
145
156
|
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,
|
|
146
157
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -249,9 +260,9 @@ class NumbersClient {
|
|
|
249
260
|
__deleteNumber(request, requestOptions) {
|
|
250
261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
262
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
252
|
-
const { number_id: numberId } = request;
|
|
263
|
+
const { number_id: numberId, "X-Sub-Account-Id": subAccountId } = request;
|
|
253
264
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
254
|
-
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);
|
|
265
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
255
266
|
const _response = yield core.fetcher({
|
|
256
267
|
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.Production, `v1/numbers/${core.url.encodePathParam(numberId)}`),
|
|
257
268
|
method: "DELETE",
|
|
@@ -0,0 +1,61 @@
|
|
|
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 RegistrationClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class RegistrationClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<RegistrationClient.Options>;
|
|
12
|
+
constructor(options?: RegistrationClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Submit an A2P 10DLC registration to enable outbound SMS on your account.
|
|
15
|
+
*
|
|
16
|
+
* US carriers require 10DLC registration before your AI agent can send text messages. This endpoint accepts both `sole_proprietor` and `standard_brand` registration types.
|
|
17
|
+
*
|
|
18
|
+
* ### How it works
|
|
19
|
+
*
|
|
20
|
+
* 1. Submit your registration details via this endpoint
|
|
21
|
+
* 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
|
|
22
|
+
* 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
|
|
23
|
+
* 4. After payment, we submit your registration to the carriers on your behalf
|
|
24
|
+
* 5. Carrier approval typically takes 7-10 business days
|
|
25
|
+
*
|
|
26
|
+
* ### Registration types
|
|
27
|
+
*
|
|
28
|
+
* - **`sole_proprietor`** — For individuals or small businesses. Simpler requirements, fewer fields.
|
|
29
|
+
* - **`standard_brand`** — For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
|
|
30
|
+
*
|
|
31
|
+
* ### Opt-in image
|
|
32
|
+
*
|
|
33
|
+
* `opt_in_image_url` must be a publicly accessible HTTPS URL to a screenshot showing how users opt in to receive messages from you (e.g. a consent checkbox on your signup form). Supports PNG, JPG, WEBP, and GIF up to 2MB. Google Drive links (`drive.google.com/file/d/.../view`) are automatically converted if the file is shared publicly.
|
|
34
|
+
*
|
|
35
|
+
* ### Re-submitting
|
|
36
|
+
*
|
|
37
|
+
* If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
|
|
38
|
+
*
|
|
39
|
+
* @param {AgentPhone.RegistrationRequest} request
|
|
40
|
+
* @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
|
+
*
|
|
42
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* await client.registration.registerA2P({
|
|
46
|
+
* registration_type: "registration_type",
|
|
47
|
+
* first_name: "first_name",
|
|
48
|
+
* last_name: "last_name",
|
|
49
|
+
* email: "email",
|
|
50
|
+
* phone_number: "phone_number",
|
|
51
|
+
* street_address: "street_address",
|
|
52
|
+
* city: "city",
|
|
53
|
+
* state: "state",
|
|
54
|
+
* zip_code: "zip_code",
|
|
55
|
+
* use_case_description: "use_case_description",
|
|
56
|
+
* opt_in_image_url: "opt_in_image_url"
|
|
57
|
+
* })
|
|
58
|
+
*/
|
|
59
|
+
registerA2P(request: AgentPhone.RegistrationRequest, requestOptions?: RegistrationClient.RequestOptions): core.HttpResponsePromise<AgentPhone.RegistrationResponse>;
|
|
60
|
+
private __registerA2P;
|
|
61
|
+
}
|
|
@@ -43,7 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.RegistrationClient = void 0;
|
|
47
47
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
48
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
@@ -51,91 +51,66 @@ const environments = __importStar(require("../../../../environments.js"));
|
|
|
51
51
|
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
52
52
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
53
53
|
const AgentPhone = __importStar(require("../../../index.js"));
|
|
54
|
-
class
|
|
54
|
+
class RegistrationClient {
|
|
55
55
|
constructor(options = {}) {
|
|
56
|
-
this._options = (0, BaseClient_js_1.
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Submit an A2P 10DLC registration to enable outbound SMS on your account.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
62
|
-
* until /v0/agent/verify is called with the code.
|
|
61
|
+
* US carriers require 10DLC registration before your AI agent can send text messages. This endpoint accepts both `sole_proprietor` and `standard_brand` registration types.
|
|
63
62
|
*
|
|
64
|
-
*
|
|
65
|
-
* @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
|
+
* ### How it works
|
|
66
64
|
*
|
|
67
|
-
*
|
|
65
|
+
* 1. Submit your registration details via this endpoint
|
|
66
|
+
* 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
|
|
67
|
+
* 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
|
|
68
|
+
* 4. After payment, we submit your registration to the carriers on your behalf
|
|
69
|
+
* 5. Carrier approval typically takes 7-10 business days
|
|
68
70
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
80
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
81
|
-
const _response = yield core.fetcher({
|
|
82
|
-
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.Production, "v0/agent/sign-up"),
|
|
83
|
-
method: "POST",
|
|
84
|
-
headers: _headers,
|
|
85
|
-
contentType: "application/json",
|
|
86
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
87
|
-
requestType: "json",
|
|
88
|
-
body: request,
|
|
89
|
-
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,
|
|
90
|
-
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,
|
|
91
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
92
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
93
|
-
logging: this._options.logging,
|
|
94
|
-
});
|
|
95
|
-
if (_response.ok) {
|
|
96
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
97
|
-
}
|
|
98
|
-
if (_response.error.reason === "status-code") {
|
|
99
|
-
switch (_response.error.statusCode) {
|
|
100
|
-
case 422:
|
|
101
|
-
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
102
|
-
default:
|
|
103
|
-
throw new errors.AgentPhoneError({
|
|
104
|
-
statusCode: _response.error.statusCode,
|
|
105
|
-
body: _response.error.body,
|
|
106
|
-
rawResponse: _response.rawResponse,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Verify the OTP and atomically provision everything.
|
|
71
|
+
* ### Registration types
|
|
72
|
+
*
|
|
73
|
+
* - **`sole_proprietor`** — For individuals or small businesses. Simpler requirements, fewer fields.
|
|
74
|
+
* - **`standard_brand`** — For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
|
|
75
|
+
*
|
|
76
|
+
* ### Opt-in image
|
|
77
|
+
*
|
|
78
|
+
* `opt_in_image_url` must be a publicly accessible HTTPS URL to a screenshot showing how users opt in to receive messages from you (e.g. a consent checkbox on your signup form). Supports PNG, JPG, WEBP, and GIF up to 2MB. Google Drive links (`drive.google.com/file/d/.../view`) are automatically converted if the file is shared publicly.
|
|
79
|
+
*
|
|
80
|
+
* ### Re-submitting
|
|
115
81
|
*
|
|
116
|
-
*
|
|
117
|
-
* + first-month charge + API key. Returns the key once — agents must save it.
|
|
82
|
+
* If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
|
|
118
83
|
*
|
|
119
|
-
* @param {AgentPhone.
|
|
120
|
-
* @param {
|
|
84
|
+
* @param {AgentPhone.RegistrationRequest} request
|
|
85
|
+
* @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
121
86
|
*
|
|
122
87
|
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
123
88
|
*
|
|
124
89
|
* @example
|
|
125
|
-
* await client.
|
|
126
|
-
*
|
|
127
|
-
*
|
|
90
|
+
* await client.registration.registerA2P({
|
|
91
|
+
* registration_type: "registration_type",
|
|
92
|
+
* first_name: "first_name",
|
|
93
|
+
* last_name: "last_name",
|
|
94
|
+
* email: "email",
|
|
95
|
+
* phone_number: "phone_number",
|
|
96
|
+
* street_address: "street_address",
|
|
97
|
+
* city: "city",
|
|
98
|
+
* state: "state",
|
|
99
|
+
* zip_code: "zip_code",
|
|
100
|
+
* use_case_description: "use_case_description",
|
|
101
|
+
* opt_in_image_url: "opt_in_image_url"
|
|
128
102
|
* })
|
|
129
103
|
*/
|
|
130
|
-
|
|
131
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
104
|
+
registerA2P(request, requestOptions) {
|
|
105
|
+
return core.HttpResponsePromise.fromPromise(this.__registerA2P(request, requestOptions));
|
|
132
106
|
}
|
|
133
|
-
|
|
107
|
+
__registerA2P(request, requestOptions) {
|
|
134
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
109
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
136
|
-
const
|
|
110
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
111
|
+
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);
|
|
137
112
|
const _response = yield core.fetcher({
|
|
138
|
-
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.Production, "
|
|
113
|
+
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.Production, "v1/register"),
|
|
139
114
|
method: "POST",
|
|
140
115
|
headers: _headers,
|
|
141
116
|
contentType: "application/json",
|
|
@@ -163,8 +138,8 @@ class AgentSignupClient {
|
|
|
163
138
|
});
|
|
164
139
|
}
|
|
165
140
|
}
|
|
166
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/
|
|
141
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/register");
|
|
167
142
|
});
|
|
168
143
|
}
|
|
169
144
|
}
|
|
170
|
-
exports.
|
|
145
|
+
exports.RegistrationClient = RegistrationClient;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* registration_type: "registration_type",
|
|
5
|
+
* first_name: "first_name",
|
|
6
|
+
* last_name: "last_name",
|
|
7
|
+
* email: "email",
|
|
8
|
+
* phone_number: "phone_number",
|
|
9
|
+
* street_address: "street_address",
|
|
10
|
+
* city: "city",
|
|
11
|
+
* state: "state",
|
|
12
|
+
* zip_code: "zip_code",
|
|
13
|
+
* use_case_description: "use_case_description",
|
|
14
|
+
* opt_in_image_url: "opt_in_image_url"
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export interface RegistrationRequest {
|
|
18
|
+
/** 'sole_proprietor' or 'standard_brand' */
|
|
19
|
+
registration_type: string;
|
|
20
|
+
/** Required for standard_brand */
|
|
21
|
+
business_name?: string | null;
|
|
22
|
+
first_name: string;
|
|
23
|
+
last_name: string;
|
|
24
|
+
email: string;
|
|
25
|
+
/** E.164 format, e.g. +15551234567 */
|
|
26
|
+
phone_number: string;
|
|
27
|
+
/** Number of phone numbers you plan to use */
|
|
28
|
+
planned_numbers?: number;
|
|
29
|
+
street_address: string;
|
|
30
|
+
city: string;
|
|
31
|
+
state: string;
|
|
32
|
+
zip_code: string;
|
|
33
|
+
country?: string;
|
|
34
|
+
business_type?: string | null;
|
|
35
|
+
business_industry?: string | null;
|
|
36
|
+
position_in_company?: string | null;
|
|
37
|
+
/** EIN / Tax ID (standard_brand only) */
|
|
38
|
+
ein?: string | null;
|
|
39
|
+
registration_id_type?: string | null;
|
|
40
|
+
company_type?: string | null;
|
|
41
|
+
website_url?: string | null;
|
|
42
|
+
social_media_url?: string | null;
|
|
43
|
+
business_regions?: string | null;
|
|
44
|
+
/** Required for standard_brand */
|
|
45
|
+
privacy_policy_url?: string | null;
|
|
46
|
+
/** Required for standard_brand */
|
|
47
|
+
terms_of_service_url?: string | null;
|
|
48
|
+
use_case?: string | null;
|
|
49
|
+
/** Who you message, why, and how. Minimum 40 characters. */
|
|
50
|
+
use_case_description: string;
|
|
51
|
+
/** Required for standard_brand. Min 20 chars, include brand name. */
|
|
52
|
+
sample_message_1?: string | null;
|
|
53
|
+
/** Required for standard_brand. Min 20 chars, include brand name. */
|
|
54
|
+
sample_message_2?: string | null;
|
|
55
|
+
/** How users opt in to receive messages */
|
|
56
|
+
message_flow?: string | null;
|
|
57
|
+
/** Publicly accessible URL to a screenshot of your opt-in flow (PNG, JPG, WEBP, or GIF, max 2MB) */
|
|
58
|
+
opt_in_image_url: string;
|
|
59
|
+
has_embedded_links?: boolean;
|
|
60
|
+
has_embedded_phone?: boolean;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { RegistrationRequest } from "./RegistrationRequest.js";
|