postgrid-node 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (265) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +26 -40
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +19 -5
  7. package/core.d.ts.map +1 -1
  8. package/core.js +25 -15
  9. package/core.js.map +1 -1
  10. package/core.mjs +26 -16
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +21 -8
  13. package/index.d.ts +21 -8
  14. package/index.d.ts.map +1 -1
  15. package/index.js +28 -5
  16. package/index.js.map +1 -1
  17. package/index.mjs +28 -5
  18. package/index.mjs.map +1 -1
  19. package/internal/qs/formats.d.ts +6 -0
  20. package/internal/qs/formats.d.ts.map +1 -0
  21. package/internal/qs/formats.js +11 -0
  22. package/internal/qs/formats.js.map +1 -0
  23. package/internal/qs/formats.mjs +8 -0
  24. package/internal/qs/formats.mjs.map +1 -0
  25. package/internal/qs/index.d.ts +10 -0
  26. package/internal/qs/index.d.ts.map +1 -0
  27. package/internal/qs/index.js +14 -0
  28. package/internal/qs/index.js.map +1 -0
  29. package/internal/qs/index.mjs +10 -0
  30. package/internal/qs/index.mjs.map +1 -0
  31. package/internal/qs/stringify.d.ts +3 -0
  32. package/internal/qs/stringify.d.ts.map +1 -0
  33. package/internal/qs/stringify.js +280 -0
  34. package/internal/qs/stringify.js.map +1 -0
  35. package/internal/qs/stringify.mjs +276 -0
  36. package/internal/qs/stringify.mjs.map +1 -0
  37. package/internal/qs/types.d.ts +57 -0
  38. package/internal/qs/types.d.ts.map +1 -0
  39. package/internal/qs/types.js +3 -0
  40. package/internal/qs/types.js.map +1 -0
  41. package/internal/qs/types.mjs +2 -0
  42. package/internal/qs/types.mjs.map +1 -0
  43. package/internal/qs/utils.d.ts +14 -0
  44. package/internal/qs/utils.d.ts.map +1 -0
  45. package/internal/qs/utils.js +229 -0
  46. package/internal/qs/utils.js.map +1 -0
  47. package/internal/qs/utils.mjs +217 -0
  48. package/internal/qs/utils.mjs.map +1 -0
  49. package/package.json +8 -29
  50. package/pagination.d.ts +2 -0
  51. package/pagination.d.ts.map +1 -1
  52. package/pagination.js +2 -1
  53. package/pagination.js.map +1 -1
  54. package/pagination.mjs +2 -1
  55. package/pagination.mjs.map +1 -1
  56. package/resource.d.ts +1 -1
  57. package/resource.d.ts.map +1 -1
  58. package/resource.js.map +1 -1
  59. package/resource.mjs.map +1 -1
  60. package/resources/bank-accounts.d.ts +61 -4
  61. package/resources/bank-accounts.d.ts.map +1 -1
  62. package/resources/bank-accounts.js +25 -0
  63. package/resources/bank-accounts.js.map +1 -1
  64. package/resources/bank-accounts.mjs +25 -0
  65. package/resources/bank-accounts.mjs.map +1 -1
  66. package/resources/boxes.d.ts +80 -15
  67. package/resources/boxes.d.ts.map +1 -1
  68. package/resources/boxes.js +27 -0
  69. package/resources/boxes.js.map +1 -1
  70. package/resources/boxes.mjs +27 -0
  71. package/resources/boxes.mjs.map +1 -1
  72. package/resources/campaigns.d.ts +22 -8
  73. package/resources/campaigns.d.ts.map +1 -1
  74. package/resources/cheques/cheques.d.ts +43 -4
  75. package/resources/cheques/cheques.d.ts.map +1 -1
  76. package/resources/cheques/cheques.js +23 -0
  77. package/resources/cheques/cheques.js.map +1 -1
  78. package/resources/cheques/cheques.mjs +23 -0
  79. package/resources/cheques/cheques.mjs.map +1 -1
  80. package/resources/cheques/url.d.ts +5 -0
  81. package/resources/cheques/url.d.ts.map +1 -1
  82. package/resources/cheques/url.js +5 -0
  83. package/resources/cheques/url.js.map +1 -1
  84. package/resources/cheques/url.mjs +5 -0
  85. package/resources/cheques/url.mjs.map +1 -1
  86. package/resources/cheques/with-deposit-ready-pdf.d.ts +6 -0
  87. package/resources/cheques/with-deposit-ready-pdf.d.ts.map +1 -1
  88. package/resources/cheques/with-deposit-ready-pdf.js +6 -0
  89. package/resources/cheques/with-deposit-ready-pdf.js.map +1 -1
  90. package/resources/cheques/with-deposit-ready-pdf.mjs +6 -0
  91. package/resources/cheques/with-deposit-ready-pdf.mjs.map +1 -1
  92. package/resources/cheques.d.ts +2 -0
  93. package/resources/cheques.d.ts.map +1 -0
  94. package/resources/cheques.js +19 -0
  95. package/resources/cheques.js.map +1 -0
  96. package/resources/cheques.mjs +3 -0
  97. package/resources/cheques.mjs.map +1 -0
  98. package/resources/contacts.d.ts +37 -3
  99. package/resources/contacts.d.ts.map +1 -1
  100. package/resources/contacts.js +20 -0
  101. package/resources/contacts.js.map +1 -1
  102. package/resources/contacts.mjs +20 -0
  103. package/resources/contacts.mjs.map +1 -1
  104. package/resources/index.d.ts +5 -1
  105. package/resources/index.d.ts.map +1 -1
  106. package/resources/index.js +12 -1
  107. package/resources/index.js.map +1 -1
  108. package/resources/index.mjs +4 -0
  109. package/resources/index.mjs.map +1 -1
  110. package/resources/letters.d.ts +50 -6
  111. package/resources/letters.d.ts.map +1 -1
  112. package/resources/letters.js +24 -0
  113. package/resources/letters.js.map +1 -1
  114. package/resources/letters.mjs +24 -0
  115. package/resources/letters.mjs.map +1 -1
  116. package/resources/mailing-list-imports.d.ts +919 -0
  117. package/resources/mailing-list-imports.d.ts.map +1 -0
  118. package/resources/mailing-list-imports.js +95 -0
  119. package/resources/mailing-list-imports.js.map +1 -0
  120. package/resources/mailing-list-imports.mjs +90 -0
  121. package/resources/mailing-list-imports.mjs.map +1 -0
  122. package/resources/mailing-lists.d.ts +398 -0
  123. package/resources/mailing-lists.d.ts.map +1 -0
  124. package/resources/mailing-lists.js +101 -0
  125. package/resources/mailing-lists.js.map +1 -0
  126. package/resources/mailing-lists.mjs +96 -0
  127. package/resources/mailing-lists.mjs.map +1 -0
  128. package/resources/order-profiles/cheques.d.ts +588 -0
  129. package/resources/order-profiles/cheques.d.ts.map +1 -0
  130. package/resources/order-profiles/cheques.js +74 -0
  131. package/resources/order-profiles/cheques.js.map +1 -0
  132. package/resources/order-profiles/cheques.mjs +69 -0
  133. package/resources/order-profiles/cheques.mjs.map +1 -0
  134. package/resources/order-profiles/index.d.ts +6 -0
  135. package/resources/order-profiles/index.d.ts.map +1 -0
  136. package/resources/order-profiles/index.js +19 -0
  137. package/resources/order-profiles/index.js.map +1 -0
  138. package/resources/order-profiles/index.mjs +7 -0
  139. package/resources/order-profiles/index.mjs.map +1 -0
  140. package/resources/order-profiles/letters.d.ts +647 -0
  141. package/resources/order-profiles/letters.d.ts.map +1 -0
  142. package/resources/order-profiles/letters.js +80 -0
  143. package/resources/order-profiles/letters.js.map +1 -0
  144. package/resources/order-profiles/letters.mjs +75 -0
  145. package/resources/order-profiles/letters.mjs.map +1 -0
  146. package/resources/order-profiles/order-profiles.d.ts +22 -0
  147. package/resources/order-profiles/order-profiles.d.ts.map +1 -0
  148. package/resources/order-profiles/order-profiles.js +55 -0
  149. package/resources/order-profiles/order-profiles.js.map +1 -0
  150. package/resources/order-profiles/order-profiles.mjs +28 -0
  151. package/resources/order-profiles/order-profiles.mjs.map +1 -0
  152. package/resources/order-profiles/postcards.d.ts +423 -0
  153. package/resources/order-profiles/postcards.d.ts.map +1 -0
  154. package/resources/order-profiles/postcards.js +73 -0
  155. package/resources/order-profiles/postcards.js.map +1 -0
  156. package/resources/order-profiles/postcards.mjs +68 -0
  157. package/resources/order-profiles/postcards.mjs.map +1 -0
  158. package/resources/order-profiles/self-mailers.d.ts +435 -0
  159. package/resources/order-profiles/self-mailers.d.ts.map +1 -0
  160. package/resources/order-profiles/self-mailers.js +75 -0
  161. package/resources/order-profiles/self-mailers.js.map +1 -0
  162. package/resources/order-profiles/self-mailers.mjs +70 -0
  163. package/resources/order-profiles/self-mailers.mjs.map +1 -0
  164. package/resources/order-profiles.d.ts +2 -0
  165. package/resources/order-profiles.d.ts.map +1 -0
  166. package/resources/order-profiles.js +19 -0
  167. package/resources/order-profiles.js.map +1 -0
  168. package/resources/order-profiles.mjs +3 -0
  169. package/resources/order-profiles.mjs.map +1 -0
  170. package/resources/postcards.d.ts +58 -8
  171. package/resources/postcards.d.ts.map +1 -1
  172. package/resources/postcards.js +26 -0
  173. package/resources/postcards.js.map +1 -1
  174. package/resources/postcards.mjs +26 -0
  175. package/resources/postcards.mjs.map +1 -1
  176. package/resources/reports/exports.d.ts +36 -3
  177. package/resources/reports/exports.d.ts.map +1 -1
  178. package/resources/reports/exports.js +27 -0
  179. package/resources/reports/exports.js.map +1 -1
  180. package/resources/reports/exports.mjs +27 -0
  181. package/resources/reports/exports.mjs.map +1 -1
  182. package/resources/reports/reports.d.ts +76 -8
  183. package/resources/reports/reports.d.ts.map +1 -1
  184. package/resources/reports/reports.js +44 -0
  185. package/resources/reports/reports.js.map +1 -1
  186. package/resources/reports/reports.mjs +44 -0
  187. package/resources/reports/reports.mjs.map +1 -1
  188. package/resources/reports.d.ts +2 -0
  189. package/resources/reports.d.ts.map +1 -0
  190. package/resources/reports.js +19 -0
  191. package/resources/reports.js.map +1 -0
  192. package/resources/reports.mjs +3 -0
  193. package/resources/reports.mjs.map +1 -0
  194. package/resources/self-mailers.d.ts +99 -15
  195. package/resources/self-mailers.d.ts.map +1 -1
  196. package/resources/self-mailers.js +38 -0
  197. package/resources/self-mailers.js.map +1 -1
  198. package/resources/self-mailers.mjs +38 -0
  199. package/resources/self-mailers.mjs.map +1 -1
  200. package/resources/shared.d.ts +6 -2
  201. package/resources/shared.d.ts.map +1 -1
  202. package/resources/sub-organizations.d.ts +394 -0
  203. package/resources/sub-organizations.d.ts.map +1 -0
  204. package/resources/sub-organizations.js +63 -0
  205. package/resources/sub-organizations.js.map +1 -0
  206. package/resources/sub-organizations.mjs +58 -0
  207. package/resources/sub-organizations.mjs.map +1 -0
  208. package/resources/templates.d.ts +43 -3
  209. package/resources/templates.d.ts.map +1 -1
  210. package/resources/templates.js +26 -0
  211. package/resources/templates.js.map +1 -1
  212. package/resources/templates.mjs +26 -0
  213. package/resources/templates.mjs.map +1 -1
  214. package/resources.d.ts +2 -0
  215. package/resources.d.ts.map +1 -0
  216. package/resources.js +18 -0
  217. package/resources.js.map +1 -0
  218. package/resources.mjs +2 -0
  219. package/resources.mjs.map +1 -0
  220. package/src/_shims/index.d.ts +2 -0
  221. package/src/_shims/index.js +5 -1
  222. package/src/_shims/index.mjs +5 -1
  223. package/src/core.ts +44 -16
  224. package/src/index.ts +112 -11
  225. package/src/internal/qs/LICENSE.md +13 -0
  226. package/src/internal/qs/README.md +3 -0
  227. package/src/internal/qs/formats.ts +9 -0
  228. package/src/internal/qs/index.ts +13 -0
  229. package/src/internal/qs/stringify.ts +388 -0
  230. package/src/internal/qs/types.ts +71 -0
  231. package/src/internal/qs/utils.ts +265 -0
  232. package/src/pagination.ts +6 -1
  233. package/src/resource.ts +1 -1
  234. package/src/resources/bank-accounts.ts +57 -4
  235. package/src/resources/boxes.ts +50 -15
  236. package/src/resources/campaigns.ts +8 -8
  237. package/src/resources/cheques/cheques.ts +35 -4
  238. package/src/resources/cheques/url.ts +5 -0
  239. package/src/resources/cheques/with-deposit-ready-pdf.ts +6 -0
  240. package/src/resources/cheques.ts +3 -0
  241. package/src/resources/contacts.ts +31 -3
  242. package/src/resources/index.ts +39 -0
  243. package/src/resources/letters.ts +38 -6
  244. package/src/resources/mailing-list-imports.ts +1076 -0
  245. package/src/resources/mailing-lists.ts +511 -0
  246. package/src/resources/order-profiles/cheques.ts +888 -0
  247. package/src/resources/order-profiles/index.ts +55 -0
  248. package/src/resources/order-profiles/letters.ts +956 -0
  249. package/src/resources/order-profiles/order-profiles.ts +133 -0
  250. package/src/resources/order-profiles/postcards.ts +694 -0
  251. package/src/resources/order-profiles/self-mailers.ts +707 -0
  252. package/src/resources/order-profiles.ts +3 -0
  253. package/src/resources/postcards.ts +42 -8
  254. package/src/resources/reports/exports.ts +30 -3
  255. package/src/resources/reports/reports.ts +60 -8
  256. package/src/resources/reports.ts +3 -0
  257. package/src/resources/self-mailers.ts +80 -14
  258. package/src/resources/shared.ts +2 -2
  259. package/src/resources/sub-organizations.ts +518 -0
  260. package/src/resources/templates.ts +37 -3
  261. package/src/resources.ts +1 -0
  262. package/src/version.ts +1 -1
  263. package/version.d.ts +1 -1
  264. package/version.js +1 -1
  265. package/version.mjs +1 -1
