postgrid-node 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (238) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +25 -39
  3. package/core.d.ts +7 -4
  4. package/core.d.ts.map +1 -1
  5. package/core.js +16 -9
  6. package/core.js.map +1 -1
  7. package/core.mjs +16 -9
  8. package/core.mjs.map +1 -1
  9. package/index.d.mts +21 -8
  10. package/index.d.ts +21 -8
  11. package/index.d.ts.map +1 -1
  12. package/index.js +28 -5
  13. package/index.js.map +1 -1
  14. package/index.mjs +28 -5
  15. package/index.mjs.map +1 -1
  16. package/internal/qs/formats.d.ts +6 -0
  17. package/internal/qs/formats.d.ts.map +1 -0
  18. package/internal/qs/formats.js +11 -0
  19. package/internal/qs/formats.js.map +1 -0
  20. package/internal/qs/formats.mjs +8 -0
  21. package/internal/qs/formats.mjs.map +1 -0
  22. package/internal/qs/index.d.ts +10 -0
  23. package/internal/qs/index.d.ts.map +1 -0
  24. package/internal/qs/index.js +14 -0
  25. package/internal/qs/index.js.map +1 -0
  26. package/internal/qs/index.mjs +10 -0
  27. package/internal/qs/index.mjs.map +1 -0
  28. package/internal/qs/stringify.d.ts +3 -0
  29. package/internal/qs/stringify.d.ts.map +1 -0
  30. package/internal/qs/stringify.js +280 -0
  31. package/internal/qs/stringify.js.map +1 -0
  32. package/internal/qs/stringify.mjs +276 -0
  33. package/internal/qs/stringify.mjs.map +1 -0
  34. package/internal/qs/types.d.ts +57 -0
  35. package/internal/qs/types.d.ts.map +1 -0
  36. package/internal/qs/types.js +3 -0
  37. package/internal/qs/types.js.map +1 -0
  38. package/internal/qs/types.mjs +2 -0
  39. package/internal/qs/types.mjs.map +1 -0
  40. package/internal/qs/utils.d.ts +14 -0
  41. package/internal/qs/utils.d.ts.map +1 -0
  42. package/internal/qs/utils.js +229 -0
  43. package/internal/qs/utils.js.map +1 -0
  44. package/internal/qs/utils.mjs +217 -0
  45. package/internal/qs/utils.mjs.map +1 -0
  46. package/package.json +4 -5
  47. package/pagination.d.ts +2 -0
  48. package/pagination.d.ts.map +1 -1
  49. package/pagination.js +2 -1
  50. package/pagination.js.map +1 -1
  51. package/pagination.mjs +2 -1
  52. package/pagination.mjs.map +1 -1
  53. package/resource.d.ts +1 -1
  54. package/resource.d.ts.map +1 -1
  55. package/resource.js.map +1 -1
  56. package/resource.mjs.map +1 -1
  57. package/resources/bank-accounts.d.ts +61 -4
  58. package/resources/bank-accounts.d.ts.map +1 -1
  59. package/resources/bank-accounts.js +25 -0
  60. package/resources/bank-accounts.js.map +1 -1
  61. package/resources/bank-accounts.mjs +25 -0
  62. package/resources/bank-accounts.mjs.map +1 -1
  63. package/resources/boxes.d.ts +80 -15
  64. package/resources/boxes.d.ts.map +1 -1
  65. package/resources/boxes.js +27 -0
  66. package/resources/boxes.js.map +1 -1
  67. package/resources/boxes.mjs +27 -0
  68. package/resources/boxes.mjs.map +1 -1
  69. package/resources/campaigns.d.ts +21 -7
  70. package/resources/campaigns.d.ts.map +1 -1
  71. package/resources/cheques/cheques.d.ts +43 -4
  72. package/resources/cheques/cheques.d.ts.map +1 -1
  73. package/resources/cheques/cheques.js +23 -0
  74. package/resources/cheques/cheques.js.map +1 -1
  75. package/resources/cheques/cheques.mjs +23 -0
  76. package/resources/cheques/cheques.mjs.map +1 -1
  77. package/resources/cheques/url.d.ts +5 -0
  78. package/resources/cheques/url.d.ts.map +1 -1
  79. package/resources/cheques/url.js +5 -0
  80. package/resources/cheques/url.js.map +1 -1
  81. package/resources/cheques/url.mjs +5 -0
  82. package/resources/cheques/url.mjs.map +1 -1
  83. package/resources/cheques/with-deposit-ready-pdf.d.ts +6 -0
  84. package/resources/cheques/with-deposit-ready-pdf.d.ts.map +1 -1
  85. package/resources/cheques/with-deposit-ready-pdf.js +6 -0
  86. package/resources/cheques/with-deposit-ready-pdf.js.map +1 -1
  87. package/resources/cheques/with-deposit-ready-pdf.mjs +6 -0
  88. package/resources/cheques/with-deposit-ready-pdf.mjs.map +1 -1
  89. package/resources/contacts.d.ts +37 -3
  90. package/resources/contacts.d.ts.map +1 -1
  91. package/resources/contacts.js +20 -0
  92. package/resources/contacts.js.map +1 -1
  93. package/resources/contacts.mjs +20 -0
  94. package/resources/contacts.mjs.map +1 -1
  95. package/resources/index.d.ts +5 -1
  96. package/resources/index.d.ts.map +1 -1
  97. package/resources/index.js +12 -1
  98. package/resources/index.js.map +1 -1
  99. package/resources/index.mjs +4 -0
  100. package/resources/index.mjs.map +1 -1
  101. package/resources/letters.d.ts +50 -6
  102. package/resources/letters.d.ts.map +1 -1
  103. package/resources/letters.js +24 -0
  104. package/resources/letters.js.map +1 -1
  105. package/resources/letters.mjs +24 -0
  106. package/resources/letters.mjs.map +1 -1
  107. package/resources/mailing-list-imports.d.ts +919 -0
  108. package/resources/mailing-list-imports.d.ts.map +1 -0
  109. package/resources/mailing-list-imports.js +95 -0
  110. package/resources/mailing-list-imports.js.map +1 -0
  111. package/resources/mailing-list-imports.mjs +90 -0
  112. package/resources/mailing-list-imports.mjs.map +1 -0
  113. package/resources/mailing-lists.d.ts +398 -0
  114. package/resources/mailing-lists.d.ts.map +1 -0
  115. package/resources/mailing-lists.js +101 -0
  116. package/resources/mailing-lists.js.map +1 -0
  117. package/resources/mailing-lists.mjs +96 -0
  118. package/resources/mailing-lists.mjs.map +1 -0
  119. package/resources/order-profiles/cheques.d.ts +588 -0
  120. package/resources/order-profiles/cheques.d.ts.map +1 -0
  121. package/resources/order-profiles/cheques.js +74 -0
  122. package/resources/order-profiles/cheques.js.map +1 -0
  123. package/resources/order-profiles/cheques.mjs +69 -0
  124. package/resources/order-profiles/cheques.mjs.map +1 -0
  125. package/resources/order-profiles/index.d.ts +6 -0
  126. package/resources/order-profiles/index.d.ts.map +1 -0
  127. package/resources/order-profiles/index.js +19 -0
  128. package/resources/order-profiles/index.js.map +1 -0
  129. package/resources/order-profiles/index.mjs +7 -0
  130. package/resources/order-profiles/index.mjs.map +1 -0
  131. package/resources/order-profiles/letters.d.ts +647 -0
  132. package/resources/order-profiles/letters.d.ts.map +1 -0
  133. package/resources/order-profiles/letters.js +80 -0
  134. package/resources/order-profiles/letters.js.map +1 -0
  135. package/resources/order-profiles/letters.mjs +75 -0
  136. package/resources/order-profiles/letters.mjs.map +1 -0
  137. package/resources/order-profiles/order-profiles.d.ts +22 -0
  138. package/resources/order-profiles/order-profiles.d.ts.map +1 -0
  139. package/resources/order-profiles/order-profiles.js +55 -0
  140. package/resources/order-profiles/order-profiles.js.map +1 -0
  141. package/resources/order-profiles/order-profiles.mjs +28 -0
  142. package/resources/order-profiles/order-profiles.mjs.map +1 -0
  143. package/resources/order-profiles/postcards.d.ts +423 -0
  144. package/resources/order-profiles/postcards.d.ts.map +1 -0
  145. package/resources/order-profiles/postcards.js +73 -0
  146. package/resources/order-profiles/postcards.js.map +1 -0
  147. package/resources/order-profiles/postcards.mjs +68 -0
  148. package/resources/order-profiles/postcards.mjs.map +1 -0
  149. package/resources/order-profiles/self-mailers.d.ts +435 -0
  150. package/resources/order-profiles/self-mailers.d.ts.map +1 -0
  151. package/resources/order-profiles/self-mailers.js +75 -0
  152. package/resources/order-profiles/self-mailers.js.map +1 -0
  153. package/resources/order-profiles/self-mailers.mjs +70 -0
  154. package/resources/order-profiles/self-mailers.mjs.map +1 -0
  155. package/resources/order-profiles.d.ts +2 -0
  156. package/resources/order-profiles.d.ts.map +1 -0
  157. package/resources/order-profiles.js +19 -0
  158. package/resources/order-profiles.js.map +1 -0
  159. package/resources/order-profiles.mjs +3 -0
  160. package/resources/order-profiles.mjs.map +1 -0
  161. package/resources/postcards.d.ts +58 -8
  162. package/resources/postcards.d.ts.map +1 -1
  163. package/resources/postcards.js +26 -0
  164. package/resources/postcards.js.map +1 -1
  165. package/resources/postcards.mjs +26 -0
  166. package/resources/postcards.mjs.map +1 -1
  167. package/resources/reports/exports.d.ts +36 -3
  168. package/resources/reports/exports.d.ts.map +1 -1
  169. package/resources/reports/exports.js +27 -0
  170. package/resources/reports/exports.js.map +1 -1
  171. package/resources/reports/exports.mjs +27 -0
  172. package/resources/reports/exports.mjs.map +1 -1
  173. package/resources/reports/reports.d.ts +76 -8
  174. package/resources/reports/reports.d.ts.map +1 -1
  175. package/resources/reports/reports.js +44 -0
  176. package/resources/reports/reports.js.map +1 -1
  177. package/resources/reports/reports.mjs +44 -0
  178. package/resources/reports/reports.mjs.map +1 -1
  179. package/resources/self-mailers.d.ts +99 -15
  180. package/resources/self-mailers.d.ts.map +1 -1
  181. package/resources/self-mailers.js +38 -0
  182. package/resources/self-mailers.js.map +1 -1
  183. package/resources/self-mailers.mjs +38 -0
  184. package/resources/self-mailers.mjs.map +1 -1
  185. package/resources/shared.d.ts +6 -2
  186. package/resources/shared.d.ts.map +1 -1
  187. package/resources/sub-organizations.d.ts +394 -0
  188. package/resources/sub-organizations.d.ts.map +1 -0
  189. package/resources/sub-organizations.js +63 -0
  190. package/resources/sub-organizations.js.map +1 -0
  191. package/resources/sub-organizations.mjs +58 -0
  192. package/resources/sub-organizations.mjs.map +1 -0
  193. package/resources/templates.d.ts +43 -3
  194. package/resources/templates.d.ts.map +1 -1
  195. package/resources/templates.js +26 -0
  196. package/resources/templates.js.map +1 -1
  197. package/resources/templates.mjs +26 -0
  198. package/resources/templates.mjs.map +1 -1
  199. package/src/core.ts +17 -8
  200. package/src/index.ts +112 -11
  201. package/src/internal/qs/LICENSE.md +13 -0
  202. package/src/internal/qs/README.md +3 -0
  203. package/src/internal/qs/formats.ts +9 -0
  204. package/src/internal/qs/index.ts +13 -0
  205. package/src/internal/qs/stringify.ts +388 -0
  206. package/src/internal/qs/types.ts +71 -0
  207. package/src/internal/qs/utils.ts +265 -0
  208. package/src/pagination.ts +6 -1
  209. package/src/resource.ts +1 -1
  210. package/src/resources/bank-accounts.ts +57 -4
  211. package/src/resources/boxes.ts +50 -15
  212. package/src/resources/campaigns.ts +7 -7
  213. package/src/resources/cheques/cheques.ts +35 -4
  214. package/src/resources/cheques/url.ts +5 -0
  215. package/src/resources/cheques/with-deposit-ready-pdf.ts +6 -0
  216. package/src/resources/contacts.ts +31 -3
  217. package/src/resources/index.ts +39 -0
  218. package/src/resources/letters.ts +38 -6
  219. package/src/resources/mailing-list-imports.ts +1076 -0
  220. package/src/resources/mailing-lists.ts +511 -0
  221. package/src/resources/order-profiles/cheques.ts +888 -0
  222. package/src/resources/order-profiles/index.ts +55 -0
  223. package/src/resources/order-profiles/letters.ts +956 -0
  224. package/src/resources/order-profiles/order-profiles.ts +133 -0
  225. package/src/resources/order-profiles/postcards.ts +694 -0
  226. package/src/resources/order-profiles/self-mailers.ts +707 -0
  227. package/src/resources/order-profiles.ts +3 -0
  228. package/src/resources/postcards.ts +42 -8
  229. package/src/resources/reports/exports.ts +30 -3
  230. package/src/resources/reports/reports.ts +60 -8
  231. package/src/resources/self-mailers.ts +80 -14
  232. package/src/resources/shared.ts +2 -2
  233. package/src/resources/sub-organizations.ts +518 -0
  234. package/src/resources/templates.ts +37 -3
  235. package/src/version.ts +1 -1
  236. package/version.d.ts +1 -1
  237. package/version.js +1 -1
  238. package/version.mjs +1 -1
