@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,251 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as UsersAPI from "./users.js";
3
+ import * as WebhooksAPI from "./webhooks.js";
4
+ import { APIPromise } from "../core/api-promise.js";
5
+ import { RequestOptions } from "../internal/request-options.js";
6
+ /**
7
+ * Invite, update, and manage organization users and roles
8
+ */
9
+ export declare class Users extends APIResource {
10
+ /**
11
+ * Retrieves detailed information about a specific user in an organization or
12
+ * profile. Requires developer role or higher.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const apiResponseOfUser = await client.users.retrieve(
17
+ * 'userId',
18
+ * );
19
+ * ```
20
+ */
21
+ retrieve(userID: string, params?: UserRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<APIResponseOfUser>;
22
+ /**
23
+ * Retrieves all users who have access to the organization or profile identified by
24
+ * the API key, including their roles and status. Shows invited users (pending
25
+ * acceptance) and active users. Requires developer role or higher.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const users = await client.users.list();
30
+ * ```
31
+ */
32
+ list(params?: UserListParams | null | undefined, options?: RequestOptions): APIPromise<UserListResponse>;
33
+ /**
34
+ * Sends an invitation to a user to join the organization or profile with a
35
+ * specific role. Requires admin role. The user will receive an invitation email
36
+ * with a token to accept. Invitation tokens expire after 7 days.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const apiResponseOfUser = await client.users.invite();
41
+ * ```
42
+ */
43
+ invite(params: UserInviteParams, options?: RequestOptions): APIPromise<APIResponseOfUser>;
44
+ /**
45
+ * Removes a user's access to an organization or profile. Requires admin role. You
46
+ * cannot remove yourself or remove the last admin.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * await client.users.remove('userId', { body: {} });
51
+ * ```
52
+ */
53
+ remove(userID: string, params: UserRemoveParams, options?: RequestOptions): APIPromise<void>;
54
+ /**
55
+ * Updates a user's role in the organization or profile. Requires admin role. You
56
+ * cannot change your own role or demote the last admin.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const apiResponseOfUser = await client.users.updateRole(
61
+ * 'userId',
62
+ * );
63
+ * ```
64
+ */
65
+ updateRole(userID: string, params: UserUpdateRoleParams, options?: RequestOptions): APIPromise<APIResponseOfUser>;
66
+ }
67
+ /**
68
+ * Standard API response envelope for all v3 endpoints
69
+ */
70
+ export interface APIResponseOfUser {
71
+ /**
72
+ * User response for v3 API
73
+ */
74
+ data?: UserResponse | null;
75
+ /**
76
+ * Error information
77
+ */
78
+ error?: WebhooksAPI.ErrorDetail | null;
79
+ /**
80
+ * Request and response metadata
81
+ */
82
+ meta?: WebhooksAPI.APIMeta;
83
+ /**
84
+ * Indicates whether the request was successful
85
+ */
86
+ success?: boolean;
87
+ }
88
+ /**
89
+ * User response for v3 API
90
+ */
91
+ export interface UserResponse {
92
+ /**
93
+ * User unique identifier
94
+ */
95
+ id?: string;
96
+ /**
97
+ * When the user was added to the organization
98
+ */
99
+ created_at?: string;
100
+ /**
101
+ * User email address
102
+ */
103
+ email?: string;
104
+ /**
105
+ * When the user was invited
106
+ */
107
+ invited_at?: string | null;
108
+ /**
109
+ * When the user last logged in
110
+ */
111
+ last_login_at?: string | null;
112
+ /**
113
+ * User full name
114
+ */
115
+ name?: string;
116
+ /**
117
+ * User role in the organization: admin, billing, developer
118
+ */
119
+ role?: string;
120
+ /**
121
+ * User status: active, invited, suspended, rejected
122
+ */
123
+ status?: string;
124
+ /**
125
+ * When the user record was last updated
126
+ */
127
+ updated_at?: string | null;
128
+ }
129
+ /**
130
+ * Standard API response envelope for all v3 endpoints
131
+ */
132
+ export interface UserListResponse {
133
+ /**
134
+ * List of users response
135
+ */
136
+ data?: UserListResponse.Data | null;
137
+ /**
138
+ * Error information
139
+ */
140
+ error?: WebhooksAPI.ErrorDetail | null;
141
+ /**
142
+ * Request and response metadata
143
+ */
144
+ meta?: WebhooksAPI.APIMeta;
145
+ /**
146
+ * Indicates whether the request was successful
147
+ */
148
+ success?: boolean;
149
+ }
150
+ export declare namespace UserListResponse {
151
+ /**
152
+ * List of users response
153
+ */
154
+ interface Data {
155
+ /**
156
+ * List of users in the organization
157
+ */
158
+ users?: Array<UsersAPI.UserResponse>;
159
+ }
160
+ }
161
+ export interface UserRetrieveParams {
162
+ /**
163
+ * Profile UUID to scope the request to a child profile. Only organization API keys
164
+ * can use this header. The profile must belong to the calling organization.
165
+ */
166
+ 'x-profile-id'?: string;
167
+ }
168
+ export interface UserListParams {
169
+ /**
170
+ * Profile UUID to scope the request to a child profile. Only organization API keys
171
+ * can use this header. The profile must belong to the calling organization.
172
+ */
173
+ 'x-profile-id'?: string;
174
+ }
175
+ export interface UserInviteParams {
176
+ /**
177
+ * Body param: User email address (required)
178
+ */
179
+ email?: string;
180
+ /**
181
+ * Body param: User full name (required)
182
+ */
183
+ name?: string;
184
+ /**
185
+ * Body param: User role: admin, billing, or developer (required)
186
+ */
187
+ role?: string;
188
+ /**
189
+ * Body param: Sandbox flag - when true, the operation is simulated without side
190
+ * effects Useful for testing integrations without actual execution
191
+ */
192
+ sandbox?: boolean;
193
+ /**
194
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
195
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
196
+ * hours per key per customer.
197
+ */
198
+ 'Idempotency-Key'?: string;
199
+ /**
200
+ * Header param: Profile UUID to scope the request to a child profile. Only
201
+ * organization API keys can use this header. The profile must belong to the
202
+ * calling organization.
203
+ */
204
+ 'x-profile-id'?: string;
205
+ }
206
+ export interface UserRemoveParams {
207
+ /**
208
+ * Body param: Request to remove a user from an organization
209
+ */
210
+ body: UserRemoveParams.Body;
211
+ /**
212
+ * Header param: Profile UUID to scope the request to a child profile. Only
213
+ * organization API keys can use this header. The profile must belong to the
214
+ * calling organization.
215
+ */
216
+ 'x-profile-id'?: string;
217
+ }
218
+ export declare namespace UserRemoveParams {
219
+ /**
220
+ * Request to remove a user from an organization
221
+ */
222
+ interface Body extends WebhooksAPI.MutationRequest {
223
+ }
224
+ }
225
+ export interface UserUpdateRoleParams {
226
+ /**
227
+ * Body param: User role: admin, billing, or developer (required)
228
+ */
229
+ role?: string;
230
+ /**
231
+ * Body param: Sandbox flag - when true, the operation is simulated without side
232
+ * effects Useful for testing integrations without actual execution
233
+ */
234
+ sandbox?: boolean;
235
+ /**
236
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
237
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
238
+ * hours per key per customer.
239
+ */
240
+ 'Idempotency-Key'?: string;
241
+ /**
242
+ * Header param: Profile UUID to scope the request to a child profile. Only
243
+ * organization API keys can use this header. The profile must belong to the
244
+ * calling organization.
245
+ */
246
+ 'x-profile-id'?: string;
247
+ }
248
+ export declare namespace Users {
249
+ export { type APIResponseOfUser as APIResponseOfUser, type UserResponse as UserResponse, type UserListResponse as UserListResponse, type UserRetrieveParams as UserRetrieveParams, type UserListParams as UserListParams, type UserInviteParams as UserInviteParams, type UserRemoveParams as UserRemoveParams, type UserUpdateRoleParams as UserUpdateRoleParams, };
250
+ }
251
+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AC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAE5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yBAAiB,gBAAgB,CAAC;IAChC;;OAEG;IACH,UAAiB,IAAK,SAAQ,WAAW,CAAC,eAAe;KAAG;CAC7D;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
@@ -0,0 +1,124 @@
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.Users = 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
+ * Invite, update, and manage organization users and roles
10
+ */
11
+ class Users extends resource_1.APIResource {
12
+ /**
13
+ * Retrieves detailed information about a specific user in an organization or
14
+ * profile. Requires developer role or higher.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const apiResponseOfUser = await client.users.retrieve(
19
+ * 'userId',
20
+ * );
21
+ * ```
22
+ */
23
+ retrieve(userID, params = {}, options) {
24
+ const { 'x-profile-id': xProfileID } = params ?? {};
25
+ return this._client.get((0, path_1.path) `/v3/users/${userID}`, {
26
+ ...options,
27
+ headers: (0, headers_1.buildHeaders)([
28
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
29
+ options?.headers,
30
+ ]),
31
+ });
32
+ }
33
+ /**
34
+ * Retrieves all users who have access to the organization or profile identified by
35
+ * the API key, including their roles and status. Shows invited users (pending
36
+ * acceptance) and active users. Requires developer role or higher.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const users = await client.users.list();
41
+ * ```
42
+ */
43
+ list(params = {}, options) {
44
+ const { 'x-profile-id': xProfileID } = params ?? {};
45
+ return this._client.get('/v3/users', {
46
+ ...options,
47
+ headers: (0, headers_1.buildHeaders)([
48
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
49
+ options?.headers,
50
+ ]),
51
+ });
52
+ }
53
+ /**
54
+ * Sends an invitation to a user to join the organization or profile with a
55
+ * specific role. Requires admin role. The user will receive an invitation email
56
+ * with a token to accept. Invitation tokens expire after 7 days.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const apiResponseOfUser = await client.users.invite();
61
+ * ```
62
+ */
63
+ invite(params, options) {
64
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
65
+ return this._client.post('/v3/users', {
66
+ body,
67
+ ...options,
68
+ headers: (0, headers_1.buildHeaders)([
69
+ {
70
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
71
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
72
+ },
73
+ options?.headers,
74
+ ]),
75
+ });
76
+ }
77
+ /**
78
+ * Removes a user's access to an organization or profile. Requires admin role. You
79
+ * cannot remove yourself or remove the last admin.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await client.users.remove('userId', { body: {} });
84
+ * ```
85
+ */
86
+ remove(userID, params, options) {
87
+ const { body, 'x-profile-id': xProfileID } = params;
88
+ return this._client.delete((0, path_1.path) `/v3/users/${userID}`, {
89
+ body: body,
90
+ ...options,
91
+ headers: (0, headers_1.buildHeaders)([
92
+ { Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
93
+ options?.headers,
94
+ ]),
95
+ });
96
+ }
97
+ /**
98
+ * Updates a user's role in the organization or profile. Requires admin role. You
99
+ * cannot change your own role or demote the last admin.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const apiResponseOfUser = await client.users.updateRole(
104
+ * 'userId',
105
+ * );
106
+ * ```
107
+ */
108
+ updateRole(userID, params, options) {
109
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
110
+ return this._client.patch((0, path_1.path) `/v3/users/${userID}`, {
111
+ body,
112
+ ...options,
113
+ headers: (0, headers_1.buildHeaders)([
114
+ {
115
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
116
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
117
+ },
118
+ options?.headers,
119
+ ]),
120
+ });
121
+ }
122
+ }
123
+ exports.Users = Users;
124
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../src/resources/users.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,oDAA8C;AAE9C;;GAEG;AACH,MAAa,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C,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;AA9HD,sBA8HC"}
@@ -0,0 +1,120 @@
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
+ * Invite, update, and manage organization users and roles
7
+ */
8
+ export class Users extends APIResource {
9
+ /**
10
+ * Retrieves detailed information about a specific user in an organization or
11
+ * profile. Requires developer role or higher.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const apiResponseOfUser = await client.users.retrieve(
16
+ * 'userId',
17
+ * );
18
+ * ```
19
+ */
20
+ retrieve(userID, params = {}, options) {
21
+ const { 'x-profile-id': xProfileID } = params ?? {};
22
+ return this._client.get(path `/v3/users/${userID}`, {
23
+ ...options,
24
+ headers: buildHeaders([
25
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
26
+ options?.headers,
27
+ ]),
28
+ });
29
+ }
30
+ /**
31
+ * Retrieves all users who have access to the organization or profile identified by
32
+ * the API key, including their roles and status. Shows invited users (pending
33
+ * acceptance) and active users. Requires developer role or higher.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const users = await client.users.list();
38
+ * ```
39
+ */
40
+ list(params = {}, options) {
41
+ const { 'x-profile-id': xProfileID } = params ?? {};
42
+ return this._client.get('/v3/users', {
43
+ ...options,
44
+ headers: buildHeaders([
45
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
46
+ options?.headers,
47
+ ]),
48
+ });
49
+ }
50
+ /**
51
+ * Sends an invitation to a user to join the organization or profile with a
52
+ * specific role. Requires admin role. The user will receive an invitation email
53
+ * with a token to accept. Invitation tokens expire after 7 days.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const apiResponseOfUser = await client.users.invite();
58
+ * ```
59
+ */
60
+ invite(params, options) {
61
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
62
+ return this._client.post('/v3/users', {
63
+ body,
64
+ ...options,
65
+ headers: buildHeaders([
66
+ {
67
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
68
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
69
+ },
70
+ options?.headers,
71
+ ]),
72
+ });
73
+ }
74
+ /**
75
+ * Removes a user's access to an organization or profile. Requires admin role. You
76
+ * cannot remove yourself or remove the last admin.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * await client.users.remove('userId', { body: {} });
81
+ * ```
82
+ */
83
+ remove(userID, params, options) {
84
+ const { body, 'x-profile-id': xProfileID } = params;
85
+ return this._client.delete(path `/v3/users/${userID}`, {
86
+ body: body,
87
+ ...options,
88
+ headers: buildHeaders([
89
+ { Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
90
+ options?.headers,
91
+ ]),
92
+ });
93
+ }
94
+ /**
95
+ * Updates a user's role in the organization or profile. Requires admin role. You
96
+ * cannot change your own role or demote the last admin.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const apiResponseOfUser = await client.users.updateRole(
101
+ * 'userId',
102
+ * );
103
+ * ```
104
+ */
105
+ updateRole(userID, params, options) {
106
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
107
+ return this._client.patch(path `/v3/users/${userID}`, {
108
+ body,
109
+ ...options,
110
+ headers: buildHeaders([
111
+ {
112
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
113
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
114
+ },
115
+ options?.headers,
116
+ ]),
117
+ });
118
+ }
119
+ }
120
+ //# sourceMappingURL=users.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.mjs","sourceRoot":"","sources":["../src/resources/users.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;OAUG;IACH,QAAQ,CACN,MAAc,EACd,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,aAAa,MAAM,EAAE,EAAE;YACjD,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;IAED;;;;;;;;;OASG;IACH,IAAI,CACF,SAA4C,EAAE,EAC9C,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;YACnC,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;IAED;;;;;;;;;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