agentphone 1.0.13 → 1.0.15

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 (86) 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 +17 -12
  4. package/dist/cjs/api/resources/contactCards/client/Client.d.ts +1 -4
  5. package/dist/cjs/api/resources/contactCards/client/Client.js +1 -4
  6. package/dist/cjs/api/resources/contactCards/client/requests/ContactCardWriteRequest.d.ts +4 -7
  7. package/dist/cjs/api/resources/conversations/client/Client.d.ts +8 -6
  8. package/dist/cjs/api/resources/conversations/client/Client.js +8 -6
  9. package/dist/cjs/api/resources/conversations/client/requests/UpdateConversationRequest.d.ts +2 -0
  10. package/dist/cjs/api/resources/index.d.ts +2 -0
  11. package/dist/cjs/api/resources/index.js +3 -1
  12. package/dist/cjs/api/resources/location/client/Client.d.ts +34 -0
  13. package/dist/cjs/api/resources/location/client/Client.js +146 -0
  14. package/dist/cjs/api/resources/location/client/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/location/client/index.js +17 -0
  16. package/dist/cjs/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.d.ts +9 -0
  17. package/dist/cjs/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.js +3 -0
  18. package/dist/cjs/api/resources/location/client/requests/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/location/client/requests/index.js +2 -0
  20. package/dist/cjs/api/resources/location/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/location/index.js +17 -0
  22. package/dist/cjs/api/resources/messages/client/Client.d.ts +0 -2
  23. package/dist/cjs/api/resources/messages/client/Client.js +0 -2
  24. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +6 -4
  25. package/dist/cjs/api/resources/numbers/client/Client.d.ts +29 -7
  26. package/dist/cjs/api/resources/numbers/client/Client.js +75 -17
  27. package/dist/cjs/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.d.ts +9 -0
  28. package/dist/cjs/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.js +3 -0
  29. package/dist/cjs/api/resources/numbers/client/requests/index.d.ts +1 -0
  30. package/dist/cjs/api/types/AgentVerifyRequest.d.ts +1 -0
  31. package/dist/cjs/api/types/LocationRefreshResponse.d.ts +4 -0
  32. package/dist/cjs/api/types/LocationRefreshResponse.js +3 -0
  33. package/dist/cjs/api/types/LocationResponse.d.ts +7 -0
  34. package/dist/cjs/api/types/LocationResponse.js +3 -0
  35. package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
  36. package/dist/cjs/api/types/ReplyToInConversation.d.ts +5 -0
  37. package/dist/cjs/api/types/ReplyToInConversation.js +3 -0
  38. package/dist/cjs/api/types/SendMessageResponse.d.ts +1 -0
  39. package/dist/cjs/api/types/index.d.ts +3 -0
  40. package/dist/cjs/api/types/index.js +3 -0
  41. package/dist/cjs/version.d.ts +1 -1
  42. package/dist/cjs/version.js +1 -1
  43. package/dist/esm/BaseClient.mjs +2 -2
  44. package/dist/esm/Client.d.mts +3 -0
  45. package/dist/esm/Client.mjs +5 -0
  46. package/dist/esm/api/resources/contactCards/client/Client.d.mts +1 -4
  47. package/dist/esm/api/resources/contactCards/client/Client.mjs +1 -4
  48. package/dist/esm/api/resources/contactCards/client/requests/ContactCardWriteRequest.d.mts +4 -7
  49. package/dist/esm/api/resources/conversations/client/Client.d.mts +8 -6
  50. package/dist/esm/api/resources/conversations/client/Client.mjs +8 -6
  51. package/dist/esm/api/resources/conversations/client/requests/UpdateConversationRequest.d.mts +2 -0
  52. package/dist/esm/api/resources/index.d.mts +2 -0
  53. package/dist/esm/api/resources/index.mjs +2 -0
  54. package/dist/esm/api/resources/location/client/Client.d.mts +34 -0
  55. package/dist/esm/api/resources/location/client/Client.mjs +109 -0
  56. package/dist/esm/api/resources/location/client/index.d.mts +1 -0
  57. package/dist/esm/api/resources/location/client/index.mjs +1 -0
  58. package/dist/esm/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.d.mts +9 -0
  59. package/dist/esm/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.mjs +2 -0
  60. package/dist/esm/api/resources/location/client/requests/index.d.mts +1 -0
  61. package/dist/esm/api/resources/location/client/requests/index.mjs +1 -0
  62. package/dist/esm/api/resources/location/index.d.mts +1 -0
  63. package/dist/esm/api/resources/location/index.mjs +1 -0
  64. package/dist/esm/api/resources/messages/client/Client.d.mts +0 -2
  65. package/dist/esm/api/resources/messages/client/Client.mjs +0 -2
  66. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +6 -4
  67. package/dist/esm/api/resources/numbers/client/Client.d.mts +29 -7
  68. package/dist/esm/api/resources/numbers/client/Client.mjs +75 -17
  69. package/dist/esm/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.d.mts +9 -0
  70. package/dist/esm/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.mjs +2 -0
  71. package/dist/esm/api/resources/numbers/client/requests/index.d.mts +1 -0
  72. package/dist/esm/api/types/AgentVerifyRequest.d.mts +1 -0
  73. package/dist/esm/api/types/LocationRefreshResponse.d.mts +4 -0
  74. package/dist/esm/api/types/LocationRefreshResponse.mjs +2 -0
  75. package/dist/esm/api/types/LocationResponse.d.mts +7 -0
  76. package/dist/esm/api/types/LocationResponse.mjs +2 -0
  77. package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
  78. package/dist/esm/api/types/ReplyToInConversation.d.mts +5 -0
  79. package/dist/esm/api/types/ReplyToInConversation.mjs +2 -0
  80. package/dist/esm/api/types/SendMessageResponse.d.mts +1 -0
  81. package/dist/esm/api/types/index.d.mts +3 -0
  82. package/dist/esm/api/types/index.mjs +3 -0
  83. package/dist/esm/version.d.mts +1 -1
  84. package/dist/esm/version.mjs +1 -1
  85. package/package.json +1 -1
  86. package/reference.md +180 -18
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentphone",
46
- "X-Fern-SDK-Version": "1.0.13",
47
- "User-Agent": "agentphone/1.0.13",
46
+ "X-Fern-SDK-Version": "1.0.15",
47
+ "User-Agent": "agentphone/1.0.15",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -4,6 +4,7 @@ import { CallsClient } from "./api/resources/calls/client/Client.js";
4
4
  import { ContactCardsClient } from "./api/resources/contactCards/client/Client.js";
