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
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * phone_number: "phone_number"
5
+ * }
6
+ */
7
+ export interface GetLocationV1LocationPhoneNumberGetRequest {
8
+ phone_number: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { GetLocationV1LocationPhoneNumberGetRequest } from "./GetLocationV1LocationPhoneNumberGetRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -36,7 +36,6 @@ export declare class MessagesClient {
36
36
  *
37
37
  * @example
38
38
  * await client.messages.sendMessage({
39
- * agent_id: "agent_id",
40
39
  * to_number: "to_number",
41
40
  * body: "body"
42
41
  * })
@@ -56,7 +56,6 @@ export class MessagesClient {
56
56
  *
57
57
  * @example
58
58
  * await client.messages.sendMessage({
59
- * agent_id: "agent_id",
60
59
  * to_number: "to_number",
61
60
  * body: "body"
62
61
  * })
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * agent_id: "agent_id",
5
4
  * to_number: "to_number",
6
5
  * body: "body"
7
6
  * }
8
7
  */
9
8
  export interface SendMessageRequest {
10
- agent_id: string;
9
+ agent_id?: string | null;
11
10
  to_number: string;
12
11
  body: string;
13
12
  media_url?: string | null;
14
13
  media_urls?: string[] | null;
15
14
  number_id?: string | null;
15
+ from_number?: string | null;
16
16
  /** Optional iMessage expressive effect. Only valid on iMessage-capable numbers. Supported values: celebration, fireworks, lasers, love, confetti, balloons, spotlight, echo, invisible, gentle, loud, slam. */
17
17
  send_style?: SendMessageRequest.SendStyle;
18
18
  /** Optional parent message ID (AgentPhone Message.id) to send this message as an inline reply in iMessage. */
@@ -11,7 +11,11 @@ export declare class NumbersClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<NumbersClient.Options>;
12
12
  constructor(options?: NumbersClient.Options);
13
13
  /**
14
- * List all phone numbers for this account.
14
+ * List the active phone numbers for this account.
15
+ *
16
+ * Released (deleted) numbers are excluded so the count reflects the numbers
17
+ * the account actually holds. Fetch a single number via GET /{number_id}
18
+ * (which returns it regardless of status).
15
19
  *
16
20
  * @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
17
21
  * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -43,22 +47,23 @@ export declare class NumbersClient {
43
47
  createNumber(request?: AgentPhone.CreateNumberRequest, requestOptions?: NumbersClient.RequestOptions): core.HttpResponsePromise<AgentPhone.PhoneNumberResponse>;
44
48
  private __createNumber;
45
49
  /**
46
- * Get messages for a specific phone number.
50
+ * Get a single phone number owned by this account.
47
51
  *
48
- * Supports cursor-based pagination via before/after timestamps.
52
+ * Returns the number regardless of status (including released) so detail
53
+ * pages still load for numbers that are no longer active.
49
54
  *
50
- * @param {AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest} request
55
+ * @param {AgentPhone.GetNumberV1NumbersNumberIdGetRequest} request
51
56
  * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
52
57
  *
53
58
  * @throws {@link AgentPhone.UnprocessableEntityError}
54
59
  *
55
60
  * @example
56
- * await client.numbers.getMessages({
61
+ * await client.numbers.getNumber({
57
62
  * number_id: "number_id"
58
63
  * })
59
64
  */
60
- getMessages(request: AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest, requestOptions?: NumbersClient.RequestOptions): core.HttpResponsePromise<AgentPhone.MessageListResponse>;
61
- private __getMessages;
65
+ getNumber(request: AgentPhone.GetNumberV1NumbersNumberIdGetRequest, requestOptions?: NumbersClient.RequestOptions): core.HttpResponsePromise<AgentPhone.PhoneNumberResponse>;
66
+ private __getNumber;
62
67
  /**
63
68
  * Release (delete) a phone number.
64
69
  *
@@ -81,4 +86,21 @@ export declare class NumbersClient {
81
86
  */
82
87
  deleteNumber(request: AgentPhone.DeleteNumberV1NumbersNumberIdDeleteRequest, requestOptions?: NumbersClient.RequestOptions): core.HttpResponsePromise<unknown>;
83
88
  private __deleteNumber;
89
+ /**
90
+ * Get messages for a specific phone number.
91
+ *
92
+ * Supports cursor-based pagination via before/after timestamps.
93
+ *
94
+ * @param {AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest} request
95
+ * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
96
+ *
97
+ * @throws {@link AgentPhone.UnprocessableEntityError}
98
+ *
99
+ * @example
100
+ * await client.numbers.getMessages({
101
+ * number_id: "number_id"
102
+ * })
103
+ */
104
+ getMessages(request: AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest, requestOptions?: NumbersClient.RequestOptions): core.HttpResponsePromise<AgentPhone.MessageListResponse>;
105
+ private __getMessages;
84
106
  }
@@ -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";
@@ -20,7 +31,11 @@ export class NumbersClient {
20
31
  this._options = normalizeClientOptionsWithAuth(options);
21
32
  }
22
33
  /**
23
- * List all phone numbers for this account.
34
+ * List the active phone numbers for this account.
35
+ *
36
+ * Released (deleted) numbers are excluded so the count reflects the numbers
37
+ * the account actually holds. Fetch a single number via GET /{number_id}
38
+ * (which returns it regardless of status).
24
39
  *
25
40
  * @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
26
41
  * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -36,13 +51,12 @@ export class NumbersClient {
36
51
  __listNumbers() {
37
52
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
53
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
- const { limit, offset } = request;
54
+ const { offset, "X-Sub-Account-Id": subAccountId } = request;
40
55
  const _queryParams = {
41
- limit,
42
56
  offset,
43
57
  };
44
58
  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);
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);
46
60
  const _response = yield core.fetcher({
47
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/numbers"),
48
62
  method: "GET",
@@ -95,8 +109,9 @@ export class NumbersClient {
95
109
  __createNumber() {
96
110
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
97
111
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
112
+ const { "X-Sub-Account-Id": subAccountId } = request, _body = __rest(request, ["X-Sub-Account-Id"]);
98
113
  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);
114
+ 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
115
  const _response = yield core.fetcher({
101
116
  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
117
  method: "POST",
@@ -104,7 +119,7 @@ export class NumbersClient {
104
119
  contentType: "application/json",
105
120
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
106
121
  requestType: "json",
107
- body: request,
122
+ body: _body,
108
123
  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
124
  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
125
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -130,39 +145,35 @@ export class NumbersClient {
130
145
  });
131
146
  }
132
147
  /**
133
- * Get messages for a specific phone number.
148
+ * Get a single phone number owned by this account.
134
149
  *
135
- * Supports cursor-based pagination via before/after timestamps.
150
+ * Returns the number regardless of status (including released) so detail
151
+ * pages still load for numbers that are no longer active.
136
152
  *
137
- * @param {AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest} request
153
+ * @param {AgentPhone.GetNumberV1NumbersNumberIdGetRequest} request
138
154
  * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
139
155
  *
140
156
  * @throws {@link AgentPhone.UnprocessableEntityError}
141
157
  *
142
158
  * @example
143
- * await client.numbers.getMessages({
159
+ * await client.numbers.getNumber({
144
160
  * number_id: "number_id"
145
161
  * })
146
162
  */
147
- getMessages(request, requestOptions) {
148
- return core.HttpResponsePromise.fromPromise(this.__getMessages(request, requestOptions));
163
+ getNumber(request, requestOptions) {
164
+ return core.HttpResponsePromise.fromPromise(this.__getNumber(request, requestOptions));
149
165
  }
150
- __getMessages(request, requestOptions) {
166
+ __getNumber(request, requestOptions) {
151
167
  return __awaiter(this, void 0, void 0, function* () {
152
168
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
153
- const { number_id: numberId, limit, before, after } = request;
154
- const _queryParams = {
155
- limit,
156
- before: before !== undefined ? before : undefined,
157
- after: after !== undefined ? after : undefined,
158
- };
169
+ const { number_id: numberId } = request;
159
170
  const _authRequest = yield this._options.authProvider.getAuthRequest();
160
171
  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);
161
172
  const _response = yield core.fetcher({
162
- 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)}/messages`),
173
+ 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)}`),
163
174
  method: "GET",
164
175
  headers: _headers,
165
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
176
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
166
177
  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,
167
178
  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,
168
179
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -184,7 +195,7 @@ export class NumbersClient {
184
195
  });
185
196
  }
186
197
  }
187
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/numbers/{number_id}/messages");
198
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/numbers/{number_id}");
188
199
  });
