agentphone 1.0.6 → 1.0.8

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 (66) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
  3. package/dist/cjs/api/resources/agents/client/Client.js +1 -1
  4. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
  5. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -0
  6. package/dist/cjs/api/resources/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/index.js +1 -0
  8. package/dist/cjs/api/resources/messages/client/Client.d.ts +18 -0
  9. package/dist/cjs/api/resources/messages/client/Client.js +18 -0
  10. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +1 -0
  11. package/dist/cjs/api/resources/usage/client/Client.d.ts +17 -0
  12. package/dist/cjs/api/resources/usage/client/Client.js +57 -0
  13. package/dist/cjs/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.d.ts +12 -0
  14. package/dist/cjs/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.js +3 -0
  15. package/dist/cjs/api/resources/usage/client/requests/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/usage/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/usage/index.js +1 -0
  18. package/dist/cjs/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.d.ts +6 -0
  19. package/dist/cjs/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.js +9 -0
  20. package/dist/cjs/api/resources/usage/types/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/usage/types/index.js +17 -0
  22. package/dist/cjs/api/types/AgentResponse.d.ts +2 -0
  23. package/dist/cjs/api/types/AgentUsageItem.d.ts +8 -0
  24. package/dist/cjs/api/types/AgentUsageItem.js +3 -0
  25. package/dist/cjs/api/types/AgentUsageResponse.d.ts +7 -0
  26. package/dist/cjs/api/types/AgentUsageResponse.js +3 -0
  27. package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
  28. package/dist/cjs/api/types/SendMessageResponse.d.ts +1 -0
  29. package/dist/cjs/api/types/index.d.ts +2 -0
  30. package/dist/cjs/api/types/index.js +2 -0
  31. package/dist/cjs/version.d.ts +1 -1
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/esm/BaseClient.mjs +2 -2
  34. package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
  35. package/dist/esm/api/resources/agents/client/Client.mjs +1 -1
  36. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +2 -0
  37. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -0
  38. package/dist/esm/api/resources/index.d.mts +1 -0
  39. package/dist/esm/api/resources/index.mjs +1 -0
  40. package/dist/esm/api/resources/messages/client/Client.d.mts +18 -0
  41. package/dist/esm/api/resources/messages/client/Client.mjs +18 -0
  42. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +1 -0
  43. package/dist/esm/api/resources/usage/client/Client.d.mts +17 -0
  44. package/dist/esm/api/resources/usage/client/Client.mjs +57 -0
  45. package/dist/esm/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.d.mts +12 -0
  46. package/dist/esm/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.mjs +2 -0
  47. package/dist/esm/api/resources/usage/client/requests/index.d.mts +1 -0
  48. package/dist/esm/api/resources/usage/index.d.mts +1 -0
  49. package/dist/esm/api/resources/usage/index.mjs +1 -0
  50. package/dist/esm/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.d.mts +6 -0
  51. package/dist/esm/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.mjs +6 -0
  52. package/dist/esm/api/resources/usage/types/index.d.mts +1 -0
  53. package/dist/esm/api/resources/usage/types/index.mjs +1 -0
  54. package/dist/esm/api/types/AgentResponse.d.mts +2 -0
  55. package/dist/esm/api/types/AgentUsageItem.d.mts +8 -0
  56. package/dist/esm/api/types/AgentUsageItem.mjs +2 -0
  57. package/dist/esm/api/types/AgentUsageResponse.d.mts +7 -0
  58. package/dist/esm/api/types/AgentUsageResponse.mjs +2 -0
  59. package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
  60. package/dist/esm/api/types/SendMessageResponse.d.mts +1 -0
  61. package/dist/esm/api/types/index.d.mts +2 -0
  62. package/dist/esm/api/types/index.mjs +2 -0
  63. package/dist/esm/version.d.mts +1 -1
  64. package/dist/esm/version.mjs +1 -1
  65. package/package.json +1 -1
  66. package/reference.md +86 -1
@@ -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.6",
47
- "User-Agent": "agentphone/1.0.6",
46
+ "X-Fern-SDK-Version": "1.0.7",
47
+ "User-Agent": "agentphone/1.0.7",
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);
@@ -11,7 +11,7 @@ export declare class AgentsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
12
12
  constructor(options?: AgentsClient.Options);