5
5
  import { ContactsClient } from "./api/resources/contacts/client/Client.js";
6
6
  import { ConversationsClient } from "./api/resources/conversations/client/Client.js";
7
+ import { LocationClient } from "./api/resources/location/client/Client.js";
7
8
  import { MessagesClient } from "./api/resources/messages/client/Client.js";
8
9
  import { NumbersClient } from "./api/resources/numbers/client/Client.js";
9
10
  import { RegistrationClient } from "./api/resources/registration/client/Client.js";
@@ -31,6 +32,7 @@ export declare class AgentPhoneClient {
31
32
  protected _contactCards: ContactCardsClient | undefined;
32
33
  protected _registration: RegistrationClient | undefined;
33
34
  protected _subAccounts: SubAccountsClient | undefined;
35
+ protected _location: LocationClient | undefined;
34
36
  constructor(options?: AgentPhoneClient.Options);
35
37
  get agents(): AgentsClient;
36
38
  get numbers(): NumbersClient;
@@ -44,4 +46,5 @@ export declare class AgentPhoneClient {
44
46
  get contactCards(): ContactCardsClient;
45
47
  get registration(): RegistrationClient;
46
48
  get subAccounts(): SubAccountsClient;
49
+ get location(): LocationClient;
47
50
  }
@@ -8,12 +8,13 @@ const Client_js_3 = require("./api/resources/calls/client/Client.js");
8
8
  const Client_js_4 = require("./api/resources/contactCards/client/Client.js");
9
9
  const Client_js_5 = require("./api/resources/contacts/client/Client.js");
10
10
  const Client_js_6 = require("./api/resources/conversations/client/Client.js");
11
- const Client_js_7 = require("./api/resources/messages/client/Client.js");
12
- const Client_js_8 = require("./api/resources/numbers/client/Client.js");
13
- const Client_js_9 = require("./api/resources/registration/client/Client.js");
14
- const Client_js_10 = require("./api/resources/subAccounts/client/Client.js");
15
- const Client_js_11 = require("./api/resources/usage/client/Client.js");
16
- const Client_js_12 = require("./api/resources/webhooks/client/Client.js");
11
+ const Client_js_7 = require("./api/resources/location/client/Client.js");
12
+ const Client_js_8 = require("./api/resources/messages/client/Client.js");
13
+ const Client_js_9 = require("./api/resources/numbers/client/Client.js");
14
+ const Client_js_10 = require("./api/resources/registration/client/Client.js");
15
+ const Client_js_11 = require("./api/resources/subAccounts/client/Client.js");
16
+ const Client_js_12 = require("./api/resources/usage/client/Client.js");
17
+ const Client_js_13 = require("./api/resources/webhooks/client/Client.js");
17
18
  const BaseClient_js_1 = require("./BaseClient.js");
18
19
  class AgentPhoneClient {
19
20
  constructor(options = {}) {
@@ -25,11 +26,11 @@ class AgentPhoneClient {
25
26
  }
26
27
  get numbers() {
27
28
  var _a;
28
- return ((_a = this._numbers) !== null && _a !== void 0 ? _a : (this._numbers = new Client_js_8.NumbersClient(this._options)));
29
+ return ((_a = this._numbers) !== null && _a !== void 0 ? _a : (this._numbers = new Client_js_9.NumbersClient(this._options)));
29
30
  }
30
31
  get webhooks() {
31
32
  var _a;
32
- return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_12.WebhooksClient(this._options)));
33
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_13.WebhooksClient(this._options)));
33
34
  }
