agentphone 1.0.15 → 1.0.16

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.
Files changed (96) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +5 -0
  3. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +5 -0
  4. package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +4 -0
  5. package/dist/cjs/api/resources/contacts/client/Client.d.ts +20 -0
  6. package/dist/cjs/api/resources/contacts/client/Client.js +62 -0
  7. package/dist/cjs/api/resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.d.ts +10 -0
  8. package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/registration/client/Client.d.ts +36 -9
  10. package/dist/cjs/api/resources/registration/client/Client.js +67 -9
  11. package/dist/cjs/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.d.ts +8 -0
  12. package/dist/cjs/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.js +3 -0
  13. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.d.ts +52 -30
  14. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.js +9 -0
  15. package/dist/cjs/api/resources/registration/client/requests/index.d.ts +2 -1
  16. package/dist/cjs/api/resources/registration/client/requests/index.js +3 -0
  17. package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +4 -1
  18. package/dist/cjs/api/resources/subAccounts/client/Client.js +23 -10
  19. package/dist/cjs/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.d.ts +8 -0
  20. package/dist/cjs/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.js +3 -0
  21. package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +1 -0
  22. package/dist/cjs/api/types/AgentResponse.d.ts +3 -0
  23. package/dist/cjs/api/types/CampaignInclude.d.ts +7 -0
  24. package/dist/cjs/api/types/CampaignInclude.js +10 -0
  25. package/dist/cjs/api/types/CampaignStatusResponse.d.ts +4 -0
  26. package/dist/cjs/api/types/CampaignStatusResponse.js +3 -0
  27. package/dist/cjs/api/types/ContactCapabilitiesResponse.d.ts +6 -0
  28. package/dist/cjs/api/types/ContactCapabilitiesResponse.js +3 -0
  29. package/dist/cjs/api/types/ContactCapabilityFlags.d.ts +4 -0
  30. package/dist/cjs/api/types/ContactCapabilityFlags.js +3 -0
  31. package/dist/cjs/api/types/ContactTitle.d.ts +11 -0
  32. package/dist/cjs/api/types/ContactTitle.js +14 -0
  33. package/dist/cjs/api/types/CustomToolParam.d.ts +28 -0
  34. package/dist/cjs/api/types/CustomToolParam.js +12 -0
  35. package/dist/cjs/api/types/OrganizationType.d.ts +11 -0
  36. package/dist/cjs/api/types/OrganizationType.js +14 -0
  37. package/dist/cjs/api/types/RegistrationResponse.d.ts +2 -3
  38. package/dist/cjs/api/types/UseCase.d.ts +13 -0
  39. package/dist/cjs/api/types/UseCase.js +16 -0
  40. package/dist/cjs/api/types/Volume.d.ts +5 -0
  41. package/dist/cjs/api/types/Volume.js +8 -0
  42. package/dist/cjs/api/types/index.d.ts +9 -1
  43. package/dist/cjs/api/types/index.js +9 -1
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +5 -0
  48. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +5 -0
  49. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +4 -0
  50. package/dist/esm/api/resources/contacts/client/Client.d.mts +20 -0
  51. package/dist/esm/api/resources/contacts/client/Client.mjs +62 -0
  52. package/dist/esm/api/resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.d.mts +10 -0
  53. package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -0
  54. package/dist/esm/api/resources/registration/client/Client.d.mts +36 -9
  55. package/dist/esm/api/resources/registration/client/Client.mjs +68 -10
  56. package/dist/esm/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.d.mts +8 -0
  57. package/dist/esm/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.mjs +2 -0
  58. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.d.mts +52 -30
  59. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.mjs +8 -1
  60. package/dist/esm/api/resources/registration/client/requests/index.d.mts +2 -1
  61. package/dist/esm/api/resources/registration/client/requests/index.mjs +1 -1
  62. package/dist/esm/api/resources/subAccounts/client/Client.d.mts +4 -1
  63. package/dist/esm/api/resources/subAccounts/client/Client.mjs +23 -10
  64. package/dist/esm/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.d.mts +8 -0
  65. package/dist/esm/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.mjs +2 -0
  66. package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +1 -0
  67. package/dist/esm/api/types/AgentResponse.d.mts +3 -0
  68. package/dist/esm/api/types/CampaignInclude.d.mts +7 -0
  69. package/dist/esm/api/types/CampaignInclude.mjs +7 -0
  70. package/dist/esm/api/types/CampaignStatusResponse.d.mts +4 -0
  71. package/dist/esm/api/types/CampaignStatusResponse.mjs +2 -0
  72. package/dist/esm/api/types/ContactCapabilitiesResponse.d.mts +6 -0
  73. package/dist/esm/api/types/ContactCapabilitiesResponse.mjs +2 -0
  74. package/dist/esm/api/types/ContactCapabilityFlags.d.mts +4 -0
  75. package/dist/esm/api/types/ContactCapabilityFlags.mjs +2 -0
  76. package/dist/esm/api/types/ContactTitle.d.mts +11 -0
  77. package/dist/esm/api/types/ContactTitle.mjs +11 -0
  78. package/dist/esm/api/types/CustomToolParam.d.mts +28 -0
  79. package/dist/esm/api/types/CustomToolParam.mjs +9 -0
  80. package/dist/esm/api/types/OrganizationType.d.mts +11 -0
  81. package/dist/esm/api/types/OrganizationType.mjs +11 -0
  82. package/dist/esm/api/types/RegistrationResponse.d.mts +2 -3
  83. package/dist/esm/api/types/UseCase.d.mts +13 -0
  84. package/dist/esm/api/types/UseCase.mjs +13 -0
  85. package/dist/esm/api/types/Volume.d.mts +5 -0
  86. package/dist/esm/api/types/Volume.mjs +5 -0
  87. package/dist/esm/api/types/index.d.mts +9 -1
  88. package/dist/esm/api/types/index.mjs +9 -1
  89. package/dist/esm/version.d.mts +1 -1
  90. package/dist/esm/version.mjs +1 -1
  91. package/package.json +1 -1
  92. package/reference.md +167 -10
  93. package/dist/cjs/api/types/FieldWarning.d.ts +0 -6
  94. package/dist/esm/api/types/FieldWarning.d.mts +0 -6
  95. /package/dist/cjs/api/{types/FieldWarning.js → resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.js} +0 -0
  96. /package/dist/esm/api/{types/FieldWarning.mjs → resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.mjs} +0 -0
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
12
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import * as environments from "../../../../environments.mjs";
15
15
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -19,6 +19,58 @@ export class RegistrationClient {
19
19
  constructor(options = {}) {
20
20
  this._options = normalizeClientOptionsWithAuth(options);
21
21
  }
22
+ /**
23
+ * Check the status of your A2P 10DLC registration.
24
+ *
25
+ * ### Sub-account status
26
+ *
27
+ * To check the registration status of a sub-account, pass the `X-Sub-Account-Id` header with the sub-account ID returned from `POST /v1/register`.
28
+ *
29
+ * ### Possible statuses
30
+ *
31
+ * - `none` -- No registration submitted.
32
+ * - `pending` -- Registration is under review.
33
+ * - `approved` -- Registration approved. Your account is ready to send messages.
34
+ *
35
+ * @param {AgentPhone.GetRegistrationStatusV1RegisterStatusGetRequest} request
36
+ * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
37
+ *
38
+ * @example
39
+ * await client.registration.getRegistrationStatus()
40
+ */
41
+ getRegistrationStatus(request = {}, requestOptions) {
42
+ return core.HttpResponsePromise.fromPromise(this.__getRegistrationStatus(request, requestOptions));
43
+ }
44
+ __getRegistrationStatus() {
45
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
47
+ const { "X-Sub-Account-Id": subAccountId } = request;
48
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
49
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
50
+ const _response = yield core.fetcher({
51
+ 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/status"),
52
+ method: "GET",
53
+ headers: _headers,
54
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
55
+ 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,
56
+ 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,
57
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
58
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
59
+ logging: this._options.logging,
60
+ });
61
+ if (_response.ok) {
62
+ return { data: _response.body, rawResponse: _response.rawResponse };
63
+ }
64
+ if (_response.error.reason === "status-code") {
65
+ throw new errors.AgentPhoneError({
66
+ statusCode: _response.error.statusCode,
67
+ body: _response.error.body,
68
+ rawResponse: _response.rawResponse,
69
+ });
70
+ }
71
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/register/status");
72
+ });
73
+ }
22
74
  /**
23
75
  * Submit an A2P 10DLC registration to enable outbound SMS on your account.
24
76
  *
@@ -27,15 +79,18 @@ export class RegistrationClient {
27
79
  * ### How it works
28
80
  *
29
81
  * 1. Submit your registration details via this endpoint
30
- * 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
31
- * 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
32
- * 4. After payment, we submit your registration to the carriers on your behalf
33
- * 5. Carrier approval typically takes 7-10 business days
82
+ * 2. A one-time $25 registration fee is deducted from your account balance
83
+ * 3. We submit your registration to the carriers on your behalf
84
+ * 4. Carrier approval typically takes 7-10 business days
34
85
  *
35
86
  * ### Registration types
36
87
  *
37
- * - **`sole_proprietor`** For individuals or small businesses. Simpler requirements, fewer fields.
38
- * - **`standard_brand`** For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
88
+ * - **`sole_proprietor`** -- For individuals or small businesses. Simpler requirements, fewer fields.
89
+ * - **`standard_brand`** -- For established businesses. Requires `business_name`, `organization_type`, `ein`, `privacy_policy_url`, `terms_of_service_url`.
90
+ *
91
+ * ### Sub-accounts
92
+ *
93
+ * Parent accounts can set `create_sub_account: true` (the default) to create a dedicated sub-account for each registration. This lets you manage multiple campaigns independently. The $25 fee is always charged to the parent account.
39
94
  *
40
95
  * ### Opt-in image
41
96
  *
@@ -43,7 +98,7 @@ export class RegistrationClient {
43
98
  *
44
99
  * ### Re-submitting
45
100
  *
46
- * If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
101
+ * If your previous registration was rejected, you can call this endpoint again to re-register.
47
102
  *
48
103
  * @param {AgentPhone.RegistrationRequest} request
49
104
  * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -52,7 +107,7 @@ export class RegistrationClient {
52
107
  *
53
108
  * @example
54
109
  * await client.registration.registerA2P({
55
- * registration_type: "registration_type",
110
+ * registration_type: "sole_proprietor",
56
111
  * first_name: "first_name",
57
112
  * last_name: "last_name",
58
113
  * email: "email",
@@ -61,7 +116,10 @@ export class RegistrationClient {
61
116
  * city: "city",
62
117
  * state: "state",
63
118
  * zip_code: "zip_code",
64
- * use_case_description: "use_case_description",
119
+ * description: "description",
120
+ * use_cases: ["account_notification"],
121
+ * message_samples: ["message_samples"],
122
+ * consent_flow: "consent_flow",
65
123
  * opt_in_image_url: "opt_in_image_url"
66
124
  * })
67
125
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface GetRegistrationStatusV1RegisterStatusGetRequest {
6
+ /** Check a sub-account's registration status. Pass the sub-account ID returned from `POST /v1/register`. Omit to check the master account. */
7
+ "X-Sub-Account-Id"?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,7 +1,8 @@
1
+ import type * as AgentPhone from "../../../../index.mjs";
1
2
  /**
2
3
  * @example
3
4
  * {
4
- * registration_type: "registration_type",
5
+ * registration_type: "sole_proprietor",
5
6
  * first_name: "first_name",
6
7
  * last_name: "last_name",
7
8
  * email: "email",
@@ -10,52 +11,73 @@
10
11
  * city: "city",
11
12
  * state: "state",
12
13
  * zip_code: "zip_code",
13
- * use_case_description: "use_case_description",
14
+ * description: "description",
15
+ * use_cases: ["account_notification"],
16
+ * message_samples: ["message_samples"],
17
+ * consent_flow: "consent_flow",
14
18
  * opt_in_image_url: "opt_in_image_url"
15
19
  * }
16
20
  */
