agentphone 1.0.12 → 1.0.14

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 (158) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +6 -0
  3. package/dist/cjs/Client.js +20 -10
  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/contactCards/client/Client.d.ts +1 -4
  14. package/dist/cjs/api/resources/contactCards/client/Client.js +1 -4
  15. package/dist/cjs/api/resources/contactCards/client/requests/ContactCardWriteRequest.d.ts +4 -7
  16. package/dist/cjs/api/resources/contacts/client/Client.js +2 -3
  17. package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts +2 -1
  18. package/dist/cjs/api/resources/conversations/client/Client.d.ts +5 -3
  19. package/dist/cjs/api/resources/conversations/client/Client.js +7 -6
  20. package/dist/cjs/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.ts +2 -1
  21. package/dist/cjs/api/resources/index.d.ts +4 -0
  22. package/dist/cjs/api/resources/index.js +5 -1
  23. package/dist/cjs/api/resources/location/client/Client.d.ts +34 -0
  24. package/dist/cjs/api/resources/location/client/Client.js +146 -0
  25. package/dist/cjs/api/resources/location/client/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/location/client/index.js +17 -0
  27. package/dist/cjs/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.d.ts +9 -0
  28. package/dist/cjs/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.js +3 -0
  29. package/dist/cjs/api/resources/location/client/requests/index.d.ts +1 -0
  30. package/dist/cjs/api/resources/location/client/requests/index.js +2 -0
  31. package/dist/cjs/api/resources/location/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/location/index.js +17 -0
  33. package/dist/cjs/api/resources/messages/client/Client.d.ts +0 -1
  34. package/dist/cjs/api/resources/messages/client/Client.js +0 -1
  35. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +2 -2
  36. package/dist/cjs/api/resources/numbers/client/Client.d.ts +29 -7
  37. package/dist/cjs/api/resources/numbers/client/Client.js +93 -24
  38. package/dist/cjs/api/resources/numbers/client/requests/CreateNumberRequest.d.ts +2 -0
  39. package/dist/cjs/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.ts +2 -0
  40. package/dist/cjs/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.d.ts +9 -0
  41. package/dist/cjs/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.js +3 -0
  42. package/dist/cjs/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.ts +2 -1
  43. package/dist/cjs/api/resources/numbers/client/requests/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +61 -0
  45. package/dist/cjs/api/resources/subAccounts/client/Client.js +261 -0
  46. package/dist/cjs/api/resources/subAccounts/client/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/subAccounts/client/index.js +17 -0
  48. package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.ts +9 -0
  49. package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.js +3 -0
  50. package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.ts +9 -0
  51. package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.js +3 -0
  52. package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.ts +11 -0
  53. package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.js +3 -0
  54. package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +3 -0
  55. package/dist/cjs/api/resources/subAccounts/client/requests/index.js +2 -0
  56. package/dist/cjs/api/resources/subAccounts/index.d.ts +1 -0
  57. package/dist/cjs/api/resources/subAccounts/index.js +17 -0
  58. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +7 -4
  59. package/dist/cjs/api/resources/webhooks/client/Client.js +14 -9
  60. package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.ts +14 -0
  61. package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.js +3 -0
  62. package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.ts +8 -0
  63. package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.js +3 -0
  64. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
  65. package/dist/cjs/api/types/AgentVerifyRequest.d.ts +1 -0
  66. package/dist/cjs/api/types/AppRoutesConversationsConversationSummary.d.ts +6 -0
  67. package/dist/cjs/api/types/ConversationDetail.d.ts +5 -0
  68. package/dist/cjs/api/types/GroupParticipant.d.ts +7 -0
  69. package/dist/cjs/api/types/GroupParticipant.js +3 -0
  70. package/dist/cjs/api/types/LocationRefreshResponse.d.ts +4 -0
  71. package/dist/cjs/api/types/LocationRefreshResponse.js +3 -0
  72. package/dist/cjs/api/types/LocationResponse.d.ts +7 -0
  73. package/dist/cjs/api/types/LocationResponse.js +3 -0
  74. package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
  75. package/dist/cjs/api/types/index.d.ts +3 -0
  76. package/dist/cjs/api/types/index.js +3 -0
  77. package/dist/cjs/version.d.ts +1 -1
  78. package/dist/cjs/version.js +1 -1
  79. package/dist/esm/BaseClient.mjs +2 -2
  80. package/dist/esm/Client.d.mts +6 -0
  81. package/dist/esm/Client.mjs +10 -0
  82. package/dist/esm/api/resources/agents/client/Client.mjs +12 -12
  83. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +2 -0
  84. package/dist/esm/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.mts +2 -0
  85. package/dist/esm/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.mts +2 -0
  86. package/dist/esm/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.mts +2 -1
  87. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -0
  88. package/dist/esm/api/resources/calls/client/Client.mjs +17 -6
  89. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +2 -0
  90. package/dist/esm/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.mts +2 -1
  91. package/dist/esm/api/resources/contactCards/client/Client.d.mts +1 -4
  92. package/dist/esm/api/resources/contactCards/client/Client.mjs +1 -4
  93. package/dist/esm/api/resources/contactCards/client/requests/ContactCardWriteRequest.d.mts +4 -7
  94. package/dist/esm/api/resources/contacts/client/Client.mjs +3 -4
  95. package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.mts +2 -1
  96. package/dist/esm/api/resources/conversations/client/Client.d.mts +5 -3
  97. package/dist/esm/api/resources/conversations/client/Client.mjs +8 -7
  98. package/dist/esm/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.mts +2 -1
  99. package/dist/esm/api/resources/index.d.mts +4 -0
  100. package/dist/esm/api/resources/index.mjs +4 -0
  101. package/dist/esm/api/resources/location/client/Client.d.mts +34 -0
  102. package/dist/esm/api/resources/location/client/Client.mjs +109 -0
  103. package/dist/esm/api/resources/location/client/index.d.mts +1 -0
  104. package/dist/esm/api/resources/location/client/index.mjs +1 -0
  105. package/dist/esm/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.d.mts +9 -0
  106. package/dist/esm/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.mjs +2 -0
  107. package/dist/esm/api/resources/location/client/requests/index.d.mts +1 -0
  108. package/dist/esm/api/resources/location/client/requests/index.mjs +1 -0
  109. package/dist/esm/api/resources/location/index.d.mts +1 -0
  110. package/dist/esm/api/resources/location/index.mjs +1 -0
  111. package/dist/esm/api/resources/messages/client/Client.d.mts +0 -1
  112. package/dist/esm/api/resources/messages/client/Client.mjs +0 -1
  113. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +2 -2
  114. package/dist/esm/api/resources/numbers/client/Client.d.mts +29 -7
  115. package/dist/esm/api/resources/numbers/client/Client.mjs +94 -25
  116. package/dist/esm/api/resources/numbers/client/requests/CreateNumberRequest.d.mts +2 -0
  117. package/dist/esm/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.mts +2 -0
  118. package/dist/esm/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.d.mts +9 -0
  119. package/dist/esm/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.mjs +2 -0
  120. package/dist/esm/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.mts +2 -1
  121. package/dist/esm/api/resources/numbers/client/requests/index.d.mts +1 -0
  122. package/dist/esm/api/resources/subAccounts/client/Client.d.mts +61 -0
  123. package/dist/esm/api/resources/subAccounts/client/Client.mjs +224 -0
  124. package/dist/esm/api/resources/subAccounts/client/index.d.mts +1 -0
  125. package/dist/esm/api/resources/subAccounts/client/index.mjs +1 -0
  126. package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.mts +9 -0
  127. package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.mjs +2 -0
  128. package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.mts +9 -0
  129. package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs +2 -0
  130. package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.mts +11 -0
  131. package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.mjs +2 -0
  132. package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +3 -0
  133. package/dist/esm/api/resources/subAccounts/client/requests/index.mjs +1 -0
  134. package/dist/esm/api/resources/subAccounts/index.d.mts +1 -0
  135. package/dist/esm/api/resources/subAccounts/index.mjs +1 -0
  136. package/dist/esm/api/resources/webhooks/client/Client.d.mts +7 -4
  137. package/dist/esm/api/resources/webhooks/client/Client.mjs +15 -10
  138. package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.mts +14 -0
  139. package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.mjs +2 -0
  140. package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.mts +8 -0
  141. package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.mjs +2 -0
  142. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
  143. package/dist/esm/api/types/AgentVerifyRequest.d.mts +1 -0
  144. package/dist/esm/api/types/AppRoutesConversationsConversationSummary.d.mts +6 -0
  145. package/dist/esm/api/types/ConversationDetail.d.mts +5 -0
  146. package/dist/esm/api/types/GroupParticipant.d.mts +7 -0
  147. package/dist/esm/api/types/GroupParticipant.mjs +2 -0
  148. package/dist/esm/api/types/LocationRefreshResponse.d.mts +4 -0
  149. package/dist/esm/api/types/LocationRefreshResponse.mjs +2 -0
  150. package/dist/esm/api/types/LocationResponse.d.mts +7 -0
  151. package/dist/esm/api/types/LocationResponse.mjs +2 -0
  152. package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
  153. package/dist/esm/api/types/index.d.mts +3 -0
  154. package/dist/esm/api/types/index.mjs +3 -0
  155. package/dist/esm/version.d.mts +1 -1
  156. package/dist/esm/version.mjs +1 -1
  157. package/package.json +1 -1
  158. package/reference.md +386 -17
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentphone",
9
- "X-Fern-SDK-Version": "1.0.12",
10
- "User-Agent": "agentphone/1.0.12",
9
+ "X-Fern-SDK-Version": "1.0.14",
10
+ "User-Agent": "agentphone/1.0.14",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -4,9 +4,11 @@ import { CallsClient } from "./api/resources/calls/client/Client.mjs";
4
4
  import { ContactCardsClient } from "./api/resources/contactCards/client/Client.mjs";
