@sentdm/sentdm 0.7.2 → 0.15.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +71 -34
  3. package/client.d.mts +49 -21
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +49 -21
  6. package/client.d.ts.map +1 -1
  7. package/client.js +52 -38
  8. package/client.js.map +1 -1
  9. package/client.mjs +52 -38
  10. package/client.mjs.map +1 -1
  11. package/internal/tslib.js +17 -17
  12. package/internal/utils/log.d.mts.map +1 -1
  13. package/internal/utils/log.d.ts.map +1 -1
  14. package/internal/utils/log.js +0 -1
  15. package/internal/utils/log.js.map +1 -1
  16. package/internal/utils/log.mjs +0 -1
  17. package/internal/utils/log.mjs.map +1 -1
  18. package/internal/utils/query.d.mts +5 -0
  19. package/internal/utils/query.d.mts.map +1 -0
  20. package/internal/utils/query.d.ts +5 -0
  21. package/internal/utils/query.d.ts.map +1 -0
  22. package/internal/utils/query.js +23 -0
  23. package/internal/utils/query.js.map +1 -0
  24. package/internal/utils/query.mjs +20 -0
  25. package/internal/utils/query.mjs.map +1 -0
  26. package/internal/utils.d.mts +1 -0
  27. package/internal/utils.d.ts +1 -0
  28. package/internal/utils.js +1 -0
  29. package/internal/utils.js.map +1 -1
  30. package/internal/utils.mjs +1 -0
  31. package/package.json +7 -1
  32. package/resources/contacts.d.mts +243 -49
  33. package/resources/contacts.d.mts.map +1 -1
  34. package/resources/contacts.d.ts +243 -49
  35. package/resources/contacts.d.ts.map +1 -1
  36. package/resources/contacts.js +112 -15
  37. package/resources/contacts.js.map +1 -1
  38. package/resources/contacts.mjs +112 -15
  39. package/resources/contacts.mjs.map +1 -1
  40. package/resources/index.d.mts +8 -4
  41. package/resources/index.d.mts.map +1 -1
  42. package/resources/index.d.ts +8 -4
  43. package/resources/index.d.ts.map +1 -1
  44. package/resources/index.js +11 -3
  45. package/resources/index.js.map +1 -1
  46. package/resources/index.mjs +5 -1
  47. package/resources/index.mjs.map +1 -1
  48. package/resources/me.d.mts +269 -0
  49. package/resources/me.d.mts.map +1 -0
  50. package/resources/me.d.ts +269 -0
  51. package/resources/me.d.ts.map +1 -0
  52. package/resources/me.js +40 -0
  53. package/resources/me.js.map +1 -0
  54. package/resources/me.mjs +36 -0
  55. package/resources/me.mjs.map +1 -0
  56. package/resources/messages.d.mts +239 -133
  57. package/resources/messages.d.mts.map +1 -1
  58. package/resources/messages.d.ts +239 -133
  59. package/resources/messages.d.ts.map +1 -1
  60. package/resources/messages.js +42 -50
  61. package/resources/messages.js.map +1 -1
  62. package/resources/messages.mjs +42 -50
  63. package/resources/messages.mjs.map +1 -1
  64. package/resources/numbers.d.mts +70 -0
  65. package/resources/numbers.d.mts.map +1 -0
  66. package/resources/numbers.d.ts +70 -0
  67. package/resources/numbers.d.ts.map +1 -0
  68. package/resources/numbers.js +36 -0
  69. package/resources/numbers.js.map +1 -0
  70. package/resources/numbers.mjs +32 -0
  71. package/resources/numbers.mjs.map +1 -0
  72. package/resources/profiles/campaigns.d.mts +339 -0
  73. package/resources/profiles/campaigns.d.mts.map +1 -0
  74. package/resources/profiles/campaigns.d.ts +339 -0
  75. package/resources/profiles/campaigns.d.ts.map +1 -0
  76. package/resources/profiles/campaigns.js +148 -0
  77. package/resources/profiles/campaigns.js.map +1 -0
  78. package/resources/profiles/campaigns.mjs +144 -0
  79. package/resources/profiles/campaigns.mjs.map +1 -0
  80. package/resources/profiles/index.d.mts +3 -0
  81. package/resources/profiles/index.d.mts.map +1 -0
  82. package/resources/profiles/index.d.ts +3 -0
  83. package/resources/profiles/index.d.ts.map +1 -0
  84. package/resources/profiles/index.js +9 -0
  85. package/resources/profiles/index.js.map +1 -0
  86. package/resources/profiles/index.mjs +4 -0
  87. package/resources/profiles/index.mjs.map +1 -0
  88. package/resources/profiles/profiles.d.mts +967 -0
  89. package/resources/profiles/profiles.d.mts.map +1 -0
  90. package/resources/profiles/profiles.d.ts +967 -0
  91. package/resources/profiles/profiles.d.ts.map +1 -0
  92. package/resources/profiles/profiles.js +227 -0
  93. package/resources/profiles/profiles.js.map +1 -0
  94. package/resources/profiles/profiles.mjs +222 -0
  95. package/resources/profiles/profiles.mjs.map +1 -0
  96. package/resources/profiles.d.mts +2 -0
  97. package/resources/profiles.d.mts.map +1 -0
  98. package/resources/profiles.d.ts +2 -0
  99. package/resources/profiles.d.ts.map +1 -0
  100. package/resources/profiles.js +6 -0
  101. package/resources/profiles.js.map +1 -0
  102. package/resources/profiles.mjs +3 -0
  103. package/resources/profiles.mjs.map +1 -0
  104. package/resources/templates.d.mts +327 -191
  105. package/resources/templates.d.mts.map +1 -1
  106. package/resources/templates.d.ts +327 -191
  107. package/resources/templates.d.ts.map +1 -1
  108. package/resources/templates.js +80 -35
  109. package/resources/templates.js.map +1 -1
  110. package/resources/templates.mjs +80 -35
  111. package/resources/templates.mjs.map +1 -1
  112. package/resources/users.d.mts +251 -0
  113. package/resources/users.d.mts.map +1 -0
  114. package/resources/users.d.ts +251 -0
  115. package/resources/users.d.ts.map +1 -0
  116. package/resources/users.js +124 -0
  117. package/resources/users.js.map +1 -0
  118. package/resources/users.mjs +120 -0
  119. package/resources/users.mjs.map +1 -0
  120. package/resources/webhooks.d.mts +639 -0
  121. package/resources/webhooks.d.mts.map +1 -0
  122. package/resources/webhooks.d.ts +639 -0
  123. package/resources/webhooks.d.ts.map +1 -0
  124. package/resources/webhooks.js +237 -0
  125. package/resources/webhooks.js.map +1 -0
  126. package/resources/webhooks.mjs +233 -0
  127. package/resources/webhooks.mjs.map +1 -0
  128. package/src/client.ts +228 -80
  129. package/src/internal/utils/log.ts +0 -1
  130. package/src/internal/utils/query.ts +23 -0
  131. package/src/internal/utils.ts +1 -0
  132. package/src/resources/contacts.ts +335 -57
  133. package/src/resources/index.ts +81 -12
  134. package/src/resources/me.ts +333 -0
  135. package/src/resources/messages.ts +306 -147
  136. package/src/resources/numbers.ts +102 -0
  137. package/src/resources/profiles/campaigns.ts +501 -0
  138. package/src/resources/profiles/index.ts +38 -0
  139. package/src/resources/profiles/profiles.ts +1302 -0
  140. package/src/resources/profiles.ts +3 -0
  141. package/src/resources/templates.ts +424 -202
  142. package/src/resources/users.ts +366 -0
  143. package/src/resources/webhooks.ts +923 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.mts.map +1 -1
  147. package/version.d.ts +1 -1
  148. package/version.d.ts.map +1 -1
  149. package/version.js +1 -1
  150. package/version.js.map +1 -1
  151. package/version.mjs +1 -1
  152. package/version.mjs.map +1 -1
  153. package/resources/number-lookup.d.mts +0 -59
  154. package/resources/number-lookup.d.mts.map +0 -1
  155. package/resources/number-lookup.d.ts +0 -59
  156. package/resources/number-lookup.d.ts.map +0 -1
  157. package/resources/number-lookup.js +0 -17
  158. package/resources/number-lookup.js.map +0 -1
  159. package/resources/number-lookup.mjs +0 -13
  160. package/resources/number-lookup.mjs.map +0 -1
  161. package/src/resources/number-lookup.ts +0 -80
