agentphone 1.0.12 → 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.
Files changed (108) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +9 -4
  4. package/dist/cjs/api/resources/agents/client/Client.js +11 -11
  5. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
  6. package/dist/cjs/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.ts +2 -0
  7. package/dist/cjs/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.ts +2 -0
  8. package/dist/cjs/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.ts +2 -1
  9. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -0
  10. package/dist/cjs/api/resources/calls/client/Client.js +16 -5
  11. package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +2 -0
  12. package/dist/cjs/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.ts +2 -1
  13. package/dist/cjs/api/resources/contacts/client/Client.js +2 -3
  14. package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts +2 -1
  15. package/dist/cjs/api/resources/conversations/client/Client.d.ts +5 -3
  16. package/dist/cjs/api/resources/conversations/client/Client.js +7 -6
  17. package/dist/cjs/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.ts +2 -1
  18. package/dist/cjs/api/resources/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/index.js +3 -1
  20. package/dist/cjs/api/resources/numbers/client/Client.js +18 -7
  21. package/dist/cjs/api/resources/numbers/client/requests/CreateNumberRequest.d.ts +2 -0
  22. package/dist/cjs/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.ts +2 -0
  23. package/dist/cjs/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.ts +2 -1
  24. package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +61 -0
  25. package/dist/cjs/api/resources/subAccounts/client/Client.js +261 -0
  26. package/dist/cjs/api/resources/subAccounts/client/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/subAccounts/client/index.js +17 -0
  28. package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.ts +9 -0
  29. package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.js +3 -0
  30. package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.ts +9 -0
  31. package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.js +3 -0
  32. package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.ts +11 -0
  33. package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.js +3 -0
  34. package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +3 -0
  35. package/dist/cjs/api/resources/subAccounts/client/requests/index.js +2 -0
  36. package/dist/cjs/api/resources/subAccounts/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/subAccounts/index.js +17 -0
  38. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +7 -4
  39. package/dist/cjs/api/resources/webhooks/client/Client.js +14 -9
  40. package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.ts +14 -0
  41. package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.js +3 -0
  42. package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.ts +8 -0
  43. package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.js +3 -0
  44. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
  45. package/dist/cjs/api/types/AppRoutesConversationsConversationSummary.d.ts +6 -0
  46. package/dist/cjs/api/types/ConversationDetail.d.ts +5 -0
  47. package/dist/cjs/api/types/GroupParticipant.d.ts +7 -0
  48. package/dist/cjs/api/types/GroupParticipant.js +3 -0
  49. package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
  50. package/dist/cjs/api/types/index.d.ts +1 -0
  51. package/dist/cjs/api/types/index.js +1 -0
  52. package/dist/cjs/version.d.ts +1 -1
  53. package/dist/cjs/version.js +1 -1
  54. package/dist/esm/BaseClient.mjs +2 -2
  55. package/dist/esm/Client.d.mts +3 -0
  56. package/dist/esm/Client.mjs +5 -0
  57. package/dist/esm/api/resources/agents/client/Client.mjs +12 -12
  58. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +2 -0
  59. package/dist/esm/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.mts +2 -0
  60. package/dist/esm/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.mts +2 -0
  61. package/dist/esm/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.mts +2 -1
  62. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -0
  63. package/dist/esm/api/resources/calls/client/Client.mjs +17 -6
  64. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +2 -0
  65. package/dist/esm/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.mts +2 -1
  66. package/dist/esm/api/resources/contacts/client/Client.mjs +3 -4
  67. package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.mts +2 -1
  68. package/dist/esm/api/resources/conversations/client/Client.d.mts +5 -3
  69. package/dist/esm/api/resources/conversations/client/Client.mjs +8 -7
  70. package/dist/esm/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.mts +2 -1
  71. package/dist/esm/api/resources/index.d.mts +2 -0
  72. package/dist/esm/api/resources/index.mjs +2 -0
  73. package/dist/esm/api/resources/numbers/client/Client.mjs +19 -8
  74. package/dist/esm/api/resources/numbers/client/requests/CreateNumberRequest.d.mts +2 -0
  75. package/dist/esm/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.mts +2 -0
  76. package/dist/esm/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.mts +2 -1
  77. package/dist/esm/api/resources/subAccounts/client/Client.d.mts +61 -0
  78. package/dist/esm/api/resources/subAccounts/client/Client.mjs +224 -0
  79. package/dist/esm/api/resources/subAccounts/client/index.d.mts +1 -0
  80. package/dist/esm/api/resources/subAccounts/client/index.mjs +1 -0
  81. package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.mts +9 -0
  82. package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.mjs +2 -0
  83. package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.mts +9 -0
  84. package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs +2 -0
  85. package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.mts +11 -0
  86. package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.mjs +2 -0
  87. package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +3 -0
  88. package/dist/esm/api/resources/subAccounts/client/requests/index.mjs +1 -0
  89. package/dist/esm/api/resources/subAccounts/index.d.mts +1 -0
  90. package/dist/esm/api/resources/subAccounts/index.mjs +1 -0
  91. package/dist/esm/api/resources/webhooks/client/Client.d.mts +7 -4
  92. package/dist/esm/api/resources/webhooks/client/Client.mjs +15 -10
  93. package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.mts +14 -0
  94. package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.mjs +2 -0
  95. package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.mts +8 -0
  96. package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.mjs +2 -0
  97. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
  98. package/dist/esm/api/types/AppRoutesConversationsConversationSummary.d.mts +6 -0
  99. package/dist/esm/api/types/ConversationDetail.d.mts +5 -0
  100. package/dist/esm/api/types/GroupParticipant.d.mts +7 -0
  101. package/dist/esm/api/types/GroupParticipant.mjs +2 -0
  102. package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
  103. package/dist/esm/api/types/index.d.mts +1 -0
  104. package/dist/esm/api/types/index.mjs +1 -0
  105. package/dist/esm/version.d.mts +1 -1
  106. package/dist/esm/version.mjs +1 -1
  107. package/package.json +1 -1
  108. package/reference.md +214 -6
