agentphone 1.0.5 → 1.0.7
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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/Client.js +1 -1
- package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +20 -0
- package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.js +12 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +20 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +12 -0
- package/dist/cjs/api/resources/calls/client/Client.d.ts +26 -0
- package/dist/cjs/api/resources/calls/client/Client.js +61 -0
- package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +2 -0
- package/dist/cjs/api/resources/calls/client/requests/CreateWebCallRequest.d.ts +2 -0
- package/dist/cjs/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.d.ts +9 -0
- package/dist/cjs/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +19 -0
- package/dist/cjs/api/resources/conversations/client/Client.js +55 -0
- package/dist/cjs/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.d.ts +9 -0
- package/dist/cjs/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.js +3 -0
- package/dist/cjs/api/resources/conversations/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.js +1 -0
- package/dist/cjs/api/resources/messages/client/Client.d.ts +18 -0
- package/dist/cjs/api/resources/messages/client/Client.js +18 -0
- package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +1 -0
- package/dist/cjs/api/resources/usage/client/Client.d.ts +27 -0
- package/dist/cjs/api/resources/usage/client/Client.js +97 -0
- package/dist/cjs/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.d.ts +12 -0
- package/dist/cjs/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.js +3 -0
- package/dist/cjs/api/resources/usage/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/usage/index.d.ts +1 -0
- package/dist/cjs/api/resources/usage/index.js +1 -0
- package/dist/cjs/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.d.ts +6 -0
- package/dist/cjs/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.js +9 -0
- package/dist/cjs/api/resources/usage/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/usage/types/index.js +17 -0
- package/dist/cjs/api/types/AgentResponse.d.ts +20 -0
- package/dist/cjs/api/types/AgentResponse.js +12 -0
- package/dist/cjs/api/types/AgentUsageItem.d.ts +8 -0
- package/dist/cjs/api/types/AgentUsageItem.js +3 -0
- package/dist/cjs/api/types/AgentUsageResponse.d.ts +7 -0
- package/dist/cjs/api/types/AgentUsageResponse.js +3 -0
- package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
- package/dist/cjs/api/types/NumberUsageItem.d.ts +10 -0
- package/dist/cjs/api/types/NumberUsageItem.js +3 -0
- package/dist/cjs/api/types/NumberUsageResponse.d.ts +4 -0
- package/dist/cjs/api/types/NumberUsageResponse.js +3 -0
- package/dist/cjs/api/types/SendMessageResponse.d.ts +1 -0
- package/dist/cjs/api/types/SendTypingResponse.d.ts +5 -0
- package/dist/cjs/api/types/SendTypingResponse.js +3 -0
- package/dist/cjs/api/types/index.d.ts +5 -0
- package/dist/cjs/api/types/index.js +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/Client.mjs +1 -1
- package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +20 -0
- package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.mjs +12 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +20 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +12 -0
- package/dist/esm/api/resources/calls/client/Client.d.mts +26 -0
- package/dist/esm/api/resources/calls/client/Client.mjs +61 -0
- package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +2 -0
- package/dist/esm/api/resources/calls/client/requests/CreateWebCallRequest.d.mts +2 -0
- package/dist/esm/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.d.mts +9 -0
- package/dist/esm/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/conversations/client/Client.d.mts +19 -0
- package/dist/esm/api/resources/conversations/client/Client.mjs +55 -0
- package/dist/esm/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.d.mts +9 -0
- package/dist/esm/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.mjs +2 -0
- package/dist/esm/api/resources/conversations/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/index.mjs +1 -0
- package/dist/esm/api/resources/messages/client/Client.d.mts +18 -0
- package/dist/esm/api/resources/messages/client/Client.mjs +18 -0
- package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +1 -0
- package/dist/esm/api/resources/usage/client/Client.d.mts +27 -0
- package/dist/esm/api/resources/usage/client/Client.mjs +97 -0
- package/dist/esm/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.d.mts +12 -0
- package/dist/esm/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.mjs +2 -0
- package/dist/esm/api/resources/usage/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/usage/index.d.mts +1 -0
- package/dist/esm/api/resources/usage/index.mjs +1 -0
- package/dist/esm/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.d.mts +6 -0
- package/dist/esm/api/resources/usage/types/GetUsageByAgentV1UsageByAgentGetRequestPeriod.mjs +6 -0
- package/dist/esm/api/resources/usage/types/index.d.mts +1 -0
- package/dist/esm/api/resources/usage/types/index.mjs +1 -0
- package/dist/esm/api/types/AgentResponse.d.mts +20 -0
- package/dist/esm/api/types/AgentResponse.mjs +12 -0
- package/dist/esm/api/types/AgentUsageItem.d.mts +8 -0
- package/dist/esm/api/types/AgentUsageItem.mjs +2 -0
- package/dist/esm/api/types/AgentUsageResponse.d.mts +7 -0
- package/dist/esm/api/types/AgentUsageResponse.mjs +2 -0
- package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
- package/dist/esm/api/types/NumberUsageItem.d.mts +10 -0
- package/dist/esm/api/types/NumberUsageItem.mjs +2 -0
- package/dist/esm/api/types/NumberUsageResponse.d.mts +4 -0
- package/dist/esm/api/types/NumberUsageResponse.mjs +2 -0
- package/dist/esm/api/types/SendMessageResponse.d.mts +1 -0
- package/dist/esm/api/types/SendTypingResponse.d.mts +5 -0
- package/dist/esm/api/types/SendTypingResponse.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +5 -0
- package/dist/esm/api/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +286 -1
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -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.
|
|
47
|
-
"User-Agent": "agentphone/1.0.
|
|
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
|
|
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
|
|
70
|
+
* Return available voices for voice calls.
|
|
71
71
|
*
|
|
72
72
|
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
73
73
|
*
|
|
@@ -16,6 +16,12 @@ export interface CreateAgentRequest {
|
|
|
16
16
|
voicemailMessage?: string | null;
|
|
17
17
|
/** Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency). */
|
|
18
18
|
sttMode?: CreateAgentRequest.SttMode;
|
|
19
|
+
/** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
|
|
20
|
+
ambientSound?: CreateAgentRequest.AmbientSound;
|
|
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
|
+
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;
|
|
19
25
|
}
|
|
20
26
|
export declare namespace CreateAgentRequest {
|
|
21
27
|
const VoiceMode: {
|
|
@@ -35,4 +41,18 @@ export declare namespace CreateAgentRequest {
|
|
|
35
41
|
readonly Accurate: "accurate";
|
|
36
42
|
};
|
|
37
43
|
type SttMode = (typeof SttMode)[keyof typeof SttMode];
|
|
44
|
+
/** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
|
|
45
|
+
const AmbientSound: {
|
|
46
|
+
readonly None: "none";
|
|
47
|
+
readonly Office: "office";
|
|
48
|
+
readonly CoffeeShop: "coffee-shop";
|
|
49
|
+
readonly Outdoor: "outdoor";
|
|
50
|
+
};
|
|
51
|
+
type AmbientSound = (typeof AmbientSound)[keyof typeof AmbientSound];
|
|
52
|
+
/** 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). */
|
|
53
|
+
const DenoisingMode: {
|
|
54
|
+
readonly NoiseCancellation: "noise-cancellation";
|
|
55
|
+
readonly NoiseAndBackgroundSpeechCancellation: "noise-and-background-speech-cancellation";
|
|
56
|
+
};
|
|
57
|
+
type DenoisingMode = (typeof DenoisingMode)[keyof typeof DenoisingMode];
|
|
38
58
|
}
|
|
@@ -18,4 +18,16 @@ var CreateAgentRequest;
|
|
|
18
18
|
Fast: "fast",
|
|
19
19
|
Accurate: "accurate",
|
|
20
20
|
};
|
|
21
|
+
/** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
|
|
22
|
+
CreateAgentRequest.AmbientSound = {
|
|
23
|
+
None: "none",
|
|
24
|
+
Office: "office",
|
|
25
|
+
CoffeeShop: "coffee-shop",
|
|
26
|
+
Outdoor: "outdoor",
|
|
27
|
+
};
|
|
28
|
+
/** 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). */
|
|
29
|
+
CreateAgentRequest.DenoisingMode = {
|
|
30
|
+
NoiseCancellation: "noise-cancellation",
|
|
31
|
+
NoiseAndBackgroundSpeechCancellation: "noise-and-background-speech-cancellation",
|
|
32
|
+
};
|
|
21
33
|
})(CreateAgentRequest || (exports.CreateAgentRequest = CreateAgentRequest = {}));
|
|
@@ -17,6 +17,12 @@ export interface UpdateAgentRequest {
|
|
|
17
17
|
voicemailMessage?: string | null;
|
|
18
18
|
/** Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency). */
|
|
19
19
|
sttMode?: UpdateAgentRequest.SttMode;
|
|
20
|
+
/** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
|
|
21
|
+
ambientSound?: UpdateAgentRequest.AmbientSound;
|
|
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
|
+
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;
|
|
20
26
|
}
|
|
21
27
|
export declare namespace UpdateAgentRequest {
|
|
22
28
|
const VoiceMode: {
|
|
@@ -36,4 +42,18 @@ export declare namespace UpdateAgentRequest {
|
|
|
36
42
|
readonly Accurate: "accurate";
|
|
37
43
|
};
|
|
38
44
|
type SttMode = (typeof SttMode)[keyof typeof SttMode];
|
|
45
|
+
/** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
|
|
46
|
+
const AmbientSound: {
|
|
47
|
+
readonly None: "none";
|
|
48
|
+
readonly Office: "office";
|
|
49
|
+
readonly CoffeeShop: "coffee-shop";
|
|
50
|
+
readonly Outdoor: "outdoor";
|
|
51
|
+
};
|
|
52
|
+
type AmbientSound = (typeof AmbientSound)[keyof typeof AmbientSound];
|
|
53
|
+
/** 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). */
|
|
54
|
+
const DenoisingMode: {
|
|
55
|
+
readonly NoiseCancellation: "noise-cancellation";
|
|
56
|
+
readonly NoiseAndBackgroundSpeechCancellation: "noise-and-background-speech-cancellation";
|
|
57
|
+
};
|
|
58
|
+
type DenoisingMode = (typeof DenoisingMode)[keyof typeof DenoisingMode];
|
|
39
59
|
}
|
|
@@ -18,4 +18,16 @@ var UpdateAgentRequest;
|
|
|
18
18
|
Fast: "fast",
|
|
19
19
|
Accurate: "accurate",
|
|
20
20
|
};
|
|
21
|
+
/** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
|
|
22
|
+
UpdateAgentRequest.AmbientSound = {
|
|
23
|
+
None: "none",
|
|
24
|
+
Office: "office",
|
|
25
|
+
CoffeeShop: "coffee-shop",
|
|
26
|
+
Outdoor: "outdoor",
|
|
27
|
+
};
|
|
28
|
+
/** 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). */
|
|
29
|
+
UpdateAgentRequest.DenoisingMode = {
|
|
30
|
+
NoiseCancellation: "noise-cancellation",
|
|
31
|
+
NoiseAndBackgroundSpeechCancellation: "noise-and-background-speech-cancellation",
|
|
32
|
+
};
|
|
21
33
|
})(UpdateAgentRequest || (exports.UpdateAgentRequest = UpdateAgentRequest = {}));
|
|
@@ -90,6 +90,32 @@ export declare class CallsClient {
|
|
|
90
90
|
*/
|
|
91
91
|
getCall(request: AgentPhone.GetCallV1CallsCallIdGetRequest, requestOptions?: CallsClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
92
92
|
private __getCall;
|
|
93
|
+
/**
|
|
94
|
+
* Returns the audio file (WAV format) for a completed call.
|
|
95
|
+
*
|
|
96
|
+
* This is a public endpoint -- no authentication is required. The call ID acts as the access token. The `recordingUrl` field in the call response already contains this URL when recording is enabled.
|
|
97
|
+
*
|
|
98
|
+
* Recording must be enabled on your account via `POST /credits/recording/enable` ($5/mo add-on). Returns `404` if the call doesn't exist or has no recording.
|
|
99
|
+
*
|
|
100
|
+
* **Response:** Binary audio file (`audio/wav`), auto-downloads with filename `recording-{call_id}.wav`.
|
|
101
|
+
*
|
|
102
|
+
* **Notes:**
|
|
103
|
+
* - Recording is available shortly after a call completes
|
|
104
|
+
* - Check `recordingAvailable: true` in the call response before fetching
|
|
105
|
+
* - The URL can be shared or embedded directly since it requires no authentication
|
|
106
|
+
*
|
|
107
|
+
* @param {AgentPhone.GetCallRecordingV1CallsCallIdRecordingGetRequest} request
|
|
108
|
+
* @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
|
+
*
|
|
110
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* await client.calls.getCallRecording({
|
|
114
|
+
* call_id: "call_id"
|
|
115
|
+
* })
|
|
116
|
+
*/
|
|
117
|
+
getCallRecording(request: AgentPhone.GetCallRecordingV1CallsCallIdRecordingGetRequest, requestOptions?: CallsClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
118
|
+
private __getCallRecording;
|
|
93
119
|
/**
|
|
94
120
|
* Get the full transcript for a call.
|
|
95
121
|
*
|
|
@@ -291,6 +291,67 @@ class CallsClient {
|
|
|
291
291
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/calls/{call_id}");
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns the audio file (WAV format) for a completed call.
|
|
296
|
+
*
|
|
297
|
+
* This is a public endpoint -- no authentication is required. The call ID acts as the access token. The `recordingUrl` field in the call response already contains this URL when recording is enabled.
|
|
298
|
+
*
|
|
299
|
+
* Recording must be enabled on your account via `POST /credits/recording/enable` ($5/mo add-on). Returns `404` if the call doesn't exist or has no recording.
|
|
300
|
+
*
|
|
301
|
+
* **Response:** Binary audio file (`audio/wav`), auto-downloads with filename `recording-{call_id}.wav`.
|
|
302
|
+
*
|
|
303
|
+
* **Notes:**
|
|
304
|
+
* - Recording is available shortly after a call completes
|
|
305
|
+
* - Check `recordingAvailable: true` in the call response before fetching
|
|
306
|
+
* - The URL can be shared or embedded directly since it requires no authentication
|
|
307
|
+
*
|
|
308
|
+
* @param {AgentPhone.GetCallRecordingV1CallsCallIdRecordingGetRequest} request
|
|
309
|
+
* @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
310
|
+
*
|
|
311
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* await client.calls.getCallRecording({
|
|
315
|
+
* call_id: "call_id"
|
|
316
|
+
* })
|
|
317
|
+
*/
|
|
318
|
+
getCallRecording(request, requestOptions) {
|
|
319
|
+
return core.HttpResponsePromise.fromPromise(this.__getCallRecording(request, requestOptions));
|
|
320
|
+
}
|
|
321
|
+
__getCallRecording(request, requestOptions) {
|
|
322
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
323
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
324
|
+
const { call_id: callId } = request;
|
|
325
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
326
|
+
const _response = yield core.fetcher({
|
|
327
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/calls/${core.url.encodePathParam(callId)}/recording`),
|
|
328
|
+
method: "GET",
|
|
329
|
+
headers: _headers,
|
|
330
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
331
|
+
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,
|
|
332
|
+
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,
|
|
333
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
334
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
335
|
+
logging: this._options.logging,
|
|
336
|
+
});
|
|
337
|
+
if (_response.ok) {
|
|
338
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
339
|
+
}
|
|
340
|
+
if (_response.error.reason === "status-code") {
|
|
341
|
+
switch (_response.error.statusCode) {
|
|
342
|
+
case 422:
|
|
343
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
344
|
+
default:
|
|
345
|
+
throw new errors.AgentPhoneError({
|
|
346
|
+
statusCode: _response.error.statusCode,
|
|
347
|
+
body: _response.error.body,
|
|
348
|
+
rawResponse: _response.rawResponse,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/calls/{call_id}/recording");
|
|
353
|
+
});
|
|
354
|
+
}
|
|
294
355
|
/**
|
|
295
356
|
* Get the full transcript for a call.
|
|
296
357
|
*
|
|
@@ -18,4 +18,6 @@ export interface CreateOutboundCallRequest {
|
|
|
18
18
|
voice?: string | null;
|
|
19
19
|
/** When provided, uses a built-in LLM for the conversation instead of forwarding to a webhook. The prompt defines the AI's personality and conversation topic. */
|
|
20
20
|
systemPrompt?: string | null;
|
|
21
|
+
/** Optional per-call dynamic variables. Values are substituted into ``{{var_name}}`` placeholders in the agent's system prompt and initial greeting at call time. Requires either ``systemPrompt`` or a hosted-mode agent. */
|
|
22
|
+
variables?: Record<string, string | null> | null;
|
|
21
23
|
}
|
|
@@ -9,4 +9,6 @@ export interface CreateWebCallRequest {
|
|
|
9
9
|
agentId: string;
|
|
10
10
|
/** Optional metadata to attach to the call */
|
|
11
11
|
metadata?: Record<string, unknown> | null;
|
|
12
|
+
/** Optional per-call dynamic variables. Values are substituted into ``{{var_name}}`` placeholders in the agent's system prompt and begin message at call time. Requires a hosted-mode agent. */
|
|
13
|
+
variables?: Record<string, string | null> | null;
|
|
12
14
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { CreateOutboundCallRequest } from "./CreateOutboundCallRequest.js";
|
|
2
2
|
export type { CreateWebCallRequest } from "./CreateWebCallRequest.js";
|
|
3
|
+
export type { GetCallRecordingV1CallsCallIdRecordingGetRequest } from "./GetCallRecordingV1CallsCallIdRecordingGetRequest.js";
|
|
3
4
|
export type { GetCallTranscriptV1CallsCallIdTranscriptGetRequest } from "./GetCallTranscriptV1CallsCallIdTranscriptGetRequest.js";
|
|
4
5
|
export type { GetCallV1CallsCallIdGetRequest } from "./GetCallV1CallsCallIdGetRequest.js";
|
|
5
6
|
export type { ListCallsForNumberV1NumbersNumberIdCallsGetRequest } from "./ListCallsForNumberV1NumbersNumberIdCallsGetRequest.js";
|
|
@@ -79,4 +79,23 @@ export declare class ConversationsClient {
|
|
|
79
79
|
*/
|
|
80
80
|
getConversationMessages(request: AgentPhone.GetConversationMessagesV1ConversationsConversationIdMessagesGetRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.MessagesListResponse>;
|
|
81
81
|
private __getConversationMessages;
|
|
82
|
+
/**
|
|
83
|
+
* Show a typing indicator in the conversation (iMessage only).
|
|
84
|
+
*
|
|
85
|
+
* Best-effort: providers may silently drop the indicator if the chat hasn't
|
|
86
|
+
* had recent activity, the recipient isn't on iMessage, or it's a group chat.
|
|
87
|
+
* Indicators auto-expire after a few seconds — no "stop typing" call needed.
|
|
88
|
+
*
|
|
89
|
+
* @param {AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest} request
|
|
90
|
+
* @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
91
|
+
*
|
|
92
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* await client.conversations.sendTypingIndicator({
|
|
96
|
+
* conversation_id: "conversation_id"
|
|
97
|
+
* })
|
|
98
|
+
*/
|
|
99
|
+
sendTypingIndicator(request: AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.SendTypingResponse>;
|
|
100
|
+
private __sendTypingIndicator;
|
|
82
101
|
}
|
|
@@ -297,5 +297,60 @@ class ConversationsClient {
|
|
|
297
297
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/conversations/{conversation_id}/messages");
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Show a typing indicator in the conversation (iMessage only).
|
|
302
|
+
*
|
|
303
|
+
* Best-effort: providers may silently drop the indicator if the chat hasn't
|
|
304
|
+
* had recent activity, the recipient isn't on iMessage, or it's a group chat.
|
|
305
|
+
* Indicators auto-expire after a few seconds — no "stop typing" call needed.
|
|
306
|
+
*
|
|
307
|
+
* @param {AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest} request
|
|
308
|
+
* @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
309
|
+
*
|
|
310
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* await client.conversations.sendTypingIndicator({
|
|
314
|
+
* conversation_id: "conversation_id"
|
|
315
|
+
* })
|
|
316
|
+
*/
|
|
317
|
+
sendTypingIndicator(request, requestOptions) {
|
|
318
|
+
return core.HttpResponsePromise.fromPromise(this.__sendTypingIndicator(request, requestOptions));
|
|
319
|
+
}
|
|
320
|
+
__sendTypingIndicator(request, requestOptions) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
323
|
+
const { conversation_id: conversationId } = request;
|
|
324
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
325
|
+
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);
|
|
326
|
+
const _response = yield core.fetcher({
|
|
327
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/conversations/${core.url.encodePathParam(conversationId)}/typing`),
|
|
328
|
+
method: "POST",
|
|
329
|
+
headers: _headers,
|
|
330
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
331
|
+
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,
|
|
332
|
+
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,
|
|
333
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
334
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
335
|
+
logging: this._options.logging,
|
|
336
|
+
});
|
|
337
|
+
if (_response.ok) {
|
|
338
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
339
|
+
}
|
|
340
|
+
if (_response.error.reason === "status-code") {
|
|
341
|
+
switch (_response.error.statusCode) {
|
|
342
|
+
case 422:
|
|
343
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
344
|
+
default:
|
|
345
|
+
throw new errors.AgentPhoneError({
|
|
346
|
+
statusCode: _response.error.statusCode,
|
|
347
|
+
body: _response.error.body,
|
|
348
|
+
rawResponse: _response.rawResponse,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/conversations/{conversation_id}/typing");
|
|
353
|
+
});
|
|
354
|
+
}
|
|
300
355
|
}
|
|
301
356
|
exports.ConversationsClient = ConversationsClient;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { GetConversationMessagesV1ConversationsConversationIdMessagesGetRequest } from "./GetConversationMessagesV1ConversationsConversationIdMessagesGetRequest.js";
|
|
2
2
|
export type { GetConversationV1ConversationsConversationIdGetRequest } from "./GetConversationV1ConversationsConversationIdGetRequest.js";
|
|
3
3
|
export type { ListConversationsV1ConversationsGetRequest } from "./ListConversationsV1ConversationsGetRequest.js";
|
|
4
|
+
export type { SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest } from "./SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.js";
|
|
4
5
|
export type { UpdateConversationRequest } from "./UpdateConversationRequest.js";
|
|
@@ -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
|
*
|
|
@@ -54,4 +54,31 @@ export declare class UsageClient {
|
|
|
54
54
|
*/
|
|
55
55
|
getMonthlyUsage(request?: AgentPhone.GetMonthlyUsageV1UsageMonthlyGetRequest, requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<AgentPhone.MonthlyUsageResponse>;
|
|
56
56
|
private __getMonthlyUsage;
|
|
57
|
+
/**
|
|
58
|
+
* Get usage statistics broken down by phone number, with linked agent info.
|
|
59
|
+
*
|
|
60
|
+
* @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* await client.usage.getUsageByNumber()
|
|
64
|
+
*/
|
|
65
|
+
getUsageByNumber(requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<AgentPhone.NumberUsageResponse>;
|
|
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;
|
|
57
84
|
}
|
|
@@ -207,5 +207,102 @@ class UsageClient {
|
|
|
207
207
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/usage/monthly");
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Get usage statistics broken down by phone number, with linked agent info.
|
|
212
|
+
*
|
|
213
|
+
* @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* await client.usage.getUsageByNumber()
|
|
217
|
+
*/
|
|
218
|
+
getUsageByNumber(requestOptions) {
|
|
219
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsageByNumber(requestOptions));
|
|
220
|
+
}
|
|
221
|
+
__getUsageByNumber(requestOptions) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
224
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
225
|
+
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);
|
|
226
|
+
const _response = yield core.fetcher({
|
|
227
|
+
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-number"),
|
|
228
|
+
method: "GET",
|
|
229
|
+
headers: _headers,
|
|
230
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
231
|
+
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,
|
|
232
|
+
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,
|
|
233
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
234
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
235
|
+
logging: this._options.logging,
|
|
236
|
+
});
|
|
237
|
+
if (_response.ok) {
|
|
238
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
239
|
+
}
|
|
240
|
+
if (_response.error.reason === "status-code") {
|
|
241
|
+
throw new errors.AgentPhoneError({
|
|
242
|
+
statusCode: _response.error.statusCode,
|
|
243
|
+
body: _response.error.body,
|
|
244
|
+
rawResponse: _response.rawResponse,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/usage/by-number");
|
|
248
|
+
});
|
|
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
|
+
}
|
|
210
307
|
}
|
|
211
308
|
exports.UsageClient = UsageClient;
|
package/dist/cjs/api/resources/usage/client/requests/GetUsageByAgentV1UsageByAgentGetRequest.d.ts
ADDED
|
@@ -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
|
+
}
|
|
@@ -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";
|