@@ -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 comprehensive details about a specific message using the message ID.
8
- * Returns complete message data including delivery status, channel information,
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 message = await client.messages.retrieve(
16
- * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
15
+ * const response = await client.messages.retrieveActivities(
16
+ * '8ba7b830-9dad-11d1-80b4-00c04fd430c8',
17
17
  * );
18
18
  * ```
19
19
  */
20
- retrieve(id, options) {
21
- return this._client.get(path `/v2/messages/${id}`, options);
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([{ Accept: '*/*' }, options?.headers]),
24
+ headers: buildHeaders([
25
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
26
+ options?.headers,
27
+ ]),
41
28
  });
42
29
  }
43
30
  /**
44
- * Sends a message to a specific contact using a template. The message can be sent
45
- * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
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.sendToContact({
52
- * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
53
- * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
54
- * });
36
+ * const response = await client.messages.retrieveStatus(
37
+ * '8ba7b830-9dad-11d1-80b4-00c04fd430c8',
38
+ * );
55
39
  * ```
56
40
  */
57
- sendToContact(body, options) {
58
- return this._client.post('/v2/messages/contact', {
59
- body,
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([{ Accept: '*/*' }, options?.headers]),
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 a phone number using a template. The phone number doesn't
66
- * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
67
- * Optionally specify a webhook URL to receive delivery status updates. The
68
- * customer ID is extracted from the authentication token.
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.sendToPhone({
73
- * phoneNumber: '+1234567890',
74
- * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
75
- * });
60
+ * const response = await client.messages.send();
76
61
  * ```
77
62
  */
78
- sendToPhone(body, options) {
79
- return this._client.post('/v2/messages/phone', {
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([{ Accept: '*/*' }, options?.headers]),
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;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,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AAI,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,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,70 @@
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"}