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,870 @@
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 Letters extends APIResource {
11
+ /**
12
+ * Create a letter. Note that you can supply one of the following:
13
+ *
14
+ * - HTML content for the letter
15
+ * - A template ID for the letter
16
+ * - A URL or file for a PDF for the letter
17
+ * - Upload the aforementioned PDF file via a multipart form upload request
18
+ */
19
+ create(body: LetterCreateParams, options?: Core.RequestOptions): Core.APIPromise<Letter> {
20
+ return this._client.post('/letters', { body, ...options });
21
+ }
22
+
23
+ /**
24
+ * Retrieve a letter by ID.
25
+ */
26
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Letter> {
27
+ return this._client.get(`/letters/${id}`, options);
28
+ }
29
+
30
+ /**
31
+ * Get a list of letters.
32
+ */
33
+ list(query?: LetterListParams, options?: Core.RequestOptions): Core.PagePromise<LettersList, Letter>;
34
+ list(options?: Core.RequestOptions): Core.PagePromise<LettersList, Letter>;
35
+ list(
36
+ query: LetterListParams | Core.RequestOptions = {},
37
+ options?: Core.RequestOptions,
38
+ ): Core.PagePromise<LettersList, Letter> {
39
+ if (isRequestOptions(query)) {
40
+ return this.list({}, query);
41
+ }
42
+ return this._client.getAPIList('/letters', LettersList, { query, ...options });
43
+ }
44
+
45
+ /**
46
+ * Cancel a letter by ID. Note that this operation cannot be undone.
47
+ */
48
+ delete(id: string, options?: Core.RequestOptions): Core.APIPromise<Letter> {
49
+ return this._client.delete(`/letters/${id}`, options);
50
+ }
51
+
52
+ /**
53
+ * Retrieve a letter preview URL.
54
+ *
55
+ * This is only available for customers with our document management addon, which
56
+ * offers document generation and hosting capabilities. This endpoint has a much
57
+ * higher rate limit than the regular order retrieval endpoint, so it is suitable
58
+ * for customer-facing use-cases.
59
+ */
60
+ url(id: string, options?: Core.RequestOptions): Core.APIPromise<LetterURLResponse> {
61
+ return this._client.get(`/letters/${id}/url`, options);
62
+ }
63
+ }
64
+
65
+ export class LettersList extends List<Letter> {}
66
+
67
+ export interface Letter {
68
+ /**
69
+ * A unique ID prefixed with letter\_
70
+ */
71
+ id: string;
72
+
73
+ /**
74
+ * Enum representing the placement of the address on the letter.
75
+ */
76
+ addressPlacement: 'top_first_page' | 'insert_blank_page';
77
+
78
+ /**
79
+ * Indicates if the letter is in color.
80
+ */
81
+ color: boolean;
82
+
83
+ /**
84
+ * The UTC time at which this resource was created.
85
+ */
86
+ createdAt: string;
87
+
88
+ /**
89
+ * Indicates if the letter is double-sided.
90
+ */
91
+ doubleSided: boolean;
92
+
93
+ /**
94
+ * The envelope (ID) for the letter or the default `standard` envelope.
95
+ */
96
+ envelope: string;
97
+
98
+ /**
99
+ * The contact information of the sender.
100
+ */
101
+ from: ContactsAPI.Contact;
102
+
103
+ /**
104
+ * `true` if this is a live mode resource else `false`.
105
+ */
106
+ live: boolean;
107
+
108
+ /**
109
+ * The mailing class of this order. This determines the speed and cost of delivery.
110
+ * See `OrderMailingClass` for more details.
111
+ */
112
+ mailingClass:
113
+ | 'first_class'
114
+ | 'standard_class'
115
+ | 'express'
116
+ | 'certified'
117
+ | 'certified_return_receipt'
118
+ | 'registered'
119
+ | 'usps_first_class'
120
+ | 'usps_standard_class'
121
+ | 'usps_eddm'
122
+ | 'usps_express_2_day'
123
+ | 'usps_express_3_day'
124
+ | 'usps_first_class_certified'
125
+ | 'usps_first_class_certified_return_receipt'
126
+ | 'usps_first_class_registered'
127
+ | 'usps_express_3_day_signature_confirmation'
128
+ | 'usps_express_3_day_certified'
129
+ | 'usps_express_3_day_certified_return_receipt'
130
+ | 'ca_post_lettermail'
131
+ | 'ca_post_personalized'
132
+ | 'ca_post_neighbourhood_mail'
133
+ | 'ups_express_overnight'
134
+ | 'ups_express_2_day'
135
+ | 'ups_express_3_day'
136
+ | 'royal_mail_first_class'
137
+ | 'royal_mail_second_class'
138
+ | 'au_post_second_class';
139
+
140
+ /**
141
+ * Always `letter`.
142
+ */
143
+ object: 'letter';
144
+
145
+ /**
146
+ * This order will transition from `ready` to `printing` on the day after this
147
+ * date. For example, if this is a date on Tuesday, the order will transition to
148
+ * `printing` on Wednesday at midnight eastern time.
149
+ */
150
+ sendDate: string;
151
+
152
+ /**
153
+ * Enum representing the supported letter sizes.
154
+ */
155
+ size: 'us_letter' | 'a4';
156
+
157
+ /**
158
+ * See `OrderStatus` for more details on the status of this order.
159
+ */
160
+ status: 'ready' | 'printing' | 'processed_for_delivery' | 'completed' | 'cancelled';
161
+
162
+ /**
163
+ * The recipient of this order. This will be provided even if you delete the
164
+ * underlying contact.
165
+ */
166
+ to: ContactsAPI.Contact;
167
+
168
+ /**
169
+ * The UTC time at which this resource was last updated.
170
+ */
171
+ updatedAt: string;
172
+
173
+ /**
174
+ * Model representing an attached PDF.
175
+ */
176
+ attachedPDF?: Letter.AttachedPdf;
177
+
178
+ /**
179
+ * The cancellation details of this order. Populated if the order has been
180
+ * cancelled.
181
+ */
182
+ cancellation?: Shared.Cancellation;
183
+
184
+ /**
185
+ * An optional string describing this resource. Will be visible in the API and the
186
+ * dashboard.
187
+ */
188
+ description?: string;
189
+
190
+ /**
191
+ * The HTML content for the letter. You can supply _either_ this or `template` but
192
+ * not both.
193
+ */
194
+ html?: string;
195
+
196
+ /**
197
+ * The last date that the IMB status was updated. See `imbStatus` for more details.
198
+ */
199
+ imbDate?: string;
200
+
201
+ /**
202
+ * The Intelligent Mail Barcode (IMB) status of this order. Only populated for
203
+ * US-printed and US-destined orders. This is the most detailed way to track
204
+ * non-express/certified orders.
205
+ */
206
+ imbStatus?: 'entered_mail_stream' | 'out_for_delivery' | 'returned_to_sender';
207
+
208
+ /**
209
+ * The most recent ZIP code of the USPS facility that the order has been processed
210
+ * through. Only populated when an `imbStatus` is present.
211
+ */
212
+ imbZIPCode?: string;
213
+
214
+ /**
215
+ * These will be merged with the variables in the template or HTML you create this
216
+ * order with. The keys in this object should match the variable names in the
217
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
218
+ * PDFs uploaded with the order.
219
+ */
220
+ mergeVariables?: Record<string, unknown>;
221
+
222
+ /**
223
+ * See the section on Metadata.
224
+ */
225
+ metadata?: Record<string, unknown>;
226
+
227
+ /**
228
+ * The ID of the PDF workflow run that created the letter, if any.
229
+ */
230
+ pdfWorkflowRun?: string;
231
+
232
+ /**
233
+ * If specified, indicates which letter page is perforated. Currently, only the
234
+ * first page can be perforated.
235
+ */
236
+ perforatedPage?: 1;
237
+
238
+ /**
239
+ * Model representing a plastic card.
240
+ */
241
+ plasticCard?: Letter.PlasticCard;
242
+
243
+ /**
244
+ * The return envelope (ID) sent out with the letter, if any.
245
+ */
246
+ returnEnvelope?: string;
247
+
248
+ /**
249
+ * The template ID used for the letter. You can supply _either_ this or `html` but
250
+ * not both.
251
+ */
252
+ template?: string;
253
+
254
+ /**
255
+ * The tracking number of this order. Populated after an express/certified order
256
+ * has been processed for delivery.
257
+ */
258
+ trackingNumber?: string;
259
+
260
+ /**
261
+ * If a PDF was uploaded for the letter, this will contain the signed link to the
262
+ * uploaded PDF.
263
+ */
264
+ uploadedPDF?: string;
265
+
266
+ /**
267
+ * PostGrid renders a PDF preview for all orders. This should be inspected to
268
+ * ensure that the order is correct before it is sent out because it shows what
269
+ * will be printed and mailed to the recipient. Once the PDF preview is generated,
270
+ * this field will be returned by all `GET` endpoints which produce this order.
271
+ *
272
+ * This URL is a signed link to the PDF preview. It will expire after a short
273
+ * period of time. If you need to access this URL after it has expired, you can
274
+ * regenerate it by calling the `GET` endpoint again.
275
+ */
276
+ url?: string;
277
+ }
278
+
279
+ export namespace Letter {
280
+ /**
281
+ * Model representing an attached PDF.
282
+ */
283
+ export interface AttachedPdf {
284
+ /**
285
+ * The file (multipart form upload) or URL pointing to a PDF for the attached PDF.
286
+ */
287
+ file: string;
288
+
289
+ /**
290
+ * Enum representing the placement of the attached PDF.
291
+ */
292
+ placement: 'before_template' | 'after_template';
293
+ }
294
+
295
+ /**
296
+ * Model representing a plastic card.
297
+ */
298
+ export interface PlasticCard {
299
+ /**
300
+ * Enum representing the size of the plastic card.
301
+ */
302
+ size: 'standard';
303
+
304
+ /**
305
+ * Model representing a double-sided plastic card.
306
+ */
307
+ doubleSided?: PlasticCard.DoubleSided;
308
+
309
+ /**
310
+ * Model representing a single-sided plastic card.
311
+ */
312
+ singleSided?: PlasticCard.SingleSided;
313
+ }
314
+
315
+ export namespace PlasticCard {
316
+ /**
317
+ * Model representing a double-sided plastic card.
318
+ */
319
+ export interface DoubleSided {
320
+ /**
321
+ * The HTML content for the back side of the double-sided plastic card.
322
+ */
323
+ backHTML?: string;
324
+
325
+ /**
326
+ * The template ID for the back side of the double-sided plastic card.
327
+ */
328
+ backTemplate?: string;
329
+
330
+ /**
331
+ * The HTML content for the front side of the double-sided plastic card.
332
+ */
333
+ frontHTML?: string;
334
+
335
+ /**
336
+ * The template ID for the front side of the double-sided plastic card.
337
+ */
338
+ frontTemplate?: string;
339
+
340
+ /**
341
+ * A URL pointing to a PDF file for the double-sided plastic card or the file
342
+ * itself.
343
+ */
344
+ pdf?: string;
345
+ }
346
+
347
+ /**
348
+ * Model representing a single-sided plastic card.
349
+ */
350
+ export interface SingleSided {
351
+ /**
352
+ * The HTML content for the single-sided plastic card. Can specify one of this,
353
+ * `template`, or `pdf`.
354
+ */
355
+ html?: string;
356
+
357
+ /**
358
+ * A URL pointing to a PDF file for the single-sided plastic card or the PDF file
359
+ * itself.
360
+ */
361
+ pdf?: string;
362
+
363
+ /**
364
+ * The template ID for the single-sided plastic card.
365
+ */
366
+ template?: string;
367
+ }
368
+ }
369
+ }
370
+
371
+ export interface LetterList {
372
+ data: Array<Letter>;
373
+
374
+ limit: number;
375
+
376
+ object: 'list';
377
+
378
+ skip: number;
379
+
380
+ totalCount: number;
381
+ }
382
+
383
+ export interface LetterURLResponse {
384
+ /**
385
+ * A unique ID prefixed with letter\_
386
+ */
387
+ id: string;
388
+
389
+ object: string;
390
+
391
+ /**
392
+ * A signed URL linking to the order preview PDF. The link remains valid for 15
393
+ * minutes from the time of the API call.
394
+ */
395
+ url: string;
396
+ }
397
+
398
+ export type LetterCreateParams =
399
+ | LetterCreateParams.LetterCreateWithHTML
400
+ | LetterCreateParams.LetterCreateWithTemplate
401
+ | LetterCreateParams.LetterCreateWithPdf;
402
+
403
+ export declare namespace LetterCreateParams {
404
+ export interface LetterCreateWithHTML {
405
+ /**
406
+ * The contact information of the sender. You can pass contact information inline
407
+ * here just like you can for the `to`.
408
+ */
409
+ from: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
410
+
411
+ /**
412
+ * The HTML content for the letter. You can supply _either_ this or `template` but
413
+ * not both.
414
+ */
415
+ html: string;
416
+
417
+ /**
418
+ * The recipient of this order. You can either supply the contact information
419
+ * inline here or provide a contact ID. PostGrid will automatically deduplicate
420
+ * contacts regardless of whether you provide the information inline here or call
421
+ * the contact creation endpoint.
422
+ */
423
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
424
+
425
+ /**
426
+ * Enum representing the placement of the address on the letter.
427
+ */
428
+ addressPlacement?: 'top_first_page' | 'insert_blank_page';
429
+
430
+ /**
431
+ * Model representing an attached PDF.
432
+ */
433
+ attachedPDF?: LetterCreateWithHTML.AttachedPdf;
434
+
435
+ /**
436
+ * Indicates if the letter is in color.
437
+ */
438
+ color?: boolean;
439
+
440
+ /**
441
+ * An optional string describing this resource. Will be visible in the API and the
442
+ * dashboard.
443
+ */
444
+ description?: string;
445
+
446
+ /**
447
+ * Indicates if the letter is double-sided.
448
+ */
449
+ doubleSided?: boolean;
450
+
451
+ /**
452
+ * The envelope (ID) for the letter. You can either specify a custom envelope ID or
453
+ * use the default `standard` envelope.
454
+ */
455
+ envelope?: string;
456
+
457
+ /**
458
+ * The mailing class of this order. If not provided, automatically set to
459
+ * `first_class`.
460
+ */
461
+ mailingClass?:
462
+ | 'first_class'
463
+ | 'standard_class'
464
+ | 'express'
465
+ | 'certified'
466
+ | 'certified_return_receipt'
467
+ | 'registered'
468
+ | 'usps_first_class'
469
+ | 'usps_standard_class'
470
+ | 'usps_eddm'
471
+ | 'usps_express_2_day'
472
+ | 'usps_express_3_day'
473
+ | 'usps_first_class_certified'
474
+ | 'usps_first_class_certified_return_receipt'
475
+ | 'usps_first_class_registered'
476
+ | 'usps_express_3_day_signature_confirmation'
477
+ | 'usps_express_3_day_certified'
478
+ | 'usps_express_3_day_certified_return_receipt'
479
+ | 'ca_post_lettermail'
480
+ | 'ca_post_personalized'
481
+ | 'ca_post_neighbourhood_mail'
482
+ | 'ups_express_overnight'
483
+ | 'ups_express_2_day'
484
+ | 'ups_express_3_day'
485
+ | 'royal_mail_first_class'
486
+ | 'royal_mail_second_class'
487
+ | 'au_post_second_class';
488
+
489
+ /**
490
+ * These will be merged with the variables in the template or HTML you create this
491
+ * order with. The keys in this object should match the variable names in the
492
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
493
+ * PDFs uploaded with the order.
494
+ */
495
+ mergeVariables?: Record<string, unknown>;
496
+
497
+ /**
498
+ * See the section on Metadata.
499
+ */
500
+ metadata?: Record<string, unknown>;
501
+
502
+ /**
503
+ * If specified, indicates which letter page is perforated. Currently, only the
504
+ * first page can be perforated.
505
+ */
506
+ perforatedPage?: 1;
507
+
508
+ /**
509
+ * Model representing a plastic card.
510
+ */
511
+ plasticCard?: LetterCreateWithHTML.PlasticCard;
512
+
513
+ /**
514
+ * The return envelope (ID) sent out with the letter, if any.
515
+ */
516
+ returnEnvelope?: string;
517
+
518
+ /**
519
+ * This order will transition from `ready` to `printing` on the day after this
520
+ * date. You can use this parameter to schedule orders for a future date.
521
+ */
522
+ sendDate?: string;
523
+
524
+ /**
525
+ * Enum representing the supported letter sizes.
526
+ */
527
+ size?: 'us_letter' | 'a4';
528
+ }
529
+
530
+ export namespace LetterCreateWithHTML {
531
+ /**
532
+ * Model representing an attached PDF.
533
+ */
534
+ export interface AttachedPdf {
535
+ /**
536
+ * The file (multipart form upload) or URL pointing to a PDF for the attached PDF.
537
+ */
538
+ file: string;
539
+
540
+ /**
541
+ * Enum representing the placement of the attached PDF.
542
+ */
543
+ placement: 'before_template' | 'after_template';
544
+ }
545
+
546
+ /**
547
+ * Model representing a plastic card.
548
+ */
549
+ export interface PlasticCard {
550
+ /**
551
+ * Enum representing the size of the plastic card.
552
+ */
553
+ size: 'standard';
554
+
555
+ /**
556
+ * Model representing a double-sided plastic card.
557
+ */
558
+ doubleSided?: PlasticCard.DoubleSided;
559
+
560
+ /**
561
+ * Model representing a single-sided plastic card.
562
+ */
563
+ singleSided?: PlasticCard.SingleSided;
564
+ }
565
+
566
+ export namespace PlasticCard {
567
+ /**
568
+ * Model representing a double-sided plastic card.
569
+ */
570
+ export interface DoubleSided {
571
+ /**
572
+ * The HTML content for the back side of the double-sided plastic card.
573
+ */
574
+ backHTML?: string;
575
+
576
+ /**
577
+ * The template ID for the back side of the double-sided plastic card.
578
+ */
579
+ backTemplate?: string;
580
+
581
+ /**
582
+ * The HTML content for the front side of the double-sided plastic card.
583
+ */
584
+ frontHTML?: string;
585
+
586
+ /**
587
+ * The template ID for the front side of the double-sided plastic card.
588
+ */
589
+ frontTemplate?: string;
590
+
591
+ /**
592
+ * A URL pointing to a PDF file for the double-sided plastic card or the file
593
+ * itself.
594
+ */
595
+ pdf?: string;
596
+ }
597
+
598
+ /**
599
+ * Model representing a single-sided plastic card.
600
+ */
601
+ export interface SingleSided {
602
+ /**
603
+ * The HTML content for the single-sided plastic card. Can specify one of this,
604
+ * `template`, or `pdf`.
605
+ */
606
+ html?: string;
607
+
608
+ /**
609
+ * A URL pointing to a PDF file for the single-sided plastic card or the PDF file
610
+ * itself.
611
+ */
612
+ pdf?: string;
613
+
614
+ /**
615
+ * The template ID for the single-sided plastic card.
616
+ */
617
+ template?: string;
618
+ }
619
+ }
620
+ }
621
+
622
+ export interface LetterCreateWithTemplate {
623
+ /**
624
+ * The template ID for the letter. You can supply _either_ this or `html` but not
625
+ * both.
626
+ */
627
+ template: string;
628
+ }
629
+
630
+ export interface LetterCreateWithPdf {
631
+ /**
632
+ * The contact information of the sender. You can pass contact information inline
633
+ * here just like you can for the `to`.
634
+ */
635
+ from: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
636
+
637
+ /**
638
+ * A URL pointing to a PDF file for the letter or the PDF file itself.
639
+ */
640
+ pdf: string;
641
+
642
+ /**
643
+ * The recipient of this order. You can either supply the contact information
644
+ * inline here or provide a contact ID. PostGrid will automatically deduplicate
645
+ * contacts regardless of whether you provide the information inline here or call
646
+ * the contact creation endpoint.
647
+ */
648
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
649
+
650
+ /**
651
+ * Enum representing the placement of the address on the letter.
652
+ */
653
+ addressPlacement?: 'top_first_page' | 'insert_blank_page';
654
+
655
+ /**
656
+ * Model representing an attached PDF.
657
+ */
658
+ attachedPDF?: LetterCreateWithPdf.AttachedPdf;
659
+
660
+ /**
661
+ * Indicates if the letter is in color.
662
+ */
663
+ color?: boolean;
664
+
665
+ /**
666
+ * An optional string describing this resource. Will be visible in the API and the
667
+ * dashboard.
668
+ */
669
+ description?: string;
670
+
671
+ /**
672
+ * Indicates if the letter is double-sided.
673
+ */
674
+ doubleSided?: boolean;
675
+
676
+ /**
677
+ * The envelope (ID) for the letter. You can either specify a custom envelope ID or
678
+ * use the default `standard` envelope.
679
+ */
680
+ envelope?: string;
681
+
682
+ /**
683
+ * The mailing class of this order. If not provided, automatically set to
684
+ * `first_class`.
685
+ */
686
+ mailingClass?:
687
+ | 'first_class'
688
+ | 'standard_class'
689
+ | 'express'
690
+ | 'certified'
691
+ | 'certified_return_receipt'
692
+ | 'registered'
693
+ | 'usps_first_class'
694
+ | 'usps_standard_class'
695
+ | 'usps_eddm'
696
+ | 'usps_express_2_day'
697
+ | 'usps_express_3_day'
698
+ | 'usps_first_class_certified'
699
+ | 'usps_first_class_certified_return_receipt'
700
+ | 'usps_first_class_registered'
701
+ | 'usps_express_3_day_signature_confirmation'
702
+ | 'usps_express_3_day_certified'
703
+ | 'usps_express_3_day_certified_return_receipt'
704
+ | 'ca_post_lettermail'
705
+ | 'ca_post_personalized'
706
+ | 'ca_post_neighbourhood_mail'
707
+ | 'ups_express_overnight'
708
+ | 'ups_express_2_day'
709
+ | 'ups_express_3_day'
710
+ | 'royal_mail_first_class'
711
+ | 'royal_mail_second_class'
712
+ | 'au_post_second_class';
713
+
714
+ /**
715
+ * These will be merged with the variables in the template or HTML you create this
716
+ * order with. The keys in this object should match the variable names in the
717
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
718
+ * PDFs uploaded with the order.
719
+ */
720
+ mergeVariables?: Record<string, unknown>;
721
+
722
+ /**
723
+ * See the section on Metadata.
724
+ */
725
+ metadata?: Record<string, unknown>;
726
+
727
+ /**
728
+ * If specified, indicates which letter page is perforated. Currently, only the
729
+ * first page can be perforated.
730
+ */
731
+ perforatedPage?: 1;
732
+
733
+ /**
734
+ * Model representing a plastic card.
735
+ */
736
+ plasticCard?: LetterCreateWithPdf.PlasticCard;
737
+
738
+ /**
739
+ * The return envelope (ID) sent out with the letter, if any.
740
+ */
741
+ returnEnvelope?: string;
742
+
743
+ /**
744
+ * This order will transition from `ready` to `printing` on the day after this
745
+ * date. You can use this parameter to schedule orders for a future date.
746
+ */
747
+ sendDate?: string;
748
+
749
+ /**
750
+ * Enum representing the supported letter sizes.
751
+ */
752
+ size?: 'us_letter' | 'a4';
753
+ }
754
+
755
+ export namespace LetterCreateWithPdf {
756
+ /**
757
+ * Model representing an attached PDF.
758
+ */
759
+ export interface AttachedPdf {
760
+ /**
761
+ * The file (multipart form upload) or URL pointing to a PDF for the attached PDF.
762
+ */
763
+ file: string;
764
+
765
+ /**
766
+ * Enum representing the placement of the attached PDF.
767
+ */
768
+ placement: 'before_template' | 'after_template';
769
+ }
770
+
771
+ /**
772
+ * Model representing a plastic card.
773
+ */
774
+ export interface PlasticCard {
775
+ /**
776
+ * Enum representing the size of the plastic card.
777
+ */
778
+ size: 'standard';
779
+
780
+ /**
781
+ * Model representing a double-sided plastic card.
782
+ */
783
+ doubleSided?: PlasticCard.DoubleSided;
784
+
785
+ /**
786
+ * Model representing a single-sided plastic card.
787
+ */
788
+ singleSided?: PlasticCard.SingleSided;
789
+ }
790
+
791
+ export namespace PlasticCard {
792
+ /**
793
+ * Model representing a double-sided plastic card.
794
+ */
795
+ export interface DoubleSided {
796
+ /**
797
+ * The HTML content for the back side of the double-sided plastic card.
798
+ */
799
+ backHTML?: string;
800
+
801
+ /**
802
+ * The template ID for the back side of the double-sided plastic card.
803
+ */
804
+ backTemplate?: string;
805
+
806
+ /**
807
+ * The HTML content for the front side of the double-sided plastic card.
808
+ */
809
+ frontHTML?: string;
810
+
811
+ /**
812
+ * The template ID for the front side of the double-sided plastic card.
813
+ */
814
+ frontTemplate?: string;
815
+
816
+ /**
817
+ * A URL pointing to a PDF file for the double-sided plastic card or the file
818
+ * itself.
819
+ */
820
+ pdf?: string;
821
+ }
822
+
823
+ /**
824
+ * Model representing a single-sided plastic card.
825
+ */
826
+ export interface SingleSided {
827
+ /**
828
+ * The HTML content for the single-sided plastic card. Can specify one of this,
829
+ * `template`, or `pdf`.
830
+ */
831
+ html?: string;
832
+
833
+ /**
834
+ * A URL pointing to a PDF file for the single-sided plastic card or the PDF file
835
+ * itself.
836
+ */
837
+ pdf?: string;
838
+
839
+ /**
840
+ * The template ID for the single-sided plastic card.
841
+ */
842
+ template?: string;
843
+ }
844
+ }
845
+ }
846
+ }
847
+
848
+ export interface LetterListParams extends ListParams {
849
+ /**
850
+ * You can supply any string to help narrow down the list of resources. For
851
+ * example, if you pass `"New York"` (quoted), it will return resources that have
852
+ * that string present somewhere in their response. Alternatively, you can supply a
853
+ * structured search query. See the documentation on `StructuredSearchQuery` for
854
+ * more details.
855
+ */
856
+ search?: string;
857
+ }
858
+
859
+ Letters.LettersList = LettersList;
860
+
861
+ export declare namespace Letters {
862
+ export {
863
+ type Letter as Letter,
864
+ type LetterList as LetterList,
865
+ type LetterURLResponse as LetterURLResponse,
866
+ LettersList as LettersList,
867
+ type LetterCreateParams as LetterCreateParams,
868
+ type LetterListParams as LetterListParams,
869
+ };
870
+ }