postgrid-node 0.2.0 → 0.4.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 (239) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +18 -26
  3. package/client.d.mts +8 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +8 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +9 -1
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +60 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +60 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +107 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +101 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/internal/tslib.js +17 -17
  28. package/package.json +11 -1
  29. package/pagination.d.mts +2 -0
  30. package/pagination.d.mts.map +1 -0
  31. package/pagination.d.ts +2 -0
  32. package/pagination.d.ts.map +1 -0
  33. package/pagination.js +6 -0
  34. package/pagination.js.map +1 -0
  35. package/pagination.mjs +2 -0
  36. package/pagination.mjs.map +1 -0
  37. package/resources/index.d.mts +1 -1
  38. package/resources/index.d.mts.map +1 -1
  39. package/resources/index.d.ts +1 -1
  40. package/resources/index.d.ts.map +1 -1
  41. package/resources/index.js.map +1 -1
  42. package/resources/index.mjs +1 -1
  43. package/resources/index.mjs.map +1 -1
  44. package/resources/print-mail/bank-accounts.d.mts +9 -14
  45. package/resources/print-mail/bank-accounts.d.mts.map +1 -1
  46. package/resources/print-mail/bank-accounts.d.ts +9 -14
  47. package/resources/print-mail/bank-accounts.d.ts.map +1 -1
  48. package/resources/print-mail/bank-accounts.js +9 -3
  49. package/resources/print-mail/bank-accounts.js.map +1 -1
  50. package/resources/print-mail/bank-accounts.mjs +9 -3
  51. package/resources/print-mail/bank-accounts.mjs.map +1 -1
  52. package/resources/print-mail/boxes.d.mts +14 -566
  53. package/resources/print-mail/boxes.d.mts.map +1 -1
  54. package/resources/print-mail/boxes.d.ts +14 -566
  55. package/resources/print-mail/boxes.d.ts.map +1 -1
  56. package/resources/print-mail/boxes.js +6 -2
  57. package/resources/print-mail/boxes.js.map +1 -1
  58. package/resources/print-mail/boxes.mjs +6 -2
  59. package/resources/print-mail/boxes.mjs.map +1 -1
  60. package/resources/print-mail/campaigns.d.mts +9 -16
  61. package/resources/print-mail/campaigns.d.mts.map +1 -1
  62. package/resources/print-mail/campaigns.d.ts +9 -16
  63. package/resources/print-mail/campaigns.d.ts.map +1 -1
  64. package/resources/print-mail/campaigns.js +6 -2
  65. package/resources/print-mail/campaigns.js.map +1 -1
  66. package/resources/print-mail/campaigns.mjs +6 -2
  67. package/resources/print-mail/campaigns.mjs.map +1 -1
  68. package/resources/print-mail/cheques.d.mts +13 -426
  69. package/resources/print-mail/cheques.d.mts.map +1 -1
  70. package/resources/print-mail/cheques.d.ts +13 -426
  71. package/resources/print-mail/cheques.d.ts.map +1 -1
  72. package/resources/print-mail/cheques.js +6 -2
  73. package/resources/print-mail/cheques.js.map +1 -1
  74. package/resources/print-mail/cheques.mjs +6 -2
  75. package/resources/print-mail/cheques.mjs.map +1 -1
  76. package/resources/print-mail/contacts.d.mts +11 -152
  77. package/resources/print-mail/contacts.d.mts.map +1 -1
  78. package/resources/print-mail/contacts.d.ts +11 -152
  79. package/resources/print-mail/contacts.d.ts.map +1 -1
  80. package/resources/print-mail/contacts.js +6 -2
  81. package/resources/print-mail/contacts.js.map +1 -1
  82. package/resources/print-mail/contacts.mjs +6 -2
  83. package/resources/print-mail/contacts.mjs.map +1 -1
  84. package/resources/print-mail/index.d.mts +14 -14
  85. package/resources/print-mail/index.d.mts.map +1 -1
  86. package/resources/print-mail/index.d.ts +14 -14
  87. package/resources/print-mail/index.d.ts.map +1 -1
  88. package/resources/print-mail/index.js.map +1 -1
  89. package/resources/print-mail/index.mjs.map +1 -1
  90. package/resources/print-mail/letters.d.mts +14 -565
  91. package/resources/print-mail/letters.d.mts.map +1 -1
  92. package/resources/print-mail/letters.d.ts +14 -565
  93. package/resources/print-mail/letters.d.ts.map +1 -1
  94. package/resources/print-mail/letters.js +6 -2
  95. package/resources/print-mail/letters.js.map +1 -1
  96. package/resources/print-mail/letters.mjs +6 -2
  97. package/resources/print-mail/letters.mjs.map +1 -1
  98. package/resources/print-mail/mailing-list-imports.d.mts +9 -17
  99. package/resources/print-mail/mailing-list-imports.d.mts.map +1 -1
  100. package/resources/print-mail/mailing-list-imports.d.ts +9 -17
  101. package/resources/print-mail/mailing-list-imports.d.ts.map +1 -1
  102. package/resources/print-mail/mailing-list-imports.js +6 -3
  103. package/resources/print-mail/mailing-list-imports.js.map +1 -1
  104. package/resources/print-mail/mailing-list-imports.mjs +6 -3
  105. package/resources/print-mail/mailing-list-imports.mjs.map +1 -1
  106. package/resources/print-mail/mailing-lists.d.mts +9 -17
  107. package/resources/print-mail/mailing-lists.d.mts.map +1 -1
  108. package/resources/print-mail/mailing-lists.d.ts +9 -17
  109. package/resources/print-mail/mailing-lists.d.ts.map +1 -1
  110. package/resources/print-mail/mailing-lists.js +9 -3
  111. package/resources/print-mail/mailing-lists.js.map +1 -1
  112. package/resources/print-mail/mailing-lists.mjs +9 -3
  113. package/resources/print-mail/mailing-lists.mjs.map +1 -1
  114. package/resources/print-mail/order-profiles/cheques.d.mts +80 -90
  115. package/resources/print-mail/order-profiles/cheques.d.mts.map +1 -1
  116. package/resources/print-mail/order-profiles/cheques.d.ts +80 -90
  117. package/resources/print-mail/order-profiles/cheques.d.ts.map +1 -1
  118. package/resources/print-mail/order-profiles/cheques.js +9 -3
  119. package/resources/print-mail/order-profiles/cheques.js.map +1 -1
  120. package/resources/print-mail/order-profiles/cheques.mjs +9 -3
  121. package/resources/print-mail/order-profiles/cheques.mjs.map +1 -1
  122. package/resources/print-mail/order-profiles/index.d.mts +4 -4
  123. package/resources/print-mail/order-profiles/index.d.mts.map +1 -1
  124. package/resources/print-mail/order-profiles/index.d.ts +4 -4
  125. package/resources/print-mail/order-profiles/index.d.ts.map +1 -1
  126. package/resources/print-mail/order-profiles/index.js.map +1 -1
  127. package/resources/print-mail/order-profiles/index.mjs.map +1 -1
  128. package/resources/print-mail/order-profiles/letters.d.mts +9 -17
  129. package/resources/print-mail/order-profiles/letters.d.mts.map +1 -1
  130. package/resources/print-mail/order-profiles/letters.d.ts +9 -17
  131. package/resources/print-mail/order-profiles/letters.d.ts.map +1 -1
  132. package/resources/print-mail/order-profiles/letters.js +9 -3
  133. package/resources/print-mail/order-profiles/letters.js.map +1 -1
  134. package/resources/print-mail/order-profiles/letters.mjs +9 -3
  135. package/resources/print-mail/order-profiles/letters.mjs.map +1 -1
  136. package/resources/print-mail/order-profiles/order-profiles.d.mts +8 -8
  137. package/resources/print-mail/order-profiles/order-profiles.d.mts.map +1 -1
  138. package/resources/print-mail/order-profiles/order-profiles.d.ts +8 -8
  139. package/resources/print-mail/order-profiles/order-profiles.d.ts.map +1 -1
  140. package/resources/print-mail/order-profiles/order-profiles.js.map +1 -1
  141. package/resources/print-mail/order-profiles/order-profiles.mjs.map +1 -1
  142. package/resources/print-mail/order-profiles/postcards.d.mts +9 -17
  143. package/resources/print-mail/order-profiles/postcards.d.mts.map +1 -1
  144. package/resources/print-mail/order-profiles/postcards.d.ts +9 -17
  145. package/resources/print-mail/order-profiles/postcards.d.ts.map +1 -1
  146. package/resources/print-mail/order-profiles/postcards.js +9 -3
  147. package/resources/print-mail/order-profiles/postcards.js.map +1 -1
  148. package/resources/print-mail/order-profiles/postcards.mjs +9 -3
  149. package/resources/print-mail/order-profiles/postcards.mjs.map +1 -1
  150. package/resources/print-mail/order-profiles/self-mailers.d.mts +9 -17
  151. package/resources/print-mail/order-profiles/self-mailers.d.mts.map +1 -1
  152. package/resources/print-mail/order-profiles/self-mailers.d.ts +9 -17
  153. package/resources/print-mail/order-profiles/self-mailers.d.ts.map +1 -1
  154. package/resources/print-mail/order-profiles/self-mailers.js +6 -3
  155. package/resources/print-mail/order-profiles/self-mailers.js.map +1 -1
  156. package/resources/print-mail/order-profiles/self-mailers.mjs +6 -3
  157. package/resources/print-mail/order-profiles/self-mailers.mjs.map +1 -1
  158. package/resources/print-mail/postcards.d.mts +16 -841
  159. package/resources/print-mail/postcards.d.mts.map +1 -1
  160. package/resources/print-mail/postcards.d.ts +16 -841
  161. package/resources/print-mail/postcards.d.ts.map +1 -1
  162. package/resources/print-mail/postcards.js +6 -2
  163. package/resources/print-mail/postcards.js.map +1 -1
  164. package/resources/print-mail/postcards.mjs +6 -2
  165. package/resources/print-mail/postcards.mjs.map +1 -1
  166. package/resources/print-mail/print-mail.d.mts +163 -26
  167. package/resources/print-mail/print-mail.d.mts.map +1 -1
  168. package/resources/print-mail/print-mail.d.ts +163 -26
  169. package/resources/print-mail/print-mail.d.ts.map +1 -1
  170. package/resources/print-mail/print-mail.js.map +1 -1
  171. package/resources/print-mail/print-mail.mjs.map +1 -1
  172. package/resources/print-mail/reports/index.d.mts +1 -1
  173. package/resources/print-mail/reports/index.d.mts.map +1 -1
  174. package/resources/print-mail/reports/index.d.ts +1 -1
  175. package/resources/print-mail/reports/index.d.ts.map +1 -1
  176. package/resources/print-mail/reports/reports.d.mts +9 -16
  177. package/resources/print-mail/reports/reports.d.mts.map +1 -1
  178. package/resources/print-mail/reports/reports.d.ts +9 -16
  179. package/resources/print-mail/reports/reports.d.ts.map +1 -1
  180. package/resources/print-mail/reports/reports.js +6 -2
  181. package/resources/print-mail/reports/reports.js.map +1 -1
  182. package/resources/print-mail/reports/reports.mjs +6 -2
  183. package/resources/print-mail/reports/reports.mjs.map +1 -1
  184. package/resources/print-mail/self-mailers.d.mts +16 -842
  185. package/resources/print-mail/self-mailers.d.mts.map +1 -1
  186. package/resources/print-mail/self-mailers.d.ts +16 -842
  187. package/resources/print-mail/self-mailers.d.ts.map +1 -1
  188. package/resources/print-mail/self-mailers.js +9 -3
  189. package/resources/print-mail/self-mailers.js.map +1 -1
  190. package/resources/print-mail/self-mailers.mjs +9 -3
  191. package/resources/print-mail/self-mailers.mjs.map +1 -1
  192. package/resources/print-mail/sub-organizations.d.mts +9 -14
  193. package/resources/print-mail/sub-organizations.d.mts.map +1 -1
  194. package/resources/print-mail/sub-organizations.d.ts +9 -14
  195. package/resources/print-mail/sub-organizations.d.ts.map +1 -1
  196. package/resources/print-mail/sub-organizations.js +9 -3
  197. package/resources/print-mail/sub-organizations.js.map +1 -1
  198. package/resources/print-mail/sub-organizations.mjs +9 -3
  199. package/resources/print-mail/sub-organizations.mjs.map +1 -1
  200. package/resources/print-mail/templates.d.mts +9 -13
  201. package/resources/print-mail/templates.d.mts.map +1 -1
  202. package/resources/print-mail/templates.d.ts +9 -13
  203. package/resources/print-mail/templates.d.ts.map +1 -1
  204. package/resources/print-mail/templates.js +6 -2
  205. package/resources/print-mail/templates.js.map +1 -1
  206. package/resources/print-mail/templates.mjs +6 -2
  207. package/resources/print-mail/templates.mjs.map +1 -1
  208. package/src/client.ts +34 -2
  209. package/src/core/pagination.ts +171 -0
  210. package/src/index.ts +1 -0
  211. package/src/pagination.ts +2 -0
  212. package/src/resources/index.ts +5 -1
  213. package/src/resources/print-mail/bank-accounts.ts +14 -22
  214. package/src/resources/print-mail/boxes.ts +19 -686
  215. package/src/resources/print-mail/campaigns.ts +11 -24
  216. package/src/resources/print-mail/cheques.ts +15 -527
  217. package/src/resources/print-mail/contacts.ts +14 -189
  218. package/src/resources/print-mail/index.ts +14 -14
  219. package/src/resources/print-mail/letters.ts +16 -697
  220. package/src/resources/print-mail/mailing-list-imports.ts +15 -25
  221. package/src/resources/print-mail/mailing-lists.ts +14 -25
  222. package/src/resources/print-mail/order-profiles/cheques.ts +91 -103
  223. package/src/resources/print-mail/order-profiles/index.ts +4 -3
  224. package/src/resources/print-mail/order-profiles/letters.ts +14 -25
  225. package/src/resources/print-mail/order-profiles/order-profiles.ts +8 -6
  226. package/src/resources/print-mail/order-profiles/postcards.ts +14 -25
  227. package/src/resources/print-mail/order-profiles/self-mailers.ts +15 -25
  228. package/src/resources/print-mail/postcards.ts +18 -1035
  229. package/src/resources/print-mail/print-mail.ts +195 -26
  230. package/src/resources/print-mail/reports/index.ts +1 -1
  231. package/src/resources/print-mail/reports/reports.ts +11 -24
  232. package/src/resources/print-mail/self-mailers.ts +21 -1036
  233. package/src/resources/print-mail/sub-organizations.ts +14 -22
  234. package/src/resources/print-mail/templates.ts +11 -21
  235. package/src/version.ts +1 -1
  236. package/version.d.mts +1 -1
  237. package/version.d.ts +1 -1
  238. package/version.js +1 -1
  239. package/version.mjs +1 -1
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as MailingListImportsAPI from './mailing-list-imports';
5
5
  import { APIPromise } from '../../core/api-promise';