5
5
  import { ContactsClient } from "./api/resources/contacts/client/Client.mjs";
6
6
  import { ConversationsClient } from "./api/resources/conversations/client/Client.mjs";
7
+ import { LocationClient } from "./api/resources/location/client/Client.mjs";
7
8
  import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
8
9
  import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
9
10
  import { RegistrationClient } from "./api/resources/registration/client/Client.mjs";
11
+ import { SubAccountsClient } from "./api/resources/subAccounts/client/Client.mjs";
10
12
  import { UsageClient } from "./api/resources/usage/client/Client.mjs";
11
13
  import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
12
14
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
@@ -29,6 +31,8 @@ export declare class AgentPhoneClient {
29
31
  protected _messages: MessagesClient | undefined;
30
32
  protected _contactCards: ContactCardsClient | undefined;
31
33
  protected _registration: RegistrationClient | undefined;
34
+ protected _subAccounts: SubAccountsClient | undefined;
35
+ protected _location: LocationClient | undefined;
32
36
  constructor(options?: AgentPhoneClient.Options);
33
37
  get agents(): AgentsClient;
34
38
  get numbers(): NumbersClient;
@@ -41,4 +45,6 @@ export declare class AgentPhoneClient {
41
45
  get messages(): MessagesClient;
42
46
  get contactCards(): ContactCardsClient;
43
47
  get registration(): RegistrationClient;
48
+ get subAccounts(): SubAccountsClient;
49
+ get location(): LocationClient;
44
50
  }
@@ -5,9 +5,11 @@ import { CallsClient } from "./api/resources/calls/client/Client.mjs";
5
5
  import { ContactCardsClient } from "./api/resources/contactCards/client/Client.mjs";
6
6
  import { ContactsClient } from "./api/resources/contacts/client/Client.mjs";
7
7
  import { ConversationsClient } from "./api/resources/conversations/client/Client.mjs";
8
+ import { LocationClient } from "./api/resources/location/client/Client.mjs";
8
9
  import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
9
10
  import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
10
11
  import { RegistrationClient } from "./api/resources/registration/client/Client.mjs";
12
+ import { SubAccountsClient } from "./api/resources/subAccounts/client/Client.mjs";
11
13
  import { UsageClient } from "./api/resources/usage/client/Client.mjs";
12
14
  import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
13
15
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
@@ -59,4 +61,12 @@ export class AgentPhoneClient {
59
61
  var _a;
60
62
  return ((_a = this._registration) !== null && _a !== void 0 ? _a : (this._registration = new RegistrationClient(this._options)));
61
63
  }
64
+ get subAccounts() {
65
+ var _a;
66
+ return ((_a = this._subAccounts) !== null && _a !== void 0 ? _a : (this._subAccounts = new SubAccountsClient(this._options)));
67
+ }
68
+ get location() {
69
+ var _a;
70
+ return ((_a = this._location) !== null && _a !== void 0 ? _a : (this._location = new LocationClient(this._options)));
71
+ }
62
72
  }