@@ -16,6 +16,17 @@ export class Postcards extends APIResource {
16
16
  * - A URL or file for a 2 page PDF where the first page is the front of the
17
17
  * postcard and the second page is the back
18
18
  * - Upload the aforementioned PDF file via a multipart form upload request
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const postcard = await client.postcards.create({
23
+ * backHTML: '<html>Back</html>',
24
+ * frontHTML: '<html>Front</html>',
25
+ * size: '6x4',
26
+ * to: 'contact_456',
27
+ * from: 'contact_123',
28
+ * });
29
+ * ```
19
30
  */
20
31
  create(body: PostcardCreateParams, options?: Core.RequestOptions): Core.APIPromise<Postcard> {
21
32
  return this._client.post('/postcards', { body, ...options });
@@ -23,6 +34,11 @@ export class Postcards extends APIResource {
23
34
 
24
35
  /**
25
36
  * Retrieve a postcard by ID.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const postcard = await client.postcards.retrieve('id');
41
+ * ```
26
42
  */
27
43
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Postcard> {
28
44
  return this._client.get(`/postcards/${id}`, options);
@@ -30,6 +46,14 @@ export class Postcards extends APIResource {
30
46
 
31
47
  /**
32
48
  * Get a list of postcards.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // Automatically fetches more pages as needed.
53
+ * for await (const postcard of client.postcards.list()) {
54
+ * // ...
55
+ * }
56
+ * ```
33
57
  */
34
58
  list(query?: PostcardListParams, options?: Core.RequestOptions): Core.PagePromise<PostcardsList, Postcard>;
35
59
  list(options?: Core.RequestOptions): Core.PagePromise<PostcardsList, Postcard>;
@@ -45,6 +69,11 @@ export class Postcards extends APIResource {
45
69
 
46
70
  /**
47
71
  * Cancel a postcard by ID. Note that this operation cannot be undone.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const postcard = await client.postcards.delete('id');
76
+ * ```
48
77
  */
49
78
  delete(id: string, options?: Core.RequestOptions): Core.APIPromise<Postcard> {
50
79
  return this._client.delete(`/postcards/${id}`, options);
@@ -57,6 +86,11 @@ export class Postcards extends APIResource {
57
86
  * offers document generation and hosting capabilities. This endpoint has a much
58
87
  * higher rate limit than the regular order retrieval endpoint, so it is suitable
59
88
  * for customer-facing use-cases.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const response = await client.postcards.url('id');
93
+ * ```
60
94
  */
61
95
  url(id: string, options?: Core.RequestOptions): Core.APIPromise<PostcardURLResponse> {
62
96
  return this._client.get(`/postcards/${id}/url`, options);
@@ -187,12 +221,12 @@ export interface Postcard {
187
221
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
188
222
  * PDFs uploaded with the order.
189
223
  */
190
- mergeVariables?: Record<string, unknown>;
224
+ mergeVariables?: { [key: string]: unknown };
191
225
 
192
226
  /**
193
227
  * See the section on Metadata.
194
228
  */
195
- metadata?: Record<string, unknown>;
229
+ metadata?: { [key: string]: unknown };
196
230
 
197
231
  /**
198
232
  * The tracking number of this order. Populated after an express/certified order
@@ -324,12 +358,12 @@ export declare namespace PostcardCreateParams {
324
358
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
325
359
  * PDFs uploaded with the order.
326
360
  */
327
- mergeVariables?: Record<string, unknown>;
361
+ mergeVariables?: { [key: string]: unknown };
328
362
 
329
363
  /**
330
364
  * See the section on Metadata.
331
365
  */
332
- metadata?: Record<string, unknown>;
366
+ metadata?: { [key: string]: unknown };
333
367
 
334
368
  /**
335
369
  * This order will transition from `ready` to `printing` on the day after this
@@ -423,12 +457,12 @@ export declare namespace PostcardCreateParams {
423
457
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
424
458
  * PDFs uploaded with the order.
425
459
  */
426
- mergeVariables?: Record<string, unknown>;
460
+ mergeVariables?: { [key: string]: unknown };
427
461
 
428
462
  /**
429
463
  * See the section on Metadata.
430
464
  */
431
- metadata?: Record<string, unknown>;
465
+ metadata?: { [key: string]: unknown };
432
466
 
433
467
  /**
434
468
  * This order will transition from `ready` to `printing` on the day after this
@@ -508,12 +542,12 @@ export declare namespace PostcardCreateParams {
508
542
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
509
543
  * PDFs uploaded with the order.
510
544
  */
511
- mergeVariables?: Record<string, unknown>;
545
+ mergeVariables?: { [key: string]: unknown };
512
546
 
513
547
  /**
514
548
  * See the section on Metadata.
515
549
  */
516
- metadata?: Record<string, unknown>;
550
+ metadata?: { [key: string]: unknown };
517
551
 
518
552
  /**
519
553
  * This order will transition from `ready` to `printing` on the day after this
@@ -9,6 +9,17 @@ export class Exports extends APIResource {
9
9
  * asynchronously and generates a downloadable CSV file with the full results. Your
10
10
  * queries can run for up to 13 minutes the resulting file can be up to 100mb
11
11
  * large.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const _export = await client.reports.exports.create(
16
+ * 'reportID',
17
+ * {
18
+ * description: 'October Orders Export',
19
+ * params: ['2023-10-01T00:00:00Z'],
20
+ * },
21
+ * );
22
+ * ```
12
23
  */
13
24
  create(
14
25
  reportId: string,
@@ -21,6 +32,14 @@ export class Exports extends APIResource {
21
32
  /**
22
33
  * Retrieve the status and details of a specific report export job. Check the
23
34
  * `outputURL` property for the download link once generation is complete.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const _export = await client.reports.exports.retrieve(
39
+ * 'reportID',
40
+ * 'exportID',
41
+ * );
42
+ * ```
24
43
  */
25
44
  retrieve(
26
45
  reportId: string,
@@ -34,6 +53,14 @@ export class Exports extends APIResource {
34
53
  * Delete a completed or failed report export job and its associated output file
35
54
  * (if any). This action cannot be undone. You cannot delete an export that is
36
55
  * still generating.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const _export = await client.reports.exports.delete(
60
+ * 'reportID',
61
+ * 'exportID',
62
+ * );
63
+ * ```
37
64
  */
38
65
  delete(
39
66
  reportId: string,
@@ -91,7 +118,7 @@ export interface ExportCreateResponse {
91
118
  /**
92
119
  * Optional key-value metadata associated with the export.
93
120
  */
94
- metadata?: Record<string, string>;
121
+ metadata?: { [key: string]: string };
95
122
 
96
123
  /**
97
124
  * A signed URL to download the exported data (CSV format). Available when
@@ -184,7 +211,7 @@ export interface ExportRetrieveResponse {
184
211
  /**
185
212
  * Optional key-value metadata associated with the export.
186
213
  */
187
- metadata?: Record<string, string>;
214
+ metadata?: { [key: string]: string };
188
215
 
189
216
  /**
190
217
  * A signed URL to download the exported data (CSV format). Available when
@@ -254,7 +281,7 @@ export interface ExportCreateParams {
254
281
  /**
255
282
  * Optional key-value metadata associated with the export.
256
283
  */
257
- metadata?: Record<string, string>;
284
+ metadata?: { [key: string]: string };
258
285
 
259
286
  /**
260
287
  * Optional parameters to bind to the SQL query of the associated report.
@@ -22,6 +22,16 @@ export class Reports extends APIResource {
22
22
  *
23
23
  * If you just want to do ad-hoc queries, you should use the `/reports/samples`
24
24
  * endpoint.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const report = await client.reports.create({
29
+ * sqlQuery:
30
+ * 'SELECT id, status FROM orders WHERE created_at > ?',
31
+ * description: 'Recent Orders',
32
+ * metadata: { team: 'Sales' },
33
+ * });
34
+ * ```
25
35
  */
26
36
  create(body: ReportCreateParams, options?: Core.RequestOptions): Core.APIPromise<ReportCreateResponse> {
27
37
  return this._client.post('/reports/', { body, ...options });
@@ -29,6 +39,11 @@ export class Reports extends APIResource {
29
39
 
30
40
  /**
31
41
  * Retrieve the details of a specific saved report by its ID.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const report = await client.reports.retrieve('id');
46
+ * ```
32
47
  */
33
48
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<ReportRetrieveResponse> {
34
49
  return this._client.get(`/reports/${id}`, options);
@@ -37,6 +52,13 @@ export class Reports extends APIResource {
37
52
  /**
38
53
  * Update an existing saved report definition. You can change the query,
39
54
  * description, or metadata.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const report = await client.reports.update('id', {
59
+ * description: 'Recent Orders (Updated)',
60
+ * });
61
+ * ```
40
62
  */
41
63
  update(
42
64
  id: string,
@@ -48,6 +70,14 @@ export class Reports extends APIResource {
48
70
 
49
71
  /**
50
72
  * Retrieve a list of saved reports for your organization.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * // Automatically fetches more pages as needed.
77
+ * for await (const reportListResponse of client.reports.list()) {
78
+ * // ...
79
+ * }
80
+ * ```
51
81
  */
52
82
  list(
53
83
  query?: ReportListParams,
@@ -67,6 +97,11 @@ export class Reports extends APIResource {
67
97
  /**
68
98
  * Delete a saved report definition. This action cannot be undone. Associated
69
99
  * exports are not automatically deleted.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const report = await client.reports.delete('id');
104
+ * ```
70
105
  */
71
106
  delete(id: string, options?: Core.RequestOptions): Core.APIPromise<ReportDeleteResponse> {
72
107
  return this._client.delete(`/reports/${id}`, options);
@@ -76,6 +111,15 @@ export class Reports extends APIResource {
76
111
  * Run an ad-hoc SQL query against your data lake and get a sample of the results.
77
112
  * This is useful for quickly testing queries without saving them as a report. The
78
113
  * query execution time and result size are limited.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * const response = await client.reports.runAdHocQuery({
118
+ * sqlQuery: 'SELECT id FROM contacts LIMIT 5',
119
+ * limit: 5,
120
+ * params: [],
121
+ * });
122
+ * ```
79
123
  */
80
124
  runAdHocQuery(
81
125
  body: ReportRunAdHocQueryParams,
@@ -89,6 +133,14 @@ export class Reports extends APIResource {
89
133
  * This allows getting up to 1000 rows of resutls but the runtime of the query is
90
134
  * limited to 30 seconds. If you need more rows or longer runtime, you should
91
135
  * create an export from this report.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const response = await client.reports.sample('id', {
140
+ * limit: 10,
141
+ * params: ['2023-10-01T00:00:00Z'],
142
+ * });
143
+ * ```
92
144
  */
93
145
  sample(
94
146
  id: string,
@@ -143,7 +195,7 @@ export interface ReportCreateResponse {
143
195
  /**
144
196
  * Optional key-value metadata associated with the report.
145
197
  */
146
- metadata?: Record<string, string>;
198
+ metadata?: { [key: string]: string };
147
199
  }
148
200
 
149
201
  /**
@@ -188,7 +240,7 @@ export interface ReportRetrieveResponse {
188
240
  /**
189
241
  * Optional key-value metadata associated with the report.
190
242
  */
191
- metadata?: Record<string, string>;
243
+ metadata?: { [key: string]: string };
192
244
  }
193
245
 
194
246
  /**
@@ -233,7 +285,7 @@ export interface ReportUpdateResponse {
233
285
  /**
234
286
  * Optional key-value metadata associated with the report.
235
287
  */
236
- metadata?: Record<string, string>;
288
+ metadata?: { [key: string]: string };
237
289
  }
238
290
 
239
291
  /**
@@ -278,7 +330,7 @@ export interface ReportListResponse {
278
330
  /**
279
331
  * Optional key-value metadata associated with the report.
280
332
  */
281
- metadata?: Record<string, string>;
333
+ metadata?: { [key: string]: string };
282
334
  }
283
335
 
284
336
  /**
@@ -308,7 +360,7 @@ export interface ReportRunAdHocQueryResponse {
308
360
  /**
309
361
  * The actual data records returned by the sample query.
310
362
  */
311
- records: Array<Record<string, unknown>>;
363
+ records: Array<{ [key: string]: unknown }>;
312
364
 
313
365
  /**
314
366
  * The ID of the report this sample was generated from, or null for ad-hoc samples.
@@ -328,7 +380,7 @@ export interface ReportSampleResponse {
328
380
  /**
329
381
  * The actual data records returned by the sample query.
330
382
  */
331
- records: Array<Record<string, unknown>>;
383
+ records: Array<{ [key: string]: unknown }>;
332
384
 
333
385
  /**
334
386
  * The ID of the report this sample was generated from, or null for ad-hoc samples.
@@ -350,7 +402,7 @@ export interface ReportCreateParams {
350
402
  /**
351
403
  * Optional key-value metadata associated with the report.
352
404
  */
353
- metadata?: Record<string, string>;
405
+ metadata?: { [key: string]: string };
354
406
  }
355
407
 
356
408
  export interface ReportUpdateParams {
@@ -362,7 +414,7 @@ export interface ReportUpdateParams {
362
414
  /**
363
415
  * Optional key-value metadata associated with the report. Set to null to remove.
364
416
  */
365
- metadata?: Record<string, string> | null;
417
+ metadata?: { [key: string]: string } | null;
366
418
 
367
419
  /**
368
420
  * The SQL query defining the report.
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './reports/index';
@@ -16,6 +16,17 @@ export class SelfMailers extends APIResource {
16
16
  * - A URL or file for a 2 page PDF where the first page is the outside of the
17
17
  * self-mailer and the second page is the inside
18
18
  * - Upload the aforementioned PDF file via a multipart form upload request
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const selfMailer = await client.selfMailers.create({
23
+ * from: 'contact_123',
24
+ * insideHTML: '<html>Inside</html>',
25
+ * outsideHTML: '<html>Outside</html>',
26
+ * size: '8.5x11_bifold',
27
+ * to: 'contact_456',
28
+ * });
29
+ * ```
19
30
  */
20
31
  create(
21
32
  body: SelfMailerCreateParams,
@@ -26,6 +37,11 @@ export class SelfMailers extends APIResource {
26
37
 
27
38
  /**
28
39
  * Retrieve a self-mailer by ID.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const selfMailer = await client.selfMailers.retrieve('id');
44
+ * ```
29
45
  */
30
46
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<SelfMailerRetrieveResponse> {
31
47
  return this._client.get(`/self_mailers/${id}`, options);
@@ -33,6 +49,14 @@ export class SelfMailers extends APIResource {
33
49
 
34
50
  /**
35
51
  * Get a list of self-mailers.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * // Automatically fetches more pages as needed.
56
+ * for await (const selfMailerListResponse of client.selfMailers.list()) {
57
+ * // ...
58
+ * }
59
+ * ```
36
60
  */
37
61
  list(
38
62
  query?: SelfMailerListParams,
@@ -51,10 +75,36 @@ export class SelfMailers extends APIResource {
51
75
 
52
76
  /**
53
77
  * Cancel a self-mailer by ID. Note that this operation cannot be undone.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const response = await client.selfMailers.cancel('id');
82
+ * ```
54
83
  */
55
84
  cancel(id: string, options?: Core.RequestOptions): Core.APIPromise<SelfMailerCancelResponse> {
56
85
  return this._client.delete(`/self_mailers/${id}`, options);
57
86
  }
87
+
88
+ /**
89
+ * Retrieve a self-mailer preview URL.
90
+ *
91
+ * This is only available for customers with our document management addon, which
92
+ * offers document generation and hosting capabilities. This endpoint has a much
93
+ * higher rate limit than the regular order retrieval endpoint, so it is suitable
94
+ * for customer-facing use-cases.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const response =
99
+ * await client.selfMailers.retrievePreviewURL('id');
100
+ * ```
101
+ */
102
+ retrievePreviewURL(
103
+ id: string,
104
+ options?: Core.RequestOptions,
105
+ ): Core.APIPromise<SelfMailerRetrievePreviewURLResponse> {
106
+ return this._client.get(`/self_mailers/${id}/url`, options);
107
+ }
58
108
  }
59
109
 
60
110
  export class SelfMailerListResponsesList extends List<SelfMailerListResponse> {}
@@ -181,12 +231,12 @@ export interface SelfMailerCreateResponse {
181
231
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
182
232
  * PDFs uploaded with the order.
183
233
  */
184
- mergeVariables?: Record<string, unknown>;
234
+ mergeVariables?: { [key: string]: unknown };
185
235
 
186
236
  /**
187
237
  * See the section on Metadata.
188
238
  */
189
- metadata?: Record<string, unknown>;
239
+ metadata?: { [key: string]: unknown };
190
240
 
191
241
  /**
192
242
  * The tracking number of this order. Populated after an express/certified order
@@ -329,12 +379,12 @@ export interface SelfMailerRetrieveResponse {
329
379
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
330
380
  * PDFs uploaded with the order.
331
381
  */
332
- mergeVariables?: Record<string, unknown>;
382
+ mergeVariables?: { [key: string]: unknown };
333
383
 
334
384
  /**
335
385
  * See the section on Metadata.
336
386
  */
337
- metadata?: Record<string, unknown>;
387
+ metadata?: { [key: string]: unknown };
338
388
 
339
389
  /**
340
390
  * The tracking number of this order. Populated after an express/certified order
@@ -477,12 +527,12 @@ export interface SelfMailerListResponse {
477
527
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
478
528
  * PDFs uploaded with the order.
479
529
  */
480
- mergeVariables?: Record<string, unknown>;
530
+ mergeVariables?: { [key: string]: unknown };
481
531
 
482
532
  /**
483
533
  * See the section on Metadata.
484
534
  */
485
- metadata?: Record<string, unknown>;
535
+ metadata?: { [key: string]: unknown };
486
536
 
487
537
  /**
488
538
  * The tracking number of this order. Populated after an express/certified order
@@ -625,12 +675,12 @@ export interface SelfMailerCancelResponse {
625
675
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
626
676
  * PDFs uploaded with the order.
627
677
  */
628
- mergeVariables?: Record<string, unknown>;
678
+ mergeVariables?: { [key: string]: unknown };
629
679
 
630
680
  /**
631
681
  * See the section on Metadata.
632
682
  */
633
- metadata?: Record<string, unknown>;
683
+ metadata?: { [key: string]: unknown };
634
684
 
635
685
  /**
636
686
  * The tracking number of this order. Populated after an express/certified order
@@ -651,6 +701,21 @@ export interface SelfMailerCancelResponse {
651
701
  url?: string;
652
702
  }
653
703
 
704
+ export interface SelfMailerRetrievePreviewURLResponse {
705
+ /**
706
+ * A unique ID prefixed with self*mailer*
707
+ */
708
+ id: string;
709
+
710
+ object: string;
711
+
712
+ /**
713
+ * A signed URL linking to the order preview PDF. The link remains valid for 15
714
+ * minutes from the time of the API call.
715
+ */
716
+ url: string;
717
+ }
718
+
654
719
  export type SelfMailerCreateParams =
655
720
  | SelfMailerCreateParams.SelfMailerCreateWithHTML
656
721
  | SelfMailerCreateParams.SelfMailerCreateWithTemplate
@@ -734,12 +799,12 @@ export declare namespace SelfMailerCreateParams {
734
799
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
735
800
  * PDFs uploaded with the order.
736
801
  */
737
- mergeVariables?: Record<string, unknown>;
802
+ mergeVariables?: { [key: string]: unknown };
738
803
 
739
804
  /**
740
805
  * See the section on Metadata.
741
806
  */
742
- metadata?: Record<string, unknown>;
807
+ metadata?: { [key: string]: unknown };
743
808
 
744
809
  /**
745
810
  * This order will transition from `ready` to `printing` on the day after this
@@ -833,12 +898,12 @@ export declare namespace SelfMailerCreateParams {
833
898
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
834
899
  * PDFs uploaded with the order.
835
900
  */
836
- mergeVariables?: Record<string, unknown>;
901
+ mergeVariables?: { [key: string]: unknown };
837
902
 
838
903
  /**
839
904
  * See the section on Metadata.
840
905
  */
841
- metadata?: Record<string, unknown>;
906
+ metadata?: { [key: string]: unknown };
842
907
 
843
908
  /**
844
909
  * This order will transition from `ready` to `printing` on the day after this
@@ -917,12 +982,12 @@ export declare namespace SelfMailerCreateParams {
917
982
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
918
983
  * PDFs uploaded with the order.
919
984
  */
920
- mergeVariables?: Record<string, unknown>;
985
+ mergeVariables?: { [key: string]: unknown };
921
986
 
922
987
  /**
923
988
  * See the section on Metadata.
924
989
  */
925
- metadata?: Record<string, unknown>;
990
+ metadata?: { [key: string]: unknown };
926
991
 
927
992
  /**
928
993
  * This order will transition from `ready` to `printing` on the day after this
@@ -951,6 +1016,7 @@ export declare namespace SelfMailers {
951
1016
  type SelfMailerRetrieveResponse as SelfMailerRetrieveResponse,
952
1017
  type SelfMailerListResponse as SelfMailerListResponse,
953
1018
  type SelfMailerCancelResponse as SelfMailerCancelResponse,
1019
+ type SelfMailerRetrievePreviewURLResponse as SelfMailerRetrievePreviewURLResponse,
954
1020
  SelfMailerListResponsesList as SelfMailerListResponsesList,
955
1021
  type SelfMailerCreateParams as SelfMailerCreateParams,
956
1022
  type SelfMailerListParams as SelfMailerListParams,
@@ -75,7 +75,7 @@ export interface ContactCreateWithCompanyName {
75
75
  /**
76
76
  * See the section on Metadata.
77
77
  */
78
- metadata?: Record<string, unknown>;
78
+ metadata?: { [key: string]: unknown };
79
79
 
80
80
  /**
81
81
  * Phone number of the contact.
@@ -157,7 +157,7 @@ export interface ContactCreateWithFirstName {
157
157
  /**
158
158
  * See the section on Metadata.
159
159
  */
160
- metadata?: Record<string, unknown>;
160
+ metadata?: { [key: string]: unknown };
161
161
 
162
162
  /**
163
163
  * Phone number of the contact.