@@ -0,0 +1,518 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+ import { List, type ListParams } from '../pagination';
7
+
8
+ export class SubOrganizations extends APIResource {
9
+ /**
10
+ * When creating a user through the API, the verifiedEmail field will automatically
11
+ * be set to true. However, if public signups are used, the email will need to be
12
+ * verified by the user.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const subOrganization =
17
+ * await client.subOrganizations.create({
18
+ * countryCode: 'CA',
19
+ * email: 'suborg@postgrid.com',
20
+ * name: 'Calvin',
21
+ * organizationName: 'PostGrid',
22
+ * password: 'very-strong-password',
23
+ * phoneNumber: '9059059059',
24
+ * });
25
+ * ```
26
+ */
27
+ create(
28
+ body: SubOrganizationCreateParams,
29
+ options?: Core.RequestOptions,
30
+ ): Core.APIPromise<SubOrganizationCreateResponse> {
31
+ return this._client.post('/sub_organizations/', { body, ...options });
32
+ }
33
+
34
+ /**
35
+ * Get a sub-organization.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const subOrganization =
40
+ * await client.subOrganizations.retrieve('id');
41
+ * ```
42
+ */
43
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<SubOrganizationRetrieveResponse> {
44
+ return this._client.get(`/sub_organizations/${id}`, options);
45
+ }
46
+
47
+ /**
48
+ * List sub-organizations.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // Automatically fetches more pages as needed.
53
+ * for await (const subOrganizationListResponse of client.subOrganizations.list()) {
54
+ * // ...
55
+ * }
56
+ * ```
57
+ */
58
+ list(
59
+ query?: SubOrganizationListParams,
60
+ options?: Core.RequestOptions,
61
+ ): Core.PagePromise<SubOrganizationListResponsesList, SubOrganizationListResponse>;
62
+ list(
63
+ options?: Core.RequestOptions,
64
+ ): Core.PagePromise<SubOrganizationListResponsesList, SubOrganizationListResponse>;
65
+ list(
66
+ query: SubOrganizationListParams | Core.RequestOptions = {},
67
+ options?: Core.RequestOptions,
68
+ ): Core.PagePromise<SubOrganizationListResponsesList, SubOrganizationListResponse> {
69
+ if (isRequestOptions(query)) {
70
+ return this.list({}, query);
71
+ }
72
+ return this._client.getAPIList('/sub_organizations/', SubOrganizationListResponsesList, {
73
+ query,
74
+ ...options,
75
+ });
76
+ }
77
+
78
+ /**
79
+ * List users for a sub-organization.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const response = await client.subOrganizations.listUsers(
84
+ * 'id',
85
+ * );
86
+ * ```
87
+ */
88
+ listUsers(
89
+ id: string,
90
+ query?: SubOrganizationListUsersParams,
91
+ options?: Core.RequestOptions,
92
+ ): Core.APIPromise<SubOrganizationListUsersResponse>;
93
+ listUsers(id: string, options?: Core.RequestOptions): Core.APIPromise<SubOrganizationListUsersResponse>;
94
+ listUsers(
95
+ id: string,
96
+ query: SubOrganizationListUsersParams | Core.RequestOptions = {},
97
+ options?: Core.RequestOptions,
98
+ ): Core.APIPromise<SubOrganizationListUsersResponse> {
99
+ if (isRequestOptions(query)) {
100
+ return this.listUsers(id, {}, query);
101
+ }
102
+ return this._client.get(`/sub_organizations/${id}/users`, { query, ...options });
103
+ }
104
+ }
105
+
106
+ export class SubOrganizationListResponsesList extends List<SubOrganizationListResponse> {}
107
+
108
+ export interface SubOrganizationCreateResponse {
109
+ /**
110
+ * The Sub-Organization object.
111
+ */
112
+ subOrganization: SubOrganizationCreateResponse.SubOrganization;
113
+
114
+ /**
115
+ * The user object.
116
+ */
117
+ user: SubOrganizationCreateResponse.User;
118
+ }
119
+
120
+ export namespace SubOrganizationCreateResponse {
121
+ /**
122
+ * The Sub-Organization object.
123
+ */
124
+ export interface SubOrganization {
125
+ /**
126
+ * A unique ID prefixed with `sub_org_`.
127
+ */
128
+ id: string;
129
+
130
+ /**
131
+ * The country code of the sub-organization.
132
+ */
133
+ countryCode: string;
134
+
135
+ /**
136
+ * The UTC time at which this resource was created.
137
+ */
138
+ createdAt: string;
139
+
140
+ /**
141
+ * The limit of mailings the sub-organization can send before being charged
142
+ * overages for the month.
143
+ */
144
+ limit: number;
145
+
146
+ /**
147
+ * The name of the sub-organization.
148
+ */
149
+ name: string;
150
+
151
+ /**
152
+ * Always `sub_org`.
153
+ */
154
+ object: 'sub_org';
155
+
156
+ /**
157
+ * The current rolling charge for the sub-organization for the month, in cents.
158
+ */
159
+ spend: number;
160
+
161
+ /**
162
+ * The UTC time at which this resource was last update.
163
+ */
164
+ updatedAt: string;
165
+
166
+ /**
167
+ * The amount of mail the sub-organization has sent out this month.
168
+ */
169
+ usage: number;
170
+ }
171
+
172
+ /**
173
+ * The user object.
174
+ */
175
+ export interface User {
176
+ /**
177
+ * A unique ID prefixed with `user_`.
178
+ */
179
+ id: string;
180
+
181
+ /**
182
+ * The user's API keys. Contains live and test mode API keys.
183
+ */
184
+ apiKeys: Array<User.APIKey>;
185
+
186
+ /**
187
+ * The email of the user.
188
+ */
189
+ email: string;
190
+
191
+ /**
192
+ * The name of the user.
193
+ */
194
+ name: string;
195
+
196
+ /**
197
+ * A unique ID prefixed with `user_`.
198
+ */
199
+ organization: string;
200
+
201
+ /**
202
+ * Indicates if the user has a pending invite.
203
+ */
204
+ pendingInvite: boolean;
205
+
206
+ /**
207
+ * The roles given to the user. Roles can be used to restrict access for users.
208
+ */
209
+ roles: Array<string>;
210
+
211
+ /**
212
+ * Indicates if the user has a verified email or not.
213
+ */
214
+ verifiedEmail: boolean;
215
+
216
+ /**
217
+ * A set of preferences for how a user should receive emails.
218
+ */
219
+ emailPreferences?: User.EmailPreferences;
220
+
221
+ /**
222
+ * The date and time at which the user last logged in.
223
+ */
224
+ lastLoginTime?: string;
225
+
226
+ /**
227
+ * The phone number of the user.
228
+ */
229
+ phoneNumber?: string;
230
+
231
+ /**
232
+ * A list of emails the user has previously had. If a user has changed their email
233
+ * before, this list will be populated with all of the emails they once had.
234
+ */
235
+ previousEmails?: Array<string>;
236
+ }
237
+
238
+ export namespace User {
239
+ /**
240
+ * An API key.
241
+ */
242
+ export interface APIKey {
243
+ /**
244
+ * The value of the API key.
245
+ */
246
+ value: string;
247
+
248
+ /**
249
+ * An optional date which the API key is active until. After this date, the API key
250
+ * will no longer be valid.
251
+ */
252
+ activeUntil?: string;
253
+ }
254
+
255
+ /**
256
+ * A set of preferences for how a user should receive emails.
257
+ */
258
+ export interface EmailPreferences {
259
+ /**
260
+ * The list of preferences for receiving order preview emails.
261
+ */
262
+ orderPreviewSendPreference?: 'do_not_send' | 'send_live_only' | 'send_live_and_test';
263
+ }
264
+ }
265
+ }
266
+
267
+ /**
268
+ * The Sub-Organization object.
269
+ */
270
+ export interface SubOrganizationRetrieveResponse {
271
+ /**
272
+ * A unique ID prefixed with `sub_org_`.
273
+ */
274
+ id: string;
275
+
276
+ /**
277
+ * The country code of the sub-organization.
278
+ */
279
+ countryCode: string;
280
+
281
+ /**
282
+ * The UTC time at which this resource was created.
283
+ */
284
+ createdAt: string;
285
+
286
+ /**
287
+ * The limit of mailings the sub-organization can send before being charged
288
+ * overages for the month.
289
+ */
290
+ limit: number;
291
+
292
+ /**
293
+ * The name of the sub-organization.
294
+ */
295
+ name: string;
296
+
297
+ /**
298
+ * Always `sub_org`.
299
+ */
300
+ object: 'sub_org';
301
+
302
+ /**
303
+ * The current rolling charge for the sub-organization for the month, in cents.
304
+ */
305
+ spend: number;
306
+
307
+ /**
308
+ * The UTC time at which this resource was last update.
309
+ */
310
+ updatedAt: string;
311
+
312
+ /**
313
+ * The amount of mail the sub-organization has sent out this month.
314
+ */
315
+ usage: number;
316
+ }
317
+
318
+ /**
319
+ * The Sub-Organization object.
320
+ */
321
+ export interface SubOrganizationListResponse {
322
+ /**
323
+ * A unique ID prefixed with `sub_org_`.
324
+ */
325
+ id: string;
326
+
327
+ /**
328
+ * The country code of the sub-organization.
329
+ */
330
+ countryCode: string;
331
+
332
+ /**
333
+ * The UTC time at which this resource was created.
334
+ */
335
+ createdAt: string;
336
+
337
+ /**
338
+ * The limit of mailings the sub-organization can send before being charged
339
+ * overages for the month.
340
+ */
341
+ limit: number;
342
+
343
+ /**
344
+ * The name of the sub-organization.
345
+ */
346
+ name: string;
347
+
348
+ /**
349
+ * Always `sub_org`.
350
+ */
351
+ object: 'sub_org';
352
+
353
+ /**
354
+ * The current rolling charge for the sub-organization for the month, in cents.
355
+ */
356
+ spend: number;
357
+
358
+ /**
359
+ * The UTC time at which this resource was last update.
360
+ */
361
+ updatedAt: string;
362
+
363
+ /**
364
+ * The amount of mail the sub-organization has sent out this month.
365
+ */
366
+ usage: number;
367
+ }
368
+
369
+ export type SubOrganizationListUsersResponse =
370
+ Array<SubOrganizationListUsersResponse.SubOrganizationListUsersResponseItem>;
371
+
372
+ export namespace SubOrganizationListUsersResponse {
373
+ /**
374
+ * The user object.
375
+ */
376
+ export interface SubOrganizationListUsersResponseItem {
377
+ /**
378
+ * A unique ID prefixed with `user_`.
379
+ */
380
+ id: string;
381
+
382
+ /**
383
+ * The email of the user.
384
+ */
385
+ email: string;
386
+
387
+ /**
388
+ * The name of the user.
389
+ */
390
+ name: string;
391
+
392
+ /**
393
+ * A unique ID prefixed with `user_`.
394
+ */
395
+ organization: string;
396
+
397
+ /**
398
+ * Indicates if the user has a pending invite.
399
+ */
400
+ pendingInvite: boolean;
401
+
402
+ /**
403
+ * The roles given to the user. Roles can be used to restrict access for users.
404
+ */
405
+ roles: Array<string>;
406
+
407
+ /**
408
+ * Indicates if the user has a verified email or not.
409
+ */
410
+ verifiedEmail: boolean;
411
+
412
+ /**
413
+ * A set of preferences for how a user should receive emails.
414
+ */
415
+ emailPreferences?: SubOrganizationListUsersResponseItem.EmailPreferences;
416
+
417
+ /**
418
+ * The date and time at which the user last logged in.
419
+ */
420
+ lastLoginTime?: string;
421
+
422
+ /**
423
+ * The phone number of the user.
424
+ */
425
+ phoneNumber?: string;
426
+
427
+ /**
428
+ * A list of emails the user has previously had. If a user has changed their email
429
+ * before, this list will be populated with all of the emails they once had.
430
+ */
431
+ previousEmails?: Array<string>;
432
+ }
433
+
434
+ export namespace SubOrganizationListUsersResponseItem {
435
+ /**
436
+ * A set of preferences for how a user should receive emails.
437
+ */
438
+ export interface EmailPreferences {
439
+ /**
440
+ * The list of preferences for receiving order preview emails.
441
+ */
442
+ orderPreviewSendPreference?: 'do_not_send' | 'send_live_only' | 'send_live_and_test';
443
+ }
444
+ }
445
+ }
446
+
447
+ export interface SubOrganizationCreateParams {
448
+ /**
449
+ * The country code of the sub-organization.
450
+ */
451
+ countryCode: string;
452
+
453
+ /**
454
+ * The email of the user to be created alongside the sub-organization.
455
+ */
456
+ email: string;
457
+
458
+ /**
459
+ * The name of the user to be created alongside the sub-organization.
460
+ */
461
+ name: string;
462
+
463
+ /**
464
+ * The name of the sub-organization.
465
+ */
466
+ organizationName: string;
467
+
468
+ /**
469
+ * The password of the user to be created alongside the sub-organization.
470
+ */
471
+ password: string;
472
+
473
+ /**
474
+ * The phone number of the user to be created alongside the sub-organization.
475
+ */
476
+ phoneNumber?: string;
477
+ }
478
+
479
+ export interface SubOrganizationListParams extends ListParams {
480
+ /**
481
+ * You can supply any string to help narrow down the list of resources. For
482
+ * example, if you pass `"New York"` (quoted), it will return resources that have
483
+ * that string present somewhere in their response. Alternatively, you can supply a
484
+ * structured search query. See the documentation on `StructuredSearchQuery` for
485
+ * more details.
486
+ */
487
+ search?: string;
488
+ }
489
+
490
+ export interface SubOrganizationListUsersParams {
491
+ limit?: number;
492
+
493
+ /**
494
+ * You can supply any string to help narrow down the list of resources. For
495
+ * example, if you pass `"New York"` (quoted), it will return resources that have
496
+ * that string present somewhere in their response. Alternatively, you can supply a
497
+ * structured search query. See the documentation on `StructuredSearchQuery` for
498
+ * more details.
499
+ */
500
+ search?: string;
501
+
502
+ skip?: number;
503
+ }
504
+
505
+ SubOrganizations.SubOrganizationListResponsesList = SubOrganizationListResponsesList;
506
+
507
+ export declare namespace SubOrganizations {
508
+ export {
509
+ type SubOrganizationCreateResponse as SubOrganizationCreateResponse,
510
+ type SubOrganizationRetrieveResponse as SubOrganizationRetrieveResponse,
511
+ type SubOrganizationListResponse as SubOrganizationListResponse,
512
+ type SubOrganizationListUsersResponse as SubOrganizationListUsersResponse,
513
+ SubOrganizationListResponsesList as SubOrganizationListResponsesList,
514
+ type SubOrganizationCreateParams as SubOrganizationCreateParams,
515
+ type SubOrganizationListParams as SubOrganizationListParams,
516
+ type SubOrganizationListUsersParams as SubOrganizationListUsersParams,
517
+ };
518
+ }
@@ -9,6 +9,14 @@ export class Templates extends APIResource {
9
9
  /**
10
10
  * Create a template. Note that if you want to create a template that works with
11
11
  * our template editor, you must use our dashboard.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const template = await client.templates.create({
16
+ * description: 'Test',
17
+ * html: '<b>Hello</b> {{to.firstName}}',
18
+ * });
19
+ * ```
12
20
  */
13
21
  create(body: TemplateCreateParams, options?: Core.RequestOptions): Core.APIPromise<Template> {
14
22
  return this._client.post('/templates', { body, ...options });
@@ -16,6 +24,11 @@ export class Templates extends APIResource {
16
24
 
17
25
  /**
18
26
  * Retrieve a template by ID.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const template = await client.templates.retrieve('id');
31
+ * ```
19
32
  */
20
33
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Template> {
21
34
  return this._client.get(`/templates/${id}`, options);
@@ -23,6 +36,14 @@ export class Templates extends APIResource {
23
36
 
24
37
  /**
25
38
  * Update a template by ID.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const template = await client.templates.update('id', {
43
+ * description: 'Test',
44
+ * html: '<b>Hello</b> {{to.firstName}}!',
45
+ * });
46
+ * ```
26
47
  */
27
48
  update(id: string, body: TemplateUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Template> {
28
49
  return this._client.post(`/templates/${id}`, { body, ...options });
@@ -30,6 +51,14 @@ export class Templates extends APIResource {
30
51
 
31
52
  /**
32
53
  * Get a list of templates.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * // Automatically fetches more pages as needed.
58
+ * for await (const template of client.templates.list()) {
59
+ * // ...
60
+ * }
61
+ * ```
33
62
  */
34
63
  list(query?: TemplateListParams, options?: Core.RequestOptions): Core.PagePromise<TemplatesList, Template>;
35
64
  list(options?: Core.RequestOptions): Core.PagePromise<TemplatesList, Template>;
@@ -45,6 +74,11 @@ export class Templates extends APIResource {
45
74
 
46
75
  /**
47
76
  * Delete a template by ID. Note that this operation cannot be undone.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const template = await client.templates.delete('id');
81
+ * ```
48
82
  */
49
83
  delete(id: string, options?: Core.RequestOptions): Core.APIPromise<TemplateDeleteResponse> {
50
84
  return this._client.delete(`/templates/${id}`, options);
@@ -93,7 +127,7 @@ export interface Template {
93
127
  /**
94
128
  * See the section on Metadata.
95
129
  */
96
- metadata?: Record<string, unknown>;
130
+ metadata?: { [key: string]: unknown };
97
131
  }
98
132
 
99
133
  export interface TemplateList {
@@ -137,7 +171,7 @@ export interface TemplateCreateParams {
137
171
  /**
138
172
  * See the section on Metadata.
139
173
  */
140
- metadata?: Record<string, unknown>;
174
+ metadata?: { [key: string]: unknown };
141
175
  }
142
176
 
143
177
  export interface TemplateUpdateParams {
@@ -155,7 +189,7 @@ export interface TemplateUpdateParams {
155
189
  /**
156
190
  * See the section on Metadata.
157
191
  */
158
- metadata?: Record<string, unknown>;
192
+ metadata?: { [key: string]: unknown };
159
193
  }
160
194
 
161
195
  export interface TemplateListParams extends ListParams {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-alpha.3'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.5'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.3";
1
+ export declare const VERSION = "0.1.0-alpha.5";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.0-alpha.3'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-alpha.5'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0-alpha.3'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.5'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map