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,210 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const LeaseDetailsRequest: z.ZodObject<{
|
|
3
|
+
number: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const LeaseDetailsResponse: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
status: z.ZodEnum<{
|
|
8
|
+
available: "available";
|
|
9
|
+
"g-available": "g-available";
|
|
10
|
+
leased: "leased";
|
|
11
|
+
unavailable: "unavailable";
|
|
12
|
+
}>;
|
|
13
|
+
number: z.ZodObject<{
|
|
14
|
+
e164: z.ZodString;
|
|
15
|
+
formatted: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
location: z.ZodObject<{
|
|
18
|
+
country: z.ZodString;
|
|
19
|
+
region: z.ZodString;
|
|
20
|
+
city: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
carrier: z.ZodEnum<{
|
|
23
|
+
"T-Mobile": "T-Mobile";
|
|
24
|
+
"AT&T": "AT&T";
|
|
25
|
+
Verizon: "Verizon";
|
|
26
|
+
Contiguity: "Contiguity";
|
|
27
|
+
"International Partner": "International Partner";
|
|
28
|
+
Twilio: "Twilio";
|
|
29
|
+
}>;
|
|
30
|
+
capabilities: z.ZodObject<{
|
|
31
|
+
intl_sms: z.ZodBoolean;
|
|
32
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
33
|
+
sms: "sms";
|
|
34
|
+
mms: "mms";
|
|
35
|
+
rcs: "rcs";
|
|
36
|
+
imessage: "imessage";
|
|
37
|
+
whatsapp: "whatsapp";
|
|
38
|
+
}>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
health: z.ZodObject<{
|
|
41
|
+
reputation: z.ZodNumber;
|
|
42
|
+
previous_owners: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
data: z.ZodObject<{
|
|
45
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
46
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
47
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
48
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
49
|
+
}>>;
|
|
50
|
+
e911_capable: z.ZodBoolean;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
created_at: z.ZodNumber;
|
|
53
|
+
pricing: z.ZodObject<{
|
|
54
|
+
currency: z.ZodEnum<{
|
|
55
|
+
USD: "USD";
|
|
56
|
+
EUR: "EUR";
|
|
57
|
+
GBP: "GBP";
|
|
58
|
+
CAD: "CAD";
|
|
59
|
+
AUD: "AUD";
|
|
60
|
+
}>;
|
|
61
|
+
upfront_fee: z.ZodNumber;
|
|
62
|
+
monthly_rate: z.ZodNumber;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
lease_id: z.ZodString;
|
|
65
|
+
lease_status: z.ZodEnum<{
|
|
66
|
+
active: "active";
|
|
67
|
+
expired: "expired";
|
|
68
|
+
terminated: "terminated";
|
|
69
|
+
}>;
|
|
70
|
+
billing: z.ZodObject<{
|
|
71
|
+
method: z.ZodEnum<{
|
|
72
|
+
monthly: "monthly";
|
|
73
|
+
service_contract: "service_contract";
|
|
74
|
+
goodwill: "goodwill";
|
|
75
|
+
}>;
|
|
76
|
+
period: z.ZodObject<{
|
|
77
|
+
start: z.ZodNumber;
|
|
78
|
+
end: z.ZodNullable<z.ZodNumber>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export declare const LeaseDetailsResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
status: z.ZodEnum<{
|
|
85
|
+
available: "available";
|
|
86
|
+
"g-available": "g-available";
|
|
87
|
+
leased: "leased";
|
|
88
|
+
unavailable: "unavailable";
|
|
89
|
+
}>;
|
|
90
|
+
number: z.ZodObject<{
|
|
91
|
+
e164: z.ZodString;
|
|
92
|
+
formatted: z.ZodString;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
location: z.ZodObject<{
|
|
95
|
+
country: z.ZodString;
|
|
96
|
+
region: z.ZodString;
|
|
97
|
+
city: z.ZodString;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
carrier: z.ZodEnum<{
|
|
100
|
+
"T-Mobile": "T-Mobile";
|
|
101
|
+
"AT&T": "AT&T";
|
|
102
|
+
Verizon: "Verizon";
|
|
103
|
+
Contiguity: "Contiguity";
|
|
104
|
+
"International Partner": "International Partner";
|
|
105
|
+
Twilio: "Twilio";
|
|
106
|
+
}>;
|
|
107
|
+
capabilities: z.ZodObject<{
|
|
108
|
+
intl_sms: z.ZodBoolean;
|
|
109
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
110
|
+
sms: "sms";
|
|
111
|
+
mms: "mms";
|
|
112
|
+
rcs: "rcs";
|
|
113
|
+
imessage: "imessage";
|
|
114
|
+
whatsapp: "whatsapp";
|
|
115
|
+
}>>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
health: z.ZodObject<{
|
|
118
|
+
reputation: z.ZodNumber;
|
|
119
|
+
previous_owners: z.ZodNumber;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
data: z.ZodObject<{
|
|
122
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
123
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
124
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
125
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
126
|
+
}>>;
|
|
127
|
+
e911_capable: z.ZodBoolean;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
created_at: z.ZodNumber;
|
|
130
|
+
pricing: z.ZodObject<{
|
|
131
|
+
currency: z.ZodEnum<{
|
|
132
|
+
USD: "USD";
|
|
133
|
+
EUR: "EUR";
|
|
134
|
+
GBP: "GBP";
|
|
135
|
+
CAD: "CAD";
|
|
136
|
+
AUD: "AUD";
|
|
137
|
+
}>;
|
|
138
|
+
upfront_fee: z.ZodNumber;
|
|
139
|
+
monthly_rate: z.ZodNumber;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
lease_id: z.ZodString;
|
|
142
|
+
lease_status: z.ZodEnum<{
|
|
143
|
+
active: "active";
|
|
144
|
+
expired: "expired";
|
|
145
|
+
terminated: "terminated";
|
|
146
|
+
}>;
|
|
147
|
+
billing: z.ZodObject<{
|
|
148
|
+
method: z.ZodEnum<{
|
|
149
|
+
monthly: "monthly";
|
|
150
|
+
service_contract: "service_contract";
|
|
151
|
+
goodwill: "goodwill";
|
|
152
|
+
}>;
|
|
153
|
+
period: z.ZodObject<{
|
|
154
|
+
start: z.ZodNumber;
|
|
155
|
+
end: z.ZodNullable<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
export type LeaseDetailsParams = z.infer<typeof LeaseDetailsRequest>;
|
|
160
|
+
export type LeaseDetailsResponseType = z.infer<typeof LeaseDetailsResponse>;
|
|
161
|
+
/**
|
|
162
|
+
* Gets information about a specific leased number
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const response = await contiguity.lease.details({
|
|
167
|
+
* number: "+1234567890"
|
|
168
|
+
* });
|
|
169
|
+
*
|
|
170
|
+
* console.log(`Number: ${response.number.formatted}`);
|
|
171
|
+
* console.log(`Lease ID: ${response.lease_id}`);
|
|
172
|
+
* console.log(`Status: ${response.lease_status}`);
|
|
173
|
+
* console.log(`Billing method: ${response.billing.method}`);
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* // Check lease billing details
|
|
179
|
+
* const response = await contiguity.lease.details({
|
|
180
|
+
* number: "+1234567890"
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* const startDate = new Date(response.billing.period.start * 1000);
|
|
184
|
+
* console.log(`Lease started: ${startDate.toLocaleDateString()}`);
|
|
185
|
+
*
|
|
186
|
+
* if (response.billing.period.end) {
|
|
187
|
+
* const endDate = new Date(response.billing.period.end * 1000);
|
|
188
|
+
* console.log(`Lease ends: ${endDate.toLocaleDateString()}`);
|
|
189
|
+
* } else {
|
|
190
|
+
* console.log(`Month-to-month billing`);
|
|
191
|
+
* }
|
|
192
|
+
*
|
|
193
|
+
* console.log(`Monthly rate: $${response.pricing.monthly_rate}`);
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* // Check number capabilities and health
|
|
199
|
+
* const response = await contiguity.lease.details({
|
|
200
|
+
* number: "+1234567890"
|
|
201
|
+
* });
|
|
202
|
+
*
|
|
203
|
+
* console.log(`Supported channels: ${response.capabilities.channels.join(', ')}`);
|
|
204
|
+
* console.log(`Reputation score: ${response.health.reputation}`);
|
|
205
|
+
* console.log(`Previous owners: ${response.health.previous_owners}`);
|
|
206
|
+
* console.log(`International SMS: ${response.capabilities.intl_sms ? 'Yes' : 'No'}`);
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare function _leaseDetails(this: any, params: LeaseDetailsParams): Promise<any>;
|
|
210
|
+
//# sourceMappingURL=details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../../src/services/lease/details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;iBAG9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAe,CAAC;AAGjD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAuC,CAAC;AAEhF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAavF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createResponse } from "@/types/base";
|
|
3
|
+
import { LeasedNumber } from "@/services/lease/leased";
|
|
4
|
+
export const LeaseDetailsRequest = z.object({
|
|
5
|
+
/** Phone number in E.164 format to get lease details for */
|
|
6
|
+
number: z.string().regex(/^\+[1-9]\d{1,14}$/, "Phone number must be in E.164 format"),
|
|
7
|
+
});
|
|
8
|
+
export const LeaseDetailsResponse = LeasedNumber;
|
|
9
|
+
// Using the new base response builder
|
|
10
|
+
export const LeaseDetailsResponseBuilder = createResponse(LeaseDetailsResponse);
|
|
11
|
+
/**
|
|
12
|
+
* Gets information about a specific leased number
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const response = await contiguity.lease.details({
|
|
17
|
+
* number: "+1234567890"
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* console.log(`Number: ${response.number.formatted}`);
|
|
21
|
+
* console.log(`Lease ID: ${response.lease_id}`);
|
|
22
|
+
* console.log(`Status: ${response.lease_status}`);
|
|
23
|
+
* console.log(`Billing method: ${response.billing.method}`);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Check lease billing details
|
|
29
|
+
* const response = await contiguity.lease.details({
|
|
30
|
+
* number: "+1234567890"
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* const startDate = new Date(response.billing.period.start * 1000);
|
|
34
|
+
* console.log(`Lease started: ${startDate.toLocaleDateString()}`);
|
|
35
|
+
*
|
|
36
|
+
* if (response.billing.period.end) {
|
|
37
|
+
* const endDate = new Date(response.billing.period.end * 1000);
|
|
38
|
+
* console.log(`Lease ends: ${endDate.toLocaleDateString()}`);
|
|
39
|
+
* } else {
|
|
40
|
+
* console.log(`Month-to-month billing`);
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* console.log(`Monthly rate: $${response.pricing.monthly_rate}`);
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Check number capabilities and health
|
|
49
|
+
* const response = await contiguity.lease.details({
|
|
50
|
+
* number: "+1234567890"
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* console.log(`Supported channels: ${response.capabilities.channels.join(', ')}`);
|
|
54
|
+
* console.log(`Reputation score: ${response.health.reputation}`);
|
|
55
|
+
* console.log(`Previous owners: ${response.health.previous_owners}`);
|
|
56
|
+
* console.log(`International SMS: ${response.capabilities.intl_sms ? 'Yes' : 'No'}`);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export async function _leaseDetails(params) {
|
|
60
|
+
const validatedParams = LeaseDetailsRequest.parse(params);
|
|
61
|
+
const response = await this.request(`/numbers/leased/${encodeURIComponent(validatedParams.number)}`, {
|
|
62
|
+
method: "GET",
|
|
63
|
+
});
|
|
64
|
+
return this.parse({
|
|
65
|
+
response,
|
|
66
|
+
schemas: {
|
|
67
|
+
sdk: LeaseDetailsResponse,
|
|
68
|
+
raw: LeaseDetailsResponseBuilder.raw
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const LeaseGetRequest: z.ZodObject<{
|
|
3
|
+
number: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const LeaseGetResponse: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
status: z.ZodEnum<{
|
|
8
|
+
available: "available";
|
|
9
|
+
"g-available": "g-available";
|
|
10
|
+
leased: "leased";
|
|
11
|
+
unavailable: "unavailable";
|
|
12
|
+
}>;
|
|
13
|
+
number: z.ZodObject<{
|
|
14
|
+
e164: z.ZodString;
|
|
15
|
+
formatted: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
location: z.ZodObject<{
|
|
18
|
+
country: z.ZodString;
|
|
19
|
+
region: z.ZodString;
|
|
20
|
+
city: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
carrier: z.ZodEnum<{
|
|
23
|
+
"T-Mobile": "T-Mobile";
|
|
24
|
+
"AT&T": "AT&T";
|
|
25
|
+
Verizon: "Verizon";
|
|
26
|
+
Contiguity: "Contiguity";
|
|
27
|
+
"International Partner": "International Partner";
|
|
28
|
+
}>;
|
|
29
|
+
capabilities: z.ZodObject<{
|
|
30
|
+
intl_sms: z.ZodBoolean;
|
|
31
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
32
|
+
sms: "sms";
|
|
33
|
+
mms: "mms";
|
|
34
|
+
rcs: "rcs";
|
|
35
|
+
imessage: "imessage";
|
|
36
|
+
whatsapp: "whatsapp";
|
|
37
|
+
}>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
health: z.ZodObject<{
|
|
40
|
+
reputation: z.ZodNumber;
|
|
41
|
+
previous_owners: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
data: z.ZodObject<{
|
|
44
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
45
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
46
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
47
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
48
|
+
}>>;
|
|
49
|
+
e911_capable: z.ZodBoolean;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
created_at: z.ZodNumber;
|
|
52
|
+
pricing: z.ZodObject<{
|
|
53
|
+
currency: z.ZodEnum<{
|
|
54
|
+
USD: "USD";
|
|
55
|
+
EUR: "EUR";
|
|
56
|
+
GBP: "GBP";
|
|
57
|
+
CAD: "CAD";
|
|
58
|
+
AUD: "AUD";
|
|
59
|
+
}>;
|
|
60
|
+
upfront_fee: z.ZodNumber;
|
|
61
|
+
monthly_rate: z.ZodNumber;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const LeaseGetResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
status: z.ZodEnum<{
|
|
67
|
+
available: "available";
|
|
68
|
+
"g-available": "g-available";
|
|
69
|
+
leased: "leased";
|
|
70
|
+
unavailable: "unavailable";
|
|
71
|
+
}>;
|
|
72
|
+
number: z.ZodObject<{
|
|
73
|
+
e164: z.ZodString;
|
|
74
|
+
formatted: z.ZodString;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
location: z.ZodObject<{
|
|
77
|
+
country: z.ZodString;
|
|
78
|
+
region: z.ZodString;
|
|
79
|
+
city: z.ZodString;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
carrier: z.ZodEnum<{
|
|
82
|
+
"T-Mobile": "T-Mobile";
|
|
83
|
+
"AT&T": "AT&T";
|
|
84
|
+
Verizon: "Verizon";
|
|
85
|
+
Contiguity: "Contiguity";
|
|
86
|
+
"International Partner": "International Partner";
|
|
87
|
+
}>;
|
|
88
|
+
capabilities: z.ZodObject<{
|
|
89
|
+
intl_sms: z.ZodBoolean;
|
|
90
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
91
|
+
sms: "sms";
|
|
92
|
+
mms: "mms";
|
|
93
|
+
rcs: "rcs";
|
|
94
|
+
imessage: "imessage";
|
|
95
|
+
whatsapp: "whatsapp";
|
|
96
|
+
}>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
health: z.ZodObject<{
|
|
99
|
+
reputation: z.ZodNumber;
|
|
100
|
+
previous_owners: z.ZodNumber;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
data: z.ZodObject<{
|
|
103
|
+
requirements: z.ZodArray<z.ZodEnum<{
|
|
104
|
+
imessage_entitlement_required: "imessage_entitlement_required";
|
|
105
|
+
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
106
|
+
enterprise_plan_required: "enterprise_plan_required";
|
|
107
|
+
}>>;
|
|
108
|
+
e911_capable: z.ZodBoolean;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
created_at: z.ZodNumber;
|
|
111
|
+
pricing: z.ZodObject<{
|
|
112
|
+
currency: z.ZodEnum<{
|
|
113
|
+
USD: "USD";
|
|
114
|
+
EUR: "EUR";
|
|
115
|
+
GBP: "GBP";
|
|
116
|
+
CAD: "CAD";
|
|
117
|
+
AUD: "AUD";
|
|
118
|
+
}>;
|
|
119
|
+
upfront_fee: z.ZodNumber;
|
|
120
|
+
monthly_rate: z.ZodNumber;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
export type LeaseGetParams = z.infer<typeof LeaseGetRequest>;
|
|
124
|
+
export type LeaseGetResponseType = z.infer<typeof LeaseGetResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Gets information about a specific number available for lease
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const response = await contiguity.lease.get({
|
|
131
|
+
* number: "+1234567890"
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* console.log(`Number: ${response.number.formatted}`);
|
|
135
|
+
* console.log(`Location: ${response.location.city}, ${response.location.region}`);
|
|
136
|
+
* console.log(`Reputation: ${response.health.reputation}`);
|
|
137
|
+
* console.log(`Monthly rate: $${response.pricing.monthly_rate}`);
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // Check if a number supports specific channels
|
|
143
|
+
* const response = await contiguity.lease.get({
|
|
144
|
+
* number: "+1234567890"
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* const supportsImessage = response.capabilities.channels.includes('imessage');
|
|
148
|
+
* const supportsWhatsApp = response.capabilities.channels.includes('whatsapp');
|
|
149
|
+
*
|
|
150
|
+
* console.log(`iMessage support: ${supportsImessage}`);
|
|
151
|
+
* console.log(`WhatsApp support: ${supportsWhatsApp}`);
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function _leaseGet(this: any, params: LeaseGetParams): Promise<any>;
|
|
155
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/services/lease/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,eAAe;;iBAG1B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqB3B,CAAC;AAGH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAmC,CAAC;AAExE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAa/E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createResponse } from "@/types/base";
|
|
3
|
+
import { E164PhoneNumber, NumberStatus, Carrier } from "@/types/common";
|
|
4
|
+
import { NumberCapabilities, NumberHealth, NumberLocation, NumberFormat, NumberData, NumberPricing } from "@/services/lease/available";
|
|
5
|
+
export const LeaseGetRequest = z.object({
|
|
6
|
+
/** Phone number in E.164 format to get information about */
|
|
7
|
+
number: E164PhoneNumber,
|
|
8
|
+
});
|
|
9
|
+
export const LeaseGetResponse = z.object({
|
|
10
|
+
/** Phone number in E.164 format */
|
|
11
|
+
id: z.string(),
|
|
12
|
+
/** Number status */
|
|
13
|
+
status: NumberStatus,
|
|
14
|
+
/** Number formats */
|
|
15
|
+
number: NumberFormat,
|
|
16
|
+
/** Geographic location */
|
|
17
|
+
location: NumberLocation,
|
|
18
|
+
/** Carrier name */
|
|
19
|
+
carrier: Carrier,
|
|
20
|
+
/** Number capabilities */
|
|
21
|
+
capabilities: NumberCapabilities,
|
|
22
|
+
/** Number health metrics */
|
|
23
|
+
health: NumberHealth,
|
|
24
|
+
/** Additional data */
|
|
25
|
+
data: NumberData,
|
|
26
|
+
/** Creation timestamp */
|
|
27
|
+
created_at: z.number(),
|
|
28
|
+
/** Pricing information */
|
|
29
|
+
pricing: NumberPricing
|
|
30
|
+
});
|
|
31
|
+
// Using the new base response builder
|
|
32
|
+
export const LeaseGetResponseBuilder = createResponse(LeaseGetResponse);
|
|
33
|
+
/**
|
|
34
|
+
* Gets information about a specific number available for lease
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const response = await contiguity.lease.get({
|
|
39
|
+
* number: "+1234567890"
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* console.log(`Number: ${response.number.formatted}`);
|
|
43
|
+
* console.log(`Location: ${response.location.city}, ${response.location.region}`);
|
|
44
|
+
* console.log(`Reputation: ${response.health.reputation}`);
|
|
45
|
+
* console.log(`Monthly rate: $${response.pricing.monthly_rate}`);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Check if a number supports specific channels
|
|
51
|
+
* const response = await contiguity.lease.get({
|
|
52
|
+
* number: "+1234567890"
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* const supportsImessage = response.capabilities.channels.includes('imessage');
|
|
56
|
+
* const supportsWhatsApp = response.capabilities.channels.includes('whatsapp');
|
|
57
|
+
*
|
|
58
|
+
* console.log(`iMessage support: ${supportsImessage}`);
|
|
59
|
+
* console.log(`WhatsApp support: ${supportsWhatsApp}`);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export async function _leaseGet(params) {
|
|
63
|
+
const validatedParams = LeaseGetRequest.parse(params);
|
|
64
|
+
const response = await this.request(`/numbers/lease/${encodeURIComponent(validatedParams.number)}`, {
|
|
65
|
+
method: "GET",
|
|
66
|
+
});
|
|
67
|
+
return this.parse({
|
|
68
|
+
response,
|
|
69
|
+
schemas: {
|
|
70
|
+
sdk: LeaseGetResponse,
|
|
71
|
+
raw: LeaseGetResponseBuilder.raw
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ContiguityClient } from "@/client/fetch";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { LeaseAvailableResponse } from "@/services/lease/available";
|
|
4
|
+
import { LeaseGetRequest, LeaseGetResponse } from "@/services/lease/get";
|
|
5
|
+
import { LeaseCreateRequest, LeaseCreateResponse } from "@/services/lease/create";
|
|
6
|
+
import { LeaseLeasedResponse } from "@/services/lease/leased";
|
|
7
|
+
import { LeaseDetailsRequest, LeaseDetailsResponse } from "@/services/lease/details";
|
|
8
|
+
import { LeaseTerminateRequest, LeaseTerminateResponse } from "@/services/lease/terminate";
|
|
9
|
+
import type { WithMetadata } from "@/types/metadata";
|
|
10
|
+
export type LeaseAvailableResponseType = z.infer<typeof LeaseAvailableResponse>;
|
|
11
|
+
export type LeaseGetParams = z.infer<typeof LeaseGetRequest>;
|
|
12
|
+
export type LeaseGetResponseType = z.infer<typeof LeaseGetResponse>;
|
|
13
|
+
export type LeaseCreateParams = z.infer<typeof LeaseCreateRequest>;
|
|
14
|
+
export type LeaseCreateResponseType = z.infer<typeof LeaseCreateResponse>;
|
|
15
|
+
export type LeaseLeasedResponseType = z.infer<typeof LeaseLeasedResponse>;
|
|
16
|
+
export type LeaseDetailsParams = z.infer<typeof LeaseDetailsRequest>;
|
|
17
|
+
export type LeaseDetailsResponseType = z.infer<typeof LeaseDetailsResponse>;
|
|
18
|
+
export type LeaseTerminateParams = z.infer<typeof LeaseTerminateRequest>;
|
|
19
|
+
export type LeaseTerminateResponseType = z.infer<typeof LeaseTerminateResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Lease service for managing phone number leases
|
|
22
|
+
*/
|
|
23
|
+
export declare class LeaseService extends ContiguityClient {
|
|
24
|
+
constructor(token: string);
|
|
25
|
+
/**
|
|
26
|
+
* Get all phone numbers available for lease
|
|
27
|
+
*/
|
|
28
|
+
available(): Promise<WithMetadata<LeaseAvailableResponseType>>;
|
|
29
|
+
/**
|
|
30
|
+
* Get information about a specific number available for lease
|
|
31
|
+
*/
|
|
32
|
+
get(params: LeaseGetParams): Promise<WithMetadata<LeaseGetResponseType>>;
|
|
33
|
+
/**
|
|
34
|
+
* Lease a specific phone number
|
|
35
|
+
*/
|
|
36
|
+
create(params: LeaseCreateParams): Promise<WithMetadata<LeaseCreateResponseType>>;
|
|
37
|
+
/**
|
|
38
|
+
* Get all phone numbers currently leased by the user
|
|
39
|
+
*/
|
|
40
|
+
leased(): Promise<WithMetadata<LeaseLeasedResponseType>>;
|
|
41
|
+
/**
|
|
42
|
+
* Get information about a specific leased number
|
|
43
|
+
*/
|
|
44
|
+
details(params: LeaseDetailsParams): Promise<WithMetadata<LeaseDetailsResponseType>>;
|
|
45
|
+
/**
|
|
46
|
+
* Terminate your lease for a number
|
|
47
|
+
*/
|
|
48
|
+
terminate(params: LeaseTerminateParams): Promise<WithMetadata<LeaseTerminateResponseType>>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/lease/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACH,sBAAsB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,eAAe,EACf,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,kBAAkB,EAClB,mBAAmB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,mBAAmB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,qBAAqB,EACrB,sBAAsB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACpE,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,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEhF;;GAEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;gBAClC,KAAK,EAAE,MAAM;IAIzB;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;IAIpE;;OAEG;IACG,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAI9E;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;IAIvF;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;IAI9D;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAC;IAI1F;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;CAGnG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ContiguityClient } from "@/client/fetch";
|
|
2
|
+
import { _leaseAvailable } from "@/services/lease/available";
|
|
3
|
+
import { _leaseGet } from "@/services/lease/get";
|
|
4
|
+
import { _leaseCreate } from "@/services/lease/create";
|
|
5
|
+
import { _leasedNumbers } from "@/services/lease/leased";
|
|
6
|
+
import { _leaseDetails } from "@/services/lease/details";
|
|
7
|
+
import { _leaseTerminate } from "@/services/lease/terminate";
|
|
8
|
+
/**
|
|
9
|
+
* Lease service for managing phone number leases
|
|
10
|
+
*/
|
|
11
|
+
export class LeaseService extends ContiguityClient {
|
|
12
|
+
constructor(token) {
|
|
13
|
+
super(token);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get all phone numbers available for lease
|
|
17
|
+
*/
|
|
18
|
+
async available() {
|
|
19
|
+
return _leaseAvailable.call(this);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get information about a specific number available for lease
|
|
23
|
+
*/
|
|
24
|
+
async get(params) {
|
|
25
|
+
return _leaseGet.call(this, params);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Lease a specific phone number
|
|
29
|
+
*/
|
|
30
|
+
async create(params) {
|
|
31
|
+
return _leaseCreate.call(this, params);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get all phone numbers currently leased by the user
|
|
35
|
+
*/
|
|
36
|
+
async leased() {
|
|
37
|
+
return _leasedNumbers.call(this);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get information about a specific leased number
|
|
41
|
+
*/
|
|
42
|
+
async details(params) {
|
|
43
|
+
return _leaseDetails.call(this, params);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Terminate your lease for a number
|
|
47
|
+
*/
|
|
48
|
+
async terminate(params) {
|
|
49
|
+
return _leaseTerminate.call(this, params);
|
|
50
|
+
}
|
|
51
|
+
}
|