189
200
  }
190
201
  /**
@@ -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",
@@ -245,4 +256,62 @@ export class NumbersClient {
245
256
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/numbers/{number_id}");
246
257
  });
247
258
  }
259
+ /**
260
+ * Get messages for a specific phone number.
261
+ *
262
+ * Supports cursor-based pagination via before/after timestamps.
263
+ *
264
+ * @param {AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest} request
265
+ * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
266
+ *
267
+ * @throws {@link AgentPhone.UnprocessableEntityError}
268
+ *
269
+ * @example
270
+ * await client.numbers.getMessages({
271
+ * number_id: "number_id"
272
+ * })
273
+ */
274
+ getMessages(request, requestOptions) {
275
+ return core.HttpResponsePromise.fromPromise(this.__getMessages(request, requestOptions));
276
+ }
277
+ __getMessages(request, requestOptions) {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
280
+ const { number_id: numberId, limit, before, after } = request;
281
+ const _queryParams = {
282
+ limit,
283
+ before: before !== undefined ? before : undefined,
284
+ after: after !== undefined ? after : undefined,
285
+ };
286
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
287
+ 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);
288
+ const _response = yield core.fetcher({
289
+ 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)}/messages`),
290
+ method: "GET",
291
+ headers: _headers,
292
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
293
+ 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,
294
+ 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,
295
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
296
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
297
+ logging: this._options.logging,
298
+ });
299
+ if (_response.ok) {
300
+ return { data: _response.body, rawResponse: _response.rawResponse };
301
+ }
302
+ if (_response.error.reason === "status-code") {
303
+ switch (_response.error.statusCode) {
304
+ case 422:
305
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
306
+ default:
307
+ throw new errors.AgentPhoneError({
308
+ statusCode: _response.error.statusCode,
309
+ body: _response.error.body,
310
+ rawResponse: _response.rawResponse,
311
+ });
312
+ }
313
+ }
314
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/numbers/{number_id}/messages");
315
+ });
316
+ }
248
317
  }
@@ -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
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * number_id: "number_id"
5
+ * }
6
+ */
7
+ export interface GetNumberV1NumbersNumberIdGetRequest {
8
+ number_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -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
  }
@@ -1,4 +1,5 @@
1
1
  export type { CreateNumberRequest } from "./CreateNumberRequest.mjs";
2
2
  export type { DeleteNumberV1NumbersNumberIdDeleteRequest } from "./DeleteNumberV1NumbersNumberIdDeleteRequest.mjs";
3
3
  export type { GetMessagesV1NumbersNumberIdMessagesGetRequest } from "./GetMessagesV1NumbersNumberIdMessagesGetRequest.mjs";
4
+ export type { GetNumberV1NumbersNumberIdGetRequest } from "./GetNumberV1NumbersNumberIdGetRequest.mjs";
4
5
  export type { ListNumbersV1NumbersGetRequest } from "./ListNumbersV1NumbersGetRequest.mjs";
@@ -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
+ }