13
13
  /**
14
- * Return available voices from the call provider (Retell).
14
+ * Return available voices for voice calls.
15
15
  *
16
16
  * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
17
17
  *
@@ -67,7 +67,7 @@ class AgentsClient {
67
67
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
68
68
  }
69
69
  /**
70
- * Return available voices from the call provider (Retell).
70
+ * Return available voices for voice calls.
71
71
  *
72
72
  * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
73
73
  *
@@ -20,6 +20,8 @@ export interface CreateAgentRequest {
20
20
  ambientSound?: CreateAgentRequest.AmbientSound;
21
21
  /** Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs ($0.005/min surcharge). */
22
22
  denoisingMode?: CreateAgentRequest.DenoisingMode;
23
+ /** Hang up the call after this many milliseconds of caller silence. Default 600000 (10 min). Raise for IVR/hold-music workflows; lower to fail fast on dead lines. Range 10000 (10s) to 3600000 (1 hour). */
24
+ maxSilenceMs?: number | null;
23
25
  }
24
26
  export declare namespace CreateAgentRequest {
25
27
  const VoiceMode: {
@@ -21,6 +21,8 @@ export interface UpdateAgentRequest {
21
21
  ambientSound?: UpdateAgentRequest.AmbientSound;
22
22
  /** Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs ($0.005/min surcharge). */
23
23
  denoisingMode?: UpdateAgentRequest.DenoisingMode;
24
+ /** Hang up the call after this many milliseconds of caller silence. Default 600000 (10 min). Raise for IVR/hold-music workflows; lower to fail fast on dead lines. Range 10000 (10s) to 3600000 (1 hour). */
25
+ maxSilenceMs?: number | null;
24
26
  }
25
27
  export declare namespace UpdateAgentRequest {
26
28
  const VoiceMode: {
@@ -16,5 +16,6 @@ export * from "./numbers/client/requests/index.js";
16
16
  export * as numbers from "./numbers/index.js";
17
17
  export * from "./usage/client/requests/index.js";
18
18
  export * as usage from "./usage/index.js";
19
+ export * from "./usage/types/index.js";
19
20
  export * from "./webhooks/client/requests/index.js";
20
21
  export * as webhooks from "./webhooks/index.js";
@@ -55,5 +55,6 @@ __exportStar(require("./numbers/client/requests/index.js"), exports);
55
55
  exports.numbers = __importStar(require("./numbers/index.js"));
56
56
  __exportStar(require("./usage/client/requests/index.js"), exports);
57
57
  exports.usage = __importStar(require("./usage/index.js"));
58
+ __exportStar(require("./usage/types/index.js"), exports);
58
59
  __exportStar(require("./webhooks/client/requests/index.js"), exports);
59
60
  exports.webhooks = __importStar(require("./webhooks/index.js"));
@@ -13,6 +13,24 @@ export declare class MessagesClient {
13
13
  /**
14
14
  * Send an outbound message (SMS or iMessage) via the provider assigned to the number.
15
15
  *
16
+ * Supports single attachments via `media_url` or multiple attachments via `media_urls`. You may use one or the other, but not both.
17
+ *
18
+ * ### Carousel / multi-image (iMessage)
19
+ *
20
+ * To send a carousel of images on iMessage, pass 2-20 URLs in `media_urls`. Requirements:
21
+ * - Each URL must be a **publicly accessible HTTPS link** to an image (JPEG, PNG, GIF, etc.)
22
+ * - Minimum 2 URLs, maximum 20
23
+ * - `body` must be omitted or empty (text cannot be sent alongside a carousel)
24
+ * - Only supported on iMessage-capable lines
25
+ *
26
+ * ### Single attachment
27
+ *
28
+ * Pass a single URL in `media_url`. The URL must be publicly accessible. Works across all channels.
29
+ *
30
+ * ### Multi-attachment (iMessage)
31
+ *
32
+ * Some iMessage lines support multiple attachments (images and other file types) via `media_urls`. No minimum count; `body` can be included alongside attachments.
33
+ *
16
34
  * @param {AgentPhone.SendMessageRequest} request
17
35
  * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
18
36
  *
@@ -69,6 +69,24 @@ class MessagesClient {
69
69
  /**
70
70
  * Send an outbound message (SMS or iMessage) via the provider assigned to the number.
71
71
  *
72
+ * Supports single attachments via `media_url` or multiple attachments via `media_urls`. You may use one or the other, but not both.
73
+ *
74
+ * ### Carousel / multi-image (iMessage)
75
+ *
76
+ * To send a carousel of images on iMessage, pass 2-20 URLs in `media_urls`. Requirements:
77
+ * - Each URL must be a **publicly accessible HTTPS link** to an image (JPEG, PNG, GIF, etc.)
78
+ * - Minimum 2 URLs, maximum 20
79
+ * - `body` must be omitted or empty (text cannot be sent alongside a carousel)
80
+ * - Only supported on iMessage-capable lines
81
+ *
82
+ * ### Single attachment
83
+ *
84
+ * Pass a single URL in `media_url`. The URL must be publicly accessible. Works across all channels.
85
+ *
86
+ * ### Multi-attachment (iMessage)
87
+ *
88
+ * Some iMessage lines support multiple attachments (images and other file types) via `media_urls`. No minimum count; `body` can be included alongside attachments.
89
+ *
72
90
  * @param {AgentPhone.SendMessageRequest} request
73
91
  * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
74
92
  *
@@ -11,5 +11,6 @@ export interface SendMessageRequest {
11
11
  to_number: string;
12
12
  body: string;
13
13
  media_url?: string | null;
14
+ media_urls?: string[] | null;
14
15
  number_id?: string | null;
15
16
  }
@@ -64,4 +64,21 @@ export declare class UsageClient {
64
64
  */
65
65
  getUsageByNumber(requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<AgentPhone.NumberUsageResponse>;
66
66
  private __getUsageByNumber;
67
+ /**
68
+ * Get usage broken down by agent for the current calendar week, month, or year.
69
+ * Includes message count, completed call count, and total call seconds per agent.
70
+ * Calls/messages with no agent attached are bucketed as "Unassigned".
71
+ *
72
+ * @param {AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest} request
73
+ * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link AgentPhone.UnprocessableEntityError}
76
+ *
77
+ * @example
78
+ * await client.usage.getUsageByAgent({
79
+ * period: "week"
80
+ * })
81
+ */
82
+ getUsageByAgent(request: AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest, requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<AgentPhone.AgentUsageResponse>;
83
+ private __getUsageByAgent;
67
84
  }
@@ -247,5 +247,62 @@ class UsageClient {
247
247
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/usage/by-number");
248
248
  });
249
249
  }
250
+ /**
251
+ * Get usage broken down by agent for the current calendar week, month, or year.
252
+ * Includes message count, completed call count, and total call seconds per agent.
253
+ * Calls/messages with no agent attached are bucketed as "Unassigned".
254
+ *
255
+ * @param {AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest} request
256
+ * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
257
+ *
258
+ * @throws {@link AgentPhone.UnprocessableEntityError}
259
+ *
260
+ * @example
261
+ * await client.usage.getUsageByAgent({
262
+ * period: "week"
263
+ * })
264
+ */
265
+ getUsageByAgent(request, requestOptions) {
266
+ return core.HttpResponsePromise.fromPromise(this.__getUsageByAgent(request, requestOptions));
267
+ }
268
+ __getUsageByAgent(request, requestOptions) {
269
+ return __awaiter(this, void 0, void 0, function* () {
270
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
271
+ const { period, tz } = request;
272
+ const _queryParams = {
273
+ period,
274
+ tz,
275
+ };
276
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
277
+ 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);
278
+ const _response = yield core.fetcher({
279
+ 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/usage/by-agent"),
280
+ method: "GET",
281
+ headers: _headers,
282
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
283
+ 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,
284
+ 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,
285
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
286
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
287
+ logging: this._options.logging,
288
+ });
289
+ if (_response.ok) {
290
+ return { data: _response.body, rawResponse: _response.rawResponse };
291
+ }
292
+ if (_response.error.reason === "status-code") {
293
+ switch (_response.error.statusCode) {
294
+ case 422:
295
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
296
+ default:
297
+ throw new errors.AgentPhoneError({
298
+ statusCode: _response.error.statusCode,
299
+ body: _response.error.body,
300
+ rawResponse: _response.rawResponse,
301
+ });
302
+ }
303
+ }
304
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/usage/by-agent");
305
+ });
306
+ }
250
307
  }
251
308
  exports.UsageClient = UsageClient;
@@ -0,0 +1,12 @@
1
+ import type * as AgentPhone from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * period: "week"
6
+ * }
7
+ */
8
+ export interface GetUsageByAgentV1UsageByAgentGetRequest {
9
+ period: AgentPhone.GetUsageByAgentV1UsageByAgentGetRequestPeriod;
10
+ /** IANA timezone, e.g. America/New_York */
11
+ tz?: string | null;
12
+ }
@@ -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 });
@@ -1,2 +1,3 @@
1
1
  export type { GetDailyUsageV1UsageDailyGetRequest } from "./GetDailyUsageV1UsageDailyGetRequest.js";
