@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.
Files changed (161) hide show
  1. package/CHANGELOG.md +117 -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
@@ -1,103 +1,297 @@
1
1
  import { APIResource } from "../core/resource.js";
2
+ import * as ContactsAPI from "./contacts.js";
3
+ import * as WebhooksAPI from "./webhooks.js";
2
4
  import { APIPromise } from "../core/api-promise.js";
3
5
  import { RequestOptions } from "../internal/request-options.js";
6
+ /**
7
+ * Create, update, and manage customer contact lists
8
+ */
4
9
  export declare class Contacts extends APIResource {
10
+ /**
11
+ * Creates a new contact by phone number and associates it with the authenticated
12
+ * customer.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const apiResponseOfContact = await client.contacts.create();
17
+ * ```
18
+ */
19
+ create(params: ContactCreateParams, options?: RequestOptions): APIPromise<APIResponseOfContact>;
20
+ /**
21
+ * Retrieves a specific contact by their unique identifier. Returns detailed
22
+ * contact information including phone formats, available channels, and opt-out
23
+ * status.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const apiResponseOfContact = await client.contacts.retrieve(
28
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
29
+ * );
30
+ * ```
31
+ */
32
+ retrieve(id: string, params?: ContactRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<APIResponseOfContact>;
33
+ /**
34
+ * Updates a contact's default channel and/or opt-out status. Inherited contacts
35
+ * cannot be updated.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const apiResponseOfContact = await client.contacts.update(
40
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
41
+ * );
42
+ * ```
43
+ */
44
+ update(id: string, params: ContactUpdateParams, options?: RequestOptions): APIPromise<APIResponseOfContact>;
5
45
  /**
6
46
  * Retrieves a paginated list of contacts for the authenticated customer. Supports
7
- * server-side pagination with configurable page size. The customer ID is extracted
8
- * from the authentication token.
47
+ * filtering by search term, channel, or phone number.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const contacts = await client.contacts.list({
52
+ * page: 0,
53
+ * page_size: 0,
54
+ * });
55
+ * ```
56
+ */
57
+ list(params: ContactListParams, options?: RequestOptions): APIPromise<ContactListResponse>;
58
+ /**
59
+ * Dissociates a contact from the authenticated customer. Inherited contacts cannot
60
+ * be deleted.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * await client.contacts.delete(
65
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
66
+ * { body: {} },
67
+ * );
68
+ * ```
9
69
  */
10
- list(query: ContactListParams, options?: RequestOptions): APIPromise<ContactListResponse>;
70
+ delete(id: string, params: ContactDeleteParams, options?: RequestOptions): APIPromise<void>;
71
+ }
72
+ /**
73
+ * Standard API response envelope for all v3 endpoints
74
+ */
75
+ export interface APIResponseOfContact {
11
76
  /**
12
- * Retrieves a contact by their phone number for the authenticated customer. Phone
13
- * number should be in international format (e.g., +1234567890). The customer ID is
14
- * extracted from the authentication token.
77
+ * Contact response for v3 API Uses snake_case for JSON property names
15
78
  */
16
- retrieveByPhone(query: ContactRetrieveByPhoneParams, options?: RequestOptions): APIPromise<ContactListItem>;
79
+ data?: ContactResponse | null;
17
80
  /**
18
- * Retrieves a specific contact by their unique identifier for the authenticated
19
- * customer. The customer ID is extracted from the authentication token. Returns
20
- * detailed contact information including phone number and creation timestamp.
81
+ * Error information
21
82
  */
22
- retrieveID(query: ContactRetrieveIDParams, options?: RequestOptions): APIPromise<ContactListItem>;
83
+ error?: WebhooksAPI.ErrorDetail | null;
84
+ /**
85
+ * Request and response metadata
86
+ */
87
+ meta?: WebhooksAPI.APIMeta;
88
+ /**
89
+ * Indicates whether the request was successful
90
+ */
91
+ success?: boolean;
23
92
  }
24
93
  /**
25
- * Represents a contact in the customer's contact list
94
+ * Contact response for v3 API Uses snake_case for JSON property names
26
95
  */
27
- export interface ContactListItem {
96
+ export interface ContactResponse {
28
97
  /**
29
- * The unique identifier of the contact
98
+ * Unique identifier for the contact
30
99
  */
31
100
  id?: string;
32
101
  /**
33
- * Comma-separated list of available messaging channels for this contact (e.g.,
34
- * "sms,whatsapp")
102
+ * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
103
+ */
104
+ available_channels?: string;
105
+ /**
106
+ * Country calling code (e.g., 1 for US/Canada)
107
+ */
108
+ country_code?: string;
109
+ /**
110
+ * When the contact was created
111
+ */
112
+ created_at?: string;
113
+ /**
114
+ * Default messaging channel to use (e.g., "sms" or "whatsapp")
35
115
  */
36
- availableChannels?: string;
116
+ default_channel?: string;
37
117
  /**
38
- * The country calling code (e.g., 1 for US/Canada)
118
+ * Phone number in E.164 format (e.g., +1234567890)
39
119
  */
40
- countryCode?: string;
120
+ format_e164?: string;
41
121
  /**
42
- * The default messaging channel to use for this contact (e.g., "sms" or
43
- * "whatsapp")
122
+ * Phone number in international format (e.g., +1 234-567-890)
44
123
  */
45
- defaultChannel?: string;
124
+ format_international?: string;
46
125
  /**
47
- * The phone number formatted in E.164 standard (e.g., +1234567890)
126
+ * Phone number in national format (e.g., (234) 567-890)
48
127
  */
49
- formatE164?: string;
128
+ format_national?: string;
50
129
  /**
51
- * The phone number formatted for international dialing (e.g., +1 234-567-890)
130
+ * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
52
131
  */
53
- formatInternational?: string;
132
+ format_rfc?: string;
54
133
  /**
55
- * The phone number formatted for national dialing (e.g., (234) 567-890)
134
+ * Whether this is an inherited contact (read-only)
56
135
  */
57
- formatNational?: string;
136
+ is_inherited?: boolean;
58
137
  /**
59
- * The phone number formatted according to RFC 3966 (e.g., tel:+1-234-567-890)
138
+ * Whether the contact has opted out of messaging
60
139
  */
61
- formatRfc?: string;
140
+ opt_out?: boolean;
62
141
  /**
63
- * The phone number in its original format
142
+ * Phone number in original format
64
143
  */
65
- phoneNumber?: string;
144
+ phone_number?: string;
66
145
  /**
67
- * The ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
146
+ * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
68
147
  */
69
- regionCode?: string;
148
+ region_code?: string;
149
+ /**
150
+ * When the contact was last updated
151
+ */
152
+ updated_at?: string | null;
70
153
  }
154
+ /**
155
+ * Standard API response envelope for all v3 endpoints
156
+ */
71
157
  export interface ContactListResponse {
72
- items?: Array<ContactListItem>;
73
- page?: number;
74
- pageSize?: number;
75
- totalCount?: number;
76
- totalPages?: number;
158
+ /**
159
+ * Paginated list of contacts response
160
+ */
161
+ data?: ContactListResponse.Data | null;
162
+ /**
163
+ * Error information
164
+ */
165
+ error?: WebhooksAPI.ErrorDetail | null;
166
+ /**
167
+ * Request and response metadata
168
+ */
169
+ meta?: WebhooksAPI.APIMeta;
170
+ /**
171
+ * Indicates whether the request was successful
172
+ */
173
+ success?: boolean;
174
+ }
175
+ export declare namespace ContactListResponse {
176
+ /**
177
+ * Paginated list of contacts response
178
+ */
179
+ interface Data {
180
+ /**
181
+ * List of contacts
182
+ */
183
+ contacts?: Array<ContactsAPI.ContactResponse>;
184
+ /**
185
+ * Pagination metadata for list responses
186
+ */
187
+ pagination?: WebhooksAPI.PaginationMeta;
188
+ }
189
+ }
190
+ export interface ContactCreateParams {
191
+ /**
192
+ * Body param: Phone number of the contact to create
193
+ */
194
+ phone_number?: string;
195
+ /**
196
+ * Body param: Sandbox flag - when true, the operation is simulated without side
197
+ * effects Useful for testing integrations without actual execution
198
+ */
199
+ sandbox?: boolean;
200
+ /**
201
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
202
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
203
+ * hours per key per customer.
204
+ */
205
+ 'Idempotency-Key'?: string;
206
+ /**
207
+ * Header param: Profile UUID to scope the request to a child profile. Only
208
+ * organization API keys can use this header. The profile must belong to the
209
+ * calling organization.
210
+ */
211
+ 'x-profile-id'?: string;
212
+ }
213
+ export interface ContactRetrieveParams {
214
+ /**
215
+ * Profile UUID to scope the request to a child profile. Only organization API keys
216
+ * can use this header. The profile must belong to the calling organization.
217
+ */
218
+ 'x-profile-id'?: string;
219
+ }
220
+ export interface ContactUpdateParams {
221
+ /**
222
+ * Body param: Default messaging channel: "sms" or "whatsapp"
223
+ */
224
+ default_channel?: string | null;
225
+ /**
226
+ * Body param: Whether the contact has opted out of messaging
227
+ */
228
+ opt_out?: boolean | null;
229
+ /**
230
+ * Body param: Sandbox flag - when true, the operation is simulated without side
231
+ * effects Useful for testing integrations without actual execution
232
+ */
233
+ sandbox?: boolean;
234
+ /**
235
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
236
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
237
+ * hours per key per customer.
238
+ */
239
+ 'Idempotency-Key'?: string;
240
+ /**
241
+ * Header param: Profile UUID to scope the request to a child profile. Only
242
+ * organization API keys can use this header. The profile must belong to the
243
+ * calling organization.
244
+ */
245
+ 'x-profile-id'?: string;
77
246
  }
78
247
  export interface ContactListParams {
79
248
  /**
80
- * The page number (zero-indexed). Default is 0.
249
+ * Query param: Page number (1-indexed)
81
250
  */
82
251
  page: number;
83
252
  /**
84
- * The number of items per page. Default is 20.
253
+ * Query param: Number of items per page
254
+ */
255
+ page_size: number;
256
+ /**
257
+ * Query param: Optional channel filter (sms, whatsapp)
85
258
  */
86
- pageSize: number;
259
+ channel?: string | null;
260
+ /**
261
+ * Query param: Optional phone number filter (alternative to list view)
262
+ */
263
+ phone?: string | null;
264
+ /**
265
+ * Query param: Optional search term for filtering contacts
266
+ */
267
+ search?: string | null;
268
+ /**
269
+ * Header param: Profile UUID to scope the request to a child profile. Only
270
+ * organization API keys can use this header. The profile must belong to the
271
+ * calling organization.
272
+ */
273
+ 'x-profile-id'?: string;
87
274
  }
88
- export interface ContactRetrieveByPhoneParams {
275
+ export interface ContactDeleteParams {
276
+ /**
277
+ * Body param: Request to delete/dissociate a contact
278
+ */
279
+ body: ContactDeleteParams.Body;
89
280
  /**
90
- * The phone number in international format (e.g., +1234567890)
281
+ * Header param: Profile UUID to scope the request to a child profile. Only
282
+ * organization API keys can use this header. The profile must belong to the
283
+ * calling organization.
91
284
  */
92
- phoneNumber: string;
285
+ 'x-profile-id'?: string;
93
286
  }
94
- export interface ContactRetrieveIDParams {
287
+ export declare namespace ContactDeleteParams {
95
288
  /**
96
- * The unique identifier (GUID) of the resource to retrieve
289
+ * Request to delete/dissociate a contact
97
290
  */
98
- id: string;
291
+ interface Body extends WebhooksAPI.MutationRequest {
292
+ }
99
293
  }
100
294
  export declare namespace Contacts {
101
- export { type ContactListItem as ContactListItem, type ContactListResponse as ContactListResponse, type ContactListParams as ContactListParams, type ContactRetrieveByPhoneParams as ContactRetrieveByPhoneParams, type ContactRetrieveIDParams as ContactRetrieveIDParams, };
295
+ export { type APIResponseOfContact as APIResponseOfContact, type ContactResponse as ContactResponse, type ContactListResponse as ContactListResponse, type ContactCreateParams as ContactCreateParams, type ContactRetrieveParams as ContactRetrieveParams, type ContactUpdateParams as ContactUpdateParams, type ContactListParams as ContactListParams, type ContactDeleteParams as ContactDeleteParams, };
102
296
  }
103
297
  //# sourceMappingURL=contacts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":"OAEO,EA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,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC;IAE/B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yBAAiB,mBAAmB,CAAC;IACnC;;OAEG;IACH,UAAiB,IAAK,SAAQ,WAAW,CAAC,eAAe;KAAG;CAC7D;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
@@ -3,30 +3,127 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Contacts = void 0;
5
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
+ * Create, update, and manage customer contact lists
10
+ */
6
11
  class Contacts extends resource_1.APIResource {
7
12
  /**
8
- * Retrieves a paginated list of contacts for the authenticated customer. Supports
9
- * server-side pagination with configurable page size. The customer ID is extracted
10
- * from the authentication token.
13
+ * Creates a new contact by phone number and associates it with the authenticated
14
+ * customer.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const apiResponseOfContact = await client.contacts.create();
19
+ * ```
20
+ */
21
+ create(params, options) {
22
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
23
+ return this._client.post('/v3/contacts', {
24
+ body,
25
+ ...options,
26
+ headers: (0, headers_1.buildHeaders)([
27
+ {
28
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
29
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
30
+ },
31
+ options?.headers,
32
+ ]),
33
+ });
34
+ }
35
+ /**
36
+ * Retrieves a specific contact by their unique identifier. Returns detailed
37
+ * contact information including phone formats, available channels, and opt-out
38
+ * status.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const apiResponseOfContact = await client.contacts.retrieve(
43
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
44
+ * );
45
+ * ```
11
46
  */
12
- list(query, options) {
13
- return this._client.get('/v2/contacts', { query, ...options });
47
+ retrieve(id, params = {}, options) {
48
+ const { 'x-profile-id': xProfileID } = params ?? {};
49
+ return this._client.get((0, path_1.path) `/v3/contacts/${id}`, {
50
+ ...options,
51
+ headers: (0, headers_1.buildHeaders)([
52
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
53
+ options?.headers,
54
+ ]),
55
+ });
14
56
  }
15
57
  /**
16
- * Retrieves a contact by their phone number for the authenticated customer. Phone
17
- * number should be in international format (e.g., +1234567890). The customer ID is
18
- * extracted from the authentication token.
58
+ * Updates a contact's default channel and/or opt-out status. Inherited contacts
59
+ * cannot be updated.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const apiResponseOfContact = await client.contacts.update(
64
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
65
+ * );
66
+ * ```
67
+ */
68
+ update(id, params, options) {
69
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
70
+ return this._client.patch((0, path_1.path) `/v3/contacts/${id}`, {
71
+ body,
72
+ ...options,
73
+ headers: (0, headers_1.buildHeaders)([
74
+ {
75
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
76
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
77
+ },
78
+ options?.headers,
79
+ ]),
80
+ });
81
+ }
82
+ /**
83
+ * Retrieves a paginated list of contacts for the authenticated customer. Supports
84
+ * filtering by search term, channel, or phone number.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const contacts = await client.contacts.list({
89
+ * page: 0,
90
+ * page_size: 0,
91
+ * });
92
+ * ```
19
93
  */
20
- retrieveByPhone(query, options) {
21
- return this._client.get('/v2/contacts/phone', { query, ...options });
94
+ list(params, options) {
95
+ const { 'x-profile-id': xProfileID, ...query } = params;
96
+ return this._client.get('/v3/contacts', {
97
+ query,
98
+ ...options,
99
+ headers: (0, headers_1.buildHeaders)([
100
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
101
+ options?.headers,
102
+ ]),
103
+ });
22
104
  }
23
105
  /**
24
- * Retrieves a specific contact by their unique identifier for the authenticated
25
- * customer. The customer ID is extracted from the authentication token. Returns
26
- * detailed contact information including phone number and creation timestamp.
106
+ * Dissociates a contact from the authenticated customer. Inherited contacts cannot
107
+ * be deleted.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * await client.contacts.delete(
112
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
113
+ * { body: {} },
114
+ * );
115
+ * ```
27
116
  */
28
- retrieveID(query, options) {
29
- return this._client.get('/v2/contacts/id', { query, ...options });
117
+ delete(id, params, options) {
118
+ const { body, 'x-profile-id': xProfileID } = params;
119
+ return this._client.delete((0, path_1.path) `/v3/contacts/${id}`, {
120
+ body: body,
121
+ ...options,
122
+ headers: (0, headers_1.buildHeaders)([
123
+ { Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
124
+ options?.headers,
125
+ ]),
126
+ });
30
127
  }
31
128
  }
32
129
  exports.Contacts = Contacts;
@@ -1 +1 @@
1
- {"version":3,"file":"contacts.js","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;OAIG;IACH,IAAI,CAAC,KAAwB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,eAAe,CACb,KAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,KAA8B,EAAE,OAAwB;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AA9BD,4BA8BC"}
1
+ {"version":3,"file":"contacts.js","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,oDAA8C;AAE9C;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;OAQG;IACH,MAAM,CAAC,MAA2B,EAAE,OAAwB;QAC1D,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,I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less. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../core/resource.mjs";
3
+ import { buildHeaders } from "../internal/headers.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ /**
6
+ * Create, update, and manage customer contact lists
7
+ */
3
8
  export class Contacts extends APIResource {
4
9
  /**
5
- * Retrieves a paginated list of contacts for the authenticated customer. Supports
6
- * server-side pagination with configurable page size. The customer ID is extracted
7
- * from the authentication token.
10
+ * Creates a new contact by phone number and associates it with the authenticated
11
+ * customer.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const apiResponseOfContact = await client.contacts.create();
16
+ * ```
17
+ */
18
+ create(params, options) {
19
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
20
+ return this._client.post('/v3/contacts', {
21
+ body,
22
+ ...options,
23
+ headers: buildHeaders([
24
+ {
25
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
26
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
27
+ },
28
+ options?.headers,
29
+ ]),
30
+ });
31
+ }
32
+ /**
33
+ * Retrieves a specific contact by their unique identifier. Returns detailed
34
+ * contact information including phone formats, available channels, and opt-out
35
+ * status.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const apiResponseOfContact = await client.contacts.retrieve(
40
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
41
+ * );
42
+ * ```
8
43
  */
9
- list(query, options) {
10
- return this._client.get('/v2/contacts', { query, ...options });
44
+ retrieve(id, params = {}, options) {
45
+ const { 'x-profile-id': xProfileID } = params ?? {};
46
+ return this._client.get(path `/v3/contacts/${id}`, {
47
+ ...options,
48
+ headers: buildHeaders([
49
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
50
+ options?.headers,
51
+ ]),
52
+ });
11
53
  }
12
54
  /**
13
- * Retrieves a contact by their phone number for the authenticated customer. Phone
14
- * number should be in international format (e.g., +1234567890). The customer ID is
15
- * extracted from the authentication token.
55
+ * Updates a contact's default channel and/or opt-out status. Inherited contacts
56
+ * cannot be updated.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const apiResponseOfContact = await client.contacts.update(
61
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
62
+ * );
63
+ * ```
64
+ */
65
+ update(id, params, options) {
66
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
67
+ return this._client.patch(path `/v3/contacts/${id}`, {
68
+ body,
69
+ ...options,
70
+ headers: buildHeaders([
71
+ {
72
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
73
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
74
+ },
75
+ options?.headers,
76
+ ]),
77
+ });
78
+ }
79
+ /**
80
+ * Retrieves a paginated list of contacts for the authenticated customer. Supports
81
+ * filtering by search term, channel, or phone number.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const contacts = await client.contacts.list({
86
+ * page: 0,
87
+ * page_size: 0,
88
+ * });
89
+ * ```
16
90
  */
17
- retrieveByPhone(query, options) {
18
- return this._client.get('/v2/contacts/phone', { query, ...options });
91
+ list(params, options) {
92
+ const { 'x-profile-id': xProfileID, ...query } = params;
93
+ return this._client.get('/v3/contacts', {
94
+ query,
95
+ ...options,
96
+ headers: buildHeaders([
97
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
98
+ options?.headers,
99
+ ]),
100
+ });
19
101
  }
20
102
  /**
21
- * Retrieves a specific contact by their unique identifier for the authenticated
22
- * customer. The customer ID is extracted from the authentication token. Returns
23
- * detailed contact information including phone number and creation timestamp.
103
+ * Dissociates a contact from the authenticated customer. Inherited contacts cannot
104
+ * be deleted.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * await client.contacts.delete(
109
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
110
+ * { body: {} },
111
+ * );
112
+ * ```
24
113
  */
25
- retrieveID(query, options) {
26
- return this._client.get('/v2/contacts/id', { query, ...options });
114
+ delete(id, params, options) {
115
+ const { body, 'x-profile-id': xProfileID } = params;
116
+ return this._client.delete(path `/v3/contacts/${id}`, {
117
+ body: body,
118
+ ...options,
119
+ headers: buildHeaders([
120
+ { Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
121
+ options?.headers,
122
+ ]),
123
+ });
27
124
  }
28
125
  }
29
126
  //# sourceMappingURL=contacts.mjs.map