postgrid-node 0.1.0-alpha.3 → 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 (238) hide show
  1. package/CHANGELOG.md +47 -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 +1 -1
  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
@@ -40,6 +40,19 @@ export class Cheques extends APIResource {
40
40
  * }
41
41
  * }
42
42
  * ```
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const cheque = await client.cheques.create({
47
+ * amount: 1000,
48
+ * bankAccount: 'bank_123',
49
+ * from: 'contact_123',
50
+ * to: 'contact_123',
51
+ * currencyCode: 'USD',
52
+ * number: 123456,
53
+ * size: 'us_letter',
54
+ * });
55
+ * ```
43
56
  */
44
57
  create(body: ChequeCreateParams, options?: Core.RequestOptions): Core.APIPromise<Cheque> {
45
58
  return this._client.post('/cheques', { body, ...options });
@@ -47,6 +60,11 @@ export class Cheques extends APIResource {
47
60
 
48
61
  /**
49
62
  * Retrieve a cheque by ID.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const cheque = await client.cheques.retrieve('id');
67
+ * ```
50
68
  */
51
69
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Cheque> {
52
70
  return this._client.get(`/cheques/${id}`, options);
@@ -54,6 +72,14 @@ export class Cheques extends APIResource {
54
72
 
55
73
  /**
56
74
  * Get a list of cheques.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * // Automatically fetches more pages as needed.
79
+ * for await (const cheque of client.cheques.list()) {
80
+ * // ...
81
+ * }
82
+ * ```
57
83
  */
58
84
  list(query?: ChequeListParams, options?: Core.RequestOptions): Core.PagePromise<ChequesList, Cheque>;
59
85
  list(options?: Core.RequestOptions): Core.PagePromise<ChequesList, Cheque>;
@@ -69,6 +95,11 @@ export class Cheques extends APIResource {
69
95
 
70
96
  /**
71
97
  * Cancel a cheque by ID. Note that this operation cannot be undone.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const cheque = await client.cheques.cancel('id');
102
+ * ```
72
103
  */
73
104
  cancel(id: string, options?: Core.RequestOptions): Core.APIPromise<Cheque> {
74
105
  return this._client.delete(`/cheques/${id}`, options);
@@ -246,7 +277,7 @@ export interface Cheque {
246
277
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
247
278
  * PDFs uploaded with the order.
248
279
  */
249
- mergeVariables?: Record<string, unknown>;
280
+ mergeVariables?: { [key: string]: unknown };
250
281
 
251
282
  /**
252
283
  * The message of the cheque.
@@ -256,7 +287,7 @@ export interface Cheque {
256
287
  /**
257
288
  * See the section on Metadata.
258
289
  */
259
- metadata?: Record<string, unknown>;
290
+ metadata?: { [key: string]: unknown };
260
291
 
261
292
  /**
262
293
  * The number of the cheque. If you don't provide this, it will automatically be
@@ -410,7 +441,7 @@ export interface ChequeCreateParams {
410
441
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
411
442
  * PDFs uploaded with the order.
412
443
  */
413
- mergeVariables?: Record<string, unknown>;
444
+ mergeVariables?: { [key: string]: unknown };
414
445
 
415
446
  /**
416
447
  * The message of the cheque.
@@ -420,7 +451,7 @@ export interface ChequeCreateParams {
420
451
  /**
421
452
  * See the section on Metadata.
422
453
  */
423
- metadata?: Record<string, unknown>;
454
+ metadata?: { [key: string]: unknown };
424
455
 
425
456
  /**
426
457
  * The number of the cheque. If you don't provide this, it will automatically be
@@ -11,6 +11,11 @@ export class URL extends APIResource {
11
11
  * offers document generation and hosting capabilities. This endpoint has a much
12
12
  * higher rate limit than the regular order retrieval endpoint, so it is suitable
13
13
  * for customer-facing use-cases.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const url = await client.cheques.url.retrieve('id');
18
+ * ```
14
19
  */
15
20
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<URLRetrieveResponse> {
16
21
  return this._client.get(`/cheques/${id}/url`, options);
@@ -10,6 +10,12 @@ export class WithDepositReadyPdf extends APIResource {
10
10
  * be called by users with 'Admin' role. In test mode, the preview PDF of the
11
11
  * digitalOnly cheque and the deposit-ready PDF are the same. In live mode, the
12
12
  * deposit-ready will have the full account number.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const cheque =
17
+ * await client.cheques.withDepositReadyPdf.retrieve('id');
18
+ * ```
13
19
  */
14
20
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<ChequesAPI.Cheque> {
15
21
  return this._client.get(`/cheques/${id}/with_deposit_ready_pdf`, options);
@@ -20,6 +20,16 @@ export class Contacts extends APIResource {
20
20
  * _Note that if you create a contact that has identical information to another
21
21
  * contact, this will simply update the description of the existing contact and
22
22
  * return it. This avoids creating duplicate contacts._
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const contact = await client.contacts.create({
27
+ * addressLine1: '90 Canal St Suite 600, Boston MA 90210',
28
+ * countryCode: 'US',
29
+ * firstName: 'Kevin',
30
+ * companyName: 'PostGrid',
31
+ * });
32
+ * ```
23
33
  */
24
34
  create(body: ContactCreateParams, options?: Core.RequestOptions): Core.APIPromise<Contact> {
25
35
  return this._client.post('/contacts', { body, ...options });
@@ -27,6 +37,11 @@ export class Contacts extends APIResource {
27
37
 
28
38
  /**
29
39
  * Retrieve a contact.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const contact = await client.contacts.retrieve('id');
44
+ * ```
30
45
  */
31
46
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Contact> {
32
47
  return this._client.get(`/contacts/${id}`, options);
@@ -34,6 +49,14 @@ export class Contacts extends APIResource {
34
49
 
35
50
  /**
36
51
  * Get a list of contacts.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * // Automatically fetches more pages as needed.
56
+ * for await (const contact of client.contacts.list()) {
57
+ * // ...
58
+ * }
59
+ * ```
37
60
  */
38
61
  list(query?: ContactListParams, options?: Core.RequestOptions): Core.PagePromise<ContactsList, Contact>;
39
62
  list(options?: Core.RequestOptions): Core.PagePromise<ContactsList, Contact>;
@@ -50,6 +73,11 @@ export class Contacts extends APIResource {
50
73
  /**
51
74
  * Delete a contact. Note that this will not affect orders that were sent to this
52
75
  * contact.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const contact = await client.contacts.delete('id');
80
+ * ```
53
81
  */
54
82
  delete(id: string, options?: Core.RequestOptions): Core.APIPromise<ContactDeleteResponse> {
55
83
  return this._client.delete(`/contacts/${id}`, options);
@@ -155,7 +183,7 @@ export interface Contact {
155
183
  /**
156
184
  * See the section on Metadata.
157
185
  */
158
- metadata?: Record<string, unknown>;
186
+ metadata?: { [key: string]: unknown };
159
187
 
160
188
  /**
161
189
  * Phone number of the contact.
@@ -256,7 +284,7 @@ export declare namespace ContactCreateParams {
256
284
  /**
257
285
  * See the section on Metadata.
258
286
  */
259
- metadata?: Record<string, unknown>;
287
+ metadata?: { [key: string]: unknown };
260
288
 
261
289
  /**
262
290
  * Phone number of the contact.
@@ -338,7 +366,7 @@ export declare namespace ContactCreateParams {
338
366
  /**
339
367
  * See the section on Metadata.
340
368
  */
341
- metadata?: Record<string, unknown>;
369
+ metadata?: { [key: string]: unknown };
342
370
 
343
371
  /**
344
372
  * Phone number of the contact.
@@ -59,6 +59,33 @@ export {
59
59
  type LetterCreateParams,
60
60
  type LetterListParams,
61
61
  } from './letters';
62
+ export {
63
+ MailingListImportListResponsesList,
64
+ MailingListImports,
65
+ type MailingListImportCreateResponse,
66
+ type MailingListImportRetrieveResponse,
67
+ type MailingListImportUpdateResponse,
68
+ type MailingListImportListResponse,
69
+ type MailingListImportDeleteResponse,
70
+ type MailingListImportCreateParams,
71
+ type MailingListImportUpdateParams,
72
+ type MailingListImportListParams,
73
+ } from './mailing-list-imports';
74
+ export {
75
+ MailingListListResponsesList,
76
+ MailingLists,
77
+ type MailingListCreateResponse,
78
+ type MailingListRetrieveResponse,
79
+ type MailingListUpdateResponse,
80
+ type MailingListListResponse,
81
+ type MailingListDeleteResponse,
82
+ type MailingListSubmitJobResponse,
83
+ type MailingListCreateParams,
84
+ type MailingListUpdateParams,
85
+ type MailingListListParams,
86
+ type MailingListSubmitJobParams,
87
+ } from './mailing-lists';
88
+ export { OrderProfiles } from './order-profiles/order-profiles';
62
89
  export {
63
90
  PostcardsList,
64
91
  Postcards,
@@ -91,9 +118,21 @@ export {
91
118
  type SelfMailerRetrieveResponse,
92
119
  type SelfMailerListResponse,
93
120
  type SelfMailerCancelResponse,
121
+ type SelfMailerRetrievePreviewURLResponse,
94
122
  type SelfMailerCreateParams,
95
123
  type SelfMailerListParams,
96
124
  } from './self-mailers';
125
+ export {
126
+ SubOrganizationListResponsesList,
127
+ SubOrganizations,
128
+ type SubOrganizationCreateResponse,
129
+ type SubOrganizationRetrieveResponse,
130
+ type SubOrganizationListResponse,
131
+ type SubOrganizationListUsersResponse,
132
+ type SubOrganizationCreateParams,
133
+ type SubOrganizationListParams,
134
+ type SubOrganizationListUsersParams,
135
+ } from './sub-organizations';
97
136
  export {
98
137
  TemplatesList,
99
138
  Templates,
@@ -15,6 +15,15 @@ export class Letters extends APIResource {
15
15
  * - A template ID for the letter
16
16
  * - A URL or file for a PDF for the letter
17
17
  * - Upload the aforementioned PDF file via a multipart form upload request
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const letter = await client.letters.create({
22
+ * from: 'contact_123',
23
+ * html: '<html>Content</html>',
24
+ * to: 'contact_123',
25
+ * });
26
+ * ```
18
27
  */
19
28
  create(body: LetterCreateParams, options?: Core.RequestOptions): Core.APIPromise<Letter> {
20
29
  return this._client.post('/letters', { body, ...options });
@@ -22,6 +31,11 @@ export class Letters extends APIResource {
22
31
 
23
32
  /**
24
33
  * Retrieve a letter by ID.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const letter = await client.letters.retrieve('id');
38
+ * ```
25
39
  */
26
40
  retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Letter> {
27
41
  return this._client.get(`/letters/${id}`, options);
@@ -29,6 +43,14 @@ export class Letters extends APIResource {
29
43
 
30
44
  /**
31
45
  * Get a list of letters.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // Automatically fetches more pages as needed.
50
+ * for await (const letter of client.letters.list()) {
51
+ * // ...
52
+ * }
53
+ * ```
32
54
  */
33
55
  list(query?: LetterListParams, options?: Core.RequestOptions): Core.PagePromise<LettersList, Letter>;
34
56
  list(options?: Core.RequestOptions): Core.PagePromise<LettersList, Letter>;
@@ -44,6 +66,11 @@ export class Letters extends APIResource {
44
66
 
45
67
  /**
46
68
  * Cancel a letter by ID. Note that this operation cannot be undone.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const letter = await client.letters.delete('id');
73
+ * ```
47
74
  */
48
75
  delete(id: string, options?: Core.RequestOptions): Core.APIPromise<Letter> {
49
76
  return this._client.delete(`/letters/${id}`, options);
@@ -56,6 +83,11 @@ export class Letters extends APIResource {
56
83
  * offers document generation and hosting capabilities. This endpoint has a much
57
84
  * higher rate limit than the regular order retrieval endpoint, so it is suitable
58
85
  * for customer-facing use-cases.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const response = await client.letters.url('id');
90
+ * ```
59
91
  */
60
92
  url(id: string, options?: Core.RequestOptions): Core.APIPromise<LetterURLResponse> {
61
93
  return this._client.get(`/letters/${id}/url`, options);
@@ -217,12 +249,12 @@ export interface Letter {
217
249
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
218
250
  * PDFs uploaded with the order.
219
251
  */
220
- mergeVariables?: Record<string, unknown>;
252
+ mergeVariables?: { [key: string]: unknown };
221
253
 
222
254
  /**
223
255
  * See the section on Metadata.
224
256
  */
225
- metadata?: Record<string, unknown>;
257
+ metadata?: { [key: string]: unknown };
226
258
 
227
259
  /**
228
260
  * The ID of the PDF workflow run that created the letter, if any.
@@ -492,12 +524,12 @@ export declare namespace LetterCreateParams {
492
524
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
493
525
  * PDFs uploaded with the order.
494
526
  */
495
- mergeVariables?: Record<string, unknown>;
527
+ mergeVariables?: { [key: string]: unknown };
496
528
 
497
529
  /**
498
530
  * See the section on Metadata.
499
531
  */
500
- metadata?: Record<string, unknown>;
532
+ metadata?: { [key: string]: unknown };
501
533
 
502
534
  /**
503
535
  * If specified, indicates which letter page is perforated. Currently, only the
@@ -717,12 +749,12 @@ export declare namespace LetterCreateParams {
717
749
  * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
718
750
  * PDFs uploaded with the order.
719
751
  */
720
- mergeVariables?: Record<string, unknown>;
752
+ mergeVariables?: { [key: string]: unknown };
721
753
 
722
754
  /**
723
755
  * See the section on Metadata.
724
756
  */
725
- metadata?: Record<string, unknown>;
757
+ metadata?: { [key: string]: unknown };
726
758
 
727
759
  /**
728
760
  * If specified, indicates which letter page is perforated. Currently, only the