6
+ import { PagePromise, SkipLimit, type SkipLimitParams } from '../../core/pagination';
6
7
  import { buildHeaders } from '../../internal/headers';
7
8
  import { RequestOptions } from '../../internal/request-options';
8
9
  import { path } from '../../internal/utils/path';
@@ -90,15 +91,21 @@ export class MailingListImports extends APIResource {
90
91
  *
91
92
  * @example
92
93
  * ```ts
93
- * const mailingListImports =
94
- * await client.printMail.mailingListImports.list();
94
+ * // Automatically fetches more pages as needed.
95
+ * for await (const mailingListImportResponse of client.printMail.mailingListImports.list()) {
96
+ * // ...
97
+ * }
95
98
  * ```
96
99
  */
97
100
  list(
98
101
  query: MailingListImportListParams | null | undefined = {},
99
102
  options?: RequestOptions,
100
- ): APIPromise<MailingListImportListResponse> {
101
- return this._client.get('/print-mail/v1/mailing_list_imports', { query, ...options });
103
+ ): PagePromise<MailingListImportResponsesSkipLimit, MailingListImportResponse> {
104
+ return this._client.getAPIList(
105
+ '/print-mail/v1/mailing_list_imports',
106
+ SkipLimit<MailingListImportResponse>,
107
+ { query, ...options },
108
+ );
102
109
  }
103
110
 
104
111
  /**
@@ -118,6 +125,8 @@ export class MailingListImports extends APIResource {
118
125
  }
119
126
  }
120
127
 
128
+ export type MailingListImportResponsesSkipLimit = SkipLimit<MailingListImportResponse>;
129
+
121
130
  /**
122
131
  * Type of file supported for mailing list imports.
123
132
  */
@@ -317,21 +326,6 @@ export interface VerificationStatusCount {
317
326
  verifiedCount: number;
318
327
  }
319
328
 
320
- /**
321
- * A list of mailing list imports.
322
- */
323
- export interface MailingListImportListResponse {
324
- data: Array<MailingListImportResponse>;
325
-
326
- limit: number;
327
-
328
- object: 'list';
329
-
330
- skip: number;
331
-
332
- totalCount: number;
333
- }
334
-
335
329
  export interface MailingListImportDeleteResponse {
336
330
  /**
337
331
  * A unique ID prefixed with mailing*list_import*
@@ -404,9 +398,7 @@ export interface MailingListImportUpdateParams {
404
398
  metadata?: { [key: string]: string } | null;
405
399
  }
406
400
 
407
- export interface MailingListImportListParams {
408
- limit?: number;
409
-
401
+ export interface MailingListImportListParams extends SkipLimitParams {
410
402
  /**
411
403
  * You can supply any string to help narrow down the list of resources. For
412
404
  * example, if you pass `"New York"` (quoted), it will return resources that have
@@ -415,8 +407,6 @@ export interface MailingListImportListParams {
415
407
  * more details.
416
408
  */
417
409
  search?: string;
418
-
419
- skip?: number;
420
410
  }
421
411
 
422
412
  export declare namespace MailingListImports {
@@ -424,8 +414,8 @@ export declare namespace MailingListImports {
424
414
  type FileType as FileType,
425
415
  type MailingListImportResponse as MailingListImportResponse,
426
416
  type VerificationStatusCount as VerificationStatusCount,
427
- type MailingListImportListResponse as MailingListImportListResponse,
428
417
  type MailingListImportDeleteResponse as MailingListImportDeleteResponse,
418
+ type MailingListImportResponsesSkipLimit as MailingListImportResponsesSkipLimit,
429
419
  type MailingListImportCreateParams as MailingListImportCreateParams,
430
420
  type MailingListImportUpdateParams as MailingListImportUpdateParams,
431
421
  type MailingListImportListParams as MailingListImportListParams,
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import { APIPromise } from '../../core/api-promise';
5
+ import { PagePromise, SkipLimit, type SkipLimitParams } from '../../core/pagination';
5
6
  import { buildHeaders } from '../../internal/headers';
6
7
  import { RequestOptions } from '../../internal/request-options';
7
8
  import { path } from '../../internal/utils/path';
@@ -67,15 +68,20 @@ export class MailingLists extends APIResource {
67
68
  *
68
69
  * @example
69
70
  * ```ts
70
- * const mailingLists =
71
- * await client.printMail.mailingLists.list();
71
+ * // Automatically fetches more pages as needed.
72
+ * for await (const mailingList of client.printMail.mailingLists.list()) {
73
+ * // ...
74
+ * }
72
75
  * ```
73
76
  */
74
77
  list(
75
78
  query: MailingListListParams | null | undefined = {},
76
79
  options?: RequestOptions,
77
- ): APIPromise<MailingListListResponse> {
78
- return this._client.get('/print-mail/v1/mailing_lists', { query, ...options });
80
+ ): PagePromise<MailingListsSkipLimit, MailingList> {
81
+ return this._client.getAPIList('/print-mail/v1/mailing_lists', SkipLimit<MailingList>, {
82
+ query,
83
+ ...options,
84
+ });
79
85
  }
80
86
 
81
87
  /**
@@ -123,6 +129,8 @@ export class MailingLists extends APIResource {
123
129
  }
124
130
  }
125
131
 
132
+ export type MailingListsSkipLimit = SkipLimit<MailingList>;
133
+
126
134
  /**
127
135
  * Represents a mailing list.
128
136
  */
@@ -206,21 +214,6 @@ export interface MailingListUpdate {
206
214
  metadata?: { [key: string]: unknown };
207
215
  }
208
216
 
209
- /**
210
- * A list of mailing lists.
211
- */
212
- export interface MailingListListResponse {
213
- data: Array<MailingList>;
214
-
215
- limit: number;
216
-
217
- object: 'list';
218
-
219
- skip: number;
220
-
221
- totalCount: number;
222
- }
223
-
224
217
  export interface MailingListDeleteResponse {
225
218
  /**
226
219
  * A unique ID prefixed with mailing*list*
@@ -261,9 +254,7 @@ export interface MailingListUpdateParams {
261
254
  metadata?: { [key: string]: unknown };
262
255
  }
263
256
 
264
- export interface MailingListListParams {
265
- limit?: number;
266
-
257
+ export interface MailingListListParams extends SkipLimitParams {
267
258
  /**
268
259
  * You can supply any string to help narrow down the list of resources. For
269
260
  * example, if you pass `"New York"` (quoted), it will return resources that have
@@ -272,8 +263,6 @@ export interface MailingListListParams {
272
263
  * more details.
273
264
  */
274
265
  search?: string;
275
-
276
- skip?: number;
277
266
  }
278
267
 
279
268
  export interface MailingListJobsParams {
@@ -306,8 +295,8 @@ export declare namespace MailingLists {
306
295
  export {
307
296
  type MailingList as MailingList,
308
297
  type MailingListUpdate as MailingListUpdate,
309
- type MailingListListResponse as MailingListListResponse,
310
298
  type MailingListDeleteResponse as MailingListDeleteResponse,
299
+ type MailingListsSkipLimit as MailingListsSkipLimit,
311
300
  type MailingListCreateParams as MailingListCreateParams,
312
301
  type MailingListUpdateParams as MailingListUpdateParams,
313
302
  type MailingListListParams as MailingListListParams,
@@ -4,6 +4,7 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as BoxesAPI from '../boxes';
5
5
  import * as ChequesAPI from '../cheques';
6
6
  import { APIPromise } from '../../../core/api-promise';
7
+ import { PagePromise, SkipLimit, type SkipLimitParams } from '../../../core/pagination';
7
8
  import { RequestOptions } from '../../../internal/request-options';
8
9
  import { path } from '../../../internal/utils/path';
9
10
 
@@ -78,15 +79,20 @@ export class Cheques extends APIResource {
78
79
  *
79
80
  * @example
80
81
  * ```ts
81
- * const cheques =
82
- * await client.printMail.orderProfiles.cheques.list();
82
+ * // Automatically fetches more pages as needed.
83
+ * for await (const chequeListResponse of client.printMail.orderProfiles.cheques.list()) {
84
+ * // ...
85
+ * }
83
86
  * ```
84
87
  */
85
88
  list(
86
89
  query: ChequeListParams | null | undefined = {},
87
90
  options?: RequestOptions,
88
- ): APIPromise<ChequeListResponse> {
89
- return this._client.get('/print-mail/v1/order_profiles/cheques', { query, ...options });
91
+ ): PagePromise<ChequeListResponsesSkipLimit, ChequeListResponse> {
92
+ return this._client.getAPIList('/print-mail/v1/order_profiles/cheques', SkipLimit<ChequeListResponse>, {
93
+ query,
94
+ ...options,
95
+ });
90
96
  }
91
97
 
92
98
  /**
@@ -103,6 +109,8 @@ export class Cheques extends APIResource {
103
109
  }
104
110
  }
105
111
 
112
+ export type ChequeListResponsesSkipLimit = SkipLimit<ChequeListResponse>;
113
+
106
114
  export interface ChequeProfile {
107
115
  /**
108
116
  * Unique identifier for the order profile.
@@ -198,106 +206,89 @@ export interface ChequeProfile {
198
206
  */
199
207
  export type CurrencyCode = 'CAD' | 'USD';
200
208
 
201
- /**
202
- * Represents a list of Cheque Profiles.
203
- */
204
209
  export interface ChequeListResponse {
205
- data: Array<ChequeListResponse.Data>;
210
+ /**
211
+ * Unique identifier for the order profile.
212
+ */
213
+ id: string;
206
214
 
207
- limit: number;
215
+ /**
216
+ * ID of the bank account to use for the cheque. Required for creation.
217
+ */
218
+ bankAccount: string;
208
219
 
209
- object: 'list';
220
+ /**
221
+ * Timestamp when the profile was created.
222
+ */
223
+ createdAt: string;
210
224
 
211
- skip: number;
225
+ /**
226
+ * Indicates if the profile is associated with the live or test environment.
227
+ */
228
+ live: boolean;
212
229
 
213
- totalCount: number;
214
- }
230
+ /**
231
+ * Always `cheque_profile`.
232
+ */
233
+ object: 'cheque_profile';
215
234
 
216
- export namespace ChequeListResponse {
217
- export interface Data {
218
- /**
219
- * Unique identifier for the order profile.
220
- */
221
- id: string;
222
-
223
- /**
224
- * ID of the bank account to use for the cheque. Required for creation.
225
- */
226
- bankAccount: string;
227
-
228
- /**
229
- * Timestamp when the profile was created.
230
- */
231
- createdAt: string;
232
-
233
- /**
234
- * Indicates if the profile is associated with the live or test environment.
235
- */
236
- live: boolean;
237
-
238
- /**
239
- * Always `cheque_profile`.
240
- */
241
- object: 'cheque_profile';
242
-
243
- /**
244
- * Enum representing the supported cheque sizes.
245
- */
246
- size: ChequesAPI.ChequeSize;
247
-
248
- /**
249
- * Timestamp when the profile was last updated.
250
- */
251
- updatedAt: string;
252
-
253
- /**
254
- * An optional description for the profile. Set to `null` to remove during update.
255
- */
256
- description?: string | null;
257
-
258
- /**
259
- * ID of a template for an optional attached letter. Cannot be used with
260
- * `letterHTML` or `letterPDF`.
261
- */
262
- letterTemplate?: string;
263
-
264
- /**
265
- * A temporary, signed URL to view the attached letter PDF, if any. Output only.
266
- */
267
- letterUploadedPDF?: string;
268
-
269
- /**
270
- * A publicly accessible URL for the logo to print on the cheque. Set to `null` to
271
- * remove during update.
272
- */
273
- logo?: string | null;
274
-
275
- /**
276
- * Mailing class. Generally must be first class (or equivalent for destination
277
- * country) for cheques.
278
- */
279
- mailingClass?: BoxesAPI.OrderMailingClass;
280
-
281
- /**
282
- * Memo line text for the cheque. Set to `null` to remove during update.
283
- */
284
- memo?: string | null;
285
-
286
- /**
287
- * Default merge variables for orders created using this profile.
288
- */
289
- mergeVariables?: { [key: string]: unknown } | null;
290
-
291
- /**
292
- * Message included on the cheque stub. Set to `null` to remove during update.
293
- */
294
- message?: string | null;
295
-
296
- /**
297
- * Optional key-value metadata.
298
- */
299
- metadata?: { [key: string]: string } | null;
300
- }
235
+ /**
236
+ * Enum representing the supported cheque sizes.
237
+ */
238
+ size: ChequesAPI.ChequeSize;
239
+
240
+ /**
241
+ * Timestamp when the profile was last updated.
242
+ */
243
+ updatedAt: string;
244
+
245
+ /**
246
+ * An optional description for the profile. Set to `null` to remove during update.
247
+ */
248
+ description?: string | null;
249
+
250
+ /**
251
+ * ID of a template for an optional attached letter. Cannot be used with
252
+ * `letterHTML` or `letterPDF`.
253
+ */
254
+ letterTemplate?: string;
255
+
256
+ /**
257
+ * A temporary, signed URL to view the attached letter PDF, if any. Output only.
258
+ */
259
+ letterUploadedPDF?: string;
260
+
261
+ /**
262
+ * A publicly accessible URL for the logo to print on the cheque. Set to `null` to
263
+ * remove during update.
264
+ */
265
+ logo?: string | null;
266
+
267
+ /**
268
+ * Mailing class. Generally must be first class (or equivalent for destination
269
+ * country) for cheques.
270
+ */
271
+ mailingClass?: BoxesAPI.OrderMailingClass;
272
+
273
+ /**
274
+ * Memo line text for the cheque. Set to `null` to remove during update.
275
+ */
276
+ memo?: string | null;
277
+
278
+ /**
279
+ * Default merge variables for orders created using this profile.
280
+ */
281
+ mergeVariables?: { [key: string]: unknown } | null;
282
+
283
+ /**
284
+ * Message included on the cheque stub. Set to `null` to remove during update.
285
+ */
286
+ message?: string | null;
287
+
288
+ /**
289
+ * Optional key-value metadata.
290
+ */
291
+ metadata?: { [key: string]: string } | null;
301
292
  }
302
293
 
303
294
  export interface ChequeDeleteResponse {
@@ -469,9 +460,7 @@ export interface ChequeUpdateParams {
469
460
  metadata?: { [key: string]: string } | null;
470
461
  }
471
462
 
472
- export interface ChequeListParams {
473
- limit?: number;
474
-
463
+ export interface ChequeListParams extends SkipLimitParams {
475
464
  /**
476
465
  * You can supply any string to help narrow down the list of resources. For
477
466
  * example, if you pass `"New York"` (quoted), it will return resources that have
@@ -480,8 +469,6 @@ export interface ChequeListParams {
480
469
  * more details.
481
470
  */
482
471
  search?: string;
483
-
484
- skip?: number;
485
472
  }
486
473
 
487
474
  export declare namespace Cheques {
@@ -490,6 +477,7 @@ export declare namespace Cheques {
490
477
  type CurrencyCode as CurrencyCode,
491
478
  type ChequeListResponse as ChequeListResponse,
492
479
  type ChequeDeleteResponse as ChequeDeleteResponse,
480
+ type ChequeListResponsesSkipLimit as ChequeListResponsesSkipLimit,
493
481
  type ChequeCreateParams as ChequeCreateParams,
494
482
  type ChequeRetrieveParams as ChequeRetrieveParams,
495
483
  type ChequeUpdateParams as ChequeUpdateParams,
@@ -10,37 +10,38 @@ export {
10
10
  type ChequeRetrieveParams,
11
11
  type ChequeUpdateParams,
12
12
  type ChequeListParams,
13
+ type ChequeListResponsesSkipLimit,
13
14
  } from './cheques';
14
15
  export {
15
16
  Letters,
16
17
  type LetterProfile,
17
- type LetterListResponse,
18
18
  type LetterDeleteResponse,
19
19
  type LetterCreateParams,
20
20
  type LetterRetrieveParams,
21
21
  type LetterUpdateParams,
22
22
  type LetterListParams,
23
+ type LetterProfilesSkipLimit,
23
24
  } from './letters';
24
25
  export { OrderProfiles } from './order-profiles';
25
26
  export {
26
27
  Postcards,
27
28
  type PostcardProfile,
28
29
  type PostcardSize,
29
- type PostcardListResponse,
30
30
  type PostcardDeleteResponse,
31
31
  type PostcardCreateParams,
32
32
  type PostcardRetrieveParams,
33
33
  type PostcardUpdateParams,
34
34
  type PostcardListParams,
35
+ type PostcardProfilesSkipLimit,
35
36
  } from './postcards';
36
37
  export {
37
38
  SelfMailers,
38
39
  type SelfMailerProfile,
39
40
  type SelfMailerSize,
40
- type SelfMailerListResponse,
41
41
  type SelfMailerDeleteResponse,
42
42
  type SelfMailerCreateParams,
43
43
  type SelfMailerRetrieveParams,
44
44
  type SelfMailerUpdateParams,
45
45
  type SelfMailerListParams,
46
+ type SelfMailerProfilesSkipLimit,
46
47
  } from './self-mailers';
@@ -4,6 +4,7 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as BoxesAPI from '../boxes';
5
5
  import * as LettersAPI from '../letters';
6
6
  import { APIPromise } from '../../../core/api-promise';
7
+ import { PagePromise, SkipLimit, type SkipLimitParams } from '../../../core/pagination';
7
8
  import { RequestOptions } from '../../../internal/request-options';
8
9
  import { path } from '../../../internal/utils/path';
9
10
 
@@ -84,15 +85,20 @@ export class Letters extends APIResource {
84
85
  *
85
86
  * @example
86
87
  * ```ts
87
- * const letters =
88
- * await client.printMail.orderProfiles.letters.list();
88
+ * // Automatically fetches more pages as needed.
89
+ * for await (const letterProfile of client.printMail.orderProfiles.letters.list()) {
90
+ * // ...
91
+ * }
89
92
  * ```
90
93
  */
91
94
  list(
92
95
  query: LetterListParams | null | undefined = {},
93
96
  options?: RequestOptions,
94
- ): APIPromise<LetterListResponse> {
95
- return this._client.get('/print-mail/v1/order_profiles/letters', { query, ...options });
97
+ ): PagePromise<LetterProfilesSkipLimit, LetterProfile> {
98
+ return this._client.getAPIList('/print-mail/v1/order_profiles/letters', SkipLimit<LetterProfile>, {
99
+ query,
100
+ ...options,
101
+ });
96
102
  }
97
103
 
98
104
  /**
@@ -110,6 +116,8 @@ export class Letters extends APIResource {
110
116
  }
111
117
  }
112
118
 
119
+ export type LetterProfilesSkipLimit = SkipLimit<LetterProfile>;
120
+
113
121
  export interface LetterProfile {
114
122
  /**
115
123
  * Unique identifier for the order profile.
@@ -202,21 +210,6 @@ export interface LetterProfile {
202
210
  uploadedPDF?: string;
203
211
  }
204
212
 
205
- /**
206
- * Represents a list of Letter Profiles.
207
- */
208
- export interface LetterListResponse {
209
- data: Array<LetterProfile>;
210
-
211
- limit: number;
212
-
213
- object: 'list';
214
-
215
- skip: number;
216
-
217
- totalCount: number;
218
- }
219
-
220
213
  export interface LetterDeleteResponse {
221
214
  /**
222
215
  * Unique identifier for the order profile.
@@ -395,9 +388,7 @@ export interface LetterUpdateParams {
395
388
  template?: string;
396
389
  }
397
390
 
398
- export interface LetterListParams {
399
- limit?: number;
400
-
391
+ export interface LetterListParams extends SkipLimitParams {
401
392
  /**
402
393
  * You can supply any string to help narrow down the list of resources. For
403
394
  * example, if you pass `"New York"` (quoted), it will return resources that have
@@ -406,15 +397,13 @@ export interface LetterListParams {
406
397
  * more details.
407
398
  */
408
399
  search?: string;
409
-
410
- skip?: number;
411
400
  }
412
401
 
413
402
  export declare namespace Letters {
414
403
  export {
415
404
  type LetterProfile as LetterProfile,
416
- type LetterListResponse as LetterListResponse,
417
405
  type LetterDeleteResponse as LetterDeleteResponse,
406
+ type LetterProfilesSkipLimit as LetterProfilesSkipLimit,
418
407
  type LetterCreateParams as LetterCreateParams,
419
408
  type LetterRetrieveParams as LetterRetrieveParams,
420
409
  type LetterUpdateParams as LetterUpdateParams,
@@ -7,6 +7,7 @@ import {
7
7
  ChequeDeleteResponse,
8
8
  ChequeListParams,
9
9
  ChequeListResponse,
10
+ ChequeListResponsesSkipLimit,
10
11
  ChequeProfile,
11
12
  ChequeRetrieveParams,
12
13
  ChequeUpdateParams,
@@ -18,8 +19,8 @@ import {
18
19
  LetterCreateParams,
19
20
  LetterDeleteResponse,
20
21
  LetterListParams,
21
- LetterListResponse,
22
22
  LetterProfile,
23
+ LetterProfilesSkipLimit,
23
24
  LetterRetrieveParams,
24
25
  LetterUpdateParams,
25
26
  Letters,
@@ -29,8 +30,8 @@ import {
29
30
  PostcardCreateParams,
30
31
  PostcardDeleteResponse,
31
32
  PostcardListParams,
32
- PostcardListResponse,
33
33
  PostcardProfile,
34
+ PostcardProfilesSkipLimit,
34
35
  PostcardRetrieveParams,
35
36
  PostcardSize,
36
37
  PostcardUpdateParams,
@@ -41,8 +42,8 @@ import {
41
42
  SelfMailerCreateParams,
42
43
  SelfMailerDeleteResponse,
43
44
  SelfMailerListParams,
44
- SelfMailerListResponse,
45
45
  SelfMailerProfile,
46
+ SelfMailerProfilesSkipLimit,
46
47
  SelfMailerRetrieveParams,
47
48
  SelfMailerSize,
48
49
  SelfMailerUpdateParams,
@@ -68,6 +69,7 @@ export declare namespace OrderProfiles {
68
69
  type CurrencyCode as CurrencyCode,
69
70
  type ChequeListResponse as ChequeListResponse,
70
71
  type ChequeDeleteResponse as ChequeDeleteResponse,
72
+ type ChequeListResponsesSkipLimit as ChequeListResponsesSkipLimit,
71
73
  type ChequeCreateParams as ChequeCreateParams,
72
74
  type ChequeRetrieveParams as ChequeRetrieveParams,
73
75
  type ChequeUpdateParams as ChequeUpdateParams,
@@ -77,8 +79,8 @@ export declare namespace OrderProfiles {
77
79
  export {
78
80
  Letters as Letters,
79
81
  type LetterProfile as LetterProfile,
80
- type LetterListResponse as LetterListResponse,
81
82
  type LetterDeleteResponse as LetterDeleteResponse,
83
+ type LetterProfilesSkipLimit as LetterProfilesSkipLimit,
82
84
  type LetterCreateParams as LetterCreateParams,
83
85
  type LetterRetrieveParams as LetterRetrieveParams,
84
86
  type LetterUpdateParams as LetterUpdateParams,
@@ -89,8 +91,8 @@ export declare namespace OrderProfiles {
89
91
  Postcards as Postcards,
90
92
  type PostcardProfile as PostcardProfile,
91
93
  type PostcardSize as PostcardSize,
92
- type PostcardListResponse as PostcardListResponse,
93
94
  type PostcardDeleteResponse as PostcardDeleteResponse,
95
+ type PostcardProfilesSkipLimit as PostcardProfilesSkipLimit,
94
96
  type PostcardCreateParams as PostcardCreateParams,
95
97
  type PostcardRetrieveParams as PostcardRetrieveParams,
96
98
  type PostcardUpdateParams as PostcardUpdateParams,
@@ -101,8 +103,8 @@ export declare namespace OrderProfiles {
101
103
  SelfMailers as SelfMailers,
102
104
  type SelfMailerProfile as SelfMailerProfile,
103
105
  type SelfMailerSize as SelfMailerSize,
104
- type SelfMailerListResponse as SelfMailerListResponse,
105
106
  type SelfMailerDeleteResponse as SelfMailerDeleteResponse,
107
+ type SelfMailerProfilesSkipLimit as SelfMailerProfilesSkipLimit,
106
108
  type SelfMailerCreateParams as SelfMailerCreateParams,
107
109
  type SelfMailerRetrieveParams as SelfMailerRetrieveParams,
108
110
  type SelfMailerUpdateParams as SelfMailerUpdateParams,