agentphone 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +17 -12
- package/dist/cjs/api/resources/contactCards/client/Client.d.ts +1 -4
- package/dist/cjs/api/resources/contactCards/client/Client.js +1 -4
- package/dist/cjs/api/resources/contactCards/client/requests/ContactCardWriteRequest.d.ts +4 -7
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/location/client/Client.d.ts +34 -0
- package/dist/cjs/api/resources/location/client/Client.js +146 -0
- package/dist/cjs/api/resources/location/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/location/client/index.js +17 -0
- package/dist/cjs/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.d.ts +9 -0
- package/dist/cjs/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.js +3 -0
- package/dist/cjs/api/resources/location/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/location/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/location/index.d.ts +1 -0
- package/dist/cjs/api/resources/location/index.js +17 -0
- package/dist/cjs/api/resources/messages/client/Client.d.ts +0 -1
- package/dist/cjs/api/resources/messages/client/Client.js +0 -1
- package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +2 -2
- package/dist/cjs/api/resources/numbers/client/Client.d.ts +29 -7
- package/dist/cjs/api/resources/numbers/client/Client.js +75 -17
- package/dist/cjs/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.d.ts +9 -0
- package/dist/cjs/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.js +3 -0
- package/dist/cjs/api/resources/numbers/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/AgentVerifyRequest.d.ts +1 -0
- package/dist/cjs/api/types/LocationRefreshResponse.d.ts +4 -0
- package/dist/cjs/api/types/LocationRefreshResponse.js +3 -0
- package/dist/cjs/api/types/LocationResponse.d.ts +7 -0
- package/dist/cjs/api/types/LocationResponse.js +3 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -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/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/contactCards/client/Client.d.mts +1 -4
- package/dist/esm/api/resources/contactCards/client/Client.mjs +1 -4
- package/dist/esm/api/resources/contactCards/client/requests/ContactCardWriteRequest.d.mts +4 -7
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/location/client/Client.d.mts +34 -0
- package/dist/esm/api/resources/location/client/Client.mjs +109 -0
- package/dist/esm/api/resources/location/client/index.d.mts +1 -0
- package/dist/esm/api/resources/location/client/index.mjs +1 -0
- package/dist/esm/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.d.mts +9 -0
- package/dist/esm/api/resources/location/client/requests/GetLocationV1LocationPhoneNumberGetRequest.mjs +2 -0
- package/dist/esm/api/resources/location/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/location/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/location/index.d.mts +1 -0
- package/dist/esm/api/resources/location/index.mjs +1 -0
- package/dist/esm/api/resources/messages/client/Client.d.mts +0 -1
- package/dist/esm/api/resources/messages/client/Client.mjs +0 -1
- package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +2 -2
- package/dist/esm/api/resources/numbers/client/Client.d.mts +29 -7
- package/dist/esm/api/resources/numbers/client/Client.mjs +75 -17
- package/dist/esm/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.d.mts +9 -0
- package/dist/esm/api/resources/numbers/client/requests/GetNumberV1NumbersNumberIdGetRequest.mjs +2 -0
- package/dist/esm/api/resources/numbers/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/AgentVerifyRequest.d.mts +1 -0
- package/dist/esm/api/types/LocationRefreshResponse.d.mts +4 -0
- package/dist/esm/api/types/LocationRefreshResponse.mjs +2 -0
- package/dist/esm/api/types/LocationResponse.d.mts +7 -0
- package/dist/esm/api/types/LocationResponse.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +172 -11
|
@@ -67,7 +67,11 @@ class NumbersClient {
|
|
|
67
67
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* List
|
|
70
|
+
* List the active phone numbers for this account.
|
|
71
|
+
*
|
|
72
|
+
* Released (deleted) numbers are excluded so the count reflects the numbers
|
|
73
|
+
* the account actually holds. Fetch a single number via GET /{number_id}
|
|
74
|
+
* (which returns it regardless of status).
|
|
71
75
|
*
|
|
72
76
|
* @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
|
|
73
77
|
* @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -177,39 +181,35 @@ class NumbersClient {
|
|
|
177
181
|
});
|
|
178
182
|
}
|
|
179
183
|
/**
|
|
180
|
-
* Get
|
|
184
|
+
* Get a single phone number owned by this account.
|
|
181
185
|
*
|
|
182
|
-
*
|
|
186
|
+
* Returns the number regardless of status (including released) so detail
|
|
187
|
+
* pages still load for numbers that are no longer active.
|
|
183
188
|
*
|
|
184
|
-
* @param {AgentPhone.
|
|
189
|
+
* @param {AgentPhone.GetNumberV1NumbersNumberIdGetRequest} request
|
|
185
190
|
* @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
186
191
|
*
|
|
187
192
|
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
188
193
|
*
|
|
189
194
|
* @example
|
|
190
|
-
* await client.numbers.
|
|
195
|
+
* await client.numbers.getNumber({
|
|
191
196
|
* number_id: "number_id"
|
|
192
197
|
* })
|
|
193
198
|
*/
|
|
194
|
-
|
|
195
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
199
|
+
getNumber(request, requestOptions) {
|
|
200
|
+
return core.HttpResponsePromise.fromPromise(this.__getNumber(request, requestOptions));
|
|
196
201
|
}
|
|
197
|
-
|
|
202
|
+
__getNumber(request, requestOptions) {
|
|
198
203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
199
204
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
200
|
-
const { number_id: numberId
|
|
201
|
-
const _queryParams = {
|
|
202
|
-
limit,
|
|
203
|
-
before: before !== undefined ? before : undefined,
|
|
204
|
-
after: after !== undefined ? after : undefined,
|
|
205
|
-
};
|
|
205
|
+
const { number_id: numberId } = request;
|
|
206
206
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
207
207
|
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);
|
|
208
208
|
const _response = yield core.fetcher({
|
|
209
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/numbers/${core.url.encodePathParam(numberId)}
|
|
209
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/numbers/${core.url.encodePathParam(numberId)}`),
|
|
210
210
|
method: "GET",
|
|
211
211
|
headers: _headers,
|
|
212
|
-
queryParameters:
|
|
212
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
213
213
|
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,
|
|
214
214
|
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,
|
|
215
215
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -231,7 +231,7 @@ class NumbersClient {
|
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/numbers/{number_id}
|
|
234
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/numbers/{number_id}");
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
@@ -292,5 +292,63 @@ class NumbersClient {
|
|
|
292
292
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/numbers/{number_id}");
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Get messages for a specific phone number.
|
|
297
|
+
*
|
|
298
|
+
* Supports cursor-based pagination via before/after timestamps.
|
|
299
|
+
*
|
|
300
|
+
* @param {AgentPhone.GetMessagesV1NumbersNumberIdMessagesGetRequest} request
|
|
301
|
+
* @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
302
|
+
*
|
|
303
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* await client.numbers.getMessages({
|
|
307
|
+
* number_id: "number_id"
|
|
308
|
+
* })
|
|
309
|
+
*/
|
|
310
|
+
getMessages(request, requestOptions) {
|
|
311
|
+
return core.HttpResponsePromise.fromPromise(this.__getMessages(request, requestOptions));
|
|
312
|
+
}
|
|
313
|
+
__getMessages(request, requestOptions) {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
316
|
+
const { number_id: numberId, limit, before, after } = request;
|
|
317
|
+
const _queryParams = {
|
|
318
|
+
limit,
|
|
319
|
+
before: before !== undefined ? before : undefined,
|
|
320
|
+
after: after !== undefined ? after : undefined,
|
|
321
|
+
};
|
|
322
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
323
|
+
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);
|
|
324
|
+
const _response = yield core.fetcher({
|
|
325
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/numbers/${core.url.encodePathParam(numberId)}/messages`),
|
|
326
|
+
method: "GET",
|
|
327
|
+
headers: _headers,
|
|
328
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
329
|
+
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,
|
|
330
|
+
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,
|
|
331
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
332
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
333
|
+
logging: this._options.logging,
|
|
334
|
+
});
|
|
335
|
+
if (_response.ok) {
|
|
336
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
337
|
+
}
|
|
338
|
+
if (_response.error.reason === "status-code") {
|
|
339
|
+
switch (_response.error.statusCode) {
|
|
340
|
+
case 422:
|
|
341
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
342
|
+
default:
|
|
343
|
+
throw new errors.AgentPhoneError({
|
|
344
|
+
statusCode: _response.error.statusCode,
|
|
345
|
+
body: _response.error.body,
|
|
346
|
+
rawResponse: _response.rawResponse,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/numbers/{number_id}/messages");
|
|
351
|
+
});
|
|
352
|
+
}
|
|
295
353
|
}
|
|
296
354
|
exports.NumbersClient = NumbersClient;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { CreateNumberRequest } from "./CreateNumberRequest.js";
|
|
2
2
|
export type { DeleteNumberV1NumbersNumberIdDeleteRequest } from "./DeleteNumberV1NumbersNumberIdDeleteRequest.js";
|
|
3
3
|
export type { GetMessagesV1NumbersNumberIdMessagesGetRequest } from "./GetMessagesV1NumbersNumberIdMessagesGetRequest.js";
|
|
4
|
+
export type { GetNumberV1NumbersNumberIdGetRequest } from "./GetNumberV1NumbersNumberIdGetRequest.js";
|
|
4
5
|
export type { ListNumbersV1NumbersGetRequest } from "./ListNumbersV1NumbersGetRequest.js";
|
|
@@ -23,6 +23,8 @@ export * from "./DeleteAgentResponse.js";
|
|
|
23
23
|
export * from "./FieldWarning.js";
|
|
24
24
|
export * from "./GroupParticipant.js";
|
|
25
25
|
export * from "./HttpValidationError.js";
|
|
26
|
+
export * from "./LocationRefreshResponse.js";
|
|
27
|
+
export * from "./LocationResponse.js";
|
|
26
28
|
export * from "./MessageInConversation.js";
|
|
27
29
|
export * from "./MessageListResponse.js";
|
|
28
30
|
export * from "./MessageResponse.js";
|
|
@@ -39,6 +39,8 @@ __exportStar(require("./DeleteAgentResponse.js"), exports);
|
|
|
39
39
|
__exportStar(require("./FieldWarning.js"), exports);
|
|
40
40
|
__exportStar(require("./GroupParticipant.js"), exports);
|
|
41
41
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
42
|
+
__exportStar(require("./LocationRefreshResponse.js"), exports);
|
|
43
|
+
__exportStar(require("./LocationResponse.js"), exports);
|
|
42
44
|
__exportStar(require("./MessageInConversation.js"), exports);
|
|
43
45
|
__exportStar(require("./MessageListResponse.js"), exports);
|
|
44
46
|
__exportStar(require("./MessageResponse.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.14";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -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.
|
|
10
|
-
"User-Agent": "agentphone/1.0.
|
|
9
|
+
"X-Fern-SDK-Version": "1.0.14",
|
|
10
|
+
"User-Agent": "agentphone/1.0.14",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { CallsClient } from "./api/resources/calls/client/Client.mjs";
|
|
|
4
4
|
import { ContactCardsClient } from "./api/resources/contactCards/client/Client.mjs";
|
|
5
5
|
import { ContactsClient } from "./api/resources/contacts/client/Client.mjs";
|
|
6
6
|
import { ConversationsClient } from "./api/resources/conversations/client/Client.mjs";
|
|
7
|
+
import { LocationClient } from "./api/resources/location/client/Client.mjs";
|
|
7
8
|
import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
|
|
8
9
|
import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
|
|
9
10
|
import { RegistrationClient } from "./api/resources/registration/client/Client.mjs";
|
|
@@ -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
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { CallsClient } from "./api/resources/calls/client/Client.mjs";
|
|
|
5
5
|
import { ContactCardsClient } from "./api/resources/contactCards/client/Client.mjs";
|
|
6
6
|
import { ContactsClient } from "./api/resources/contacts/client/Client.mjs";
|
|
7
7
|
import { ConversationsClient } from "./api/resources/conversations/client/Client.mjs";
|
|
8
|
+
import { LocationClient } from "./api/resources/location/client/Client.mjs";
|
|
8
9
|
import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
|
|
9
10
|
import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
|
|
10
11
|
import { RegistrationClient } from "./api/resources/registration/client/Client.mjs";
|
|
@@ -64,4 +65,8 @@ export class AgentPhoneClient {
|
|
|
64
65
|
var _a;
|
|
65
66
|
return ((_a = this._subAccounts) !== null && _a !== void 0 ? _a : (this._subAccounts = new SubAccountsClient(this._options)));
|
|
66
67
|
}
|
|
68
|
+
get location() {
|
|
69
|
+
var _a;
|
|
70
|
+
return ((_a = this._location) !== null && _a !== void 0 ? _a : (this._location = new LocationClient(this._options)));
|
|
71
|
+
}
|
|
67
72
|
}
|
|
@@ -35,10 +35,7 @@ export declare class ContactCardsClient {
|
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* await client.contactCards.putContactCard({
|
|
38
|
-
* number_id: "number_id"
|
|
39
|
-
* firstName: "firstName",
|
|
40
|
-
* lastName: "lastName",
|
|
41
|
-
* avatarUrl: "avatarUrl"
|
|
38
|
+
* number_id: "number_id"
|
|
42
39
|
* })
|
|
43
40
|
*/
|
|
44
41
|
putContactCard(request: AgentPhone.ContactCardWriteRequest, requestOptions?: ContactCardsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactCardResponse>;
|
|
@@ -91,10 +91,7 @@ export class ContactCardsClient {
|
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
93
|
* await client.contactCards.putContactCard({
|
|
94
|
-
* number_id: "number_id"
|
|
95
|
-
* firstName: "firstName",
|
|
96
|
-
* lastName: "lastName",
|
|
97
|
-
* avatarUrl: "avatarUrl"
|
|
94
|
+
* number_id: "number_id"
|
|
98
95
|
* })
|
|
99
96
|
*/
|
|
100
97
|
putContactCard(request, requestOptions) {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* number_id: "number_id"
|
|
5
|
-
* firstName: "firstName",
|
|
6
|
-
* lastName: "lastName",
|
|
7
|
-
* avatarUrl: "avatarUrl"
|
|
4
|
+
* number_id: "number_id"
|
|
8
5
|
* }
|
|
9
6
|
*/
|
|
10
7
|
export interface ContactCardWriteRequest {
|
|
11
8
|
number_id: string;
|
|
12
|
-
firstName
|
|
13
|
-
lastName
|
|
9
|
+
firstName?: string | null;
|
|
10
|
+
lastName?: string | null;
|
|
14
11
|
displayName?: string | null;
|
|
15
|
-
avatarUrl
|
|
12
|
+
avatarUrl?: string | null;
|
|
16
13
|
}
|
|
@@ -10,6 +10,8 @@ export * from "./contacts/client/requests/index.mjs";
|
|
|
10
10
|
export * as contacts from "./contacts/index.mjs";
|
|
11
11
|
export * from "./conversations/client/requests/index.mjs";
|
|
12
12
|
export * as conversations from "./conversations/index.mjs";
|
|
13
|
+
export * from "./location/client/requests/index.mjs";
|
|
14
|
+
export * as location from "./location/index.mjs";
|
|
13
15
|
export * from "./messages/client/requests/index.mjs";
|
|
14
16
|
export * as messages from "./messages/index.mjs";
|
|
15
17
|
export * from "./numbers/client/requests/index.mjs";
|
|
@@ -10,6 +10,8 @@ export * from "./contacts/client/requests/index.mjs";
|
|
|
10
10
|
export * as contacts from "./contacts/index.mjs";
|
|
11
11
|
export * from "./conversations/client/requests/index.mjs";
|
|
12
12
|
export * as conversations from "./conversations/index.mjs";
|
|
13
|
+
export * from "./location/client/requests/index.mjs";
|
|
14
|
+
export * as location from "./location/index.mjs";
|
|
13
15
|
export * from "./messages/client/requests/index.mjs";
|
|
14
16
|
export * as messages from "./messages/index.mjs";
|
|
15
17
|
export * from "./numbers/client/requests/index.mjs";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as AgentPhone from "../../../index.mjs";
|
|
5
|
+
export declare namespace LocationClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class LocationClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<LocationClient.Options>;
|
|
12
|
+
constructor(options?: LocationClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* @param {AgentPhone.GetLocationV1LocationPhoneNumberGetRequest} request
|
|
15
|
+
* @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
16
|
+
*
|
|
17
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* await client.location.getLocation({
|
|
21
|
+
* phone_number: "phone_number"
|
|
22
|
+
* })
|
|
23
|
+
*/
|
|
24
|
+
getLocation(request: AgentPhone.GetLocationV1LocationPhoneNumberGetRequest, requestOptions?: LocationClient.RequestOptions): core.HttpResponsePromise<AgentPhone.LocationResponse>;
|
|
25
|
+
private __getLocation;
|
|
26
|
+
/**
|
|
27
|
+
* @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* await client.location.refreshLocations()
|
|
31
|
+
*/
|
|
32
|
+
refreshLocations(requestOptions?: LocationClient.RequestOptions): core.HttpResponsePromise<AgentPhone.LocationRefreshResponse>;
|
|
33
|
+
private __refreshLocations;
|
|
34
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as AgentPhone from "../../../index.mjs";
|
|
18
|
+
export class LocationClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @param {AgentPhone.GetLocationV1LocationPhoneNumberGetRequest} request
|
|
24
|
+
* @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
|
+
*
|
|
26
|
+
* @throws {@link AgentPhone.UnprocessableEntityError}
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* await client.location.getLocation({
|
|
30
|
+
* phone_number: "phone_number"
|
|
31
|
+
* })
|
|
32
|
+
*/
|
|
33
|
+
getLocation(request, requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__getLocation(request, requestOptions));
|
|
35
|
+
}
|
|
36
|
+
__getLocation(request, requestOptions) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
|
+
const { phone_number: phoneNumber } = request;
|
|
40
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
41
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
42
|
+
const _response = yield core.fetcher({
|
|
43
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/location/${core.url.encodePathParam(phoneNumber)}`),
|
|
44
|
+
method: "GET",
|
|
45
|
+
headers: _headers,
|
|
46
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
47
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
48
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
49
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
50
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
51
|
+
logging: this._options.logging,
|
|
52
|
+
});
|
|
53
|
+
if (_response.ok) {
|
|
54
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
55
|
+
}
|
|
56
|
+
if (_response.error.reason === "status-code") {
|
|
57
|
+
switch (_response.error.statusCode) {
|
|
58
|
+
case 422:
|
|
59
|
+
throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
60
|
+
default:
|
|
61
|
+
throw new errors.AgentPhoneError({
|
|
62
|
+
statusCode: _response.error.statusCode,
|
|
63
|
+
body: _response.error.body,
|
|
64
|
+
rawResponse: _response.rawResponse,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/location/{phone_number}");
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @param {LocationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* await client.location.refreshLocations()
|
|
76
|
+
*/
|
|
77
|
+
refreshLocations(requestOptions) {
|
|
78
|
+
return core.HttpResponsePromise.fromPromise(this.__refreshLocations(requestOptions));
|
|
79
|
+
}
|
|
80
|
+
__refreshLocations(requestOptions) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
83
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
84
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
85
|
+
const _response = yield core.fetcher({
|
|
86
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, "v1/location/refresh"),
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: _headers,
|
|
89
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
90
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
91
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
92
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
93
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
94
|
+
logging: this._options.logging,
|
|
95
|
+
});
|
|
96
|
+
if (_response.ok) {
|
|
97
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
98
|
+
}
|
|
99
|
+
if (_response.error.reason === "status-code") {
|
|
100
|
+
throw new errors.AgentPhoneError({
|
|
101
|
+
statusCode: _response.error.statusCode,
|
|
102
|
+
body: _response.error.body,
|
|
103
|
+
rawResponse: _response.rawResponse,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/location/refresh");
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { GetLocationV1LocationPhoneNumberGetRequest } from "./GetLocationV1LocationPhoneNumberGetRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* agent_id: "agent_id",
|
|
5
4
|
* to_number: "to_number",
|
|
6
5
|
* body: "body"
|
|
7
6
|
* }
|
|
8
7
|
*/
|
|
9
8
|
export interface SendMessageRequest {
|
|
10
|
-
agent_id
|
|
9
|
+
agent_id?: string | null;
|
|
11
10
|
to_number: string;
|
|
12
11
|
body: string;
|
|
13
12
|
media_url?: string | null;
|
|
14
13
|
media_urls?: string[] | null;
|
|
15
14
|
number_id?: string | null;
|
|
15
|
+
from_number?: string | null;
|
|
16
16
|
/** Optional iMessage expressive effect. Only valid on iMessage-capable numbers. Supported values: celebration, fireworks, lasers, love, confetti, balloons, spotlight, echo, invisible, gentle, loud, slam. */
|
|
17
17
|
send_style?: SendMessageRequest.SendStyle;
|
|
18
18
|
/** Optional parent message ID (AgentPhone Message.id) to send this message as an inline reply in iMessage. */
|
|
@@ -11,7 +11,11 @@ export declare class NumbersClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<NumbersClient.Options>;
|
|
12
12
|
constructor(options?: NumbersClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* List
|
|
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
|
|
50
|
+
* Get a single phone number owned by this account.
|
|
47
51
|
*
|
|
48
|
-
*
|
|
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.
|
|
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.
|
|
61
|
+
* await client.numbers.getNumber({
|
|
57
62
|
* number_id: "number_id"
|
|
58
63
|
* })
|
|
59
64
|
*/
|
|
60
|
-
|
|
61
|
-
private
|
|
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
|
}
|