17
21
  export interface RegistrationRequest {
18
22
  /** 'sole_proprietor' or 'standard_brand' */
19
- registration_type: string;
20
- /** Required for standard_brand */
21
- business_name?: string | null;
23
+ registration_type: RegistrationRequest.RegistrationType;
22
24
  first_name: string;
23
25
  last_name: string;
24
26
  email: string;
25
27
  /** E.164 format, e.g. +15551234567 */
26
28
  phone_number: string;
27
- /** Number of phone numbers you plan to use */
28
- planned_numbers?: number;
29
+ /** Legal/registered business name. Required for standard_brand. */
30
+ business_name?: string | null;
31
+ /** Public-facing brand name if different from business_name. */
32
+ brand_name?: string | null;
33
+ /** Required for standard_brand. */
34
+ organization_type?: AgentPhone.OrganizationType | null;
35
+ /** Your role. Required for standard_brand. */
36
+ contact_title?: AgentPhone.ContactTitle | null;
37
+ /** Custom title when contact_title is 'other'. */
38
+ contact_title_other?: string | null;
39
+ /** EIN / Tax ID. Required for standard_brand. */
40
+ ein?: string | null;
41
+ website_url?: string | null;
42
+ /** e.g. technology, real_estate, retail, healthcare */
43
+ industry?: string | null;
44
+ business_regions?: string[];
29
45
  street_address: string;
46
+ street_address_2?: string | null;
30
47
  city: string;
31
48
  state: string;
32
49
  zip_code: string;
33
50
  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 */
51
+ /** Number of phone numbers you plan to use */
52
+ planned_numbers?: number;
53
+ /** What your business does, who you message, and what types of messages you send. Min 40 chars. */
54
+ description: string;
55
+ /** 1-5 specific use cases for your SMS campaign. */
56
+ use_cases: AgentPhone.UseCase[];
57
+ /** Expected message volume. */
58
+ volume?: AgentPhone.Volume;
59
+ /** 2-5 example messages. Each must be 20-1024 chars and include your brand name. */
60
+ message_samples: string[];
61
+ /** How users opt in to receive messages. Min 40 chars. */
62
+ consent_flow: string;
63
+ /** Required for standard_brand. */
45
64
  privacy_policy_url?: string | null;
46
- /** Required for standard_brand */
65
+ /** Required for standard_brand. */
47
66
  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
67
  /** Publicly accessible URL to a screenshot of your opt-in flow (PNG, JPG, WEBP, or GIF, max 2MB) */
58
68
  opt_in_image_url: string;
59
- has_embedded_links?: boolean;
60
- has_embedded_phone?: boolean;
69
+ /** Content types included in messages. */
70
+ includes?: AgentPhone.CampaignInclude[];
71
+ /** Example URL if messages contain links. */
72
+ link_sample?: string | null;
73
+ /** Create a dedicated sub-account for this campaign. Set false to register on your main account. */
74
+ create_sub_account?: boolean;
75
+ }
76
+ export declare namespace RegistrationRequest {
77
+ /** 'sole_proprietor' or 'standard_brand' */
78
+ const RegistrationType: {
79
+ readonly SoleProprietor: "sole_proprietor";
80
+ readonly StandardBrand: "standard_brand";
81
+ };
82
+ type RegistrationType = (typeof RegistrationType)[keyof typeof RegistrationType];
61
83
  }