34
35
  get agentWebhooks() {
35
36
  var _a;
@@ -49,11 +50,11 @@ class AgentPhoneClient {
49
50
  }
50
51
  get usage() {
51
52
  var _a;
52
- return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_11.UsageClient(this._options)));
53
+ return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_12.UsageClient(this._options)));
53
54
  }
54
55
  get messages() {
55
56
  var _a;
56
- return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_7.MessagesClient(this._options)));
57
+ return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_8.MessagesClient(this._options)));
57
58
  }
58
59
  get contactCards() {
59
60
  var _a;
@@ -61,11 +62,15 @@ class AgentPhoneClient {
61
62
  }
62
63
  get registration() {
63
64
  var _a;
64
- return ((_a = this._registration) !== null && _a !== void 0 ? _a : (this._registration = new Client_js_9.RegistrationClient(this._options)));
65
+ return ((_a = this._registration) !== null && _a !== void 0 ? _a : (this._registration = new Client_js_10.RegistrationClient(this._options)));
65
66
  }
66
67
  get subAccounts() {
67
68
  var _a;
68
- return ((_a = this._subAccounts) !== null && _a !== void 0 ? _a : (this._subAccounts = new Client_js_10.SubAccountsClient(this._options)));
69
+ return ((_a = this._subAccounts) !== null && _a !== void 0 ? _a : (this._subAccounts = new Client_js_11.SubAccountsClient(this._options)));
70
+ }
71
+ get location() {
72
+ var _a;
73
+ return ((_a = this._location) !== null && _a !== void 0 ? _a : (this._location = new Client_js_7.LocationClient(this._options)));
69
74
  }
70
75
  }
71
76
  exports.AgentPhoneClient = AgentPhoneClient;
@@ -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>;
@@ -127,10 +127,7 @@ class ContactCardsClient {
127
127
  *
128
128
  * @example
129
129
  * await client.contactCards.putContactCard({
130
- * number_id: "number_id",
131
- * firstName: "firstName",
132
- * lastName: "lastName",
133
- * avatarUrl: "avatarUrl"
130
+ * number_id: "number_id"
134
131
  * })
135
132
  */
136
133
  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
  }
