postgrid-node 0.1.0-alpha.1

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 (291) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +201 -0
  3. package/README.md +346 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +914 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +882 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +47 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +113 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +97 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +144 -0
  87. package/index.d.ts +144 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +161 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +118 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +124 -0
  94. package/pagination.d.ts +24 -0
  95. package/pagination.d.ts.map +1 -0
  96. package/pagination.js +45 -0
  97. package/pagination.js.map +1 -0
  98. package/pagination.mjs +41 -0
  99. package/pagination.mjs.map +1 -0
  100. package/resource.d.ts +6 -0
  101. package/resource.d.ts.map +1 -0
  102. package/resource.js +11 -0
  103. package/resource.js.map +1 -0
  104. package/resource.mjs +7 -0
  105. package/resource.mjs.map +1 -0
  106. package/resources/bank-accounts.d.ts +285 -0
  107. package/resources/bank-accounts.d.ts.map +1 -0
  108. package/resources/bank-accounts.js +45 -0
  109. package/resources/bank-accounts.js.map +1 -0
  110. package/resources/bank-accounts.mjs +40 -0
  111. package/resources/bank-accounts.mjs.map +1 -0
  112. package/resources/boxes.d.ts +683 -0
  113. package/resources/boxes.d.ts.map +1 -0
  114. package/resources/boxes.js +54 -0
  115. package/resources/boxes.js.map +1 -0
  116. package/resources/boxes.mjs +49 -0
  117. package/resources/boxes.mjs.map +1 -0
  118. package/resources/campaigns.d.ts +644 -0
  119. package/resources/campaigns.d.ts.map +1 -0
  120. package/resources/campaigns.js +67 -0
  121. package/resources/campaigns.js.map +1 -0
  122. package/resources/campaigns.mjs +62 -0
  123. package/resources/campaigns.mjs.map +1 -0
  124. package/resources/cheques/cheques.d.ts +349 -0
  125. package/resources/cheques/cheques.d.ts.map +1 -0
  126. package/resources/cheques/cheques.js +95 -0
  127. package/resources/cheques/cheques.js.map +1 -0
  128. package/resources/cheques/cheques.mjs +67 -0
  129. package/resources/cheques/cheques.mjs.map +1 -0
  130. package/resources/cheques/index.d.ts +4 -0
  131. package/resources/cheques/index.d.ts.map +1 -0
  132. package/resources/cheques/index.js +12 -0
  133. package/resources/cheques/index.js.map +1 -0
  134. package/resources/cheques/index.mjs +5 -0
  135. package/resources/cheques/index.mjs.map +1 -0
  136. package/resources/cheques/url.d.ts +29 -0
  137. package/resources/cheques/url.d.ts.map +1 -0
  138. package/resources/cheques/url.js +20 -0
  139. package/resources/cheques/url.js.map +1 -0
  140. package/resources/cheques/url.mjs +16 -0
  141. package/resources/cheques/url.mjs.map +1 -0
  142. package/resources/cheques/with-deposit-ready-pdf.d.ts +13 -0
  143. package/resources/cheques/with-deposit-ready-pdf.d.ts.map +1 -0
  144. package/resources/cheques/with-deposit-ready-pdf.js +18 -0
  145. package/resources/cheques/with-deposit-ready-pdf.js.map +1 -0
  146. package/resources/cheques/with-deposit-ready-pdf.mjs +14 -0
  147. package/resources/cheques/with-deposit-ready-pdf.mjs.map +1 -0
  148. package/resources/contacts.d.ts +295 -0
  149. package/resources/contacts.d.ts.map +1 -0
  150. package/resources/contacts.js +52 -0
  151. package/resources/contacts.js.map +1 -0
  152. package/resources/contacts.mjs +47 -0
  153. package/resources/contacts.mjs.map +1 -0
  154. package/resources/index.d.ts +12 -0
  155. package/resources/index.d.ts.map +1 -0
  156. package/resources/index.js +50 -0
  157. package/resources/index.js.map +1 -0
  158. package/resources/index.mjs +13 -0
  159. package/resources/index.mjs.map +1 -0
  160. package/resources/letters.d.ts +639 -0
  161. package/resources/letters.d.ts.map +1 -0
  162. package/resources/letters.js +55 -0
  163. package/resources/letters.js.map +1 -0
  164. package/resources/letters.mjs +50 -0
  165. package/resources/letters.mjs.map +1 -0
  166. package/resources/postcards.d.ts +346 -0
  167. package/resources/postcards.d.ts.map +1 -0
  168. package/resources/postcards.js +56 -0
  169. package/resources/postcards.js.map +1 -0
  170. package/resources/postcards.mjs +51 -0
  171. package/resources/postcards.mjs.map +1 -0
  172. package/resources/reports/exports.d.ts +207 -0
  173. package/resources/reports/exports.d.ts.map +1 -0
  174. package/resources/reports/exports.js +33 -0
  175. package/resources/reports/exports.js.map +1 -0
  176. package/resources/reports/exports.mjs +29 -0
  177. package/resources/reports/exports.mjs.map +1 -0
  178. package/resources/reports/index.d.ts +4 -0
  179. package/resources/reports/index.d.ts.map +1 -0
  180. package/resources/reports/index.js +12 -0
  181. package/resources/reports/index.js.map +1 -0
  182. package/resources/reports/index.mjs +5 -0
  183. package/resources/reports/index.mjs.map +1 -0
  184. package/resources/reports/reports.d.ts +245 -0
  185. package/resources/reports/reports.d.ts.map +1 -0
  186. package/resources/reports/reports.js +85 -0
  187. package/resources/reports/reports.js.map +1 -0
  188. package/resources/reports/reports.mjs +57 -0
  189. package/resources/reports/reports.mjs.map +1 -0
  190. package/resources/reports/samples.d.ts +81 -0
  191. package/resources/reports/samples.d.ts.map +1 -0
  192. package/resources/reports/samples.js +26 -0
  193. package/resources/reports/samples.js.map +1 -0
  194. package/resources/reports/samples.mjs +22 -0
  195. package/resources/reports/samples.mjs.map +1 -0
  196. package/resources/self-mailers.d.ts +622 -0
  197. package/resources/self-mailers.d.ts.map +1 -0
  198. package/resources/self-mailers.js +45 -0
  199. package/resources/self-mailers.js.map +1 -0
  200. package/resources/self-mailers.mjs +40 -0
  201. package/resources/self-mailers.mjs.map +1 -0
  202. package/resources/shared.d.ts +147 -0
  203. package/resources/shared.d.ts.map +1 -0
  204. package/resources/shared.js +4 -0
  205. package/resources/shared.js.map +1 -0
  206. package/resources/shared.mjs +3 -0
  207. package/resources/shared.mjs.map +1 -0
  208. package/resources/templates.d.ts +126 -0
  209. package/resources/templates.d.ts.map +1 -0
  210. package/resources/templates.js +46 -0
  211. package/resources/templates.js.map +1 -0
  212. package/resources/templates.mjs +41 -0
  213. package/resources/templates.mjs.map +1 -0
  214. package/shims/node.d.ts +30 -0
  215. package/shims/node.d.ts.map +1 -0
  216. package/shims/node.js +31 -0
  217. package/shims/node.js.map +1 -0
  218. package/shims/node.mjs +5 -0
  219. package/shims/node.mjs.map +1 -0
  220. package/shims/web.d.ts +26 -0
  221. package/shims/web.d.ts.map +1 -0
  222. package/shims/web.js +31 -0
  223. package/shims/web.js.map +1 -0
  224. package/shims/web.mjs +5 -0
  225. package/shims/web.mjs.map +1 -0
  226. package/src/_shims/MultipartBody.ts +9 -0
  227. package/src/_shims/README.md +46 -0
  228. package/src/_shims/auto/runtime-bun.ts +4 -0
  229. package/src/_shims/auto/runtime-node.ts +4 -0
  230. package/src/_shims/auto/runtime.ts +4 -0
  231. package/src/_shims/auto/types-node.ts +4 -0
  232. package/src/_shims/auto/types.d.ts +101 -0
  233. package/src/_shims/auto/types.js +3 -0
  234. package/src/_shims/auto/types.mjs +3 -0
  235. package/src/_shims/bun-runtime.ts +14 -0
  236. package/src/_shims/index.d.ts +81 -0
  237. package/src/_shims/index.js +13 -0
  238. package/src/_shims/index.mjs +7 -0
  239. package/src/_shims/manual-types.d.ts +12 -0
  240. package/src/_shims/manual-types.js +3 -0
  241. package/src/_shims/manual-types.mjs +3 -0
  242. package/src/_shims/node-runtime.ts +81 -0
  243. package/src/_shims/node-types.d.ts +42 -0
  244. package/src/_shims/node-types.js +3 -0
  245. package/src/_shims/node-types.mjs +3 -0
  246. package/src/_shims/registry.ts +67 -0
  247. package/src/_shims/web-runtime.ts +103 -0
  248. package/src/_shims/web-types.d.ts +83 -0
  249. package/src/_shims/web-types.js +3 -0
  250. package/src/_shims/web-types.mjs +3 -0
  251. package/src/core.ts +1208 -0
  252. package/src/error.ts +130 -0
  253. package/src/index.ts +428 -0
  254. package/src/lib/.keep +4 -0
  255. package/src/pagination.ts +69 -0
  256. package/src/resource.ts +11 -0
  257. package/src/resources/bank-accounts.ts +382 -0
  258. package/src/resources/boxes.ts +982 -0
  259. package/src/resources/campaigns.ts +853 -0
  260. package/src/resources/cheques/cheques.ts +493 -0
  261. package/src/resources/cheques/index.ts +12 -0
  262. package/src/resources/cheques/url.ts +37 -0
  263. package/src/resources/cheques/with-deposit-ready-pdf.ts +17 -0
  264. package/src/resources/contacts.ts +387 -0
  265. package/src/resources/index.ts +102 -0
  266. package/src/resources/letters.ts +870 -0
  267. package/src/resources/postcards.ts +548 -0
  268. package/src/resources/reports/exports.ts +272 -0
  269. package/src/resources/reports/index.ts +28 -0
  270. package/src/resources/reports/reports.ts +359 -0
  271. package/src/resources/reports/samples.ts +109 -0
  272. package/src/resources/self-mailers.ts +958 -0
  273. package/src/resources/shared.ts +182 -0
  274. package/src/resources/templates.ts +184 -0
  275. package/src/shims/node.ts +50 -0
  276. package/src/shims/web.ts +50 -0
  277. package/src/tsconfig.json +11 -0
  278. package/src/uploads.ts +255 -0
  279. package/src/version.ts +1 -0
  280. package/uploads.d.ts +75 -0
  281. package/uploads.d.ts.map +1 -0
  282. package/uploads.js +171 -0
  283. package/uploads.js.map +1 -0
  284. package/uploads.mjs +158 -0
  285. package/uploads.mjs.map +1 -0
  286. package/version.d.ts +2 -0
  287. package/version.d.ts.map +1 -0
  288. package/version.js +5 -0
  289. package/version.js.map +1 -0
  290. package/version.mjs +2 -0
  291. package/version.mjs.map +1 -0