@@ -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
  }
@@ -35,10 +35,7 @@ export declare class ContactCardsClient {
35
35
  *
36
36
  * @example
37
37
  * await client.contactCards.putContactCard({
38
- * number_id: "number_id",
39
- * firstName: "firstName",
40
- * lastName: "lastName",
41
- * avatarUrl: "avatarUrl"
38
+ * number_id: "number_id"
42
39
  * })
43
40
  */
44
41
  putContactCard(request: AgentPhone.ContactCardWriteRequest, requestOptions?: ContactCardsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactCardResponse>;
@@ -91,10 +91,7 @@ export class ContactCardsClient {
91
91
  *
92
92
  * @example
93
93
  * await client.contactCards.putContactCard({
94
- * number_id: "number_id",
95
- * firstName: "firstName",
96
- * lastName: "lastName",
97
- * avatarUrl: "avatarUrl"
94
+ * number_id: "number_id"
98
95
  * })
99
96
  */
100
97
  putContactCard(request, requestOptions) {
@@ -1,16 +1,13 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * number_id: "number_id",
5
- * firstName: "firstName",
6
- * lastName: "lastName",
7
- * avatarUrl: "avatarUrl"
4
+ * number_id: "number_id"
8
5
  * }
9
6
  */
10
7
  export interface ContactCardWriteRequest {
11
8
  number_id: string;
12
- firstName: string;
13
- lastName: string;
9
+ firstName?: string | null;
10
+ lastName?: string | null;
14
11
  displayName?: string | null;
15
- avatarUrl: string;
12
+ avatarUrl?: string | null;
16
13
  }
@@ -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
  }
@@ -10,12 +10,16 @@ export * from "./contacts/client/requests/index.mjs";
10
10
  export * as contacts from "./contacts/index.mjs";
11
11
  export * from "./conversations/client/requests/index.mjs";
12
12
  export * as conversations from "./conversations/index.mjs";
13
+ export * from "./location/client/requests/index.mjs";
14
+ export * as location from "./location/index.mjs";
13
15
  export * from "./messages/client/requests/index.mjs";
14
16
  export * as messages from "./messages/index.mjs";
15
17
  export * from "./numbers/client/requests/index.mjs";
16
18
  export * as numbers from "./numbers/index.mjs";
17
19
  export * from "./registration/client/requests/index.mjs";
18
20
  export * as registration from "./registration/index.mjs";
21
+ export * from "./subAccounts/client/requests/index.mjs";
22
+ export * as subAccounts from "./subAccounts/index.mjs";
19
23
  export * from "./usage/client/requests/index.mjs";
20
24
  export * as usage from "./usage/index.mjs";
21
25
  export * from "./usage/types/index.mjs";
@@ -10,12 +10,16 @@ export * from "./contacts/client/requests/index.mjs";
10
10
  export * as contacts from "./contacts/index.mjs";
11
11
  export * from "./conversations/client/requests/index.mjs";
12
12
  export * as conversations from "./conversations/index.mjs";
13
+ export * from "./location/client/requests/index.mjs";
14
+ export * as location from "./location/index.mjs";
13
15
  export * from "./messages/client/requests/index.mjs";
14
16
  export * as messages from "./messages/index.mjs";
15
17
  export * from "./numbers/client/requests/index.mjs";
16
18
  export * as numbers from "./numbers/index.mjs";
17
19
  export * from "./registration/client/requests/index.mjs";
18
20
  export * as registration from "./registration/index.mjs";
21
+ export * from "./subAccounts/client/requests/index.mjs";
22
+ export * as subAccounts from "./subAccounts/index.mjs";
19
23
  export * from "./usage/client/requests/index.mjs";
20
24
  export * as usage from "./usage/index.mjs";
21
25
  export * from "./usage/types/index.mjs";
@@ -0,0 +1,34 @@
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 LocationClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class LocationClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<LocationClient.Options>;
12
+ constructor(options?: LocationClient.Options);
13
+ /**
14
+ * @param {AgentPhone.GetLocationV1LocationPhoneNumberGetRequest} request
15
+ * @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
16
+ *
17
+ * @throws {@link AgentPhone.UnprocessableEntityError}
18
+ *
19
+ * @example
20
+ * await client.location.getLocation({
21
+ * phone_number: "phone_number"
22
+ * })
23
+ */
24
+ getLocation(request: AgentPhone.GetLocationV1LocationPhoneNumberGetRequest, requestOptions?: LocationClient.RequestOptions): core.HttpResponsePromise<AgentPhone.LocationResponse>;
25
+ private __getLocation;
26
+ /**
27
+ * @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @example
30
+ * await client.location.refreshLocations()
31
+ */
32
+ refreshLocations(requestOptions?: LocationClient.RequestOptions): core.HttpResponsePromise<AgentPhone.LocationRefreshResponse>;
33
+ private __refreshLocations;
34
+ }
@@ -0,0 +1,109 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../core/headers.mjs";
13
+ import * as core from "../../../../core/index.mjs";
14
+ import * as environments from "../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../errors/index.mjs";
17
+ import * as AgentPhone from "../../../index.mjs";
18
+ export class LocationClient {
19
+ constructor(options = {}) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * @param {AgentPhone.GetLocationV1LocationPhoneNumberGetRequest} request
24
+ * @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link AgentPhone.UnprocessableEntityError}
27
+ *
28
+ * @example
29
+ * await client.location.getLocation({
30
+ * phone_number: "phone_number"
31
+ * })
32
+ */
33
+ getLocation(request, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__getLocation(request, requestOptions));
35
+ }
36
+ __getLocation(request, requestOptions) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
+ const { phone_number: phoneNumber } = request;
40
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
41
+ 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);
42
+ const _response = yield core.fetcher({
43
+ 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/location/${core.url.encodePathParam(phoneNumber)}`),
44
+ method: "GET",
45
+ headers: _headers,
46
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
47
+ 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,
48
+ 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,
49
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
50
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
51
+ logging: this._options.logging,
52
+ });
53
+ if (_response.ok) {
54
+ return { data: _response.body, rawResponse: _response.rawResponse };
55
+ }
56
+ if (_response.error.reason === "status-code") {
57
+ switch (_response.error.statusCode) {
58
+ case 422:
59
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
60
+ default:
61
+ throw new errors.AgentPhoneError({
62
+ statusCode: _response.error.statusCode,
63
+ body: _response.error.body,
64
+ rawResponse: _response.rawResponse,
65
+ });
66
+ }
67
+ }
68
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/location/{phone_number}");
69
+ });
70
+ }
71
+ /**
72
+ * @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
73
+ *
74
+ * @example
75
+ * await client.location.refreshLocations()
76
+ */
77
+ refreshLocations(requestOptions) {
78
+ return core.HttpResponsePromise.fromPromise(this.__refreshLocations(requestOptions));
79
+ }
80
+ __refreshLocations(requestOptions) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
84
+ 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);
85
+ const _response = yield core.fetcher({
86
+ 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/location/refresh"),
87
+ method: "POST",
88
+ headers: _headers,
89
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
90
+ 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,
91
+ 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,
92
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
93
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
94
+ logging: this._options.logging,
95
+ });
96
+ if (_response.ok) {
97
+ return { data: _response.body, rawResponse: _response.rawResponse };
98
+ }
99
+ if (_response.error.reason === "status-code") {
100
+ throw new errors.AgentPhoneError({
101
+ statusCode: _response.error.statusCode,
102
+ body: _response.error.body,
103
+ rawResponse: _response.rawResponse,
104
+ });
105
+ }
106
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/location/refresh");
107
+ });
108
+ }
109
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";