2
2
  export type { GetMonthlyUsageV1UsageMonthlyGetRequest } from "./GetMonthlyUsageV1UsageMonthlyGetRequest.js";
3
+ export type { GetUsageByAgentV1UsageByAgentGetRequest } from "./GetUsageByAgentV1UsageByAgentGetRequest.js";
@@ -1 +1,2 @@
1
1
  export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client/index.js"), exports);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -0,0 +1,6 @@
1
+ export declare const GetUsageByAgentV1UsageByAgentGetRequestPeriod: {
2
+ readonly Week: "week";
3
+ readonly Month: "month";
4
+ readonly Year: "year";
5
+ };
6
+ export type GetUsageByAgentV1UsageByAgentGetRequestPeriod = (typeof GetUsageByAgentV1UsageByAgentGetRequestPeriod)[keyof typeof GetUsageByAgentV1UsageByAgentGetRequestPeriod];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GetUsageByAgentV1UsageByAgentGetRequestPeriod = void 0;
5
+ exports.GetUsageByAgentV1UsageByAgentGetRequestPeriod = {
6
+ Week: "week",
7
+ Month: "month",
8
+ Year: "year",
9
+ };
@@ -0,0 +1 @@
1
+ export * from "./GetUsageByAgentV1UsageByAgentGetRequestPeriod.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("./GetUsageByAgentV1UsageByAgentGetRequestPeriod.js"), exports);
@@ -16,6 +16,8 @@ export interface AgentResponse {
16
16
  ambientSound?: AgentResponse.AmbientSound;
17
17
  /** Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs ($0.005/min surcharge). */
18
18
  denoisingMode?: AgentResponse.DenoisingMode;
19
+ /** Hang up the call after this many milliseconds of caller silence. Range 10000 (10s) to 3600000 (1 hour). Default 600000 (10 min). */
20
+ maxSilenceMs?: number;
19
21
  createdAt: string;
20
22
  numbers?: AgentPhone.AgentNumberResponse[] | null;
21
23
  }
