contiguity 0.0.1
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/LICENSE.md +8 -0
- package/README.md +1 -0
- package/dist/client/fetch.d.ts +30 -0
- package/dist/client/fetch.d.ts.map +1 -0
- package/dist/client/fetch.js +117 -0
- package/dist/contiguity.d.ts +81 -0
- package/dist/contiguity.d.ts.map +1 -0
- package/dist/contiguity.js +106 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12542 -0
- package/dist/services/domains/delete.d.ts +32 -0
- package/dist/services/domains/delete.d.ts.map +1 -0
- package/dist/services/domains/delete.js +43 -0
- package/dist/services/domains/get.d.ts +128 -0
- package/dist/services/domains/get.d.ts.map +1 -0
- package/dist/services/domains/get.js +95 -0
- package/dist/services/domains/index.d.ts +34 -0
- package/dist/services/domains/index.d.ts.map +1 -0
- package/dist/services/domains/index.js +37 -0
- package/dist/services/domains/list.d.ts +68 -0
- package/dist/services/domains/list.d.ts.map +1 -0
- package/dist/services/domains/list.js +52 -0
- package/dist/services/domains/register.d.ts +89 -0
- package/dist/services/domains/register.d.ts.map +1 -0
- package/dist/services/domains/register.js +73 -0
- package/dist/services/email/index.d.ts +17 -0
- package/dist/services/email/index.d.ts.map +1 -0
- package/dist/services/email/index.js +16 -0
- package/dist/services/email/send.d.ts +69 -0
- package/dist/services/email/send.d.ts.map +1 -0
- package/dist/services/email/send.js +84 -0
- package/dist/services/imessage/index.d.ts +24 -0
- package/dist/services/imessage/index.d.ts.map +1 -0
- package/dist/services/imessage/index.js +23 -0
- package/dist/services/imessage/send.d.ts +60 -0
- package/dist/services/imessage/send.d.ts.map +1 -0
- package/dist/services/imessage/send.js +66 -0
- package/dist/services/imessage/typing.d.ts +43 -0
- package/dist/services/imessage/typing.d.ts.map +1 -0
- package/dist/services/imessage/typing.js +55 -0
- package/dist/services/lease/available.d.ts +255 -0
- package/dist/services/lease/available.d.ts.map +1 -0
- package/dist/services/lease/available.js +109 -0
- package/dist/services/lease/create.d.ts +139 -0
- package/dist/services/lease/create.d.ts.map +1 -0
- package/dist/services/lease/create.js +84 -0
- package/dist/services/lease/details.d.ts +210 -0
- package/dist/services/lease/details.d.ts.map +1 -0
- package/dist/services/lease/details.js +71 -0
- package/dist/services/lease/get.d.ts +155 -0
- package/dist/services/lease/get.d.ts.map +1 -0
- package/dist/services/lease/get.js +74 -0
- package/dist/services/lease/index.d.ts +50 -0
- package/dist/services/lease/index.d.ts.map +1 -0
- package/dist/services/lease/index.js +51 -0
- package/dist/services/lease/leased.d.ts +308 -0
- package/dist/services/lease/leased.d.ts.map +1 -0
- package/dist/services/lease/leased.js +114 -0
- package/dist/services/lease/terminate.d.ts +81 -0
- package/dist/services/lease/terminate.d.ts.map +1 -0
- package/dist/services/lease/terminate.js +84 -0
- package/dist/services/otp/index.d.ts +28 -0
- package/dist/services/otp/index.d.ts.map +1 -0
- package/dist/services/otp/index.js +30 -0
- package/dist/services/otp/new.d.ts +29 -0
- package/dist/services/otp/new.d.ts.map +1 -0
- package/dist/services/otp/new.js +44 -0
- package/dist/services/otp/resend.d.ts +25 -0
- package/dist/services/otp/resend.d.ts.map +1 -0
- package/dist/services/otp/resend.js +37 -0
- package/dist/services/otp/verify.d.ts +27 -0
- package/dist/services/otp/verify.d.ts.map +1 -0
- package/dist/services/otp/verify.js +40 -0
- package/dist/services/text/index.d.ts +17 -0
- package/dist/services/text/index.d.ts.map +1 -0
- package/dist/services/text/index.js +16 -0
- package/dist/services/text/send.d.ts +28 -0
- package/dist/services/text/send.d.ts.map +1 -0
- package/dist/services/text/send.js +43 -0
- package/dist/services/whatsapp/index.d.ts +24 -0
- package/dist/services/whatsapp/index.d.ts.map +1 -0
- package/dist/services/whatsapp/index.js +23 -0
- package/dist/services/whatsapp/send.d.ts +60 -0
- package/dist/services/whatsapp/send.d.ts.map +1 -0
- package/dist/services/whatsapp/send.js +66 -0
- package/dist/services/whatsapp/typing.d.ts +43 -0
- package/dist/services/whatsapp/typing.d.ts.map +1 -0
- package/dist/services/whatsapp/typing.js +55 -0
- package/dist/types/base.d.ts +38 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/base.js +32 -0
- package/dist/types/common.d.ts +56 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +48 -0
- package/dist/types/error.d.ts +37 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/error.js +54 -0
- package/dist/types/metadata.d.ts +10 -0
- package/dist/types/metadata.d.ts.map +1 -0
- package/dist/types/metadata.js +1 -0
- package/dist/types/response.d.ts +17 -0
- package/dist/types/response.d.ts.map +1 -0
- package/dist/types/response.js +17 -0
- package/dist/utils/parse.d.ts +8 -0
- package/dist/utils/parse.d.ts.map +1 -0
- package/dist/utils/parse.js +36 -0
- package/dist/utils/request.d.ts +6 -0
- package/dist/utils/request.d.ts.map +1 -0
- package/dist/utils/request.js +47 -0
- package/package.json +46 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const NumberCapabilities: z.ZodObject<{
|
|
3
|
+
intl_sms: z.ZodBoolean;
|
|
4
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
5
|
+
sms: "sms";
|
|
6
|
+
mms: "mms";
|
|
7
|
+
rcs: "rcs";
|
|
8
|
+
imessage: "imessage";
|
|
9
|
+
whatsapp: "whatsapp";
|
|
10
|
+
}>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const NumberHealth: z.ZodObject<{
|
|
13
|
+
reputation: z.ZodNumber;
|
|
14
|
+
previous_owners: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const NumberLocation: z.ZodObject<{
|
|
17
|
+
country: z.ZodString;
|
|
18
|
+
region: z.ZodString;
|
|
19
|
+
city: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const NumberFormat: z.ZodObject<{
|
|
22
|
+
e164: z.ZodString;
|
|
23
|
+
formatted: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const NumberData: z.ZodObject<{
|
|
26
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
27
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
28
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
29
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
30
|
+
}>>;
|
|
31
|
+
e911_capable: z.ZodBoolean;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const NumberPricing: z.ZodObject<{
|
|
34
|
+
currency: z.ZodEnum<{
|
|
35
|
+
USD: "USD";
|
|
36
|
+
EUR: "EUR";
|
|
37
|
+
GBP: "GBP";
|
|
38
|
+
CAD: "CAD";
|
|
39
|
+
AUD: "AUD";
|
|
40
|
+
}>;
|
|
41
|
+
upfront_fee: z.ZodNumber;
|
|
42
|
+
monthly_rate: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export declare const AvailableNumber: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
status: z.ZodEnum<{
|
|
47
|
+
available: "available";
|
|
48
|
+
"g-available": "g-available";
|
|
49
|
+
leased: "leased";
|
|
50
|
+
unavailable: "unavailable";
|
|
51
|
+
}>;
|
|
52
|
+
number: z.ZodObject<{
|
|
53
|
+
e164: z.ZodString;
|
|
54
|
+
formatted: z.ZodString;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
location: z.ZodObject<{
|
|
57
|
+
country: z.ZodString;
|
|
58
|
+
region: z.ZodString;
|
|
59
|
+
city: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
carrier: z.ZodEnum<{
|
|
62
|
+
"T-Mobile": "T-Mobile";
|
|
63
|
+
"AT&T": "AT&T";
|
|
64
|
+
Verizon: "Verizon";
|
|
65
|
+
Contiguity: "Contiguity";
|
|
66
|
+
"International Partner": "International Partner";
|
|
67
|
+
}>;
|
|
68
|
+
capabilities: z.ZodObject<{
|
|
69
|
+
intl_sms: z.ZodBoolean;
|
|
70
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
71
|
+
sms: "sms";
|
|
72
|
+
mms: "mms";
|
|
73
|
+
rcs: "rcs";
|
|
74
|
+
imessage: "imessage";
|
|
75
|
+
whatsapp: "whatsapp";
|
|
76
|
+
}>>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
health: z.ZodObject<{
|
|
79
|
+
reputation: z.ZodNumber;
|
|
80
|
+
previous_owners: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
data: z.ZodObject<{
|
|
83
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
84
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
85
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
86
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
87
|
+
}>>;
|
|
88
|
+
e911_capable: z.ZodBoolean;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
created_at: z.ZodNumber;
|
|
91
|
+
pricing: z.ZodObject<{
|
|
92
|
+
currency: z.ZodEnum<{
|
|
93
|
+
USD: "USD";
|
|
94
|
+
EUR: "EUR";
|
|
95
|
+
GBP: "GBP";
|
|
96
|
+
CAD: "CAD";
|
|
97
|
+
AUD: "AUD";
|
|
98
|
+
}>;
|
|
99
|
+
upfront_fee: z.ZodNumber;
|
|
100
|
+
monthly_rate: z.ZodNumber;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export declare const LeaseAvailableResponse: z.ZodObject<{
|
|
104
|
+
available: z.ZodNumber;
|
|
105
|
+
numbers: z.ZodArray<z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
status: z.ZodEnum<{
|
|
108
|
+
available: "available";
|
|
109
|
+
"g-available": "g-available";
|
|
110
|
+
leased: "leased";
|
|
111
|
+
unavailable: "unavailable";
|
|
112
|
+
}>;
|
|
113
|
+
number: z.ZodObject<{
|
|
114
|
+
e164: z.ZodString;
|
|
115
|
+
formatted: z.ZodString;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
location: z.ZodObject<{
|
|
118
|
+
country: z.ZodString;
|
|
119
|
+
region: z.ZodString;
|
|
120
|
+
city: z.ZodString;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
carrier: z.ZodEnum<{
|
|
123
|
+
"T-Mobile": "T-Mobile";
|
|
124
|
+
"AT&T": "AT&T";
|
|
125
|
+
Verizon: "Verizon";
|
|
126
|
+
Contiguity: "Contiguity";
|
|
127
|
+
"International Partner": "International Partner";
|
|
128
|
+
}>;
|
|
129
|
+
capabilities: z.ZodObject<{
|
|
130
|
+
intl_sms: z.ZodBoolean;
|
|
131
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
132
|
+
sms: "sms";
|
|
133
|
+
mms: "mms";
|
|
134
|
+
rcs: "rcs";
|
|
135
|
+
imessage: "imessage";
|
|
136
|
+
whatsapp: "whatsapp";
|
|
137
|
+
}>>;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
health: z.ZodObject<{
|
|
140
|
+
reputation: z.ZodNumber;
|
|
141
|
+
previous_owners: z.ZodNumber;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
data: z.ZodObject<{
|
|
144
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
145
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
146
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
147
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
148
|
+
}>>;
|
|
149
|
+
e911_capable: z.ZodBoolean;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
created_at: z.ZodNumber;
|
|
152
|
+
pricing: z.ZodObject<{
|
|
153
|
+
currency: z.ZodEnum<{
|
|
154
|
+
USD: "USD";
|
|
155
|
+
EUR: "EUR";
|
|
156
|
+
GBP: "GBP";
|
|
157
|
+
CAD: "CAD";
|
|
158
|
+
AUD: "AUD";
|
|
159
|
+
}>;
|
|
160
|
+
upfront_fee: z.ZodNumber;
|
|
161
|
+
monthly_rate: z.ZodNumber;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export declare const LeaseAvailableResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
166
|
+
available: z.ZodNumber;
|
|
167
|
+
numbers: z.ZodArray<z.ZodObject<{
|
|
168
|
+
id: z.ZodString;
|
|
169
|
+
status: z.ZodEnum<{
|
|
170
|
+
available: "available";
|
|
171
|
+
"g-available": "g-available";
|
|
172
|
+
leased: "leased";
|
|
173
|
+
unavailable: "unavailable";
|
|
174
|
+
}>;
|
|
175
|
+
number: z.ZodObject<{
|
|
176
|
+
e164: z.ZodString;
|
|
177
|
+
formatted: z.ZodString;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
location: z.ZodObject<{
|
|
180
|
+
country: z.ZodString;
|
|
181
|
+
region: z.ZodString;
|
|
182
|
+
city: z.ZodString;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
carrier: z.ZodEnum<{
|
|
185
|
+
"T-Mobile": "T-Mobile";
|
|
186
|
+
"AT&T": "AT&T";
|
|
187
|
+
Verizon: "Verizon";
|
|
188
|
+
Contiguity: "Contiguity";
|
|
189
|
+
"International Partner": "International Partner";
|
|
190
|
+
}>;
|
|
191
|
+
capabilities: z.ZodObject<{
|
|
192
|
+
intl_sms: z.ZodBoolean;
|
|
193
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
194
|
+
sms: "sms";
|
|
195
|
+
mms: "mms";
|
|
196
|
+
rcs: "rcs";
|
|
197
|
+
imessage: "imessage";
|
|
198
|
+
whatsapp: "whatsapp";
|
|
199
|
+
}>>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
health: z.ZodObject<{
|
|
202
|
+
reputation: z.ZodNumber;
|
|
203
|
+
previous_owners: z.ZodNumber;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
data: z.ZodObject<{
|
|
206
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
207
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
208
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
209
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
210
|
+
}>>;
|
|
211
|
+
e911_capable: z.ZodBoolean;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
created_at: z.ZodNumber;
|
|
214
|
+
pricing: z.ZodObject<{
|
|
215
|
+
currency: z.ZodEnum<{
|
|
216
|
+
USD: "USD";
|
|
217
|
+
EUR: "EUR";
|
|
218
|
+
GBP: "GBP";
|
|
219
|
+
CAD: "CAD";
|
|
220
|
+
AUD: "AUD";
|
|
221
|
+
}>;
|
|
222
|
+
upfront_fee: z.ZodNumber;
|
|
223
|
+
monthly_rate: z.ZodNumber;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
}, z.core.$strip>>;
|
|
227
|
+
export type LeaseAvailableResponseType = z.infer<typeof LeaseAvailableResponse>;
|
|
228
|
+
export type AvailableNumberType = z.infer<typeof AvailableNumber>;
|
|
229
|
+
/**
|
|
230
|
+
* Gets all phone numbers available for lease
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const response = await contiguity.lease.available();
|
|
235
|
+
* console.log(`${response.available} numbers available`);
|
|
236
|
+
*
|
|
237
|
+
* // Find numbers with iMessage support
|
|
238
|
+
* const imessageNumbers = response.numbers.filter(
|
|
239
|
+
* num => num.capabilities.channels.includes('imessage')
|
|
240
|
+
* );
|
|
241
|
+
* console.log(`Found ${imessageNumbers.length} iMessage-capable numbers`);
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* // Find high-reputation numbers in a specific city
|
|
247
|
+
* const response = await contiguity.lease.available();
|
|
248
|
+
* const miamiNumbers = response.numbers.filter(
|
|
249
|
+
* num => num.location.city === 'Miami' && num.health.reputation > 0.8
|
|
250
|
+
* );
|
|
251
|
+
* console.log(`Found ${miamiNumbers.length} high-reputation Miami numbers`);
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
export declare function _leaseAvailable(this: any): Promise<any>;
|
|
255
|
+
//# sourceMappingURL=available.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available.d.ts","sourceRoot":"","sources":["../../../src/services/lease/available.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;;;;iBAK7B,CAAC;AAEH,eAAO,MAAM,YAAY;;;iBAKvB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;iBAOzB,CAAC;AAEH,eAAO,MAAM,YAAY;;;iBAKvB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;iBAKrB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;iBAOxB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqB1B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKjC,CAAC;AAGH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAyC,CAAC;AAEpF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAChF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAY7D"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createResponse } from "@/types/base";
|
|
3
|
+
export const NumberCapabilities = z.object({
|
|
4
|
+
/** International SMS support (generally only T-Mobile numbers support this) */
|
|
5
|
+
intl_sms: z.boolean(),
|
|
6
|
+
/** Supported channels */
|
|
7
|
+
channels: z.array(z.enum(["sms", "mms", "rcs", "imessage", "whatsapp"]))
|
|
8
|
+
});
|
|
9
|
+
export const NumberHealth = z.object({
|
|
10
|
+
/** Reputation score 0.00-0.99. >0.80 is considered acceptable for all applications. <0.70 should be used for messages you care less about */
|
|
11
|
+
reputation: z.number().min(0).max(1),
|
|
12
|
+
/** Number of previous lessees */
|
|
13
|
+
previous_owners: z.number()
|
|
14
|
+
});
|
|
15
|
+
export const NumberLocation = z.object({
|
|
16
|
+
/** 2-letter country code */
|
|
17
|
+
country: z.string(),
|
|
18
|
+
/** Region/state */
|
|
19
|
+
region: z.string(),
|
|
20
|
+
/** City */
|
|
21
|
+
city: z.string()
|
|
22
|
+
});
|
|
23
|
+
export const NumberFormat = z.object({
|
|
24
|
+
/** E.164 format */
|
|
25
|
+
e164: z.string(),
|
|
26
|
+
/** Formatted phone number */
|
|
27
|
+
formatted: z.string()
|
|
28
|
+
});
|
|
29
|
+
export const NumberData = z.object({
|
|
30
|
+
/** Entitlements required to lease this number */
|
|
31
|
+
requirements: z.array(z.enum(["imessage_entitlement_required", "whatsapp_entitlement_required", "enterprise_plan_required"])),
|
|
32
|
+
/** E911 capability */
|
|
33
|
+
e911_capable: z.boolean()
|
|
34
|
+
});
|
|
35
|
+
export const NumberPricing = z.object({
|
|
36
|
+
/** Currency */
|
|
37
|
+
currency: z.enum(["USD", "EUR", "GBP", "CAD", "AUD"]),
|
|
38
|
+
/** One-time fee */
|
|
39
|
+
upfront_fee: z.number(),
|
|
40
|
+
/** Monthly rate */
|
|
41
|
+
monthly_rate: z.number()
|
|
42
|
+
});
|
|
43
|
+
export const AvailableNumber = z.object({
|
|
44
|
+
/** Phone number in E.164 format */
|
|
45
|
+
id: z.string(),
|
|
46
|
+
/** Number status */
|
|
47
|
+
status: z.enum(["available", "g-available", "leased", "unavailable"]),
|
|
48
|
+
/** Number formats */
|
|
49
|
+
number: NumberFormat,
|
|
50
|
+
/** Geographic location */
|
|
51
|
+
location: NumberLocation,
|
|
52
|
+
/** Carrier name */
|
|
53
|
+
carrier: z.enum(["T-Mobile", "AT&T", "Verizon", "Contiguity", "International Partner"]),
|
|
54
|
+
/** Number capabilities */
|
|
55
|
+
capabilities: NumberCapabilities,
|
|
56
|
+
/** Number health metrics */
|
|
57
|
+
health: NumberHealth,
|
|
58
|
+
/** Additional data */
|
|
59
|
+
data: NumberData,
|
|
60
|
+
/** Date & time of when the number was provisioned */
|
|
61
|
+
created_at: z.number(),
|
|
62
|
+
/** Pricing information */
|
|
63
|
+
pricing: NumberPricing
|
|
64
|
+
});
|
|
65
|
+
export const LeaseAvailableResponse = z.object({
|
|
66
|
+
/** Count of available numbers */
|
|
67
|
+
available: z.number(),
|
|
68
|
+
/** Available numbers */
|
|
69
|
+
numbers: z.array(AvailableNumber)
|
|
70
|
+
});
|
|
71
|
+
// Using the new base response builder
|
|
72
|
+
export const LeaseAvailableResponseBuilder = createResponse(LeaseAvailableResponse);
|
|
73
|
+
/**
|
|
74
|
+
* Gets all phone numbers available for lease
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const response = await contiguity.lease.available();
|
|
79
|
+
* console.log(`${response.available} numbers available`);
|
|
80
|
+
*
|
|
81
|
+
* // Find numbers with iMessage support
|
|
82
|
+
* const imessageNumbers = response.numbers.filter(
|
|
83
|
+
* num => num.capabilities.channels.includes('imessage')
|
|
84
|
+
* );
|
|
85
|
+
* console.log(`Found ${imessageNumbers.length} iMessage-capable numbers`);
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* // Find high-reputation numbers in a specific city
|
|
91
|
+
* const response = await contiguity.lease.available();
|
|
92
|
+
* const miamiNumbers = response.numbers.filter(
|
|
93
|
+
* num => num.location.city === 'Miami' && num.health.reputation > 0.8
|
|
94
|
+
* );
|
|
95
|
+
* console.log(`Found ${miamiNumbers.length} high-reputation Miami numbers`);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export async function _leaseAvailable() {
|
|
99
|
+
const response = await this.request("/numbers/leases", {
|
|
100
|
+
method: "GET",
|
|
101
|
+
});
|
|
102
|
+
return this.parse({
|
|
103
|
+
response,
|
|
104
|
+
schemas: {
|
|
105
|
+
sdk: LeaseAvailableResponse,
|
|
106
|
+
raw: LeaseAvailableResponseBuilder.raw
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const LeaseCreateRequest: z.ZodObject<{
|
|
3
|
+
number: z.ZodString;
|
|
4
|
+
billing_method: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
5
|
+
monthly: "monthly";
|
|
6
|
+
service_contract: "service_contract";
|
|
7
|
+
}>>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const LeaseBillingPrice: z.ZodObject<{
|
|
10
|
+
currency: z.ZodEnum<{
|
|
11
|
+
USD: "USD";
|
|
12
|
+
EUR: "EUR";
|
|
13
|
+
GBP: "GBP";
|
|
14
|
+
CAD: "CAD";
|
|
15
|
+
AUD: "AUD";
|
|
16
|
+
}>;
|
|
17
|
+
monthly_rate: z.ZodNumber;
|
|
18
|
+
upfront_fee: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const LeaseBillingPeriod: z.ZodObject<{
|
|
21
|
+
start: z.ZodNumber;
|
|
22
|
+
end: z.ZodNull;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const LeaseBilling: z.ZodObject<{
|
|
25
|
+
method: z.ZodEnum<{
|
|
26
|
+
monthly: "monthly";
|
|
27
|
+
service_contract: "service_contract";
|
|
28
|
+
goodwill: "goodwill";
|
|
29
|
+
}>;
|
|
30
|
+
price: z.ZodObject<{
|
|
31
|
+
currency: z.ZodEnum<{
|
|
32
|
+
USD: "USD";
|
|
33
|
+
EUR: "EUR";
|
|
34
|
+
GBP: "GBP";
|
|
35
|
+
CAD: "CAD";
|
|
36
|
+
AUD: "AUD";
|
|
37
|
+
}>;
|
|
38
|
+
monthly_rate: z.ZodNumber;
|
|
39
|
+
upfront_fee: z.ZodNumber;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
period: z.ZodObject<{
|
|
42
|
+
start: z.ZodNumber;
|
|
43
|
+
end: z.ZodNull;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export declare const LeaseCreateResponse: z.ZodObject<{
|
|
47
|
+
lease_id: z.ZodString;
|
|
48
|
+
number: z.ZodString;
|
|
49
|
+
status: z.ZodEnum<{
|
|
50
|
+
active: "active";
|
|
51
|
+
expired: "expired";
|
|
52
|
+
terminated: "terminated";
|
|
53
|
+
}>;
|
|
54
|
+
billing: z.ZodObject<{
|
|
55
|
+
method: z.ZodEnum<{
|
|
56
|
+
monthly: "monthly";
|
|
57
|
+
service_contract: "service_contract";
|
|
58
|
+
goodwill: "goodwill";
|
|
59
|
+
}>;
|
|
60
|
+
price: z.ZodObject<{
|
|
61
|
+
currency: z.ZodEnum<{
|
|
62
|
+
USD: "USD";
|
|
63
|
+
EUR: "EUR";
|
|
64
|
+
GBP: "GBP";
|
|
65
|
+
CAD: "CAD";
|
|
66
|
+
AUD: "AUD";
|
|
67
|
+
}>;
|
|
68
|
+
monthly_rate: z.ZodNumber;
|
|
69
|
+
upfront_fee: z.ZodNumber;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
period: z.ZodObject<{
|
|
72
|
+
start: z.ZodNumber;
|
|
73
|
+
end: z.ZodNull;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export declare const LeaseCreateResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
78
|
+
lease_id: z.ZodString;
|
|
79
|
+
number: z.ZodString;
|
|
80
|
+
status: z.ZodEnum<{
|
|
81
|
+
active: "active";
|
|
82
|
+
expired: "expired";
|
|
83
|
+
terminated: "terminated";
|
|
84
|
+
}>;
|
|
85
|
+
billing: z.ZodObject<{
|
|
86
|
+
method: z.ZodEnum<{
|
|
87
|
+
monthly: "monthly";
|
|
88
|
+
service_contract: "service_contract";
|
|
89
|
+
goodwill: "goodwill";
|
|
90
|
+
}>;
|
|
91
|
+
price: z.ZodObject<{
|
|
92
|
+
currency: z.ZodEnum<{
|
|
93
|
+
USD: "USD";
|
|
94
|
+
EUR: "EUR";
|
|
95
|
+
GBP: "GBP";
|
|
96
|
+
CAD: "CAD";
|
|
97
|
+
AUD: "AUD";
|
|
98
|
+
}>;
|
|
99
|
+
monthly_rate: z.ZodNumber;
|
|
100
|
+
upfront_fee: z.ZodNumber;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
period: z.ZodObject<{
|
|
103
|
+
start: z.ZodNumber;
|
|
104
|
+
end: z.ZodNull;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
export type LeaseCreateParams = z.infer<typeof LeaseCreateRequest>;
|
|
109
|
+
export type LeaseCreateResponseType = z.infer<typeof LeaseCreateResponse>;
|
|
110
|
+
export type LeaseBillingType = z.infer<typeof LeaseBilling>;
|
|
111
|
+
/**
|
|
112
|
+
* Leases a specific phone number
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const response = await contiguity.lease.create({
|
|
117
|
+
* number: "+1234567890"
|
|
118
|
+
* });
|
|
119
|
+
*
|
|
120
|
+
* console.log(`Lease ID: ${response.lease_id}`);
|
|
121
|
+
* console.log(`Number: ${response.number}`);
|
|
122
|
+
* console.log(`Status: ${response.status}`);
|
|
123
|
+
* console.log(`Monthly rate: $${response.billing.price.monthly_rate}`);
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* // Lease with specific billing method
|
|
129
|
+
* const response = await contiguity.lease.create({
|
|
130
|
+
* number: "+1234567890",
|
|
131
|
+
* billing_method: "service_contract"
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* console.log(`Lease created with ${response.billing.method} billing`);
|
|
135
|
+
* console.log(`Lease starts: ${new Date(response.billing.period.start * 1000)}`);
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export declare function _leaseCreate(this: any, params: LeaseCreateParams): Promise<any>;
|
|
139
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/services/lease/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;iBAK7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAO5B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;iBAK7B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;iBAOvB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS9B,CAAC;AAGH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAsC,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,CAgBrF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createResponse } from "@/types/base";
|
|
3
|
+
export const LeaseCreateRequest = z.object({
|
|
4
|
+
/** Phone number in E.164 format to lease */
|
|
5
|
+
number: z.string().regex(/^\+[1-9]\d{1,14}$/, "Phone number must be in E.164 format"),
|
|
6
|
+
/** Billing method (service_contract only works if active) */
|
|
7
|
+
billing_method: z.enum(["monthly", "service_contract"]).default("monthly").optional(),
|
|
8
|
+
});
|
|
9
|
+
export const LeaseBillingPrice = z.object({
|
|
10
|
+
/** Currency */
|
|
11
|
+
currency: z.enum(["USD", "EUR", "GBP", "CAD", "AUD"]),
|
|
12
|
+
/** Monthly rate */
|
|
13
|
+
monthly_rate: z.number(),
|
|
14
|
+
/** One-time fee */
|
|
15
|
+
upfront_fee: z.number()
|
|
16
|
+
});
|
|
17
|
+
export const LeaseBillingPeriod = z.object({
|
|
18
|
+
/** Lease start timestamp */
|
|
19
|
+
start: z.number(),
|
|
20
|
+
/** Always null for month-to-month leases */
|
|
21
|
+
end: z.null()
|
|
22
|
+
});
|
|
23
|
+
export const LeaseBilling = z.object({
|
|
24
|
+
/** Billing method */
|
|
25
|
+
method: z.enum(["monthly", "service_contract", "goodwill"]),
|
|
26
|
+
/** Pricing information */
|
|
27
|
+
price: LeaseBillingPrice,
|
|
28
|
+
/** Billing period */
|
|
29
|
+
period: LeaseBillingPeriod
|
|
30
|
+
});
|
|
31
|
+
export const LeaseCreateResponse = z.object({
|
|
32
|
+
/** Lease ID */
|
|
33
|
+
lease_id: z.string(),
|
|
34
|
+
/** Phone number ID */
|
|
35
|
+
number: z.string(),
|
|
36
|
+
/** Lease status */
|
|
37
|
+
status: z.enum(["active", "expired", "terminated"]),
|
|
38
|
+
/** Lease billing information */
|
|
39
|
+
billing: LeaseBilling
|
|
40
|
+
});
|
|
41
|
+
// Using the new base response builder
|
|
42
|
+
export const LeaseCreateResponseBuilder = createResponse(LeaseCreateResponse);
|
|
43
|
+
/**
|
|
44
|
+
* Leases a specific phone number
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const response = await contiguity.lease.create({
|
|
49
|
+
* number: "+1234567890"
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* console.log(`Lease ID: ${response.lease_id}`);
|
|
53
|
+
* console.log(`Number: ${response.number}`);
|
|
54
|
+
* console.log(`Status: ${response.status}`);
|
|
55
|
+
* console.log(`Monthly rate: $${response.billing.price.monthly_rate}`);
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // Lease with specific billing method
|
|
61
|
+
* const response = await contiguity.lease.create({
|
|
62
|
+
* number: "+1234567890",
|
|
63
|
+
* billing_method: "service_contract"
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* console.log(`Lease created with ${response.billing.method} billing`);
|
|
67
|
+
* console.log(`Lease starts: ${new Date(response.billing.period.start * 1000)}`);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export async function _leaseCreate(params) {
|
|
71
|
+
const validatedParams = LeaseCreateRequest.parse(params);
|
|
72
|
+
const { number, ...body } = validatedParams;
|
|
73
|
+
const response = await this.request(`/numbers/lease/${encodeURIComponent(number)}`, {
|
|
74
|
+
method: "POST",
|
|
75
|
+
body: JSON.stringify(body),
|
|
76
|
+
});
|
|
77
|
+
return this.parse({
|
|
78
|
+
response,
|
|
79
|
+
schemas: {
|
|
80
|
+
sdk: LeaseCreateResponse,
|
|
81
|
+
raw: LeaseCreateResponseBuilder.raw
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|