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,548 @@
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 Postcards extends APIResource {
11
+ /**
12
+ * Create a postcard. Note that you can supply one of the following:
13
+ *
14
+ * - HTML content for the front and back of the postcard
15
+ * - A template ID for the front and back of the postcard
16
+ * - A URL or file for a 2 page PDF where the first page is the front of the
17
+ * postcard and the second page is the back
18
+ * - Upload the aforementioned PDF file via a multipart form upload request
19
+ */
20
+ create(body: PostcardCreateParams, options?: Core.RequestOptions): Core.APIPromise<Postcard> {
21
+ return this._client.post('/postcards', { body, ...options });
22
+ }
23
+
24
+ /**
25
+ * Retrieve a postcard by ID.
26
+ */
27
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Postcard> {
28
+ return this._client.get(`/postcards/${id}`, options);
29
+ }
30
+
31
+ /**
32
+ * Get a list of postcards.
33
+ */
34
+ list(query?: PostcardListParams, options?: Core.RequestOptions): Core.PagePromise<PostcardsList, Postcard>;
35
+ list(options?: Core.RequestOptions): Core.PagePromise<PostcardsList, Postcard>;
36
+ list(
37
+ query: PostcardListParams | Core.RequestOptions = {},
38
+ options?: Core.RequestOptions,
39
+ ): Core.PagePromise<PostcardsList, Postcard> {
40
+ if (isRequestOptions(query)) {
41
+ return this.list({}, query);
42
+ }
43
+ return this._client.getAPIList('/postcards', PostcardsList, { query, ...options });
44
+ }
45
+
46
+ /**
47
+ * Cancel a postcard by ID. Note that this operation cannot be undone.
48
+ */
49
+ delete(id: string, options?: Core.RequestOptions): Core.APIPromise<Postcard> {
50
+ return this._client.delete(`/postcards/${id}`, options);
51
+ }
52
+
53
+ /**
54
+ * Retrieve a postcard preview URL.
55
+ *
56
+ * This is only available for customers with our document management addon, which
57
+ * offers document generation and hosting capabilities. This endpoint has a much
58
+ * higher rate limit than the regular order retrieval endpoint, so it is suitable
59
+ * for customer-facing use-cases.
60
+ */
61
+ url(id: string, options?: Core.RequestOptions): Core.APIPromise<PostcardURLResponse> {
62
+ return this._client.get(`/postcards/${id}/url`, options);
63
+ }
64
+ }
65
+
66
+ export class PostcardsList extends List<Postcard> {}
67
+
68
+ export interface Postcard {
69
+ /**
70
+ * A unique ID prefixed with postcard\_
71
+ */
72
+ id: string;
73
+
74
+ /**
75
+ * The UTC time at which this resource was created.
76
+ */
77
+ createdAt: string;
78
+
79
+ /**
80
+ * `true` if this is a live mode resource else `false`.
81
+ */
82
+ live: boolean;
83
+
84
+ /**
85
+ * The mailing class of this order. This determines the speed and cost of delivery.
86
+ * See `OrderMailingClass` for more details.
87
+ */
88
+ mailingClass:
89
+ | 'first_class'
90
+ | 'standard_class'
91
+ | 'express'
92
+ | 'certified'
93
+ | 'certified_return_receipt'
94
+ | 'registered'
95
+ | 'usps_first_class'
96
+ | 'usps_standard_class'
97
+ | 'usps_eddm'
98
+ | 'usps_express_2_day'
99
+ | 'usps_express_3_day'
100
+ | 'usps_first_class_certified'
101
+ | 'usps_first_class_certified_return_receipt'
102
+ | 'usps_first_class_registered'
103
+ | 'usps_express_3_day_signature_confirmation'
104
+ | 'usps_express_3_day_certified'
105
+ | 'usps_express_3_day_certified_return_receipt'
106
+ | 'ca_post_lettermail'
107
+ | 'ca_post_personalized'
108
+ | 'ca_post_neighbourhood_mail'
109
+ | 'ups_express_overnight'
110
+ | 'ups_express_2_day'
111
+ | 'ups_express_3_day'
112
+ | 'royal_mail_first_class'
113
+ | 'royal_mail_second_class'
114
+ | 'au_post_second_class';
115
+
116
+ /**
117
+ * Always `postcard`.
118
+ */
119
+ object: 'postcard';
120
+
121
+ /**
122
+ * This order will transition from `ready` to `printing` on the day after this
123
+ * date. For example, if this is a date on Tuesday, the order will transition to
124
+ * `printing` on Wednesday at midnight eastern time.
125
+ */
126
+ sendDate: string;
127
+
128
+ /**
129
+ * Enum representing the supported postcard sizes.
130
+ */
131
+ size: '6x4' | '9x6' | '11x6';
132
+
133
+ /**
134
+ * See `OrderStatus` for more details on the status of this order.
135
+ */
136
+ status: 'ready' | 'printing' | 'processed_for_delivery' | 'completed' | 'cancelled';
137
+
138
+ /**
139
+ * The recipient of this order. This will be provided even if you delete the
140
+ * underlying contact.
141
+ */
142
+ to: ContactsAPI.Contact;
143
+
144
+ /**
145
+ * The UTC time at which this resource was last updated.
146
+ */
147
+ updatedAt: string;
148
+
149
+ /**
150
+ * The cancellation details of this order. Populated if the order has been
151
+ * cancelled.
152
+ */
153
+ cancellation?: Shared.Cancellation;
154
+
155
+ /**
156
+ * An optional string describing this resource. Will be visible in the API and the
157
+ * dashboard.
158
+ */
159
+ description?: string;
160
+
161
+ /**
162
+ * The contact information of the sender.
163
+ */
164
+ from?: ContactsAPI.Contact;
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 interface PostcardList {
217
+ data: Array<Postcard>;
218
+
219
+ limit: number;
220
+
221
+ object: 'list';
222
+
223
+ skip: number;
224
+
225
+ totalCount: number;
226
+ }
227
+
228
+ export interface PostcardURLResponse {
229
+ /**
230
+ * A unique ID prefixed with postcard\_
231
+ */
232
+ id: string;
233
+
234
+ object: string;
235
+
236
+ /**
237
+ * A signed URL linking to the order preview PDF. The link remains valid for 15
238
+ * minutes from the time of the API call.
239
+ */
240
+ url: string;
241
+ }
242
+
243
+ export type PostcardCreateParams =
244
+ | PostcardCreateParams.PostcardCreateWithHTML
245
+ | PostcardCreateParams.PostcardCreateWithTemplate
246
+ | PostcardCreateParams.PostcardCreateWithPdfurl
247
+ | PostcardCreateParams.PostcardCreateWithPdfFile;
248
+
249
+ export declare namespace PostcardCreateParams {
250
+ export interface PostcardCreateWithHTML {
251
+ /**
252
+ * The HTML content for the back of the postcard. You can supply _either_ this or
253
+ * `backTemplate` but not both.
254
+ */
255
+ backHTML: string;
256
+
257
+ /**
258
+ * The HTML content for the front of the postcard. You can supply _either_ this or
259
+ * `frontTemplate` but not both.
260
+ */
261
+ frontHTML: string;
262
+
263
+ /**
264
+ * Enum representing the supported postcard sizes.
265
+ */
266
+ size: '6x4' | '9x6' | '11x6';
267
+
268
+ /**
269
+ * The recipient of this order. You can either supply the contact information
270
+ * inline here or provide a contact ID. PostGrid will automatically deduplicate
271
+ * contacts regardless of whether you provide the information inline here or call
272
+ * the contact creation endpoint.
273
+ */
274
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
275
+
276
+ /**
277
+ * An optional string describing this resource. Will be visible in the API and the
278
+ * dashboard.
279
+ */
280
+ description?: string;
281
+
282
+ /**
283
+ * The contact information of the sender. You can pass contact information inline
284
+ * here just like you can for the `to`. Unlike other order types, the sender
285
+ * address is optional for postcards.
286
+ */
287
+ from?: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
288
+
289
+ /**
290
+ * The mailing class of this order. If not provided, automatically set to
291
+ * `first_class`.
292
+ */
293
+ mailingClass?:
294
+ | 'first_class'
295
+ | 'standard_class'
296
+ | 'express'
297
+ | 'certified'
298
+ | 'certified_return_receipt'
299
+ | 'registered'
300
+ | 'usps_first_class'
301
+ | 'usps_standard_class'
302
+ | 'usps_eddm'
303
+ | 'usps_express_2_day'
304
+ | 'usps_express_3_day'
305
+ | 'usps_first_class_certified'
306
+ | 'usps_first_class_certified_return_receipt'
307
+ | 'usps_first_class_registered'
308
+ | 'usps_express_3_day_signature_confirmation'
309
+ | 'usps_express_3_day_certified'
310
+ | 'usps_express_3_day_certified_return_receipt'
311
+ | 'ca_post_lettermail'
312
+ | 'ca_post_personalized'
313
+ | 'ca_post_neighbourhood_mail'
314
+ | 'ups_express_overnight'
315
+ | 'ups_express_2_day'
316
+ | 'ups_express_3_day'
317
+ | 'royal_mail_first_class'
318
+ | 'royal_mail_second_class'
319
+ | 'au_post_second_class';
320
+
321
+ /**
322
+ * These will be merged with the variables in the template or HTML you create this
323
+ * order with. The keys in this object should match the variable names in the
324
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
325
+ * PDFs uploaded with the order.
326
+ */
327
+ mergeVariables?: Record<string, unknown>;
328
+
329
+ /**
330
+ * See the section on Metadata.
331
+ */
332
+ metadata?: Record<string, unknown>;
333
+
334
+ /**
335
+ * This order will transition from `ready` to `printing` on the day after this
336
+ * date. You can use this parameter to schedule orders for a future date.
337
+ */
338
+ sendDate?: string;
339
+ }
340
+
341
+ export interface PostcardCreateWithTemplate {
342
+ /**
343
+ * The template ID for the back of the postcard. You can supply _either_ this or
344
+ * `backHTML` but not both.
345
+ */
346
+ backTemplate: string;
347
+
348
+ /**
349
+ * The template ID for the front of the postcard. You can supply _either_ this or
350
+ * `frontHTML` but not both.
351
+ */
352
+ frontTemplate: string;
353
+ }
354
+
355
+ export interface PostcardCreateWithPdfurl {
356
+ /**
357
+ * A URL pointing to a 2 page PDF file. The first page is the front of the postcard
358
+ * and the second page is the back (where the address will be stamped on).
359
+ */
360
+ pdf: string;
361
+
362
+ /**
363
+ * Enum representing the supported postcard sizes.
364
+ */
365
+ size: '6x4' | '9x6' | '11x6';
366
+
367
+ /**
368
+ * The recipient of this order. You can either supply the contact information
369
+ * inline here or provide a contact ID. PostGrid will automatically deduplicate
370
+ * contacts regardless of whether you provide the information inline here or call
371
+ * the contact creation endpoint.
372
+ */
373
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
374
+
375
+ /**
376
+ * An optional string describing this resource. Will be visible in the API and the
377
+ * dashboard.
378
+ */
379
+ description?: string;
380
+
381
+ /**
382
+ * The contact information of the sender. You can pass contact information inline
383
+ * here just like you can for the `to`. Unlike other order types, the sender
384
+ * address is optional for postcards.
385
+ */
386
+ from?: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
387
+
388
+ /**
389
+ * The mailing class of this order. If not provided, automatically set to
390
+ * `first_class`.
391
+ */
392
+ mailingClass?:
393
+ | 'first_class'
394
+ | 'standard_class'
395
+ | 'express'
396
+ | 'certified'
397
+ | 'certified_return_receipt'
398
+ | 'registered'
399
+ | 'usps_first_class'
400
+ | 'usps_standard_class'
401
+ | 'usps_eddm'
402
+ | 'usps_express_2_day'
403
+ | 'usps_express_3_day'
404
+ | 'usps_first_class_certified'
405
+ | 'usps_first_class_certified_return_receipt'
406
+ | 'usps_first_class_registered'
407
+ | 'usps_express_3_day_signature_confirmation'
408
+ | 'usps_express_3_day_certified'
409
+ | 'usps_express_3_day_certified_return_receipt'
410
+ | 'ca_post_lettermail'
411
+ | 'ca_post_personalized'
412
+ | 'ca_post_neighbourhood_mail'
413
+ | 'ups_express_overnight'
414
+ | 'ups_express_2_day'
415
+ | 'ups_express_3_day'
416
+ | 'royal_mail_first_class'
417
+ | 'royal_mail_second_class'
418
+ | 'au_post_second_class';
419
+
420
+ /**
421
+ * These will be merged with the variables in the template or HTML you create this
422
+ * order with. The keys in this object should match the variable names in the
423
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
424
+ * PDFs uploaded with the order.
425
+ */
426
+ mergeVariables?: Record<string, unknown>;
427
+
428
+ /**
429
+ * See the section on Metadata.
430
+ */
431
+ metadata?: Record<string, unknown>;
432
+
433
+ /**
434
+ * This order will transition from `ready` to `printing` on the day after this
435
+ * date. You can use this parameter to schedule orders for a future date.
436
+ */
437
+ sendDate?: string;
438
+ }
439
+
440
+ export interface PostcardCreateWithPdfFile {
441
+ /**
442
+ * A 2 page PDF file. The first page is the front of the postcard and the second
443
+ * page is the back (where the address will be stamped on).
444
+ */
445
+ pdf: string;
446
+
447
+ /**
448
+ * Enum representing the supported postcard sizes.
449
+ */
450
+ size: '6x4' | '9x6' | '11x6';
451
+
452
+ /**
453
+ * The recipient of this order. You can either supply the contact information
454
+ * inline here or provide a contact ID. PostGrid will automatically deduplicate
455
+ * contacts regardless of whether you provide the information inline here or call
456
+ * the contact creation endpoint.
457
+ */
458
+ to: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
459
+
460
+ /**
461
+ * An optional string describing this resource. Will be visible in the API and the
462
+ * dashboard.
463
+ */
464
+ description?: string;
465
+
466
+ /**
467
+ * The contact information of the sender. You can pass contact information inline
468
+ * here just like you can for the `to`. Unlike other order types, the sender
469
+ * address is optional for postcards.
470
+ */
471
+ from?: Shared.ContactCreateWithFirstName | Shared.ContactCreateWithCompanyName | string;
472
+
473
+ /**
474
+ * The mailing class of this order. If not provided, automatically set to
475
+ * `first_class`.
476
+ */
477
+ mailingClass?:
478
+ | 'first_class'
479
+ | 'standard_class'
480
+ | 'express'
481
+ | 'certified'
482
+ | 'certified_return_receipt'
483
+ | 'registered'
484
+ | 'usps_first_class'
485
+ | 'usps_standard_class'
486
+ | 'usps_eddm'
487
+ | 'usps_express_2_day'
488
+ | 'usps_express_3_day'
489
+ | 'usps_first_class_certified'
490
+ | 'usps_first_class_certified_return_receipt'
491
+ | 'usps_first_class_registered'
492
+ | 'usps_express_3_day_signature_confirmation'
493
+ | 'usps_express_3_day_certified'
494
+ | 'usps_express_3_day_certified_return_receipt'
495
+ | 'ca_post_lettermail'
496
+ | 'ca_post_personalized'
497
+ | 'ca_post_neighbourhood_mail'
498
+ | 'ups_express_overnight'
499
+ | 'ups_express_2_day'
500
+ | 'ups_express_3_day'
501
+ | 'royal_mail_first_class'
502
+ | 'royal_mail_second_class'
503
+ | 'au_post_second_class';
504
+
505
+ /**
506
+ * These will be merged with the variables in the template or HTML you create this
507
+ * order with. The keys in this object should match the variable names in the
508
+ * template _exactly_ as they are case-sensitive. Note that these _do not_ apply to
509
+ * PDFs uploaded with the order.
510
+ */
511
+ mergeVariables?: Record<string, unknown>;
512
+
513
+ /**
514
+ * See the section on Metadata.
515
+ */
516
+ metadata?: Record<string, unknown>;
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
+
526
+ export interface PostcardListParams extends ListParams {
527
+ /**
528
+ * You can supply any string to help narrow down the list of resources. For
529
+ * example, if you pass `"New York"` (quoted), it will return resources that have
530
+ * that string present somewhere in their response. Alternatively, you can supply a
531
+ * structured search query. See the documentation on `StructuredSearchQuery` for
532
+ * more details.
533
+ */
534
+ search?: string;
535
+ }
536
+
537
+ Postcards.PostcardsList = PostcardsList;
538
+
539
+ export declare namespace Postcards {
540
+ export {
541
+ type Postcard as Postcard,
542
+ type PostcardList as PostcardList,
543
+ type PostcardURLResponse as PostcardURLResponse,
544
+ PostcardsList as PostcardsList,
545
+ type PostcardCreateParams as PostcardCreateParams,
546
+ type PostcardListParams as PostcardListParams,
547
+ };
548
+ }