@@ -0,0 +1,8 @@
1
+ export interface AgentUsageItem {
2
+ agentId: string | null;
3
+ agentName: string;
4
+ messages: number;
5
+ calls: number;
6
+ totalSeconds: number;
7
+ isOrphan?: boolean;
8
+ }
@@ -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,7 @@
1
+ import type * as AgentPhone from "../index.js";
2
+ export interface AgentUsageResponse {
3
+ data: AgentPhone.AgentUsageItem[];
4
+ period: string;
5
+ periodStart: string;
6
+ periodEnd: string;
7
+ }
@@ -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 });
@@ -7,6 +7,7 @@ export interface MessageInConversation {
7
7
  direction: string;
8
8
  channel?: string | null;
9
9
  mediaUrl?: string | null;
10
+ mediaUrls?: string[];
10
11
  receivedAt: string;
11
12
  reactions?: AgentPhone.ReactionInConversation[];
12
13
  }
@@ -4,4 +4,5 @@ export interface SendMessageResponse {
4
4
  channel: string;
5
5
  from_number: string;
6
6
  to_number: string;
7
+ media_urls?: string[];
7
8
  }
@@ -1,6 +1,8 @@
1
1
  export * from "./AgentListResponse.js";
2
2
  export * from "./AgentNumberResponse.js";
3
3
  export * from "./AgentResponse.js";
4
+ export * from "./AgentUsageItem.js";
5
+ export * from "./AgentUsageResponse.js";
4
6
  export * from "./AllTimeStatsResponse.js";
5
7
  export * from "./AppRoutesAgentsConversationListResponse.js";
6
8
  export * from "./AppRoutesAgentsConversationSummary.js";
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AgentListResponse.js"), exports);
18
18
  __exportStar(require("./AgentNumberResponse.js"), exports);
19
19
  __exportStar(require("./AgentResponse.js"), exports);
20
+ __exportStar(require("./AgentUsageItem.js"), exports);
21
+ __exportStar(require("./AgentUsageResponse.js"), exports);
20
22
  __exportStar(require("./AllTimeStatsResponse.js"), exports);
21
23
  __exportStar(require("./AppRoutesAgentsConversationListResponse.js"), exports);