@@ -0,0 +1,982 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+ import * as ContactsAPI from './contacts';
7
+ import * as Shared from './shared';
8
+ import { List, type ListParams } from '../pagination';
9
+
10
+ export class Boxes extends APIResource {
11
+ /**
12
+ * This endpoint allows you to create a box containing up to 100 cheques. A Box is
13
+ * mailed to a single destination.
14
+ *
15
+ * To create a box. You must specify:
16
+ *
17
+ * - `to`: The recipient (contact or contact ID)
18
+ * - `from`: The sender (contact or contact ID)
19
+ * - `cheques`: An array of cheques to go in the box
20
+ *
21
+ * For each cheque You must specify:
22
+ *
23
+ * - `to`: The recipient (contact or contact ID)
24
+ * - `from`: The sender (contact or contact ID)
25
+ * - `bankAccount`: The bank account ID
26
+ * - `amount`: The amount to be sent
27
+ * - `number`: The cheque number
28
+ */
29
+ create(body: BoxCreateParams, options?: Core.RequestOptions): Core.APIPromise<BoxCreateResponse> {
30
+ return this._client.post('/boxes', { body, ...options });
31
+ }
32
+
33
+ /**
34
+ * Retrieve a box by ID.
35
+ */
36
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<BoxRetrieveResponse> {
37
+ return this._client.get(`/boxes/${id}`, options);
38
+ }
39
+
40
+ /**
41
+ * List all boxes.
42
+ */
43
+ list(
44
+ query?: BoxListParams,
45
+ options?: Core.RequestOptions,
46
+ ): Core.PagePromise<BoxListResponsesList, BoxListResponse>;
47
+ list(options?: Core.RequestOptions): Core.PagePromise<BoxListResponsesList, BoxListResponse>;
48
+ list(
49
+ query: BoxListParams | Core.RequestOptions = {},
50
+ options?: Core.RequestOptions,
51
+ ): Core.PagePromise<BoxListResponsesList, BoxListResponse> {
52
+ if (isRequestOptions(query)) {
53
+ return this.list({}, query);
54
+ }
55
+ return this._client.getAPIList('/boxes', BoxListResponsesList, { query, ...options });
56
+ }
57
+
58
+ /**
59
+ * Cancel a box by ID (cannot be undone).
60
+ */
61
+ cancel(id: string, options?: Core.RequestOptions): Core.APIPromise<BoxCancelResponse> {
62
+ return this._client.delete(`/boxes/${id}`, options);
63
+ }
64
+ }
65
+
66
+ export class BoxListResponsesList extends List<BoxListResponse> {}
67
+
68
+ export interface BoxCreateResponse {
69
+ /**
70
+ * A unique ID prefixed with box\_
71
+ */
72
+ id: string;
73
+
74
+ /**
75
+ * The cheques inside this box (in read mode).
76
+ */
77
+ cheques: Array<BoxCreateResponse.Cheque>;
78
+
79
+ /**
80
+ * The UTC time at which this resource was created.
81
+ */
82
+ createdAt: string;
83
+
84
+ /**
85
+ * The contact of the 'from' field in read mode should be a fully expanded Contact.
86
+ */
87
+ from: ContactsAPI.Contact;
88
+
89
+ /**
90
+ * `true` if this is a live mode resource else `false`.
91
+ */
92
+ live: boolean;
93
+
94
+ /**
95
+ * The mailing class of this order. This determines the speed and cost of delivery.
96
+ * See `OrderMailingClass` for more details.
97
+ */
98
+ mailingClass:
99
+ | 'first_class'
100
+ | 'standard_class'
101
+ | 'express'
102
+ | 'certified'
103
+ | 'certified_return_receipt'
104
+ | 'registered'
105
+ | 'usps_first_class'
106
+ | 'usps_standard_class'
107
+ | 'usps_eddm'
108
+ | 'usps_express_2_day'
109
+ | 'usps_express_3_day'
110
+ | 'usps_first_class_certified'
111
+ | 'usps_first_class_certified_return_receipt'
112
+ | 'usps_first_class_registered'
113
+ | 'usps_express_3_day_signature_confirmation'
114
+ | 'usps_express_3_day_certified'
115
+ | 'usps_express_3_day_certified_return_receipt'
116
+ | 'ca_post_lettermail'
117
+ | 'ca_post_personalized'
118
+ | 'ca_post_neighbourhood_mail'
119
+ | 'ups_express_overnight'
120
+ | 'ups_express_2_day'
121
+ | 'ups_express_3_day'
122
+ | 'royal_mail_first_class'
123
+ | 'royal_mail_second_class'
124
+ | 'au_post_second_class';
125
+
126
+ /**
127
+ * Always "box".
128
+ */
129
+ object: 'box';
130
+
131
+ /**
132
+ * This order will transition from `ready` to `printing` on the day after this
133
+ * date. For example, if this is a date on Tuesday, the order will transition to
134
+ * `printing` on Wednesday at midnight eastern time.
135
+ */
136
+ sendDate: string;
137
+
138
+ /**
139
+ * See `OrderStatus` for more details on the status of this order.
140
+ */
141
+ status: 'ready' | 'printing' | 'processed_for_delivery' | 'completed' | 'cancelled';
142
+
143
+ /**
144
+ * The recipient of this order. This will be provided even if you delete the
145
+ * underlying contact.
146
+ */
147
+ to: ContactsAPI.Contact;
148
+
149
+ /**
150
+ * The UTC time at which this resource was last updated.
151
+ */
152
+ updatedAt: string;
153
+
154
+ /**
155
+ * The cancellation details of this order. Populated if the order has been
156
+ * cancelled.
157
+ */
158
+ cancellation?: Shared.Cancellation;
159
+
160
+ /**
161
+ * An optional string describing this resource. Will be visible in the API and the
162
+ * dashboard.
163
+ */
164
+ description?: string;
165
+
166
+ /**
167
+ * The last date that the IMB status was updated. See `imbStatus` for more details.
168
+ */
169
+ imbDate?: string;
170
+
171
+ /**
172
+ * The Intelligent Mail Barcode (IMB) status of this order. Only populated for
173
+ * US-printed and US-destined orders. This is the most detailed way to track
174
+ * non-express/certified orders.
175
+ */
176
+ imbStatus?: 'entered_mail_stream' | 'out_for_delivery' | 'returned_to_sender';
177
+
178
+ /**
179
+ * The most recent ZIP code of the USPS facility that the order has been processed
180
+ * through. Only populated when an `imbStatus` is present.
181
+ */
182
+ imbZIPCode?: string;
183
+
184
+ /**
185
+ * These will be merged with the variables in the template or HTML you create this
186
+ * order with. The keys in this object should match the variable names in the
187
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
188
+ * PDFs uploaded with the order.
189
+ */
190
+ mergeVariables?: Record<string, unknown>;
191
+
192
+ /**
193
+ * See the section on Metadata.
194
+ */
195
+ metadata?: Record<string, unknown>;
196
+
197
+ /**
198
+ * The tracking number of this order. Populated after an express/certified order
199
+ * has been processed for delivery.
200
+ */
201
+ trackingNumber?: string;
202
+
203
+ /**
204
+ * PostGrid renders a PDF preview for all orders. This should be inspected to
205
+ * ensure that the order is correct before it is sent out because it shows what
206
+ * will be printed and mailed to the recipient. Once the PDF preview is generated,
207
+ * this field will be returned by all `GET` endpoints which produce this order.
208
+ *
209
+ * This URL is a signed link to the PDF preview. It will expire after a short
210
+ * period of time. If you need to access this URL after it has expired, you can
211
+ * regenerate it by calling the `GET` endpoint again.
212
+ */
213
+ url?: string;
214
+ }
215
+
216
+ export namespace BoxCreateResponse {
217
+ export interface Cheque {
218
+ /**
219
+ * The amount on the cheque.
220
+ */
221
+ amount: number;
222
+
223
+ /**
224
+ * The bank account (ID or reference) from which the cheque amount is drawn.
225
+ */
226
+ bankAccount: string;
227
+
228
+ from: ContactsAPI.Contact;
229
+
230
+ /**
231
+ * The cheque number.
232
+ */
233
+ number: number;
234
+
235
+ to: ContactsAPI.Contact;
236
+
237
+ /**
238
+ * A URL to a logo for the cheque (optional).
239
+ */
240
+ logoURL?: string;
241
+
242
+ /**
243
+ * The memo text on the cheque (optional).
244
+ */
245
+ memo?: string;
246
+
247
+ /**
248
+ * A set of dynamic merge variables for customizing the cheque or accompanying
249
+ * documents (optional).
250
+ */
251
+ mergeVariables?: Record<string, unknown>;
252
+
253
+ /**
254
+ * An optional message template to be printed on or with the cheque.
255
+ */
256
+ messageTemplate?: string;
257
+ }
258
+ }
259
+
260
+ export interface BoxRetrieveResponse {
261
+ /**
262
+ * A unique ID prefixed with box\_
263
+ */
264
+ id: string;
265
+
266
+ /**
267
+ * The cheques inside this box (in read mode).
268
+ */
269
+ cheques: Array<BoxRetrieveResponse.Cheque>;
270
+
271
+ /**
272
+ * The UTC time at which this resource was created.
273
+ */
274
+ createdAt: string;
275
+
276
+ /**
277
+ * The contact of the 'from' field in read mode should be a fully expanded Contact.
278
+ */
279
+ from: ContactsAPI.Contact;
280
+
281
+ /**
282
+ * `true` if this is a live mode resource else `false`.
283
+ */
284
+ live: boolean;
285
+
286
+ /**
287
+ * The mailing class of this order. This determines the speed and cost of delivery.
288
+ * See `OrderMailingClass` for more details.
289
+ */
290
+ mailingClass:
291
+ | 'first_class'
292
+ | 'standard_class'
293
+ | 'express'
294
+ | 'certified'
295
+ | 'certified_return_receipt'
296
+ | 'registered'
297
+ | 'usps_first_class'
298
+ | 'usps_standard_class'
299
+ | 'usps_eddm'
300
+ | 'usps_express_2_day'
301
+ | 'usps_express_3_day'
302
+ | 'usps_first_class_certified'
303
+ | 'usps_first_class_certified_return_receipt'
304
+ | 'usps_first_class_registered'
305
+ | 'usps_express_3_day_signature_confirmation'
306
+ | 'usps_express_3_day_certified'
307
+ | 'usps_express_3_day_certified_return_receipt'
308
+ | 'ca_post_lettermail'
309
+ | 'ca_post_personalized'
310
+ | 'ca_post_neighbourhood_mail'
311
+ | 'ups_express_overnight'
312
+ | 'ups_express_2_day'
313
+ | 'ups_express_3_day'
314
+ | 'royal_mail_first_class'
315
+ | 'royal_mail_second_class'
316
+ | 'au_post_second_class';
317
+
318
+ /**
319
+ * Always "box".
320
+ */
321
+ object: 'box';
322
+
323
+ /**
324
+ * This order will transition from `ready` to `printing` on the day after this
325
+ * date. For example, if this is a date on Tuesday, the order will transition to
326
+ * `printing` on Wednesday at midnight eastern time.
327
+ */
328
+ sendDate: string;
329
+
330
+ /**
331
+ * See `OrderStatus` for more details on the status of this order.
332
+ */
333
+ status: 'ready' | 'printing' | 'processed_for_delivery' | 'completed' | 'cancelled';
334
+
335
+ /**
336
+ * The recipient of this order. This will be provided even if you delete the
337
+ * underlying contact.
338
+ */
339
+ to: ContactsAPI.Contact;
340
+
341
+ /**
342
+ * The UTC time at which this resource was last updated.
343
+ */
344
+ updatedAt: string;
345
+
346
+ /**
347
+ * The cancellation details of this order. Populated if the order has been
348
+ * cancelled.
349
+ */
350
+ cancellation?: Shared.Cancellation;
351
+
352
+ /**
353
+ * An optional string describing this resource. Will be visible in the API and the
354
+ * dashboard.
355
+ */
356
+ description?: string;
357
+
358
+ /**
359
+ * The last date that the IMB status was updated. See `imbStatus` for more details.
360
+ */
361
+ imbDate?: string;
362
+
363
+ /**
364
+ * The Intelligent Mail Barcode (IMB) status of this order. Only populated for
365
+ * US-printed and US-destined orders. This is the most detailed way to track
366
+ * non-express/certified orders.
367
+ */
368
+ imbStatus?: 'entered_mail_stream' | 'out_for_delivery' | 'returned_to_sender';
369
+
370
+ /**
371
+ * The most recent ZIP code of the USPS facility that the order has been processed
372
+ * through. Only populated when an `imbStatus` is present.
373
+ */
374
+ imbZIPCode?: string;
375
+
376
+ /**
377
+ * These will be merged with the variables in the template or HTML you create this
378
+ * order with. The keys in this object should match the variable names in the
379
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
380
+ * PDFs uploaded with the order.
381
+ */
382
+ mergeVariables?: Record<string, unknown>;
383
+
384
+ /**
385
+ * See the section on Metadata.
386
+ */
387
+ metadata?: Record<string, unknown>;
388
+
389
+ /**
390
+ * The tracking number of this order. Populated after an express/certified order
391
+ * has been processed for delivery.
392
+ */
393
+ trackingNumber?: string;
394
+
395
+ /**
396
+ * PostGrid renders a PDF preview for all orders. This should be inspected to
397
+ * ensure that the order is correct before it is sent out because it shows what
398
+ * will be printed and mailed to the recipient. Once the PDF preview is generated,
399
+ * this field will be returned by all `GET` endpoints which produce this order.
400
+ *
401
+ * This URL is a signed link to the PDF preview. It will expire after a short
402
+ * period of time. If you need to access this URL after it has expired, you can
403
+ * regenerate it by calling the `GET` endpoint again.
404
+ */
405
+ url?: string;
406
+ }
407
+
408
+ export namespace BoxRetrieveResponse {
409
+ export interface Cheque {
410
+ /**
411
+ * The amount on the cheque.
412
+ */
413
+ amount: number;
414
+
415
+ /**
416
+ * The bank account (ID or reference) from which the cheque amount is drawn.
417
+ */
418
+ bankAccount: string;
419
+
420
+ from: ContactsAPI.Contact;
421
+
422
+ /**
423
+ * The cheque number.
424
+ */
425
+ number: number;
426
+
427
+ to: ContactsAPI.Contact;
428
+
429
+ /**
430
+ * A URL to a logo for the cheque (optional).
431
+ */
432
+ logoURL?: string;
433
+
434
+ /**
435
+ * The memo text on the cheque (optional).
436
+ */
437
+ memo?: string;
438
+
439
+ /**
440
+ * A set of dynamic merge variables for customizing the cheque or accompanying
441
+ * documents (optional).
442
+ */
443
+ mergeVariables?: Record<string, unknown>;
444
+
445
+ /**
446
+ * An optional message template to be printed on or with the cheque.
447
+ */
448
+ messageTemplate?: string;
449
+ }
450
+ }
451
+
452
+ export interface BoxListResponse {
453
+ /**
454
+ * A unique ID prefixed with box\_
455
+ */
456
+ id: string;
457
+
458
+ /**
459
+ * The cheques inside this box (in read mode).
460
+ */
461
+ cheques: Array<BoxListResponse.Cheque>;
462
+
463
+ /**
464
+ * The UTC time at which this resource was created.
465
+ */
466
+ createdAt: string;
467
+
468
+ /**
469
+ * The contact of the 'from' field in read mode should be a fully expanded Contact.
470
+ */
471
+ from: ContactsAPI.Contact;
472
+
473
+ /**
474
+ * `true` if this is a live mode resource else `false`.
475
+ */
476
+ live: boolean;
477
+
478
+ /**
479
+ * The mailing class of this order. This determines the speed and cost of delivery.
480
+ * See `OrderMailingClass` for more details.
481
+ */
482
+ mailingClass:
483
+ | 'first_class'
484
+ | 'standard_class'
485
+ | 'express'
486
+ | 'certified'
487
+ | 'certified_return_receipt'
488
+ | 'registered'
489
+ | 'usps_first_class'
490
+ | 'usps_standard_class'
491
+ | 'usps_eddm'
492
+ | 'usps_express_2_day'
493
+ | 'usps_express_3_day'
494
+ | 'usps_first_class_certified'
495
+ | 'usps_first_class_certified_return_receipt'
496
+ | 'usps_first_class_registered'
497
+ | 'usps_express_3_day_signature_confirmation'
498
+ | 'usps_express_3_day_certified'
499
+ | 'usps_express_3_day_certified_return_receipt'
500
+ | 'ca_post_lettermail'
501
+ | 'ca_post_personalized'
502
+ | 'ca_post_neighbourhood_mail'
503
+ | 'ups_express_overnight'
504
+ | 'ups_express_2_day'
505
+ | 'ups_express_3_day'
506
+ | 'royal_mail_first_class'
507
+ | 'royal_mail_second_class'
508
+ | 'au_post_second_class';
509
+
510
+ /**
511
+ * Always "box".
512
+ */
513
+ object: 'box';
514
+
515
+ /**
516
+ * This order will transition from `ready` to `printing` on the day after this
517
+ * date. For example, if this is a date on Tuesday, the order will transition to
518
+ * `printing` on Wednesday at midnight eastern time.
519
+ */
520
+ sendDate: string;
521
+
522
+ /**
523
+ * See `OrderStatus` for more details on the status of this order.
524
+ */
525
+ status: 'ready' | 'printing' | 'processed_for_delivery' | 'completed' | 'cancelled';
526
+
527
+ /**
528
+ * The recipient of this order. This will be provided even if you delete the
529
+ * underlying contact.
530
+ */
531
+ to: ContactsAPI.Contact;
532
+
533
+ /**
534
+ * The UTC time at which this resource was last updated.
535
+ */
536
+ updatedAt: string;
537
+
538
+ /**
539
+ * The cancellation details of this order. Populated if the order has been
540
+ * cancelled.
541
+ */
542
+ cancellation?: Shared.Cancellation;
543
+
544
+ /**
545
+ * An optional string describing this resource. Will be visible in the API and the
546
+ * dashboard.
547
+ */
548
+ description?: string;
549
+
550
+ /**
551
+ * The last date that the IMB status was updated. See `imbStatus` for more details.
552
+ */
553
+ imbDate?: string;
554
+
555
+ /**
556
+ * The Intelligent Mail Barcode (IMB) status of this order. Only populated for
557
+ * US-printed and US-destined orders. This is the most detailed way to track
558
+ * non-express/certified orders.
559
+ */
560
+ imbStatus?: 'entered_mail_stream' | 'out_for_delivery' | 'returned_to_sender';
561
+
562
+ /**
563
+ * The most recent ZIP code of the USPS facility that the order has been processed
564
+ * through. Only populated when an `imbStatus` is present.
565
+ */
566
+ imbZIPCode?: string;
567
+
568
+ /**
569
+ * These will be merged with the variables in the template or HTML you create this
570
+ * order with. The keys in this object should match the variable names in the
571
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
572
+ * PDFs uploaded with the order.
573
+ */
574
+ mergeVariables?: Record<string, unknown>;
575
+
576
+ /**
577
+ * See the section on Metadata.
578
+ */
579
+ metadata?: Record<string, unknown>;
580
+
581
+ /**
582
+ * The tracking number of this order. Populated after an express/certified order
583
+ * has been processed for delivery.
584
+ */
585
+ trackingNumber?: string;
586
+
587
+ /**
588
+ * PostGrid renders a PDF preview for all orders. This should be inspected to
589
+ * ensure that the order is correct before it is sent out because it shows what
590
+ * will be printed and mailed to the recipient. Once the PDF preview is generated,
591
+ * this field will be returned by all `GET` endpoints which produce this order.
592
+ *
593
+ * This URL is a signed link to the PDF preview. It will expire after a short
594
+ * period of time. If you need to access this URL after it has expired, you can
595
+ * regenerate it by calling the `GET` endpoint again.
596
+ */
597
+ url?: string;
598
+ }
599
+
600
+ export namespace BoxListResponse {
601
+ export interface Cheque {
602
+ /**
603
+ * The amount on the cheque.
604
+ */
605
+ amount: number;
606
+
607
+ /**
608
+ * The bank account (ID or reference) from which the cheque amount is drawn.
609
+ */
610
+ bankAccount: string;
611
+
612
+ from: ContactsAPI.Contact;
613
+
614
+ /**
615
+ * The cheque number.
616
+ */
617
+ number: number;
618
+
619
+ to: ContactsAPI.Contact;
620
+
621
+ /**
622
+ * A URL to a logo for the cheque (optional).
623
+ */
624
+ logoURL?: string;
625
+
626
+ /**
627
+ * The memo text on the cheque (optional).
628
+ */
629
+ memo?: string;
630
+
631
+ /**
632
+ * A set of dynamic merge variables for customizing the cheque or accompanying
633
+ * documents (optional).
634
+ */
635
+ mergeVariables?: Record<string, unknown>;
636
+
637
+ /**
638
+ * An optional message template to be printed on or with the cheque.
639
+ */
640
+ messageTemplate?: string;
641
+ }
642
+ }
643
+
644
+ export interface BoxCancelResponse {
645
+ /**
646
+ * A unique ID prefixed with box\_
647
+ */
648
+ id: string;
649
+
650
+ /**
651
+ * The cheques inside this box (in read mode).
652
+ */
653
+ cheques: Array<BoxCancelResponse.Cheque>;
654
+
655
+ /**
656
+ * The UTC time at which this resource was created.
657
+ */
658
+ createdAt: string;
659
+
660
+ /**
661
+ * The contact of the 'from' field in read mode should be a fully expanded Contact.
662
+ */
663
+ from: ContactsAPI.Contact;
664
+
665
+ /**
666
+ * `true` if this is a live mode resource else `false`.
667
+ */
668
+ live: boolean;
669
+
670
+ /**
671
+ * The mailing class of this order. This determines the speed and cost of delivery.
672
+ * See `OrderMailingClass` for more details.
673
+ */
674
+ mailingClass:
675
+ | 'first_class'
676
+ | 'standard_class'
677
+ | 'express'
678
+ | 'certified'
679
+ | 'certified_return_receipt'
680
+ | 'registered'
681
+ | 'usps_first_class'
682
+ | 'usps_standard_class'
683
+ | 'usps_eddm'
684
+ | 'usps_express_2_day'
685
+ | 'usps_express_3_day'
686
+ | 'usps_first_class_certified'
687
+ | 'usps_first_class_certified_return_receipt'
688
+ | 'usps_first_class_registered'
689
+ | 'usps_express_3_day_signature_confirmation'
690
+ | 'usps_express_3_day_certified'
691
+ | 'usps_express_3_day_certified_return_receipt'
692
+ | 'ca_post_lettermail'
693
+ | 'ca_post_personalized'
694
+ | 'ca_post_neighbourhood_mail'
695
+ | 'ups_express_overnight'
696
+ | 'ups_express_2_day'
697
+ | 'ups_express_3_day'
698
+ | 'royal_mail_first_class'
699
+ | 'royal_mail_second_class'
700
+ | 'au_post_second_class';
701
+
702
+ /**
703
+ * Always "box".
704
+ */
705
+ object: 'box';
706
+
707
+ /**
708
+ * This order will transition from `ready` to `printing` on the day after this
709
+ * date. For example, if this is a date on Tuesday, the order will transition to
710
+ * `printing` on Wednesday at midnight eastern time.
711
+ */
712
+ sendDate: string;
713
+
714
+ /**
715
+ * See `OrderStatus` for more details on the status of this order.
716
+ */
717
+ status: 'ready' | 'printing' | 'processed_for_delivery' | 'completed' | 'cancelled';
718
+
719
+ /**
720
+ * The recipient of this order. This will be provided even if you delete the
721
+ * underlying contact.
722
+ */
723
+ to: ContactsAPI.Contact;
724
+
725
+ /**
726
+ * The UTC time at which this resource was last updated.
727
+ */
728
+ updatedAt: string;
729
+
730
+ /**
731
+ * The cancellation details of this order. Populated if the order has been
732
+ * cancelled.
733
+ */
734
+ cancellation?: Shared.Cancellation;
735
+
736
+ /**
737
+ * An optional string describing this resource. Will be visible in the API and the
738
+ * dashboard.
739
+ */
740
+ description?: string;
741
+
742
+ /**
743
+ * The last date that the IMB status was updated. See `imbStatus` for more details.
744
+ */
745
+ imbDate?: string;
746
+
747
+ /**
748
+ * The Intelligent Mail Barcode (IMB) status of this order. Only populated for
749
+ * US-printed and US-destined orders. This is the most detailed way to track
750
+ * non-express/certified orders.
751
+ */
752
+ imbStatus?: 'entered_mail_stream' | 'out_for_delivery' | 'returned_to_sender';
753
+
754
+ /**
755
+ * The most recent ZIP code of the USPS facility that the order has been processed
756
+ * through. Only populated when an `imbStatus` is present.
757
+ */
758
+ imbZIPCode?: string;
759
+
760
+ /**
761
+ * These will be merged with the variables in the template or HTML you create this
762
+ * order with. The keys in this object should match the variable names in the
763
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
764
+ * PDFs uploaded with the order.
765
+ */
766
+ mergeVariables?: Record<string, unknown>;
767
+
768
+ /**
769
+ * See the section on Metadata.
770
+ */
771
+ metadata?: Record<string, unknown>;
772
+
773
+ /**
774
+ * The tracking number of this order. Populated after an express/certified order
775
+ * has been processed for delivery.
776
+ */
777
+ trackingNumber?: string;
778
+
779
+ /**
780
+ * PostGrid renders a PDF preview for all orders. This should be inspected to
781
+ * ensure that the order is correct before it is sent out because it shows what
782
+ * will be printed and mailed to the recipient. Once the PDF preview is generated,
783
+ * this field will be returned by all `GET` endpoints which produce this order.
784
+ *
785
+ * This URL is a signed link to the PDF preview. It will expire after a short
786
+ * period of time. If you need to access this URL after it has expired, you can
787
+ * regenerate it by calling the `GET` endpoint again.
788
+ */
789
+ url?: string;
790
+ }
791
+
792
+ export namespace BoxCancelResponse {
793
+ export interface Cheque {
794
+ /**
795
+ * The amount on the cheque.
796
+ */
797
+ amount: number;
798
+
799
+ /**
800
+ * The bank account (ID or reference) from which the cheque amount is drawn.
801
+ */
802
+ bankAccount: string;
803
+
804
+ from: ContactsAPI.Contact;
805
+
806
+ /**
807
+ * The cheque number.
808
+ */
809
+ number: number;
810
+
811
+ to: ContactsAPI.Contact;
812
+
813
+ /**
814
+ * A URL to a logo for the cheque (optional).
815
+ */
816
+ logoURL?: string;
817
+
818
+ /**
819
+ * The memo text on the cheque (optional).
820
+ */
821
+ memo?: string;
822
+
823
+ /**
824
+ * A set of dynamic merge variables for customizing the cheque or accompanying
825
+ * documents (optional).
826
+ */
827
+ mergeVariables?: Record<string, unknown>;
828
+
829
+ /**
830
+ * An optional message template to be printed on or with the cheque.
831
+ */
832
+ messageTemplate?: string;
833
+ }
834
+ }
835
+
836
+ export interface BoxCreateParams {
837
+ /**
838
+ * The cheques to be mailed in the box. Only 100 cheques can be included in a box
839
+ * at a time.
840
+ */
841
+ cheques: Array<BoxCreateParams.Cheque>;
842
+
843
+ /**
844
+ * The 'from' (sender) of the entire box. Accepts inline ContactCreate or a
845
+ * contactID.
846
+ */
847
+ from: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
848
+
849
+ /**
850
+ * The recipient of this order. You can either supply the contact information
851
+ * inline here or provide a contact ID. PostGrid will automatically deduplicate
852
+ * contacts regardless of whether you provide the information inline here or call
853
+ * the contact creation endpoint.
854
+ */
855
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
856
+
857
+ /**
858
+ * An optional string describing this resource. Will be visible in the API and the
859
+ * dashboard.
860
+ */
861
+ description?: string;
862
+
863
+ /**
864
+ * The mailing class of this order. If not provided, automatically set to
865
+ * `first_class`.
866
+ */
867
+ mailingClass?:
868
+ | 'first_class'
869
+ | 'standard_class'
870
+ | 'express'
871
+ | 'certified'
872
+ | 'certified_return_receipt'
873
+ | 'registered'
874
+ | 'usps_first_class'
875
+ | 'usps_standard_class'
876
+ | 'usps_eddm'
877
+ | 'usps_express_2_day'
878
+ | 'usps_express_3_day'
879
+ | 'usps_first_class_certified'
880
+ | 'usps_first_class_certified_return_receipt'
881
+ | 'usps_first_class_registered'
882
+ | 'usps_express_3_day_signature_confirmation'
883
+ | 'usps_express_3_day_certified'
884
+ | 'usps_express_3_day_certified_return_receipt'
885
+ | 'ca_post_lettermail'
886
+ | 'ca_post_personalized'
887
+ | 'ca_post_neighbourhood_mail'
888
+ | 'ups_express_overnight'
889
+ | 'ups_express_2_day'
890
+ | 'ups_express_3_day'
891
+ | 'royal_mail_first_class'
892
+ | 'royal_mail_second_class'
893
+ | 'au_post_second_class';
894
+
895
+ /**
896
+ * These will be merged with the variables in the template or HTML you create this
897
+ * order with. The keys in this object should match the variable names in the
898
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
899
+ * PDFs uploaded with the order.
900
+ */
901
+ mergeVariables?: Record<string, unknown>;
902
+
903
+ /**
904
+ * See the section on Metadata.
905
+ */
906
+ metadata?: Record<string, unknown>;
907
+
908
+ /**
909
+ * This order will transition from `ready` to `printing` on the day after this
910
+ * date. You can use this parameter to schedule orders for a future date.
911
+ */
912
+ sendDate?: string;
913
+ }
914
+
915
+ export namespace BoxCreateParams {
916
+ export interface Cheque {
917
+ /**
918
+ * The amount on the cheque.
919
+ */
920
+ amount: number;
921
+
922
+ /**
923
+ * The bank account (ID or reference) from which the cheque amount is drawn.
924
+ */
925
+ bankAccount: string;
926
+
927
+ from: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
928
+
929
+ /**
930
+ * The cheque number.
931
+ */
932
+ number: number;
933
+
934
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
935
+
936
+ /**
937
+ * A URL to a logo for the cheque (optional).
938
+ */
939
+ logoURL?: string;
940
+
941
+ /**
942
+ * The memo text on the cheque (optional).
943
+ */
944
+ memo?: string;
945
+
946
+ /**
947
+ * A set of dynamic merge variables for customizing the cheque or accompanying
948
+ * documents (optional).
949
+ */
950
+ mergeVariables?: Record<string, unknown>;
951
+
952
+ /**
953
+ * An optional message template to be printed on or with the cheque.
954
+ */
955
+ messageTemplate?: string;
956
+ }
957
+ }
958
+
959
+ export interface BoxListParams extends ListParams {
960
+ /**
961
+ * You can supply any string to help narrow down the list of resources. For
962
+ * example, if you pass `"New York"` (quoted), it will return resources that have
963
+ * that string present somewhere in their response. Alternatively, you can supply a
964
+ * structured search query. See the documentation on `StructuredSearchQuery` for
965
+ * more details.
966
+ */
967
+ search?: string;
968
+ }
969
+
970
+ Boxes.BoxListResponsesList = BoxListResponsesList;
971
+
972
+ export declare namespace Boxes {
973
+ export {
974
+ type BoxCreateResponse as BoxCreateResponse,
975
+ type BoxRetrieveResponse as BoxRetrieveResponse,
976
+ type BoxListResponse as BoxListResponse,
977
+ type BoxCancelResponse as BoxCancelResponse,
978
+ BoxListResponsesList as BoxListResponsesList,
979
+ type BoxCreateParams as BoxCreateParams,
980
+ type BoxListParams as BoxListParams,
981
+ };
982
+ }