@zavudev/sdk 0.10.0 → 0.11.0
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/CHANGELOG.md +8 -0
- package/client.d.mts +3 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -0
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +200 -0
- package/resources/phone-numbers.d.mts.map +1 -0
- package/resources/phone-numbers.d.ts +200 -0
- package/resources/phone-numbers.d.ts.map +1 -0
- package/resources/phone-numbers.js +95 -0
- package/resources/phone-numbers.js.map +1 -0
- package/resources/phone-numbers.mjs +91 -0
- package/resources/phone-numbers.mjs.map +1 -0
- package/src/client.ts +41 -0
- package/src/resources/index.ts +19 -0
- package/src/resources/phone-numbers.ts +297 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.mjs";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
+
export declare class PhoneNumbers extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Get details of a specific phone number.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const phoneNumber = await client.phoneNumbers.retrieve(
|
|
12
|
+
* 'phoneNumberId',
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
retrieve(phoneNumberID: string, options?: RequestOptions): APIPromise<PhoneNumberRetrieveResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update a phone number's name or sender assignment.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const phoneNumber = await client.phoneNumbers.update(
|
|
23
|
+
* 'phoneNumberId',
|
|
24
|
+
* { name: 'Support Line' },
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
update(phoneNumberID: string, body: PhoneNumberUpdateParams, options?: RequestOptions): APIPromise<PhoneNumberUpdateResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* List all phone numbers owned by this project.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Automatically fetches more pages as needed.
|
|
35
|
+
* for await (const ownedPhoneNumber of client.phoneNumbers.list()) {
|
|
36
|
+
* // ...
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
list(query?: PhoneNumberListParams | null | undefined, options?: RequestOptions): PagePromise<OwnedPhoneNumbersCursor, OwnedPhoneNumber>;
|
|
41
|
+
/**
|
|
42
|
+
* Purchase an available phone number. The first US phone number is free for each
|
|
43
|
+
* team.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const response = await client.phoneNumbers.purchase({
|
|
48
|
+
* phoneNumber: '+15551234567',
|
|
49
|
+
* name: 'Primary Line',
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
purchase(body: PhoneNumberPurchaseParams, options?: RequestOptions): APIPromise<PhoneNumberPurchaseResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Release a phone number. The phone number must not be assigned to a sender.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await client.phoneNumbers.release('phoneNumberId');
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
release(phoneNumberID: string, options?: RequestOptions): APIPromise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Search for available phone numbers to purchase by country and type.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const response = await client.phoneNumbers.searchAvailable({
|
|
69
|
+
* countryCode: 'xx',
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
searchAvailable(query: PhoneNumberSearchAvailableParams, options?: RequestOptions): APIPromise<PhoneNumberSearchAvailableResponse>;
|
|
74
|
+
}
|
|
75
|
+
export type OwnedPhoneNumbersCursor = Cursor<OwnedPhoneNumber>;
|
|
76
|
+
export interface AvailablePhoneNumber {
|
|
77
|
+
capabilities: PhoneNumberCapabilities;
|
|
78
|
+
phoneNumber: string;
|
|
79
|
+
pricing: PhoneNumberPricing;
|
|
80
|
+
friendlyName?: string;
|
|
81
|
+
locality?: string;
|
|
82
|
+
region?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface OwnedPhoneNumber {
|
|
85
|
+
id: string;
|
|
86
|
+
capabilities: Array<string>;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
phoneNumber: string;
|
|
89
|
+
pricing: OwnedPhoneNumberPricing;
|
|
90
|
+
status: PhoneNumberStatus;
|
|
91
|
+
/**
|
|
92
|
+
* Optional custom name for the phone number.
|
|
93
|
+
*/
|
|
94
|
+
name?: string;
|
|
95
|
+
nextRenewalDate?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Sender ID if the phone number is assigned to a sender.
|
|
98
|
+
*/
|
|
99
|
+
senderId?: string;
|
|
100
|
+
updatedAt?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface OwnedPhoneNumberPricing {
|
|
103
|
+
/**
|
|
104
|
+
* Whether this is a free number.
|
|
105
|
+
*/
|
|
106
|
+
isFreeNumber?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Monthly cost in cents.
|
|
109
|
+
*/
|
|
110
|
+
monthlyCost?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Monthly price in USD.
|
|
113
|
+
*/
|
|
114
|
+
monthlyPrice?: number;
|
|
115
|
+
/**
|
|
116
|
+
* One-time purchase cost in cents.
|
|
117
|
+
*/
|
|
118
|
+
upfrontCost?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface PhoneNumberCapabilities {
|
|
121
|
+
mms?: boolean;
|
|
122
|
+
sms?: boolean;
|
|
123
|
+
voice?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface PhoneNumberPricing {
|
|
126
|
+
/**
|
|
127
|
+
* Whether this number qualifies for the free first US number offer.
|
|
128
|
+
*/
|
|
129
|
+
isFreeEligible?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Monthly price in USD.
|
|
132
|
+
*/
|
|
133
|
+
monthlyPrice?: number;
|
|
134
|
+
/**
|
|
135
|
+
* One-time purchase price in USD.
|
|
136
|
+
*/
|
|
137
|
+
upfrontPrice?: number;
|
|
138
|
+
}
|
|
139
|
+
export type PhoneNumberStatus = 'active' | 'suspended' | 'pending';
|
|
140
|
+
export type PhoneNumberType = 'local' | 'mobile' | 'tollFree';
|
|
141
|
+
export interface PhoneNumberRetrieveResponse {
|
|
142
|
+
phoneNumber: OwnedPhoneNumber;
|
|
143
|
+
}
|
|
144
|
+
export interface PhoneNumberUpdateResponse {
|
|
145
|
+
phoneNumber: OwnedPhoneNumber;
|
|
146
|
+
}
|
|
147
|
+
export interface PhoneNumberPurchaseResponse {
|
|
148
|
+
phoneNumber: OwnedPhoneNumber;
|
|
149
|
+
}
|
|
150
|
+
export interface PhoneNumberSearchAvailableResponse {
|
|
151
|
+
items: Array<AvailablePhoneNumber>;
|
|
152
|
+
}
|
|
153
|
+
export interface PhoneNumberUpdateParams {
|
|
154
|
+
/**
|
|
155
|
+
* Custom name for the phone number. Set to null to clear.
|
|
156
|
+
*/
|
|
157
|
+
name?: string | null;
|
|
158
|
+
/**
|
|
159
|
+
* Sender ID to assign the phone number to. Set to null to unassign.
|
|
160
|
+
*/
|
|
161
|
+
senderId?: string | null;
|
|
162
|
+
}
|
|
163
|
+
export interface PhoneNumberListParams extends CursorParams {
|
|
164
|
+
/**
|
|
165
|
+
* Filter by phone number status.
|
|
166
|
+
*/
|
|
167
|
+
status?: PhoneNumberStatus;
|
|
168
|
+
}
|
|
169
|
+
export interface PhoneNumberPurchaseParams {
|
|
170
|
+
/**
|
|
171
|
+
* Phone number in E.164 format.
|
|
172
|
+
*/
|
|
173
|
+
phoneNumber: string;
|
|
174
|
+
/**
|
|
175
|
+
* Optional custom name for the phone number.
|
|
176
|
+
*/
|
|
177
|
+
name?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface PhoneNumberSearchAvailableParams {
|
|
180
|
+
/**
|
|
181
|
+
* Two-letter ISO country code.
|
|
182
|
+
*/
|
|
183
|
+
countryCode: string;
|
|
184
|
+
/**
|
|
185
|
+
* Search for numbers containing this string.
|
|
186
|
+
*/
|
|
187
|
+
contains?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Maximum number of results to return.
|
|
190
|
+
*/
|
|
191
|
+
limit?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Type of phone number to search for.
|
|
194
|
+
*/
|
|
195
|
+
type?: PhoneNumberType;
|
|
196
|
+
}
|
|
197
|
+
export declare namespace PhoneNumbers {
|
|
198
|
+
export { type AvailablePhoneNumber as AvailablePhoneNumber, type OwnedPhoneNumber as OwnedPhoneNumber, type OwnedPhoneNumberPricing as OwnedPhoneNumberPricing, type PhoneNumberCapabilities as PhoneNumberCapabilities, type PhoneNumberPricing as PhoneNumberPricing, type PhoneNumberStatus as PhoneNumberStatus, type PhoneNumberType as PhoneNumberType, type PhoneNumberRetrieveResponse as PhoneNumberRetrieveResponse, type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse, type PhoneNumberPurchaseResponse as PhoneNumberPurchaseResponse, type PhoneNumberSearchAvailableResponse as PhoneNumberSearchAvailableResponse, type OwnedPhoneNumbersCursor as OwnedPhoneNumbersCursor, type PhoneNumberUpdateParams as PhoneNumberUpdateParams, type PhoneNumberListParams as PhoneNumberListParams, type PhoneNumberPurchaseParams as PhoneNumberPurchaseParams, type PhoneNumberSearchAvailableParams as PhoneNumberSearchAvailableParams, };
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=phone-numbers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-numbers.d.mts","sourceRoot":"","sources":["../src/resources/phone-numbers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE;OAE1C,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,2BAA2B,CAAC;IAIlG;;;;;;;;;;OAUG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,yBAAyB,CAAC;IAIxC;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,GAAE,qBAAqB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,uBAAuB,EAAE,gBAAgB,CAAC;IAIzD;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,IAAI,EAAE,yBAAyB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,2BAA2B,CAAC;IAI1C;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAA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ACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
export declare class PhoneNumbers extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Get details of a specific phone number.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const phoneNumber = await client.phoneNumbers.retrieve(
|
|
12
|
+
* 'phoneNumberId',
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
retrieve(phoneNumberID: string, options?: RequestOptions): APIPromise<PhoneNumberRetrieveResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update a phone number's name or sender assignment.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const phoneNumber = await client.phoneNumbers.update(
|
|
23
|
+
* 'phoneNumberId',
|
|
24
|
+
* { name: 'Support Line' },
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
update(phoneNumberID: string, body: PhoneNumberUpdateParams, options?: RequestOptions): APIPromise<PhoneNumberUpdateResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* List all phone numbers owned by this project.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Automatically fetches more pages as needed.
|
|
35
|
+
* for await (const ownedPhoneNumber of client.phoneNumbers.list()) {
|
|
36
|
+
* // ...
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
list(query?: PhoneNumberListParams | null | undefined, options?: RequestOptions): PagePromise<OwnedPhoneNumbersCursor, OwnedPhoneNumber>;
|
|
41
|
+
/**
|
|
42
|
+
* Purchase an available phone number. The first US phone number is free for each
|
|
43
|
+
* team.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const response = await client.phoneNumbers.purchase({
|
|
48
|
+
* phoneNumber: '+15551234567',
|
|
49
|
+
* name: 'Primary Line',
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
purchase(body: PhoneNumberPurchaseParams, options?: RequestOptions): APIPromise<PhoneNumberPurchaseResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Release a phone number. The phone number must not be assigned to a sender.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await client.phoneNumbers.release('phoneNumberId');
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
release(phoneNumberID: string, options?: RequestOptions): APIPromise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Search for available phone numbers to purchase by country and type.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const response = await client.phoneNumbers.searchAvailable({
|
|
69
|
+
* countryCode: 'xx',
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
searchAvailable(query: PhoneNumberSearchAvailableParams, options?: RequestOptions): APIPromise<PhoneNumberSearchAvailableResponse>;
|
|
74
|
+
}
|
|
75
|
+
export type OwnedPhoneNumbersCursor = Cursor<OwnedPhoneNumber>;
|
|
76
|
+
export interface AvailablePhoneNumber {
|
|
77
|
+
capabilities: PhoneNumberCapabilities;
|
|
78
|
+
phoneNumber: string;
|
|
79
|
+
pricing: PhoneNumberPricing;
|
|
80
|
+
friendlyName?: string;
|
|
81
|
+
locality?: string;
|
|
82
|
+
region?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface OwnedPhoneNumber {
|
|
85
|
+
id: string;
|
|
86
|
+
capabilities: Array<string>;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
phoneNumber: string;
|
|
89
|
+
pricing: OwnedPhoneNumberPricing;
|
|
90
|
+
status: PhoneNumberStatus;
|
|
91
|
+
/**
|
|
92
|
+
* Optional custom name for the phone number.
|
|
93
|
+
*/
|
|
94
|
+
name?: string;
|
|
95
|
+
nextRenewalDate?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Sender ID if the phone number is assigned to a sender.
|
|
98
|
+
*/
|
|
99
|
+
senderId?: string;
|
|
100
|
+
updatedAt?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface OwnedPhoneNumberPricing {
|
|
103
|
+
/**
|
|
104
|
+
* Whether this is a free number.
|
|
105
|
+
*/
|
|
106
|
+
isFreeNumber?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Monthly cost in cents.
|
|
109
|
+
*/
|
|
110
|
+
monthlyCost?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Monthly price in USD.
|
|
113
|
+
*/
|
|
114
|
+
monthlyPrice?: number;
|
|
115
|
+
/**
|
|
116
|
+
* One-time purchase cost in cents.
|
|
117
|
+
*/
|
|
118
|
+
upfrontCost?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface PhoneNumberCapabilities {
|
|
121
|
+
mms?: boolean;
|
|
122
|
+
sms?: boolean;
|
|
123
|
+
voice?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface PhoneNumberPricing {
|
|
126
|
+
/**
|
|
127
|
+
* Whether this number qualifies for the free first US number offer.
|
|
128
|
+
*/
|
|
129
|
+
isFreeEligible?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Monthly price in USD.
|
|
132
|
+
*/
|
|
133
|
+
monthlyPrice?: number;
|
|
134
|
+
/**
|
|
135
|
+
* One-time purchase price in USD.
|
|
136
|
+
*/
|
|
137
|
+
upfrontPrice?: number;
|
|
138
|
+
}
|
|
139
|
+
export type PhoneNumberStatus = 'active' | 'suspended' | 'pending';
|
|
140
|
+
export type PhoneNumberType = 'local' | 'mobile' | 'tollFree';
|
|
141
|
+
export interface PhoneNumberRetrieveResponse {
|
|
142
|
+
phoneNumber: OwnedPhoneNumber;
|
|
143
|
+
}
|
|
144
|
+
export interface PhoneNumberUpdateResponse {
|
|
145
|
+
phoneNumber: OwnedPhoneNumber;
|
|
146
|
+
}
|
|
147
|
+
export interface PhoneNumberPurchaseResponse {
|
|
148
|
+
phoneNumber: OwnedPhoneNumber;
|
|
149
|
+
}
|
|
150
|
+
export interface PhoneNumberSearchAvailableResponse {
|
|
151
|
+
items: Array<AvailablePhoneNumber>;
|
|
152
|
+
}
|
|
153
|
+
export interface PhoneNumberUpdateParams {
|
|
154
|
+
/**
|
|
155
|
+
* Custom name for the phone number. Set to null to clear.
|
|
156
|
+
*/
|
|
157
|
+
name?: string | null;
|
|
158
|
+
/**
|
|
159
|
+
* Sender ID to assign the phone number to. Set to null to unassign.
|
|
160
|
+
*/
|
|
161
|
+
senderId?: string | null;
|
|
162
|
+
}
|
|
163
|
+
export interface PhoneNumberListParams extends CursorParams {
|
|
164
|
+
/**
|
|
165
|
+
* Filter by phone number status.
|
|
166
|
+
*/
|
|
167
|
+
status?: PhoneNumberStatus;
|
|
168
|
+
}
|
|
169
|
+
export interface PhoneNumberPurchaseParams {
|
|
170
|
+
/**
|
|
171
|
+
* Phone number in E.164 format.
|
|
172
|
+
*/
|
|
173
|
+
phoneNumber: string;
|
|
174
|
+
/**
|
|
175
|
+
* Optional custom name for the phone number.
|
|
176
|
+
*/
|
|
177
|
+
name?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface PhoneNumberSearchAvailableParams {
|
|
180
|
+
/**
|
|
181
|
+
* Two-letter ISO country code.
|
|
182
|
+
*/
|
|
183
|
+
countryCode: string;
|
|
184
|
+
/**
|
|
185
|
+
* Search for numbers containing this string.
|
|
186
|
+
*/
|
|
187
|
+
contains?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Maximum number of results to return.
|
|
190
|
+
*/
|
|
191
|
+
limit?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Type of phone number to search for.
|
|
194
|
+
*/
|
|
195
|
+
type?: PhoneNumberType;
|
|
196
|
+
}
|
|
197
|
+
export declare namespace PhoneNumbers {
|
|
198
|
+
export { type AvailablePhoneNumber as AvailablePhoneNumber, type OwnedPhoneNumber as OwnedPhoneNumber, type OwnedPhoneNumberPricing as OwnedPhoneNumberPricing, type PhoneNumberCapabilities as PhoneNumberCapabilities, type PhoneNumberPricing as PhoneNumberPricing, type PhoneNumberStatus as PhoneNumberStatus, type PhoneNumberType as PhoneNumberType, type PhoneNumberRetrieveResponse as PhoneNumberRetrieveResponse, type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse, type PhoneNumberPurchaseResponse as PhoneNumberPurchaseResponse, type PhoneNumberSearchAvailableResponse as PhoneNumberSearchAvailableResponse, type OwnedPhoneNumbersCursor as OwnedPhoneNumbersCursor, type PhoneNumberUpdateParams as PhoneNumberUpdateParams, type PhoneNumberListParams as PhoneNumberListParams, type PhoneNumberPurchaseParams as PhoneNumberPurchaseParams, type PhoneNumberSearchAvailableParams as PhoneNumberSearchAvailableParams, };
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=phone-numbers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-numbers.d.ts","sourceRoot":"","sources":["../src/resources/phone-numbers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE;OAE1C,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,2BAA2B,CAAC;IAIlG;;;;;;;;;;OAUG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,yBAAyB,CAAC;IAIxC;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,GAAE,qBAAqB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,uBAAuB,EAAE,gBAAgB,CAAC;IAIzD;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,IAAI,EAAE,yBAAyB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,2BAA2B,CAAC;IAI1C;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO1E;;;;;;;;;OASG;IACH,eAAe,CACb,KAAK,EAAE,gCAAgC,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kCAAkC,CAAC;CAGlD;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,uBAAuB,CAAC;IAEtC,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BAA2B,EAC/D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PhoneNumbers = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../core/pagination.js");
|
|
7
|
+
const headers_1 = require("../internal/headers.js");
|
|
8
|
+
const path_1 = require("../internal/utils/path.js");
|
|
9
|
+
class PhoneNumbers extends resource_1.APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Get details of a specific phone number.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const phoneNumber = await client.phoneNumbers.retrieve(
|
|
16
|
+
* 'phoneNumberId',
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
retrieve(phoneNumberID, options) {
|
|
21
|
+
return this._client.get((0, path_1.path) `/v1/phone-numbers/${phoneNumberID}`, options);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Update a phone number's name or sender assignment.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const phoneNumber = await client.phoneNumbers.update(
|
|
29
|
+
* 'phoneNumberId',
|
|
30
|
+
* { name: 'Support Line' },
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
update(phoneNumberID, body, options) {
|
|
35
|
+
return this._client.patch((0, path_1.path) `/v1/phone-numbers/${phoneNumberID}`, { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* List all phone numbers owned by this project.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* // Automatically fetches more pages as needed.
|
|
43
|
+
* for await (const ownedPhoneNumber of client.phoneNumbers.list()) {
|
|
44
|
+
* // ...
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
list(query = {}, options) {
|
|
49
|
+
return this._client.getAPIList('/v1/phone-numbers', (pagination_1.Cursor), { query, ...options });
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Purchase an available phone number. The first US phone number is free for each
|
|
53
|
+
* team.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const response = await client.phoneNumbers.purchase({
|
|
58
|
+
* phoneNumber: '+15551234567',
|
|
59
|
+
* name: 'Primary Line',
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
purchase(body, options) {
|
|
64
|
+
return this._client.post('/v1/phone-numbers', { body, ...options });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Release a phone number. The phone number must not be assigned to a sender.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* await client.phoneNumbers.release('phoneNumberId');
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
release(phoneNumberID, options) {
|
|
75
|
+
return this._client.delete((0, path_1.path) `/v1/phone-numbers/${phoneNumberID}`, {
|
|
76
|
+
...options,
|
|
77
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Search for available phone numbers to purchase by country and type.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const response = await client.phoneNumbers.searchAvailable({
|
|
86
|
+
* countryCode: 'xx',
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
searchAvailable(query, options) {
|
|
91
|
+
return this._client.get('/v1/phone-numbers/available', { query, ...options });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.PhoneNumbers = PhoneNumbers;
|
|
95
|
+
//# sourceMappingURL=phone-numbers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-numbers.js","sourceRoot":"","sources":["../src/resources/phone-numbers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAC5E,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAqB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,qBAAqB,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,aAAqB,EACrB,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,qBAAqB,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA,mBAAwB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvG,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,aAAqB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,qBAAqB,aAAa,EAAE,EAAE;YACnE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,eAAe,CACb,KAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AAtGD,oCAsGC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { Cursor } from "../core/pagination.mjs";
|
|
4
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
5
|
+
import { path } from "../internal/utils/path.mjs";
|
|
6
|
+
export class PhoneNumbers extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Get details of a specific phone number.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const phoneNumber = await client.phoneNumbers.retrieve(
|
|
13
|
+
* 'phoneNumberId',
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
retrieve(phoneNumberID, options) {
|
|
18
|
+
return this._client.get(path `/v1/phone-numbers/${phoneNumberID}`, options);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Update a phone number's name or sender assignment.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const phoneNumber = await client.phoneNumbers.update(
|
|
26
|
+
* 'phoneNumberId',
|
|
27
|
+
* { name: 'Support Line' },
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
update(phoneNumberID, body, options) {
|
|
32
|
+
return this._client.patch(path `/v1/phone-numbers/${phoneNumberID}`, { body, ...options });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* List all phone numbers owned by this project.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* // Automatically fetches more pages as needed.
|
|
40
|
+
* for await (const ownedPhoneNumber of client.phoneNumbers.list()) {
|
|
41
|
+
* // ...
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
list(query = {}, options) {
|
|
46
|
+
return this._client.getAPIList('/v1/phone-numbers', (Cursor), { query, ...options });
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Purchase an available phone number. The first US phone number is free for each
|
|
50
|
+
* team.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const response = await client.phoneNumbers.purchase({
|
|
55
|
+
* phoneNumber: '+15551234567',
|
|
56
|
+
* name: 'Primary Line',
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
purchase(body, options) {
|
|
61
|
+
return this._client.post('/v1/phone-numbers', { body, ...options });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Release a phone number. The phone number must not be assigned to a sender.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* await client.phoneNumbers.release('phoneNumberId');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
release(phoneNumberID, options) {
|
|
72
|
+
return this._client.delete(path `/v1/phone-numbers/${phoneNumberID}`, {
|
|
73
|
+
...options,
|
|
74
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Search for available phone numbers to purchase by country and type.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const response = await client.phoneNumbers.searchAvailable({
|
|
83
|
+
* countryCode: 'xx',
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
searchAvailable(query, options) {
|
|
88
|
+
return this._client.get('/v1/phone-numbers/available', { query, ...options });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=phone-numbers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-numbers.mjs","sourceRoot":"","sources":["../src/resources/phone-numbers.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,MAAM,EAAkC;OAC1C,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAqB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,qBAAqB,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,aAAqB,EACrB,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,qBAAqB,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA,MAAwB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvG,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,aAAqB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,qBAAqB,aAAa,EAAE,EAAE;YACnE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,eAAe,CACb,KAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -44,6 +44,25 @@ import {
|
|
|
44
44
|
Messages,
|
|
45
45
|
MessagesCursor,
|
|
46
46
|
} from './resources/messages';
|
|
47
|
+
import {
|
|
48
|
+
AvailablePhoneNumber,
|
|
49
|
+
OwnedPhoneNumber,
|
|
50
|
+
OwnedPhoneNumberPricing,
|
|
51
|
+
OwnedPhoneNumbersCursor,
|
|
52
|
+
PhoneNumberCapabilities,
|
|
53
|
+
PhoneNumberListParams,
|
|
54
|
+
PhoneNumberPricing,
|
|
55
|
+
PhoneNumberPurchaseParams,
|
|
56
|
+
PhoneNumberPurchaseResponse,
|
|
57
|
+
PhoneNumberRetrieveResponse,
|
|
58
|
+
PhoneNumberSearchAvailableParams,
|
|
59
|
+
PhoneNumberSearchAvailableResponse,
|
|
60
|
+
PhoneNumberStatus,
|
|
61
|
+
PhoneNumberType,
|
|
62
|
+
PhoneNumberUpdateParams,
|
|
63
|
+
PhoneNumberUpdateResponse,
|
|
64
|
+
PhoneNumbers,
|
|
65
|
+
} from './resources/phone-numbers';
|
|
47
66
|
import {
|
|
48
67
|
Sender,
|
|
49
68
|
SenderCreateParams,
|
|
@@ -803,6 +822,7 @@ export class Zavudev {
|
|
|
803
822
|
contacts: API.Contacts = new API.Contacts(this);
|
|
804
823
|
broadcasts: API.Broadcasts = new API.Broadcasts(this);
|
|
805
824
|
introspect: API.Introspect = new API.Introspect(this);
|
|
825
|
+
phoneNumbers: API.PhoneNumbers = new API.PhoneNumbers(this);
|
|
806
826
|
}
|
|
807
827
|
|
|
808
828
|
Zavudev.Messages = Messages;
|
|
@@ -811,6 +831,7 @@ Zavudev.Senders = Senders;
|
|
|
811
831
|
Zavudev.Contacts = Contacts;
|
|
812
832
|
Zavudev.Broadcasts = Broadcasts;
|
|
813
833
|
Zavudev.Introspect = Introspect;
|
|
834
|
+
Zavudev.PhoneNumbers = PhoneNumbers;
|
|
814
835
|
|
|
815
836
|
export declare namespace Zavudev {
|
|
816
837
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -886,4 +907,24 @@ export declare namespace Zavudev {
|
|
|
886
907
|
type IntrospectValidatePhoneResponse as IntrospectValidatePhoneResponse,
|
|
887
908
|
type IntrospectValidatePhoneParams as IntrospectValidatePhoneParams,
|
|
888
909
|
};
|
|
910
|
+
|
|
911
|
+
export {
|
|
912
|
+
PhoneNumbers as PhoneNumbers,
|
|
913
|
+
type AvailablePhoneNumber as AvailablePhoneNumber,
|
|
914
|
+
type OwnedPhoneNumber as OwnedPhoneNumber,
|
|
915
|
+
type OwnedPhoneNumberPricing as OwnedPhoneNumberPricing,
|
|
916
|
+
type PhoneNumberCapabilities as PhoneNumberCapabilities,
|
|
917
|
+
type PhoneNumberPricing as PhoneNumberPricing,
|
|
918
|
+
type PhoneNumberStatus as PhoneNumberStatus,
|
|
919
|
+
type PhoneNumberType as PhoneNumberType,
|
|
920
|
+
type PhoneNumberRetrieveResponse as PhoneNumberRetrieveResponse,
|
|
921
|
+
type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse,
|
|
922
|
+
type PhoneNumberPurchaseResponse as PhoneNumberPurchaseResponse,
|
|
923
|
+
type PhoneNumberSearchAvailableResponse as PhoneNumberSearchAvailableResponse,
|
|
924
|
+
type OwnedPhoneNumbersCursor as OwnedPhoneNumbersCursor,
|
|
925
|
+
type PhoneNumberUpdateParams as PhoneNumberUpdateParams,
|
|
926
|
+
type PhoneNumberListParams as PhoneNumberListParams,
|
|
927
|
+
type PhoneNumberPurchaseParams as PhoneNumberPurchaseParams,
|
|
928
|
+
type PhoneNumberSearchAvailableParams as PhoneNumberSearchAvailableParams,
|
|
929
|
+
};
|
|
889
930
|
}
|