22
24
  __exportStar(require("./AppRoutesAgentsConversationSummary.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.6";
1
+ export declare const SDK_VERSION = "1.0.7";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.0.6";
4
+ exports.SDK_VERSION = "1.0.7";
@@ -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.6",
10
- "User-Agent": "agentphone/1.0.6",
9
+ "X-Fern-SDK-Version": "1.0.7",
10
+ "User-Agent": "agentphone/1.0.7",
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);
@@ -11,7 +11,7 @@ export declare class AgentsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
12
12
  constructor(options?: AgentsClient.Options);
13
13
  /**
14
- * Return available voices from the call provider (Retell).
14
+ * Return available voices for voice calls.
15
15
  *
16
16
  * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
17
17
  *
@@ -31,7 +31,7 @@ export class AgentsClient {
31
31
  this._options = normalizeClientOptionsWithAuth(options);
32
32
  }
33
33
  /**
34
- * Return available voices from the call provider (Retell).
34
+ * Return available voices for voice calls.
35
35
  *
36
36
  * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
37
37
  *
@@ -20,6 +20,8 @@ export interface CreateAgentRequest {
20
20
  ambientSound?: CreateAgentRequest.AmbientSound;
21
21
  /** Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs ($0.005/min surcharge). */
22
22
  denoisingMode?: CreateAgentRequest.DenoisingMode;
23
+ /** Hang up the call after this many milliseconds of caller silence. Default 600000 (10 min). Raise for IVR/hold-music workflows; lower to fail fast on dead lines. Range 10000 (10s) to 3600000 (1 hour). */
24
+ maxSilenceMs?: number | null;
23
25
  }