@@ -1,2 +1,9 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export {};
2
+ export var RegistrationRequest;
3
+ (function (RegistrationRequest) {
4
+ /** 'sole_proprietor' or 'standard_brand' */
5
+ RegistrationRequest.RegistrationType = {
6
+ SoleProprietor: "sole_proprietor",
7
+ StandardBrand: "standard_brand",
8
+ };
9
+ })(RegistrationRequest || (RegistrationRequest = {}));
@@ -1 +1,2 @@
1
- export type { RegistrationRequest } from "./RegistrationRequest.mjs";
1
+ export type { GetRegistrationStatusV1RegisterStatusGetRequest } from "./GetRegistrationStatusV1RegisterStatusGetRequest.mjs";
2
+ export { RegistrationRequest } from "./RegistrationRequest.mjs";
@@ -1 +1 @@
1
- export {};
1
+ export { RegistrationRequest } from "./RegistrationRequest.mjs";
@@ -11,12 +11,15 @@ export declare class SubAccountsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<SubAccountsClient.Options>;
12
12
  constructor(options?: SubAccountsClient.Options);
13
13
  /**
14
+ * @param {AgentPhone.ListSubAccountsV1SubAccountsGetRequest} request
14
15
  * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
15
16
  *
17
+ * @throws {@link AgentPhone.UnprocessableEntityError}
18
+ *
16
19
  * @example
17
20
  * await client.subAccounts.listSubAccounts()
18
21
  */