@@ -42,14 +42,16 @@ export declare class ConversationsClient {
42
42
  getConversation(request: AgentPhone.GetConversationV1ConversationsConversationIdGetRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ConversationDetail>;
43
43
  private __getConversation;
44
44
  /**
45
- * Update conversation metadata (state).
45
+ * Update a conversation.
46
46
  *
47
- * Use this to store custom context for AI agents:
48
- * - Customer information (name, account ID)
49
- * - Business context (order ID, ticket number)
50
- * - Session state (current topic, preferences)
47
+ * - `metadata`: store custom context for AI agents (customer info, order/ticket
48
+ * ids, session state). Replaces the stored object; surfaced in webhook
49
+ * payloads as `conversationState`.
50
+ * - `group_name`: rename a group conversation (iMessage groups only). Also
51
+ * renames the underlying iMessage thread.
51
52
  *
52
- * The metadata is included in webhook payloads as `conversationState`.
53
+ * Only the fields you include are changed: a rename-only PATCH leaves metadata
54
+ * untouched, and vice versa.
53
55
  *
54
56
  * @param {AgentPhone.UpdateConversationRequest} request
55
57
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -179,14 +179,16 @@ class ConversationsClient {
179
179
  });
180
180
  }
181
181
  /**
182
- * Update conversation metadata (state).
182
+ * Update a conversation.
183
183
  *
184
- * Use this to store custom context for AI agents:
185
- * - Customer information (name, account ID)
186
- * - Business context (order ID, ticket number)
187
- * - Session state (current topic, preferences)
184
+ * - `metadata`: store custom context for AI agents (customer info, order/ticket
185
+ * ids, session state). Replaces the stored object; surfaced in webhook
186
+ * payloads as `conversationState`.
187
+ * - `group_name`: rename a group conversation (iMessage groups only). Also
188
+ * renames the underlying iMessage thread.
188
189
  *
189
- * The metadata is included in webhook payloads as `conversationState`.
190
+ * Only the fields you include are changed: a rename-only PATCH leaves metadata
191
+ * untouched, and vice versa.
190
192
  *
191
193
  * @param {AgentPhone.UpdateConversationRequest} request
192
194
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7,4 +7,6 @@
7
7
  export interface UpdateConversationRequest {
8
8
  conversation_id: string;
9
9
  metadata?: Record<string, unknown> | null;
10
+ /** New display name for a group conversation. iMessage groups only; also renames the underlying iMessage thread. Ignored (omit) for 1:1 chats. */
11
+ group_name?: string | null;
10
12
  }
@@ -10,6 +10,8 @@ export * from "./contacts/client/requests/index.js";
10
10
  export * as contacts from "./contacts/index.js";
11
11
  export * from "./conversations/client/requests/index.js";
12
12
  export * as conversations from "./conversations/index.js";
13
+ export * from "./location/client/requests/index.js";
14
+ export * as location from "./location/index.js";
13
15
  export * from "./messages/client/requests/index.js";
14
16
  export * as messages from "./messages/index.js";
15
17
  export * from "./numbers/client/requests/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.webhooks = exports.usage = exports.subAccounts = exports.registration = exports.numbers = exports.messages = exports.conversations = exports.contacts = exports.contactCards = exports.calls = exports.agentWebhooks = exports.agents = void 0;
39
+ exports.webhooks = exports.usage = exports.subAccounts = exports.registration = exports.numbers = exports.messages = exports.location = exports.conversations = exports.contacts = exports.contactCards = exports.calls = exports.agentWebhooks = exports.agents = void 0;
40
40
  __exportStar(require("./agents/client/requests/index.js"), exports);
41
41
  exports.agents = __importStar(require("./agents/index.js"));
42
42
  __exportStar(require("./agentWebhooks/client/requests/index.js"), exports);
@@ -49,6 +49,8 @@ __exportStar(require("./contacts/client/requests/index.js"), exports);
49
49
  exports.contacts = __importStar(require("./contacts/index.js"));
50
50
  __exportStar(require("./conversations/client/requests/index.js"), exports);
51
51
  exports.conversations = __importStar(require("./conversations/index.js"));
52
+ __exportStar(require("./location/client/requests/index.js"), exports);
53
+ exports.location = __importStar(require("./location/index.js"));
52
54
  __exportStar(require("./messages/client/requests/index.js"), exports);
53
55
  exports.messages = __importStar(require("./messages/index.js"));
54
56
  __exportStar(require("./numbers/client/requests/index.js"), exports);
@@ -0,0 +1,34 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as AgentPhone from "../../../index.js";
5
+ export declare namespace 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,146 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.LocationClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const AgentPhone = __importStar(require("../../../index.js"));
54
+ class LocationClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * @param {AgentPhone.GetLocationV1LocationPhoneNumberGetRequest} request
60
+ * @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link AgentPhone.UnprocessableEntityError}
63
+ *
64
+ * @example
65
+ * await client.location.getLocation({
66
+ * phone_number: "phone_number"
67
+ * })
68
+ */
69
+ getLocation(request, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__getLocation(request, requestOptions));
71
+ }
72
+ __getLocation(request, requestOptions) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
+ const { phone_number: phoneNumber } = request;
76
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
77
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
78
+ const _response = yield core.fetcher({
79
+ 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)}`),
80
+ method: "GET",
81
+ headers: _headers,
82
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
83
+ 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,
84
+ 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,
85
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
86
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
87
+ logging: this._options.logging,
88
+ });
89
+ if (_response.ok) {
90
+ return { data: _response.body, rawResponse: _response.rawResponse };
91
+ }
92
+ if (_response.error.reason === "status-code") {
93
+ switch (_response.error.statusCode) {
94
+ case 422:
95
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
96
+ default:
97
+ throw new errors.AgentPhoneError({
98
+ statusCode: _response.error.statusCode,
99
+ body: _response.error.body,
100
+ rawResponse: _response.rawResponse,
101
+ });
102
+ }
103
+ }
104
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/location/{phone_number}");
105
+ });
106
+ }
107
+ /**
108
+ * @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
109
+ *
110
+ * @example
111
+ * await client.location.refreshLocations()
112
+ */
113
+ refreshLocations(requestOptions) {
114
+ return core.HttpResponsePromise.fromPromise(this.__refreshLocations(requestOptions));
115
+ }
116
+ __refreshLocations(requestOptions) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
119
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
120
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
121
+ const _response = yield core.fetcher({
122
+ 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"),
123
+ method: "POST",
124
+ headers: _headers,
125
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
126
+ 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,
127
+ 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,
128
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
129
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
130
+ logging: this._options.logging,
131
+ });
132
+ if (_response.ok) {
133
+ return { data: _response.body, rawResponse: _response.rawResponse };
134
+ }
135
+ if (_response.error.reason === "status-code") {
136
+ throw new errors.AgentPhoneError({
137
+ statusCode: _response.error.statusCode,
138
+ body: _response.error.body,
139
+ rawResponse: _response.rawResponse,
140
+ });
141
+ }
142
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/location/refresh");
143
+ });
144
+ }
145
+ }
146
+ exports.LocationClient = LocationClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { GetLocationV1LocationPhoneNumberGetRequest } from "./GetLocationV1LocationPhoneNumberGetRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -36,8 +36,6 @@ export declare class MessagesClient {
36
36
  *
37
37
  * @example
38
38
  * await client.messages.sendMessage({
39
- * agent_id: "agent_id",
40
- * to_number: "to_number",
41
39
  * body: "body"
42
40
  * })
43
41
  */
@@ -92,8 +92,6 @@ class MessagesClient {
92
92
  *
93
93
  * @example
94
94
  * await client.messages.sendMessage({
95
- * agent_id: "agent_id",
96
- * to_number: "to_number",
97
95
  * body: "body"
98
96
  * })
99
97
  */
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * agent_id: "agent_id",
5
- * to_number: "to_number",
6
4
  * body: "body"
7
5
  * }
8
6
  */
9
7
  export interface SendMessageRequest {
10
- agent_id: string;
11
- to_number: string;
8
+ agent_id?: string | null;
9
+ /** Recipient of an existing chat: a phone (any format, normalized to E.164), US short code, email, or a group id (grp_...). Provide this OR `recipients` (to start a new group), not both. */
10
+ to_number?: string | null;
11
+ /** Start a NEW iMessage group by listing 2 or more recipients (phones or emails). The first message is delivered to all of them, an iMessage group is created, and the response `to_number` returns the new group id (grp_...) to use for follow-up sends. iMessage numbers only. */
12
+ recipients?: string[] | null;
12
13
  body: string;
13
14
  media_url?: string | null;
14
15
  media_urls?: string[] | null;
15
16
  number_id?: string | null;
17
+ from_number?: string | null;
16
18
  /** 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
19
  send_style?: SendMessageRequest.SendStyle;
18
20
  /** 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
  }