24
26
  export declare namespace CreateAgentRequest {
25
27
  const VoiceMode: {
@@ -21,6 +21,8 @@ export interface UpdateAgentRequest {
21
21
  ambientSound?: UpdateAgentRequest.AmbientSound;
22
22
  /** Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs ($0.005/min surcharge). */
23
23
  denoisingMode?: UpdateAgentRequest.DenoisingMode;
24
+ /** Hang up the call after this many milliseconds of caller silence. Default 600000 (10 min). Raise for IVR/hold-music workflows; lower to fail fast on dead lines. Range 10000 (10s) to 3600000 (1 hour). */
25
+ maxSilenceMs?: number | null;
24
26
  }
25
27
  export declare namespace UpdateAgentRequest {
26
28
  const VoiceMode: {
@@ -16,5 +16,6 @@ export * from "./numbers/client/requests/index.mjs";
16
16
  export * as numbers from "./numbers/index.mjs";
17
17
  export * from "./usage/client/requests/index.mjs";
18
18
  export * as usage from "./usage/index.mjs";
19
+ export * from "./usage/types/index.mjs";
19
20
  export * from "./webhooks/client/requests/index.mjs";
20
21
  export * as webhooks from "./webhooks/index.mjs";
@@ -16,5 +16,6 @@ export * from "./numbers/client/requests/index.mjs";
16
16
  export * as numbers from "./numbers/index.mjs";
17
17
  export * from "./usage/client/requests/index.mjs";
18
18
  export * as usage from "./usage/index.mjs";
19
+ export * from "./usage/types/index.mjs";
19
20
  export * from "./webhooks/client/requests/index.mjs";
20
21
  export * as webhooks from "./webhooks/index.mjs";
@@ -13,6 +13,24 @@ export declare class MessagesClient {
13
13
  /**
14
14
  * Send an outbound message (SMS or iMessage) via the provider assigned to the number.
15
15
  *
16
+ * Supports single attachments via `media_url` or multiple attachments via `media_urls`. You may use one or the other, but not both.
17
+ *
18
+ * ### Carousel / multi-image (iMessage)
19
+ *
20
+ * To send a carousel of images on iMessage, pass 2-20 URLs in `media_urls`. Requirements:
21
+ * - Each URL must be a **publicly accessible HTTPS link** to an image (JPEG, PNG, GIF, etc.)
22
+ * - Minimum 2 URLs, maximum 20
23
+ * - `body` must be omitted or empty (text cannot be sent alongside a carousel)
24
+ * - Only supported on iMessage-capable lines
25
+ *
26
+ * ### Single attachment
27
+ *
28
+ * Pass a single URL in `media_url`. The URL must be publicly accessible. Works across all channels.
29
+ *
30
+ * ### Multi-attachment (iMessage)
31
+ *
32
+ * Some iMessage lines support multiple attachments (images and other file types) via `media_urls`. No minimum count; `body` can be included alongside attachments.
33
+ *
16
34
  * @param {AgentPhone.SendMessageRequest} request
17
35
  * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
18
36
  *
@@ -33,6 +33,24 @@ export class MessagesClient {
33
33
  /**
34
34
  * Send an outbound message (SMS or iMessage) via the provider assigned to the number.
35
35
  *
36
+ * Supports single attachments via `media_url` or multiple attachments via `media_urls`. You may use one or the other, but not both.
37
+ *
38
+ * ### Carousel / multi-image (iMessage)
39
+ *
40
+ * To send a carousel of images on iMessage, pass 2-20 URLs in `media_urls`. Requirements:
41
+ * - Each URL must be a **publicly accessible HTTPS link** to an image (JPEG, PNG, GIF, etc.)
42
+ * - Minimum 2 URLs, maximum 20
43
+ * - `body` must be omitted or empty (text cannot be sent alongside a carousel)
44
+ * - Only supported on iMessage-capable lines
45
+ *
46
+ * ### Single attachment
47
+ *
48
+ * Pass a single URL in `media_url`. The URL must be publicly accessible. Works across all channels.
49
+ *
50
+ * ### Multi-attachment (iMessage)
51
+ *
52
+ * Some iMessage lines support multiple attachments (images and other file types) via `media_urls`. No minimum count; `body` can be included alongside attachments.
53
+ *
36
54
  * @param {AgentPhone.SendMessageRequest} request
37
55
  * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
38
56
  *
@@ -11,5 +11,6 @@ export interface SendMessageRequest {
11
11
  to_number: string;
12
12
  body: string;
13
13
  media_url?: string | null;
14
+ media_urls?: string[] | null;
14
15
  number_id?: string | null;
15
16
  }
@@ -64,4 +64,21 @@ export declare class UsageClient {
64
64
  */
65
65
  getUsageByNumber(requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<AgentPhone.NumberUsageResponse>;
66
66
  private __getUsageByNumber;
67
+ /**
68
+ * Get usage broken down by agent for the current calendar week, month, or year.
69
+ * Includes message count, completed call count, and total call seconds per agent.
70
+ * Calls/messages with no agent attached are bucketed as "Unassigned".
71
+ *
72
+ * @param {AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest} request
73
+ * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link AgentPhone.UnprocessableEntityError}
76
+ *
77
+ * @example
78
+ * await client.usage.getUsageByAgent({
79
+ * period: "week"
80
+ * })
81
+ */
82
+ getUsageByAgent(request: AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest, requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<AgentPhone.AgentUsageResponse>;
83
+ private __getUsageByAgent;
67
84
  }
@@ -211,4 +211,61 @@ export class UsageClient {
211
211
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage/by-number");
212
212
  });
213
213
  }
214
+ /**
215
+ * Get usage broken down by agent for the current calendar week, month, or year.
216
+ * Includes message count, completed call count, and total call seconds per agent.
217
+ * Calls/messages with no agent attached are bucketed as "Unassigned".
218
+ *
219
+ * @param {AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest} request
220
+ * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
221
+ *
222
+ * @throws {@link AgentPhone.UnprocessableEntityError}
223
+ *
224
+ * @example
225
+ * await client.usage.getUsageByAgent({
226
+ * period: "week"
227
+ * })
228
+ */
229
+ getUsageByAgent(request, requestOptions) {
230
+ return core.HttpResponsePromise.fromPromise(this.__getUsageByAgent(request, requestOptions));
231
+ }
232
+ __getUsageByAgent(request, requestOptions) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
235
+ const { period, tz } = request;
236
+ const _queryParams = {
237
+ period,
238
+ tz,
239
+ };
240
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
241
+ 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);
242
+ const _response = yield core.fetcher({
243
+ 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/usage/by-agent"),
244
+ method: "GET",
245
+ headers: _headers,
246
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
247
+ 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,
248
+ 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,
249
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
250
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
251
+ logging: this._options.logging,
252
+ });
253
+ if (_response.ok) {
254
+ return { data: _response.body, rawResponse: _response.rawResponse };
255
+ }
256
+ if (_response.error.reason === "status-code") {
257
+ switch (_response.error.statusCode) {
258
+ case 422:
259
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
260
+ default:
261
+ throw new errors.AgentPhoneError({
262
+ statusCode: _response.error.statusCode,
263
+ body: _response.error.body,
264
+ rawResponse: _response.rawResponse,
265
+ });
266
+ }
267
+ }
268
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage/by-agent");
269
+ });
270
+ }
214
271
  }