@@ -8,6 +8,7 @@ import { ConversationsClient } from "./api/resources/conversations/client/Client
8
8
  import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
9
9
  import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
10
10
  import { RegistrationClient } from "./api/resources/registration/client/Client.mjs";
11
+ import { SubAccountsClient } from "./api/resources/subAccounts/client/Client.mjs";
11
12
  import { UsageClient } from "./api/resources/usage/client/Client.mjs";
12
13
  import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
13
14
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
@@ -59,4 +60,8 @@ export class AgentPhoneClient {
59
60
  var _a;
60
61
  return ((_a = this._registration) !== null && _a !== void 0 ? _a : (this._registration = new RegistrationClient(this._options)));
61
62
  }
63
+ get subAccounts() {
64
+ var _a;
65
+ return ((_a = this._subAccounts) !== null && _a !== void 0 ? _a : (this._subAccounts = new SubAccountsClient(this._options)));
66
+ }
62
67
  }
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
- import { mergeHeaders } from "../../../../core/headers.mjs";
23
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
24
24
  import * as core from "../../../../core/index.mjs";
25
25
  import * as environments from "../../../../environments.mjs";
26
26
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -87,13 +87,12 @@ export class AgentsClient {
87
87
  __listAgents() {
88
88
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
89
89
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
90
- const { limit, offset } = request;
90
+ const { offset, "X-Sub-Account-Id": subAccountId } = request;
91
91
  const _queryParams = {
92
- limit,
93
92
  offset,
94
93
  };
95
94
  const _authRequest = yield this._options.authProvider.getAuthRequest();
96
- 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);
95
+ 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);
97
96
  const _response = yield core.fetcher({
98
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/agents"),
99
98
  method: "GET",
@@ -148,8 +147,9 @@ export class AgentsClient {
148
147
  __createAgent(request, requestOptions) {
149
148
  return __awaiter(this, void 0, void 0, function* () {
150
149
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
150
+ const { "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["X-Sub-Account-Id"]);
151
151
  const _authRequest = yield this._options.authProvider.getAuthRequest();
152
- 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);
152
+ 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);
153
153
  const _response = yield core.fetcher({
154
154
  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/agents"),
155
155
  method: "POST",
@@ -157,7 +157,7 @@ export class AgentsClient {
157
157
  contentType: "application/json",
158
158
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
159
159
  requestType: "json",
160
- body: request,
160
+ body: _body,
161
161
  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,
162
162
  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,
163
163
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -201,9 +201,9 @@ export class AgentsClient {
201
201
  __getAgent(request, requestOptions) {
202
202
  return __awaiter(this, void 0, void 0, function* () {
203
203
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
204
- const { agent_id: agentId } = request;
204
+ const { agent_id: agentId, "X-Sub-Account-Id": subAccountId } = request;
205
205
  const _authRequest = yield this._options.authProvider.getAuthRequest();
206
- 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);
206
+ 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);
207
207
  const _response = yield core.fetcher({
208
208
  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/agents/${core.url.encodePathParam(agentId)}`),
209
209
  method: "GET",
@@ -255,9 +255,9 @@ export class AgentsClient {
255
255
  __deleteAgent(request, requestOptions) {
256
256
  return __awaiter(this, void 0, void 0, function* () {
257
257
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
258
- const { agent_id: agentId } = request;
258
+ const { agent_id: agentId, "X-Sub-Account-Id": subAccountId } = request;
259
259
  const _authRequest = yield this._options.authProvider.getAuthRequest();
260
- 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);
260
+ 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);
261
261
  const _response = yield core.fetcher({
262
262
  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/agents/${core.url.encodePathParam(agentId)}`),
263
263
  method: "DELETE",
@@ -309,9 +309,9 @@ export class AgentsClient {
309
309
  __updateAgent(request, requestOptions) {
310
310
  return __awaiter(this, void 0, void 0, function* () {
311
311
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
312
- const { agent_id: agentId } = request, _body = __rest(request, ["agent_id"]);
312
+ const { agent_id: agentId, "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["agent_id", "X-Sub-Account-Id"]);
313
313
  const _authRequest = yield this._options.authProvider.getAuthRequest();
314
- 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);
314
+ 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);
315
315
  const _response = yield core.fetcher({
316
316
  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/agents/${core.url.encodePathParam(agentId)}`),
317
317
  method: "PATCH",
@@ -5,6 +5,8 @@
5
5
  * }
6
6
  */
7
7
  export interface CreateAgentRequest {
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;
8
10
  name: string;
9
11
  description?: string | null;
10
12
  voiceMode?: CreateAgentRequest.VoiceMode;
@@ -6,4 +6,6 @@
6
6
  */
7
7
  export interface DeleteAgentV1AgentsAgentIdDeleteRequest {
8
8
  agent_id: string;
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
  }
@@ -6,4 +6,6 @@
6
6
  */
7
7
  export interface GetAgentV1AgentsAgentIdGetRequest {
8
8
  agent_id: string;
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
  }
@@ -3,6 +3,7 @@
3
3
  * {}
4
4
  */
5
5
  export interface ListAgentsV1AgentsGetRequest {
6
- limit?: number;
7
6
  offset?: number;
7
+ /** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
8
+ "X-Sub-Account-Id"?: string;
8
9
  }
@@ -6,6 +6,8 @@
6
6
  */
7
7
  export interface UpdateAgentRequest {
8
8
  agent_id: string;
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
  name?: string | null;
10
12
  description?: string | null;
11
13
  voiceMode?: UpdateAgentRequest.VoiceMode;
@@ -8,8 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
23
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
24
  import * as core from "../../../../core/index.mjs";
14
25
  import * as environments from "../../../../environments.mjs";
15
26
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -36,9 +47,8 @@ export class CallsClient {
36
47
  __listCalls() {
37
48
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
49
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
- const { limit, offset, status, direction, type: type_, search } = request;
50
+ const { offset, status, direction, type: type_, search, "X-Sub-Account-Id": subAccountId } = request;
40
51
  const _queryParams = {
41
- limit,
42
52
  offset,
43
53
  status,
44
54
  direction,
@@ -46,7 +56,7 @@ export class CallsClient {
46
56
  search,
47
57
  };
48
58
  const _authRequest = yield this._options.authProvider.getAuthRequest();
49
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
59
+ 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
60
  const _response = yield core.fetcher({
51
61
  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"),
52
62
  method: "GET",
@@ -107,8 +117,9 @@ export class CallsClient {
107
117
  __createOutboundCall(request, requestOptions) {
108
118
  return __awaiter(this, void 0, void 0, function* () {
109
119
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
120
+ const { "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["X-Sub-Account-Id"]);
110
121
  const _authRequest = yield this._options.authProvider.getAuthRequest();
111
- 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);
122
+ 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);
112
123
  const _response = yield core.fetcher({
113
124
  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"),
114
125
  method: "POST",
@@ -116,7 +127,7 @@ export class CallsClient {
116
127
  contentType: "application/json",
117
128
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
118
129
  requestType: "json",
119
- body: request,
130
+ body: _body,
120
131
  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,
121
132
  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,
122
133
  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
  }
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
- import { mergeHeaders } from "../../../../core/headers.mjs";
23
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
24
24
  import * as core from "../../../../core/index.mjs";
25
25
  import * as environments from "../../../../environments.mjs";
26
26
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -49,14 +49,13 @@ export class ContactsClient {
49
49
  __listContacts() {
50
50
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
51
51
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
52
- const { search, limit, offset } = request;
52
+ const { limit, offset, "X-Sub-Account-Id": subAccountId } = request;
53
53
  const _queryParams = {
54
- search,
55
54
  limit,
56
55
  offset,
57
56
  };
58
57
  const _authRequest = yield this._options.authProvider.getAuthRequest();
59
- 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);
58
+ 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);
60
59
  const _response = yield core.fetcher({
61
60
  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"),
62
61
  method: "GET",
@@ -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
- * Best-effort: providers may silently drop the indicator if the chat hasn't
87
- * had recent activity, the recipient isn't on iMessage, or it's a group chat.
88
- * Indicators auto-expire after a few seconds no "stop typing" call needed.
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.
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
- import { mergeHeaders } from "../../../../core/headers.mjs";
23
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
24
24
  import * as core from "../../../../core/index.mjs";
25
25
  import * as environments from "../../../../environments.mjs";
26
26
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -50,13 +50,12 @@ export class ConversationsClient {
50
50
  __listConversations() {
51
51
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
52
52
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
53
- const { limit, offset } = request;
53
+ const { offset, "X-Sub-Account-Id": subAccountId } = request;
54
54
  const _queryParams = {
55
- limit,
56
55
  offset,
57
56
  };
58
57
  const _authRequest = yield this._options.authProvider.getAuthRequest();
59
- 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);
58
+ 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);
60
59
  const _response = yield core.fetcher({
61
60
  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"),
62
61
  method: "GET",
@@ -265,9 +264,11 @@ export class ConversationsClient {
265
264
  /**
266
265
  * Show a typing indicator in the conversation (iMessage only).
267
266
  *
268
- * Best-effort: providers may silently drop the indicator if the chat hasn't
269
- * had recent activity, the recipient isn't on iMessage, or it's a group chat.
270
- * Indicators auto-expire after a few seconds no "stop typing" call needed.
267
+ * Works for both 1:1 and group chats: a group id is itself a valid typing
268
+ * target, so every participant sees the indicator. Best-effort: the
269
+ * indicator may be silently dropped if the chat has no recent activity, the
270
+ * recipient isn't on iMessage, or it's RCS-routed (RCS carries no composing
271
+ * state). Auto-expires after a few seconds; no "stop typing" call needed.
271
272
  *
272
273
  * @param {AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest} request
273
274
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3,6 +3,7 @@
3
3
  * {}
4
4
  */
5
5
  export interface ListConversationsV1ConversationsGetRequest {
6
- limit?: number;
7
6
  offset?: number;
7
+ /** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
8
+ "X-Sub-Account-Id"?: string;
8
9
  }
@@ -16,6 +16,8 @@ export * from "./numbers/client/requests/index.mjs";
16
16
  export * as numbers from "./numbers/index.mjs";
17
17
  export * from "./registration/client/requests/index.mjs";
18
18
  export * as registration from "./registration/index.mjs";
19
+ export * from "./subAccounts/client/requests/index.mjs";
20
+ export * as subAccounts from "./subAccounts/index.mjs";
19
21
  export * from "./usage/client/requests/index.mjs";
20
22
  export * as usage from "./usage/index.mjs";
21
23
  export * from "./usage/types/index.mjs";
@@ -16,6 +16,8 @@ export * from "./numbers/client/requests/index.mjs";
16
16
  export * as numbers from "./numbers/index.mjs";
17
17
  export * from "./registration/client/requests/index.mjs";
18
18
  export * as registration from "./registration/index.mjs";
19
+ export * from "./subAccounts/client/requests/index.mjs";
20
+ export * as subAccounts from "./subAccounts/index.mjs";
19
21
  export * from "./usage/client/requests/index.mjs";
20
22
  export * as usage from "./usage/index.mjs";
21
23
  export * from "./usage/types/index.mjs";
@@ -8,8 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
23
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
24
  import * as core from "../../../../core/index.mjs";
14
25
  import * as environments from "../../../../environments.mjs";
15
26
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -36,13 +47,12 @@ export class NumbersClient {
36
47
  __listNumbers() {
37
48
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
49
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
- const { limit, offset } = request;
50
+ const { offset, "X-Sub-Account-Id": subAccountId } = request;
40
51
  const _queryParams = {
41
- limit,
42
52
  offset,
43
53
  };
44
54
  const _authRequest = yield this._options.authProvider.getAuthRequest();
45
- 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);
55
+ 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);
46
56
  const _response = yield core.fetcher({
47
57
  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"),
48
58
  method: "GET",
@@ -95,8 +105,9 @@ export class NumbersClient {
95
105
  __createNumber() {
96
106
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
97
107
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
108
+ const { "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["X-Sub-Account-Id"]);
98
109
  const _authRequest = yield this._options.authProvider.getAuthRequest();
99
- 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);
110
+ 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);
100
111
  const _response = yield core.fetcher({
101
112
  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"),
102
113
  method: "POST",
@@ -104,7 +115,7 @@ export class NumbersClient {
104
115
  contentType: "application/json",
105
116
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
106
117
  requestType: "json",
107
- body: request,
118
+ body: _body,
108
119
  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,
109
120
  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,
110
121
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -213,9 +224,9 @@ export class NumbersClient {
213
224
  __deleteNumber(request, requestOptions) {
214
225
  return __awaiter(this, void 0, void 0, function* () {
215
226
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
216
- const { number_id: numberId } = request;
227
+ const { number_id: numberId, "X-Sub-Account-Id": subAccountId } = request;
217
228
  const _authRequest = yield this._options.authProvider.getAuthRequest();
218
- 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);
229
+ 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);
219
230
  const _response = yield core.fetcher({
220
231
  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)}`),
221
232
  method: "DELETE",
@@ -3,6 +3,8 @@
3
3
  * {}
4
4
  */
5
5
  export interface CreateNumberRequest {
6
+ /** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
7
+ "X-Sub-Account-Id"?: string;
6
8
  country?: string;
7
9
  areaCode?: string | null;
8
10
  agentId?: string | null;
@@ -6,4 +6,6 @@
6
6
  */
7
7
  export interface DeleteNumberV1NumbersNumberIdDeleteRequest {
8
8
  number_id: string;
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
  }
@@ -3,6 +3,7 @@
3
3
  * {}
4
4
  */
5
5
  export interface ListNumbersV1NumbersGetRequest {
6
- limit?: number;
7
6
  offset?: number;
7
+ /** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
8
+ "X-Sub-Account-Id"?: string;
8
9
  }
@@ -0,0 +1,61 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
+ import * as core from "../../../../core/index.mjs";
4
+ import * as AgentPhone from "../../../index.mjs";
5
+ export declare namespace SubAccountsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class SubAccountsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<SubAccountsClient.Options>;
12
+ constructor(options?: SubAccountsClient.Options);
13
+ /**
14
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
15
+ *
16
+ * @example
17
+ * await client.subAccounts.listSubAccounts()
18
+ */
19
+ listSubAccounts(requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
20
+ private __listSubAccounts;
21
+ /**
22
+ * @param {AgentPhone.CreateSubAccountRequest} request
23
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
24
+ *
25
+ * @throws {@link AgentPhone.UnprocessableEntityError}
26
+ *
27
+ * @example
28
+ * await client.subAccounts.createSubAccount({
29
+ * name: "name"
30
+ * })
31
+ */
32
+ createSubAccount(request: AgentPhone.CreateSubAccountRequest, requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
33
+ private __createSubAccount;
34
+ /**
35
+ * @param {AgentPhone.DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest} request
36
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
37
+ *
38
+ * @throws {@link AgentPhone.UnprocessableEntityError}
39
+ *
40
+ * @example
41
+ * await client.subAccounts.deleteSubAccount({
42
+ * sub_account_id: "sub_account_id"
43
+ * })
44
+ */
45
+ deleteSubAccount(request: AgentPhone.DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest, requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
46
+ private __deleteSubAccount;
47
+ /**
48
+ * @param {AgentPhone.UpdateSubAccountRequest} request
49
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
50
+ *
51
+ * @throws {@link AgentPhone.UnprocessableEntityError}
52
+ *
53
+ * @example
54
+ * await client.subAccounts.updateSubAccount({
55
+ * sub_account_id: "sub_account_id",
56
+ * name: "name"
57
+ * })
58
+ */
59
+ updateSubAccount(request: AgentPhone.UpdateSubAccountRequest, requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
60
+ private __updateSubAccount;
61
+ }