@sentdm/sentdm 0.7.2 → 0.14.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 +117 -0
- package/README.md +71 -34
- package/client.d.mts +49 -21
- package/client.d.mts.map +1 -1
- package/client.d.ts +49 -21
- package/client.d.ts.map +1 -1
- package/client.js +52 -38
- package/client.js.map +1 -1
- package/client.mjs +52 -38
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +0 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +0 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +7 -1
- package/resources/contacts.d.mts +243 -49
- package/resources/contacts.d.mts.map +1 -1
- package/resources/contacts.d.ts +243 -49
- package/resources/contacts.d.ts.map +1 -1
- package/resources/contacts.js +112 -15
- package/resources/contacts.js.map +1 -1
- package/resources/contacts.mjs +112 -15
- package/resources/contacts.mjs.map +1 -1
- package/resources/index.d.mts +8 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +8 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +5 -1
- package/resources/index.mjs.map +1 -1
- package/resources/me.d.mts +269 -0
- package/resources/me.d.mts.map +1 -0
- package/resources/me.d.ts +269 -0
- package/resources/me.d.ts.map +1 -0
- package/resources/me.js +40 -0
- package/resources/me.js.map +1 -0
- package/resources/me.mjs +36 -0
- package/resources/me.mjs.map +1 -0
- package/resources/messages.d.mts +239 -133
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +239 -133
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +42 -50
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +42 -50
- package/resources/messages.mjs.map +1 -1
- package/resources/numbers.d.mts +70 -0
- package/resources/numbers.d.mts.map +1 -0
- package/resources/numbers.d.ts +70 -0
- package/resources/numbers.d.ts.map +1 -0
- package/resources/numbers.js +36 -0
- package/resources/numbers.js.map +1 -0
- package/resources/numbers.mjs +32 -0
- package/resources/numbers.mjs.map +1 -0
- package/resources/profiles/campaigns.d.mts +339 -0
- package/resources/profiles/campaigns.d.mts.map +1 -0
- package/resources/profiles/campaigns.d.ts +339 -0
- package/resources/profiles/campaigns.d.ts.map +1 -0
- package/resources/profiles/campaigns.js +148 -0
- package/resources/profiles/campaigns.js.map +1 -0
- package/resources/profiles/campaigns.mjs +144 -0
- package/resources/profiles/campaigns.mjs.map +1 -0
- package/resources/profiles/index.d.mts +3 -0
- package/resources/profiles/index.d.mts.map +1 -0
- package/resources/profiles/index.d.ts +3 -0
- package/resources/profiles/index.d.ts.map +1 -0
- package/resources/profiles/index.js +9 -0
- package/resources/profiles/index.js.map +1 -0
- package/resources/profiles/index.mjs +4 -0
- package/resources/profiles/index.mjs.map +1 -0
- package/resources/profiles/profiles.d.mts +967 -0
- package/resources/profiles/profiles.d.mts.map +1 -0
- package/resources/profiles/profiles.d.ts +967 -0
- package/resources/profiles/profiles.d.ts.map +1 -0
- package/resources/profiles/profiles.js +227 -0
- package/resources/profiles/profiles.js.map +1 -0
- package/resources/profiles/profiles.mjs +222 -0
- package/resources/profiles/profiles.mjs.map +1 -0
- package/resources/profiles.d.mts +2 -0
- package/resources/profiles.d.mts.map +1 -0
- package/resources/profiles.d.ts +2 -0
- package/resources/profiles.d.ts.map +1 -0
- package/resources/profiles.js +6 -0
- package/resources/profiles.js.map +1 -0
- package/resources/profiles.mjs +3 -0
- package/resources/profiles.mjs.map +1 -0
- package/resources/templates.d.mts +327 -191
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +327 -191
- package/resources/templates.d.ts.map +1 -1
- package/resources/templates.js +80 -35
- package/resources/templates.js.map +1 -1
- package/resources/templates.mjs +80 -35
- package/resources/templates.mjs.map +1 -1
- package/resources/users.d.mts +251 -0
- package/resources/users.d.mts.map +1 -0
- package/resources/users.d.ts +251 -0
- package/resources/users.d.ts.map +1 -0
- package/resources/users.js +124 -0
- package/resources/users.js.map +1 -0
- package/resources/users.mjs +120 -0
- package/resources/users.mjs.map +1 -0
- package/resources/webhooks.d.mts +639 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +639 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +237 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +233 -0
- package/resources/webhooks.mjs.map +1 -0
- package/src/client.ts +228 -80
- package/src/internal/utils/log.ts +0 -1
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/contacts.ts +335 -57
- package/src/resources/index.ts +81 -12
- package/src/resources/me.ts +333 -0
- package/src/resources/messages.ts +306 -147
- package/src/resources/numbers.ts +102 -0
- package/src/resources/profiles/campaigns.ts +501 -0
- package/src/resources/profiles/index.ts +38 -0
- package/src/resources/profiles/profiles.ts +1302 -0
- package/src/resources/profiles.ts +3 -0
- package/src/resources/templates.ts +424 -202
- package/src/resources/users.ts +366 -0
- package/src/resources/webhooks.ts +923 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/number-lookup.d.mts +0 -59
- package/resources/number-lookup.d.mts.map +0 -1
- package/resources/number-lookup.d.ts +0 -59
- package/resources/number-lookup.d.ts.map +0 -1
- package/resources/number-lookup.js +0 -17
- package/resources/number-lookup.js.map +0 -1
- package/resources/number-lookup.mjs +0 -13
- package/resources/number-lookup.mjs.map +0 -1
- package/src/resources/number-lookup.ts +0 -80
package/resources/messages.mjs
CHANGED
|
@@ -2,84 +2,76 @@
|
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
3
|
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
4
|
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Send and track SMS and WhatsApp messages
|
|
7
|
+
*/
|
|
5
8
|
export class Messages extends APIResource {
|
|
6
9
|
/**
|
|
7
|
-
* Retrieves
|
|
8
|
-
*
|
|
9
|
-
* template details, contact information, and pricing. The customer ID is extracted
|
|
10
|
-
* from the authentication token to ensure the message belongs to the authenticated
|
|
11
|
-
* customer.
|
|
10
|
+
* Retrieves the activity log for a specific message. Activities track the message
|
|
11
|
+
* lifecycle including acceptance, processing, sending, delivery, and any errors.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
|
-
* const
|
|
16
|
-
* '
|
|
15
|
+
* const response = await client.messages.retrieveActivities(
|
|
16
|
+
* '8ba7b830-9dad-11d1-80b4-00c04fd430c8',
|
|
17
17
|
* );
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Sends a message to a phone number using the default template. This endpoint is
|
|
25
|
-
* rate limited to 5 messages per customer per day. The customer ID is extracted
|
|
26
|
-
* from the authentication token.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* await client.messages.sendQuickMessage({
|
|
31
|
-
* customMessage: 'Hello, this is a test message!',
|
|
32
|
-
* phoneNumber: '+1234567890',
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
sendQuickMessage(body, options) {
|
|
37
|
-
return this._client.post('/v2/messages/quick-message', {
|
|
38
|
-
body,
|
|
20
|
+
retrieveActivities(id, params = {}, options) {
|
|
21
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
22
|
+
return this._client.get(path `/v3/messages/${id}/activities`, {
|
|
39
23
|
...options,
|
|
40
|
-
headers: buildHeaders([
|
|
24
|
+
headers: buildHeaders([
|
|
25
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
26
|
+
options?.headers,
|
|
27
|
+
]),
|
|
41
28
|
});
|
|
42
29
|
}
|
|
43
30
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* a webhook URL to receive delivery status updates. The customer ID is extracted
|
|
47
|
-
* from the authentication token.
|
|
31
|
+
* Retrieves the current status and details of a message by ID. Includes delivery
|
|
32
|
+
* status, timestamps, and error information if applicable.
|
|
48
33
|
*
|
|
49
34
|
* @example
|
|
50
35
|
* ```ts
|
|
51
|
-
* await client.messages.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* });
|
|
36
|
+
* const response = await client.messages.retrieveStatus(
|
|
37
|
+
* '8ba7b830-9dad-11d1-80b4-00c04fd430c8',
|
|
38
|
+
* );
|
|
55
39
|
* ```
|
|
56
40
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
retrieveStatus(id, params = {}, options) {
|
|
42
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
43
|
+
return this._client.get(path `/v3/messages/${id}`, {
|
|
60
44
|
...options,
|
|
61
|
-
headers: buildHeaders([
|
|
45
|
+
headers: buildHeaders([
|
|
46
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
47
|
+
options?.headers,
|
|
48
|
+
]),
|
|
62
49
|
});
|
|
63
50
|
}
|
|
64
51
|
/**
|
|
65
|
-
* Sends a message to
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
52
|
+
* Sends a message to one or more recipients using a template. Supports
|
|
53
|
+
* multi-channel broadcast — when multiple channels are specified (e.g. ["sms",
|
|
54
|
+
* "whatsapp"]), a separate message is created for each (recipient, channel) pair.
|
|
55
|
+
* Returns immediately with per-recipient message IDs for async tracking via
|
|
56
|
+
* webhooks or the GET /messages/{id} endpoint.
|
|
69
57
|
*
|
|
70
58
|
* @example
|
|
71
59
|
* ```ts
|
|
72
|
-
* await client.messages.
|
|
73
|
-
* phoneNumber: '+1234567890',
|
|
74
|
-
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
75
|
-
* });
|
|
60
|
+
* const response = await client.messages.send();
|
|
76
61
|
* ```
|
|
77
62
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
send(params, options) {
|
|
64
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
65
|
+
return this._client.post('/v3/messages', {
|
|
80
66
|
body,
|
|
81
67
|
...options,
|
|
82
|
-
headers: buildHeaders([
|
|
68
|
+
headers: buildHeaders([
|
|
69
|
+
{
|
|
70
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
71
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
72
|
+
},
|
|
73
|
+
options?.headers,
|
|
74
|
+
]),
|
|
83
75
|
});
|
|
84
76
|
}
|
|
85
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,Y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AAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAC/E,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACrE;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as WebhooksAPI from "./webhooks.mjs";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Manage and lookup phone numbers
|
|
7
|
+
*/
|
|
8
|
+
export declare class Numbers extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves detailed information about a phone number including carrier, line
|
|
11
|
+
* type, porting status, and VoIP detection. Uses the customer's messaging provider
|
|
12
|
+
* for rich data, with fallback to the internal index.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.numbers.lookup(
|
|
17
|
+
* '+12025551234',
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
lookup(phoneNumber: string, params?: NumberLookupParams | null | undefined, options?: RequestOptions): APIPromise<NumberLookupResponse>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Standard API response envelope for all v3 endpoints
|
|
25
|
+
*/
|
|
26
|
+
export interface NumberLookupResponse {
|
|
27
|
+
/**
|
|
28
|
+
* The response data (null if error)
|
|
29
|
+
*/
|
|
30
|
+
data?: NumberLookupResponse.Data | null;
|
|
31
|
+
/**
|
|
32
|
+
* Error information
|
|
33
|
+
*/
|
|
34
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
35
|
+
/**
|
|
36
|
+
* Request and response metadata
|
|
37
|
+
*/
|
|
38
|
+
meta?: WebhooksAPI.APIMeta;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates whether the request was successful
|
|
41
|
+
*/
|
|
42
|
+
success?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace NumberLookupResponse {
|
|
45
|
+
/**
|
|
46
|
+
* The response data (null if error)
|
|
47
|
+
*/
|
|
48
|
+
interface Data {
|
|
49
|
+
carrier_name?: string | null;
|
|
50
|
+
country_code?: string | null;
|
|
51
|
+
is_ported?: boolean | null;
|
|
52
|
+
is_valid?: boolean;
|
|
53
|
+
is_voip?: boolean | null;
|
|
54
|
+
line_type?: string | null;
|
|
55
|
+
mobile_country_code?: string | null;
|
|
56
|
+
mobile_network_code?: string | null;
|
|
57
|
+
phone_number?: string;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export interface NumberLookupParams {
|
|
61
|
+
/**
|
|
62
|
+
* Profile UUID to scope the request to a child profile. Only organization API keys
|
|
63
|
+
* can use this header. The profile must belong to the calling organization.
|
|
64
|
+
*/
|
|
65
|
+
'x-profile-id'?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare namespace Numbers {
|
|
68
|
+
export { type NumberLookupResponse as NumberLookupResponse, type NumberLookupParams as NumberLookupParams };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=numbers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.d.mts","sourceRoot":"","sources":["../src/resources/numbers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAA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|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import * as WebhooksAPI from "./webhooks.js";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
/**
|
|
6
|
+
* Manage and lookup phone numbers
|
|
7
|
+
*/
|
|
8
|
+
export declare class Numbers extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves detailed information about a phone number including carrier, line
|
|
11
|
+
* type, porting status, and VoIP detection. Uses the customer's messaging provider
|
|
12
|
+
* for rich data, with fallback to the internal index.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.numbers.lookup(
|
|
17
|
+
* '+12025551234',
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
lookup(phoneNumber: string, params?: NumberLookupParams | null | undefined, options?: RequestOptions): APIPromise<NumberLookupResponse>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Standard API response envelope for all v3 endpoints
|
|
25
|
+
*/
|
|
26
|
+
export interface NumberLookupResponse {
|
|
27
|
+
/**
|
|
28
|
+
* The response data (null if error)
|
|
29
|
+
*/
|
|
30
|
+
data?: NumberLookupResponse.Data | null;
|
|
31
|
+
/**
|
|
32
|
+
* Error information
|
|
33
|
+
*/
|
|
34
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
35
|
+
/**
|
|
36
|
+
* Request and response metadata
|
|
37
|
+
*/
|
|
38
|
+
meta?: WebhooksAPI.APIMeta;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates whether the request was successful
|
|
41
|
+
*/
|
|
42
|
+
success?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace NumberLookupResponse {
|
|
45
|
+
/**
|
|
46
|
+
* The response data (null if error)
|
|
47
|
+
*/
|
|
48
|
+
interface Data {
|
|
49
|
+
carrier_name?: string | null;
|
|
50
|
+
country_code?: string | null;
|
|
51
|
+
is_ported?: boolean | null;
|
|
52
|
+
is_valid?: boolean;
|
|
53
|
+
is_voip?: boolean | null;
|
|
54
|
+
line_type?: string | null;
|
|
55
|
+
mobile_country_code?: string | null;
|
|
56
|
+
mobile_network_code?: string | null;
|
|
57
|
+
phone_number?: string;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export interface NumberLookupParams {
|
|
61
|
+
/**
|
|
62
|
+
* Profile UUID to scope the request to a child profile. Only organization API keys
|
|
63
|
+
* can use this header. The profile must belong to the calling organization.
|
|
64
|
+
*/
|
|
65
|
+
'x-profile-id'?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare namespace Numbers {
|
|
68
|
+
export { type NumberLookupResponse as NumberLookupResponse, type NumberLookupParams as NumberLookupParams };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../src/resources/numbers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,kBAAkB,GAAG,IAAI,GAAG,SAAc,EAClD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;CAUpC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,UAAiB,IAAI;QACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE7B,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAE3B,QAAQ,CAAC,EAAE,OAAO,CAAC;QAEnB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAEzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE1B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEpC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEpC,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EAAE,KAAK,oBAAoB,IAAI,oBAAoB,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,CAAC;CAC7G"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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.Numbers = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const headers_1 = require("../internal/headers.js");
|
|
7
|
+
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
/**
|
|
9
|
+
* Manage and lookup phone numbers
|
|
10
|
+
*/
|
|
11
|
+
class Numbers extends resource_1.APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves detailed information about a phone number including carrier, line
|
|
14
|
+
* type, porting status, and VoIP detection. Uses the customer's messaging provider
|
|
15
|
+
* for rich data, with fallback to the internal index.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const response = await client.numbers.lookup(
|
|
20
|
+
* '+12025551234',
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
lookup(phoneNumber, params = {}, options) {
|
|
25
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
26
|
+
return this._client.get((0, path_1.path) `/v3/numbers/lookup/${phoneNumber}`, {
|
|
27
|
+
...options,
|
|
28
|
+
headers: (0, headers_1.buildHeaders)([
|
|
29
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
30
|
+
options?.headers,
|
|
31
|
+
]),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Numbers = Numbers;
|
|
36
|
+
//# sourceMappingURL=numbers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../src/resources/numbers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C;;GAEG;AACH,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,WAAmB,EACnB,SAAgD,EAAE,EAClD,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,sBAAsB,WAAW,EAAE,EAAE;YAC/D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxE,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AA3BD,0BA2BC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
+
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Manage and lookup phone numbers
|
|
7
|
+
*/
|
|
8
|
+
export class Numbers extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves detailed information about a phone number including carrier, line
|
|
11
|
+
* type, porting status, and VoIP detection. Uses the customer's messaging provider
|
|
12
|
+
* for rich data, with fallback to the internal index.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.numbers.lookup(
|
|
17
|
+
* '+12025551234',
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
lookup(phoneNumber, params = {}, options) {
|
|
22
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
23
|
+
return this._client.get(path `/v3/numbers/lookup/${phoneNumber}`, {
|
|
24
|
+
...options,
|
|
25
|
+
headers: buildHeaders([
|
|
26
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
27
|
+
options?.headers,
|
|
28
|
+
]),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=numbers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.mjs","sourceRoot":"","sources":["../src/resources/numbers.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,WAAmB,EACnB,SAAgD,EAAE,EAClD,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,sBAAsB,WAAW,EAAE,EAAE;YAC/D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxE,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|