@@ -0,0 +1,12 @@
1
+ import type * as AgentPhone from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * period: "week"
6
+ * }
7
+ */
8
+ export interface GetUsageByAgentV1UsageByAgentGetRequest {
9
+ period: AgentPhone.GetUsageByAgentV1UsageByAgentGetRequestPeriod;
10
+ /** IANA timezone, e.g. America/New_York */
11
+ tz?: string | null;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,2 +1,3 @@
1
1
  export type { GetDailyUsageV1UsageDailyGetRequest } from "./GetDailyUsageV1UsageDailyGetRequest.mjs";
2
2
  export type { GetMonthlyUsageV1UsageMonthlyGetRequest } from "./GetMonthlyUsageV1UsageMonthlyGetRequest.mjs";
3
+ export type { GetUsageByAgentV1UsageByAgentGetRequest } from "./GetUsageByAgentV1UsageByAgentGetRequest.mjs";
@@ -1 +1,2 @@
1
1
  export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -1 +1,2 @@
1
1
  export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,6 @@
1
+ export declare const GetUsageByAgentV1UsageByAgentGetRequestPeriod: {
2
+ readonly Week: "week";
3
+ readonly Month: "month";
4
+ readonly Year: "year";
5
+ };
6
+ export type GetUsageByAgentV1UsageByAgentGetRequestPeriod = (typeof GetUsageByAgentV1UsageByAgentGetRequestPeriod)[keyof typeof GetUsageByAgentV1UsageByAgentGetRequestPeriod];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const GetUsageByAgentV1UsageByAgentGetRequestPeriod = {
3
+ Week: "week",
4
+ Month: "month",
5
+ Year: "year",
6
+ };
@@ -0,0 +1 @@
1
+ export * from "./GetUsageByAgentV1UsageByAgentGetRequestPeriod.mjs";
@@ -0,0 +1 @@
1
+ export * from "./GetUsageByAgentV1UsageByAgentGetRequestPeriod.mjs";
@@ -16,6 +16,8 @@ export interface AgentResponse {
16
16
  ambientSound?: AgentResponse.AmbientSound;
17
17
  /** Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs ($0.005/min surcharge). */
18
18
  denoisingMode?: AgentResponse.DenoisingMode;
19
+ /** Hang up the call after this many milliseconds of caller silence. Range 10000 (10s) to 3600000 (1 hour). Default 600000 (10 min). */
20
+ maxSilenceMs?: number;
19
21
  createdAt: string;
20
22
  numbers?: AgentPhone.AgentNumberResponse[] | null;
21
23
  }
@@ -0,0 +1,8 @@
1
+ export interface AgentUsageItem {
2
+ agentId: string | null;
3
+ agentName: string;
4
+ messages: number;
5
+ calls: number;
6
+ totalSeconds: number;
7
+ isOrphan?: boolean;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ import type * as AgentPhone from "../index.mjs";
2
+ export interface AgentUsageResponse {
3
+ data: AgentPhone.AgentUsageItem[];
4
+ period: string;
5
+ periodStart: string;
6
+ periodEnd: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -7,6 +7,7 @@ export interface MessageInConversation {
7
7
  direction: string;
8
8
  channel?: string | null;
9
9
  mediaUrl?: string | null;
10
+ mediaUrls?: string[];
10
11
  receivedAt: string;
11
12
  reactions?: AgentPhone.ReactionInConversation[];
12
13
  }
@@ -4,4 +4,5 @@ export interface SendMessageResponse {
4
4
  channel: string;
5
5
  from_number: string;
6
6
  to_number: string;
7
+ media_urls?: string[];
7
8
  }
@@ -1,6 +1,8 @@
1
1
  export * from "./AgentListResponse.mjs";
2
2
  export * from "./AgentNumberResponse.mjs";
3
3
  export * from "./AgentResponse.mjs";
4
+ export * from "./AgentUsageItem.mjs";
5
+ export * from "./AgentUsageResponse.mjs";
4
6
  export * from "./AllTimeStatsResponse.mjs";
5
7
  export * from "./AppRoutesAgentsConversationListResponse.mjs";
6
8
  export * from "./AppRoutesAgentsConversationSummary.mjs";
@@ -1,6 +1,8 @@
1
1
  export * from "./AgentListResponse.mjs";
2
2
  export * from "./AgentNumberResponse.mjs";
3
3
  export * from "./AgentResponse.mjs";
4
+ export * from "./AgentUsageItem.mjs";
5
+ export * from "./AgentUsageResponse.mjs";
4
6
  export * from "./AllTimeStatsResponse.mjs";
5
7
  export * from "./AppRoutesAgentsConversationListResponse.mjs";
6
8
  export * from "./AppRoutesAgentsConversationSummary.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.6";
1
+ export declare const SDK_VERSION = "1.0.7";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.6";
1
+ export const SDK_VERSION = "1.0.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentphone",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -150,7 +150,7 @@ await client.agentSignup.agentVerify({
150
150
  <dl>
151
151
  <dd>
152
152
 
153
- Return available voices from the call provider (Retell).
153
+ Return available voices for voice calls.
154
154
  </dd>
155
155
  </dl>
156
156
  </dd>
@@ -3304,6 +3304,73 @@ await client.usage.getUsageByNumber();
3304
3304
  </dl>
3305
3305
 
3306
3306
 
3307
+ </dd>
3308
+ </dl>
3309
+ </details>
3310
+
3311
+ <details><summary><code>client.usage.<a href="/src/api/resources/usage/client/Client.ts">getUsageByAgent</a>({ ...params }) -> AgentPhone.AgentUsageResponse</code></summary>
3312
+ <dl>
3313
+ <dd>
3314
+
3315
+ #### 📝 Description
3316
+
3317
+ <dl>
3318
+ <dd>
3319
+
3320
+ <dl>
3321
+ <dd>
3322
+
3323
+ Get usage broken down by agent for the current calendar week, month, or year.
3324
+ Includes message count, completed call count, and total call seconds per agent.
3325
+ Calls/messages with no agent attached are bucketed as "Unassigned".
3326
+ </dd>
3327
+ </dl>
3328
+ </dd>
3329
+ </dl>
3330
+
3331
+ #### 🔌 Usage
3332
+
3333
+ <dl>
3334
+ <dd>
3335
+
3336
+ <dl>
3337
+ <dd>
3338
+
3339
+ ```typescript
3340
+ await client.usage.getUsageByAgent({
3341
+ period: "week"
3342
+ });
3343
+
3344
+ ```
3345
+ </dd>
3346
+ </dl>
3347
+ </dd>
3348
+ </dl>
3349
+
3350
+ #### ⚙️ Parameters
3351
+
3352
+ <dl>
3353
+ <dd>
3354
+
3355
+ <dl>
3356
+ <dd>
3357
+
3358
+ **request:** `AgentPhone.GetUsageByAgentV1UsageByAgentGetRequest`
3359
+
3360
+ </dd>
3361
+ </dl>
3362
+
3363
+ <dl>
3364
+ <dd>
3365
+
3366
+ **requestOptions:** `UsageClient.RequestOptions`
3367
+
3368
+ </dd>
3369
+ </dl>
3370
+ </dd>
3371
+ </dl>
3372
+
3373
+
3307
3374
  </dd>
3308
3375
  </dl>
3309
3376
  </details>
@@ -3322,6 +3389,24 @@ await client.usage.getUsageByNumber();
3322
3389
  <dd>
3323
3390
 
3324
3391
  Send an outbound message (SMS or iMessage) via the provider assigned to the number.
3392
+
3393
+ Supports single attachments via `media_url` or multiple attachments via `media_urls`. You may use one or the other, but not both.
3394
+
3395
+ ### Carousel / multi-image (iMessage)
3396
+
3397
+ To send a carousel of images on iMessage, pass 2-20 URLs in `media_urls`. Requirements:
3398
+ - Each URL must be a **publicly accessible HTTPS link** to an image (JPEG, PNG, GIF, etc.)
3399
+ - Minimum 2 URLs, maximum 20
3400
+ - `body` must be omitted or empty (text cannot be sent alongside a carousel)
3401
+ - Only supported on iMessage-capable lines
3402
+
3403
+ ### Single attachment
3404
+
3405
+ Pass a single URL in `media_url`. The URL must be publicly accessible. Works across all channels.
3406
+
3407
+ ### Multi-attachment (iMessage)
3408
+
3409
+ Some iMessage lines support multiple attachments (images and other file types) via `media_urls`. No minimum count; `body` can be included alongside attachments.
3325
3410
  </dd>
3326
3411
  </dl>
3327
3412
  </dd>