@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
@@ -0,0 +1,366 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as UsersAPI from './users';
5
+ import * as WebhooksAPI from './webhooks';
6
+ import { APIPromise } from '../core/api-promise';
7
+ import { buildHeaders } from '../internal/headers';
8
+ import { RequestOptions } from '../internal/request-options';
9
+ import { path } from '../internal/utils/path';
10
+
11
+ /**
12
+ * Invite, update, and manage organization users and roles
13
+ */
14
+ export class Users extends APIResource {
15
+ /**
16
+ * Retrieves detailed information about a specific user in an organization or
17
+ * profile. Requires developer role or higher.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const apiResponseOfUser = await client.users.retrieve(
22
+ * 'userId',
23
+ * );
24
+ * ```
25
+ */
26
+ retrieve(
27
+ userID: string,
28
+ params: UserRetrieveParams | null | undefined = {},
29
+ options?: RequestOptions,
30
+ ): APIPromise<APIResponseOfUser> {
31
+ const { 'x-profile-id': xProfileID } = params ?? {};
32
+ return this._client.get(path`/v3/users/${userID}`, {
33
+ ...options,
34
+ headers: buildHeaders([
35
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
36
+ options?.headers,
37
+ ]),
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Retrieves all users who have access to the organization or profile identified by
43
+ * the API key, including their roles and status. Shows invited users (pending
44
+ * acceptance) and active users. Requires developer role or higher.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const users = await client.users.list();
49
+ * ```
50
+ */
51
+ list(
52
+ params: UserListParams | null | undefined = {},
53
+ options?: RequestOptions,
54
+ ): APIPromise<UserListResponse> {
55
+ const { 'x-profile-id': xProfileID } = params ?? {};
56
+ return this._client.get('/v3/users', {
57
+ ...options,
58
+ headers: buildHeaders([
59
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
60
+ options?.headers,
61
+ ]),
62
+ });
63
+ }
64
+
65
+ /**
66
+ * Sends an invitation to a user to join the organization or profile with a
67
+ * specific role. Requires admin role. The user will receive an invitation email
68
+ * with a token to accept. Invitation tokens expire after 7 days.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const apiResponseOfUser = await client.users.invite();
73
+ * ```
74
+ */
75
+ invite(params: UserInviteParams, options?: RequestOptions): APIPromise<APIResponseOfUser> {
76
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
77
+ return this._client.post('/v3/users', {
78
+ body,
79
+ ...options,
80
+ headers: buildHeaders([
81
+ {
82
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
83
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
84
+ },
85
+ options?.headers,
86
+ ]),
87
+ });
88
+ }
89
+
90
+ /**
91
+ * Removes a user's access to an organization or profile. Requires admin role. You
92
+ * cannot remove yourself or remove the last admin.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * await client.users.remove('userId', { body: {} });
97
+ * ```
98
+ */
99
+ remove(userID: string, params: UserRemoveParams, options?: RequestOptions): APIPromise<void> {
100
+ const { body, 'x-profile-id': xProfileID } = params;
101
+ return this._client.delete(path`/v3/users/${userID}`, {
102
+ body: body,
103
+ ...options,
104
+ headers: buildHeaders([
105
+ { Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
106
+ options?.headers,
107
+ ]),
108
+ });
109
+ }
110
+
111
+ /**
112
+ * Updates a user's role in the organization or profile. Requires admin role. You
113
+ * cannot change your own role or demote the last admin.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * const apiResponseOfUser = await client.users.updateRole(
118
+ * 'userId',
119
+ * );
120
+ * ```
121
+ */
122
+ updateRole(
123
+ userID: string,
124
+ params: UserUpdateRoleParams,
125
+ options?: RequestOptions,
126
+ ): APIPromise<APIResponseOfUser> {
127
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
128
+ return this._client.patch(path`/v3/users/${userID}`, {
129
+ body,
130
+ ...options,
131
+ headers: buildHeaders([
132
+ {
133
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
134
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
135
+ },
136
+ options?.headers,
137
+ ]),
138
+ });
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Standard API response envelope for all v3 endpoints
144
+ */
145
+ export interface APIResponseOfUser {
146
+ /**
147
+ * User response for v3 API
148
+ */
149
+ data?: UserResponse | null;
150
+
151
+ /**
152
+ * Error information
153
+ */
154
+ error?: WebhooksAPI.ErrorDetail | null;
155
+
156
+ /**
157
+ * Request and response metadata
158
+ */
159
+ meta?: WebhooksAPI.APIMeta;
160
+
161
+ /**
162
+ * Indicates whether the request was successful
163
+ */
164
+ success?: boolean;
165
+ }
166
+
167
+ /**
168
+ * User response for v3 API
169
+ */
170
+ export interface UserResponse {
171
+ /**
172
+ * User unique identifier
173
+ */
174
+ id?: string;
175
+
176
+ /**
177
+ * When the user was added to the organization
178
+ */
179
+ created_at?: string;
180
+
181
+ /**
182
+ * User email address
183
+ */
184
+ email?: string;
185
+
186
+ /**
187
+ * When the user was invited
188
+ */
189
+ invited_at?: string | null;
190
+
191
+ /**
192
+ * When the user last logged in
193
+ */
194
+ last_login_at?: string | null;
195
+
196
+ /**
197
+ * User full name
198
+ */
199
+ name?: string;
200
+
201
+ /**
202
+ * User role in the organization: admin, billing, developer
203
+ */
204
+ role?: string;
205
+
206
+ /**
207
+ * User status: active, invited, suspended, rejected
208
+ */
209
+ status?: string;
210
+
211
+ /**
212
+ * When the user record was last updated
213
+ */
214
+ updated_at?: string | null;
215
+ }
216
+
217
+ /**
218
+ * Standard API response envelope for all v3 endpoints
219
+ */
220
+ export interface UserListResponse {
221
+ /**
222
+ * List of users response
223
+ */
224
+ data?: UserListResponse.Data | null;
225
+
226
+ /**
227
+ * Error information
228
+ */
229
+ error?: WebhooksAPI.ErrorDetail | null;
230
+
231
+ /**
232
+ * Request and response metadata
233
+ */
234
+ meta?: WebhooksAPI.APIMeta;
235
+
236
+ /**
237
+ * Indicates whether the request was successful
238
+ */
239
+ success?: boolean;
240
+ }
241
+
242
+ export namespace UserListResponse {
243
+ /**
244
+ * List of users response
245
+ */
246
+ export interface Data {
247
+ /**
248
+ * List of users in the organization
249
+ */
250
+ users?: Array<UsersAPI.UserResponse>;
251
+ }
252
+ }
253
+
254
+ export interface UserRetrieveParams {
255
+ /**
256
+ * Profile UUID to scope the request to a child profile. Only organization API keys
257
+ * can use this header. The profile must belong to the calling organization.
258
+ */
259
+ 'x-profile-id'?: string;
260
+ }
261
+
262
+ export interface UserListParams {
263
+ /**
264
+ * Profile UUID to scope the request to a child profile. Only organization API keys
265
+ * can use this header. The profile must belong to the calling organization.
266
+ */
267
+ 'x-profile-id'?: string;
268
+ }
269
+
270
+ export interface UserInviteParams {
271
+ /**
272
+ * Body param: User email address (required)
273
+ */
274
+ email?: string;
275
+
276
+ /**
277
+ * Body param: User full name (required)
278
+ */
279
+ name?: string;
280
+
281
+ /**
282
+ * Body param: User role: admin, billing, or developer (required)
283
+ */
284
+ role?: string;
285
+
286
+ /**
287
+ * Body param: Sandbox flag - when true, the operation is simulated without side
288
+ * effects Useful for testing integrations without actual execution
289
+ */
290
+ sandbox?: boolean;
291
+
292
+ /**
293
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
294
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
295
+ * hours per key per customer.
296
+ */
297
+ 'Idempotency-Key'?: string;
298
+
299
+ /**
300
+ * Header param: Profile UUID to scope the request to a child profile. Only
301
+ * organization API keys can use this header. The profile must belong to the
302
+ * calling organization.
303
+ */
304
+ 'x-profile-id'?: string;
305
+ }
306
+
307
+ export interface UserRemoveParams {
308
+ /**
309
+ * Body param: Request to remove a user from an organization
310
+ */
311
+ body: UserRemoveParams.Body;
312
+
313
+ /**
314
+ * Header param: Profile UUID to scope the request to a child profile. Only
315
+ * organization API keys can use this header. The profile must belong to the
316
+ * calling organization.
317
+ */
318
+ 'x-profile-id'?: string;
319
+ }
320
+
321
+ export namespace UserRemoveParams {
322
+ /**
323
+ * Request to remove a user from an organization
324
+ */
325
+ export interface Body extends WebhooksAPI.MutationRequest {}
326
+ }
327
+
328
+ export interface UserUpdateRoleParams {
329
+ /**
330
+ * Body param: User role: admin, billing, or developer (required)
331
+ */
332
+ role?: string;
333
+
334
+ /**
335
+ * Body param: Sandbox flag - when true, the operation is simulated without side
336
+ * effects Useful for testing integrations without actual execution
337
+ */
338
+ sandbox?: boolean;
339
+
340
+ /**
341
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
342
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
343
+ * hours per key per customer.
344
+ */
345
+ 'Idempotency-Key'?: string;
346
+
347
+ /**
348
+ * Header param: Profile UUID to scope the request to a child profile. Only
349
+ * organization API keys can use this header. The profile must belong to the
350
+ * calling organization.
351
+ */
352
+ 'x-profile-id'?: string;
353
+ }
354
+
355
+ export declare namespace Users {
356
+ export {
357
+ type APIResponseOfUser as APIResponseOfUser,
358
+ type UserResponse as UserResponse,
359
+ type UserListResponse as UserListResponse,
360
+ type UserRetrieveParams as UserRetrieveParams,
361
+ type UserListParams as UserListParams,
362
+ type UserInviteParams as UserInviteParams,
363
+ type UserRemoveParams as UserRemoveParams,
364
+ type UserUpdateRoleParams as UserUpdateRoleParams,
365
+ };
366
+ }