19
- listSubAccounts(requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
22
+ listSubAccounts(request?: AgentPhone.ListSubAccountsV1SubAccountsGetRequest, requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
20
23
  private __listSubAccounts;
21
24
  /**
22
25
  * @param {AgentPhone.CreateSubAccountRequest} request
@@ -31,24 +31,32 @@ export class SubAccountsClient {
31
31
  this._options = normalizeClientOptionsWithAuth(options);
32
32
  }
33
33
  /**
34
+ * @param {AgentPhone.ListSubAccountsV1SubAccountsGetRequest} request
34
35
  * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
35
36
  *
37
+ * @throws {@link AgentPhone.UnprocessableEntityError}
38
+ *
36
39
  * @example
37
40
  * await client.subAccounts.listSubAccounts()
38
41
  */
39
- listSubAccounts(requestOptions) {
40
- return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(requestOptions));
42
+ listSubAccounts(request = {}, requestOptions) {
43
+ return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(request, requestOptions));
41
44
  }
42
- __listSubAccounts(requestOptions) {
43
- return __awaiter(this, void 0, void 0, function* () {
45
+ __listSubAccounts() {
46
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
44
47
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
48
+ const { limit, offset } = request;
49
+ const _queryParams = {
50
+ limit,
51
+ offset,
52
+ };
45
53
  const _authRequest = yield this._options.authProvider.getAuthRequest();
46
54
  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);
47
55
  const _response = yield core.fetcher({
48
56
  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/sub-accounts"),
49
57
  method: "GET",
50
58
  headers: _headers,
51
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
59
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
52
60
  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,
53
61
  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,
54
62
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -59,11 +67,16 @@ export class SubAccountsClient {
59
67
  return { data: _response.body, rawResponse: _response.rawResponse };
60
68
  }
61
69
  if (_response.error.reason === "status-code") {
62
- throw new errors.AgentPhoneError({
63
- statusCode: _response.error.statusCode,
64
- body: _response.error.body,
65
- rawResponse: _response.rawResponse,
66
- });
70
+ switch (_response.error.statusCode) {
71
+ case 422:
72
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
73
+ default:
74
+ throw new errors.AgentPhoneError({
75
+ statusCode: _response.error.statusCode,
76
+ body: _response.error.body,
77
+ rawResponse: _response.rawResponse,
78
+ });
79
+ }
67
80
  }
68
81
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/sub-accounts");
69
82
  });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListSubAccountsV1SubAccountsGetRequest {
6
+ limit?: number | null;
7
+ offset?: number;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,3 +1,4 @@
1
1
  export type { CreateSubAccountRequest } from "./CreateSubAccountRequest.mjs";
2
2
  export type { DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest } from "./DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs";
3
+ export type { ListSubAccountsV1SubAccountsGetRequest } from "./ListSubAccountsV1SubAccountsGetRequest.mjs";
3
4
  export type { UpdateSubAccountRequest } from "./UpdateSubAccountRequest.mjs";
@@ -10,7 +10,10 @@ export interface AgentResponse {
10
10
  beginMessage?: string | null;
11
11
  voice: string;
12
12
  transferNumber?: string | null;
13
+ customTools?: Record<string, unknown>[] | null;
13
14
  voicemailMessage?: string | null;
15
+ callScreeningIdentity?: string | null;
16
+ callScreeningPurpose?: string | null;
14
17
  /** Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency). */
15
18
  sttMode?: AgentResponse.SttMode;
16
19
  /** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
@@ -0,0 +1,7 @@
1
+ export declare const CampaignInclude: {
2
+ readonly Links: "links";
3
+ readonly PhoneNumbers: "phone_numbers";
4
+ readonly AgeGated: "age_gated";
5
+ readonly DirectLending: "direct_lending";
6
+ };
7
+ export type CampaignInclude = (typeof CampaignInclude)[keyof typeof CampaignInclude];
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const CampaignInclude = {
3
+ Links: "links",
4
+ PhoneNumbers: "phone_numbers",
5
+ AgeGated: "age_gated",
6
+ DirectLending: "direct_lending",
7
+ };
@@ -0,0 +1,4 @@
1
+ export interface CampaignStatusResponse {
2
+ campaign_status: string;
3
+ message: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as AgentPhone from "../index.mjs";
2
+ export interface ContactCapabilitiesResponse {
3
+ phoneNumber: string;
4
+ capabilities: AgentPhone.ContactCapabilityFlags;
5
+ checkedAt: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface ContactCapabilityFlags {
2
+ imessage: boolean;
3
+ sms: boolean;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare const ContactTitle: {
2
+ readonly Ceo: "ceo";
3
+ readonly Cfo: "cfo";
4
+ readonly Cto: "cto";
5
+ readonly Coo: "coo";
6
+ readonly Vp: "vp";
7
+ readonly Gm: "gm";
8
+ readonly Director: "director";
9
+ readonly Other: "other";
10
+ };
11
+ export type ContactTitle = (typeof ContactTitle)[keyof typeof ContactTitle];
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const ContactTitle = {
3
+ Ceo: "ceo",
4
+ Cfo: "cfo",
5
+ Cto: "cto",
6
+ Coo: "coo",
7
+ Vp: "vp",
8
+ Gm: "gm",
9
+ Director: "director",
10
+ Other: "other",
11
+ };
@@ -0,0 +1,28 @@
1
+ export interface CustomToolParam {
2
+ /** Function name the agent calls. Letters, numbers, underscores, hyphens; max 64 chars. Must be unique and not a reserved built-in name. */
3
+ name: string;
4
+ /** What the tool does and when to use it. The agent relies on this to decide when to call it. */
5
+ description: string;
6
+ /** HTTPS endpoint the voice provider calls when the agent invokes this tool. */
7
+ url: string;
8
+ /** HTTP method. Defaults to POST. */
9
+ method?: CustomToolParam.Method;
10
+ /** Optional HTTP headers sent with the request (e.g. an Authorization token for your endpoint). */
11
+ headers?: Record<string, string | null> | null;
12
+ /** JSON Schema object describing the arguments the agent fills in. Omit for a no-argument tool. */
13
+ parameters?: Record<string, unknown> | null;
14
+ /** How long to wait for your endpoint before giving up. Range 1000-120000 ms. */
15
+ timeoutMs?: number | null;
16
+ /** When true, the agent speaks executionMessage while the tool runs. */
17
+ speakDuringExecution?: boolean | null;
18
+ /** What the agent says while the tool runs (used when speakDuringExecution is true). */
19
+ executionMessage?: string | null;
20
+ }
21
+ export declare namespace CustomToolParam {
22
+ /** HTTP method. Defaults to POST. */
23
+ const Method: {
24
+ readonly Get: "GET";
25
+ readonly Post: "POST";
26
+ };
27
+ type Method = (typeof Method)[keyof typeof Method];
28
+ }
@@ -0,0 +1,9 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var CustomToolParam;
3
+ (function (CustomToolParam) {
4
+ /** HTTP method. Defaults to POST. */
5
+ CustomToolParam.Method = {
6
+ Get: "GET",
7
+ Post: "POST",
8
+ };
9
+ })(CustomToolParam || (CustomToolParam = {}));
@@ -0,0 +1,11 @@
1
+ export declare const OrganizationType: {
2
+ readonly SoleProprietor: "sole_proprietor";
3
+ readonly PrivateCorporation: "private_corporation";
4
+ readonly PublicCorporation: "public_corporation";
5
+ readonly Llc: "llc";
6
+ readonly Partnership: "partnership";
7
+ readonly NonProfit: "non_profit";
8
+ readonly CoOp: "co_op";
9
+ readonly Government: "government";
10
+ };
11
+ export type OrganizationType = (typeof OrganizationType)[keyof typeof OrganizationType];
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const OrganizationType = {
3
+ SoleProprietor: "sole_proprietor",
4
+ PrivateCorporation: "private_corporation",
5
+ PublicCorporation: "public_corporation",
6
+ Llc: "llc",
7
+ Partnership: "partnership",
8
+ NonProfit: "non_profit",
9
+ CoOp: "co_op",
10
+ Government: "government",
11
+ };
@@ -1,8 +1,7 @@
1
- import type * as AgentPhone from "../index.mjs";
2
1
  export interface RegistrationResponse {
3
2
  ok: boolean;
4
3
  message: string;
5
- payment_url: string;
6
4
  campaign_status: string;
7
- warnings?: AgentPhone.FieldWarning[];
5
+ sub_account_id?: string | null;
6
+ fee_cents?: number;
8
7
  }
@@ -0,0 +1,13 @@
1
+ export declare const UseCase: {
2
+ readonly AccountNotification: "account_notification";
3
+ readonly CustomerCare: "customer_care";
4
+ readonly DeliveryNotification: "delivery_notification";
5
+ readonly FraudAlert: "fraud_alert";
6
+ readonly HigherEducation: "higher_education";
7
+ readonly Marketing: "marketing";
8
+ readonly PollingVoting: "polling_voting";
9
+ readonly PublicServiceAnnouncement: "public_service_announcement";
10
+ readonly SecurityAlert: "security_alert";
11
+ readonly TwoFactorAuthentication: "two_factor_authentication";
12
+ };
13
+ export type UseCase = (typeof UseCase)[keyof typeof UseCase];
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const UseCase = {
3
+ AccountNotification: "account_notification",
4
+ CustomerCare: "customer_care",
5
+ DeliveryNotification: "delivery_notification",
6
+ FraudAlert: "fraud_alert",
7
+ HigherEducation: "higher_education",
8
+ Marketing: "marketing",
9
+ PollingVoting: "polling_voting",
10
+ PublicServiceAnnouncement: "public_service_announcement",
11
+ SecurityAlert: "security_alert",
12
+ TwoFactorAuthentication: "two_factor_authentication",
13
+ };
@@ -0,0 +1,5 @@
1
+ export declare const Volume: {
2
+ readonly Low: "low";
3
+ readonly High: "high";
4
+ };
5
+ export type Volume = (typeof Volume)[keyof typeof Volume];
@@ -0,0 +1,5 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const Volume = {
3
+ Low: "low",
4
+ High: "high",
5
+ };
@@ -13,14 +13,19 @@ export * from "./AppRoutesConversationsConversationSummary.mjs";
13
13
  export * from "./AttachNumberResponse.mjs";
14
14
  export * from "./CallListResponse.mjs";
15
15
  export * from "./CallSummary.mjs";
16
+ export * from "./CampaignInclude.mjs";
17
+ export * from "./CampaignStatusResponse.mjs";
18
+ export * from "./ContactCapabilitiesResponse.mjs";
19
+ export * from "./ContactCapabilityFlags.mjs";
16
20
  export * from "./ContactCardResponse.mjs";
17
21
  export * from "./ContactListResponse.mjs";
18
22
  export * from "./ContactResponse.mjs";
23
+ export * from "./ContactTitle.mjs";
19
24
  export * from "./ConversationDetail.mjs";
25
+ export * from "./CustomToolParam.mjs";
20
26
  export * from "./DailyUsagePoint.mjs";
21
27
  export * from "./DailyUsageResponse.mjs";
22
28
  export * from "./DeleteAgentResponse.mjs";
23
- export * from "./FieldWarning.mjs";
24
29
  export * from "./GroupParticipant.mjs";
25
30
  export * from "./HttpValidationError.mjs";
26
31
  export * from "./LocationRefreshResponse.mjs";
@@ -34,6 +39,7 @@ export * from "./MonthlyUsageResponse.mjs";
34
39
  export * from "./NumberLimits.mjs";
35
40
  export * from "./NumberUsageItem.mjs";
36
41
  export * from "./NumberUsageResponse.mjs";
42
+ export * from "./OrganizationType.mjs";
37
43
  export * from "./PaginatedDeliveriesResponse.mjs";
38
44
  export * from "./PhoneNumberListResponse.mjs";
39
45
  export * from "./PhoneNumberResponse.mjs";
@@ -48,7 +54,9 @@ export * from "./SendTypingResponse.mjs";
48
54
  export * from "./SetBackgroundResponse.mjs";
49
55
  export * from "./UsageResponse.mjs";
50
56
  export * from "./UsageStats.mjs";
57
+ export * from "./UseCase.mjs";
51
58
  export * from "./ValidationError.mjs";
59
+ export * from "./Volume.mjs";
52
60
  export * from "./WebhookCreateRequest.mjs";
53
61
  export * from "./WebhookDeliveryResponse.mjs";
54
62
  export * from "./WebhookDeliveryStatsResponse.mjs";