-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfiles.ts
More file actions
380 lines (352 loc) · 13.4 KB
/
files.ts
File metadata and controls
380 lines (352 loc) · 13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { Page, type PageParams, PagePromise } from '../core/pagination';
import { type Uploadable } from '../core/uploads';
import { RequestOptions } from '../internal/request-options';
import { multipartFormRequestOptions } from '../internal/uploads';
import { path } from '../internal/utils/path';
export class Files extends APIResource {
/**
* To upload a file to Increase, you'll need to send a request of Content-Type
* `multipart/form-data`. The request should contain the file you would like to
* upload, as well as the parameters for creating a file.
*
* @example
* ```ts
* const file = await client.files.create({
* file: fs.createReadStream('path/to/file'),
* purpose: 'check_image_front',
* });
* ```
*/
create(body: FileCreateParams, options?: RequestOptions): APIPromise<File> {
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client));
}
/**
* Retrieve a File
*
* @example
* ```ts
* const file = await client.files.retrieve(
* 'file_makxrc67oh9l6sg7w9yc',
* );
* ```
*/
retrieve(fileID: string, options?: RequestOptions): APIPromise<File> {
return this._client.get(path`/files/${fileID}`, options);
}
/**
* List Files
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const file of client.files.list()) {
* // ...
* }
* ```
*/
list(
query: FileListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<FilesPage, File> {
return this._client.getAPIList('/files', Page<File>, { query, ...options });
}
}
export type FilesPage = Page<File>;
/**
* Files are objects that represent a file hosted on Increase's servers. The file
* may have been uploaded by you (for example, when uploading a check image) or it
* may have been created by Increase (for example, an autogenerated statement PDF).
* If you need to download a File, create a File Link.
*/
export interface File {
/**
* The File's identifier.
*/
id: string;
/**
* The time the File was created.
*/
created_at: string;
/**
* A description of the File.
*/
description: string | null;
/**
* Whether the File was generated by Increase or by you and sent to Increase.
*
* - `to_increase` - This File was sent by you to Increase.
* - `from_increase` - This File was generated by Increase.
*/
direction: 'to_increase' | 'from_increase';
/**
* The filename that was provided upon upload or generated by Increase.
*/
filename: string | null;
/**
* The idempotency key you chose for this object. This value is unique across
* Increase and is used to ensure that a request is only processed once. Learn more
* about [idempotency](https://increase.com/documentation/idempotency-keys).
*/
idempotency_key: string | null;
/**
* The MIME type of the file.
*/
mime_type: string;
/**
* What the File will be used for. We may add additional possible values for this
* enum over time; your application should be able to handle such additions
* gracefully.
*
* - `card_dispute_attachment` - A file to be attached to a Card Dispute.
* - `check_image_front` - An image of the front of a check, used for check
* deposits.
* - `check_image_back` - An image of the back of a check, used for check deposits.
* - `processed_check_image_front` - An image of the front of a deposited check
* after processing by Increase and submission to the Federal Reserve.
* - `processed_check_image_back` - An image of the back of a deposited check after
* processing by Increase and submission to the Federal Reserve.
* - `mailed_check_image` - An image of a check that was mailed to a recipient.
* - `check_attachment` - A document to be printed on an additional page and mailed
* with a check that you've requested Increase print. This must be a PDF whose
* pages are all US letter size and all have the same orientation.
* - `check_voucher_image` - An image to be used as the check voucher image, which
* is printed in the middle of the trifold area of a check. This must be a
* 2550x1100 pixel PNG.
* - `check_signature` - A signature image to be printed on a check. This must be a
* 1320x120 pixel PNG.
* - `inbound_mail_item` - A scanned mail item sent to Increase.
* - `form_1099_int` - IRS Form 1099-INT.
* - `form_1099_misc` - IRS Form 1099-MISC.
* - `form_ss_4` - IRS Form SS-4.
* - `identity_document` - An image of a government-issued ID.
* - `increase_statement` - A statement generated by Increase.
* - `loan_application_supplemental_document` - A supplemental document for a Loan
* Application.
* - `other` - A file purpose not covered by any of the other cases.
* - `trust_formation_document` - A legal document forming a trust.
* - `digital_wallet_artwork` - A card image to be rendered inside digital wallet
* apps. This must be a 1536x969 pixel PNG.
* - `digital_wallet_app_icon` - An icon for you app to be rendered inside digital
* wallet apps. This must be a 100x100 pixel PNG.
* - `physical_card_front` - A card image to be printed on the front of a physical
* card. This must be a 2100x1344 pixel PNG with no other color but black.
* - `physical_card_back` - The image to be printed on the back of a physical card.
* - `physical_card_carrier` - An image representing the entirety of the carrier
* used for a physical card. This must be a 2550x3300 pixel PNG with no other
* color but black.
* - `document_request` - A document requested by Increase.
* - `entity_supplemental_document` - A supplemental document associated an an
* Entity.
* - `export` - The results of an Export you requested via the dashboard or API.
* - `fee_statement` - A fee statement.
* - `unusual_activity_report_attachment` - An attachment to an Unusual Activity
* Report.
* - `deposit_account_control_agreement` - A document granting another entity
* access to the funds into your account.
* - `proof_of_authorization_request_submission` - A file containing additional
* evidence for a Proof of Authorization Request Submission.
* - `account_verification_letter` - An account verification letter.
* - `funding_instructions` - Funding instructions.
* - `hold_harmless_letter` - A Hold Harmless Letter.
*/
purpose:
| 'card_dispute_attachment'
| 'check_image_front'
| 'check_image_back'
| 'processed_check_image_front'
| 'processed_check_image_back'
| 'mailed_check_image'
| 'check_attachment'
| 'check_voucher_image'
| 'check_signature'
| 'inbound_mail_item'
| 'form_1099_int'
| 'form_1099_misc'
| 'form_ss_4'
| 'identity_document'
| 'increase_statement'
| 'loan_application_supplemental_document'
| 'other'
| 'trust_formation_document'
| 'digital_wallet_artwork'
| 'digital_wallet_app_icon'
| 'physical_card_front'
| 'physical_card_back'
| 'physical_card_carrier'
| 'document_request'
| 'entity_supplemental_document'
| 'export'
| 'fee_statement'
| 'unusual_activity_report_attachment'
| 'deposit_account_control_agreement'
| 'proof_of_authorization_request_submission'
| 'account_verification_letter'
| 'funding_instructions'
| 'hold_harmless_letter';
/**
* A constant representing the object's type. For this resource it will always be
* `file`.
*/
type: 'file';
[k: string]: unknown;
}
export interface FileCreateParams {
/**
* The file contents. This should follow the specifications of
* [RFC 7578](https://datatracker.ietf.org/doc/html/rfc7578) which defines file
* transfers for the multipart/form-data protocol.
*/
file: Uploadable;
/**
* What the File will be used for in Increase's systems.
*
* - `card_dispute_attachment` - A file to be attached to a Card Dispute.
* - `check_image_front` - An image of the front of a check, used for check
* deposits.
* - `check_image_back` - An image of the back of a check, used for check deposits.
* - `mailed_check_image` - An image of a check that was mailed to a recipient.
* - `check_attachment` - A document to be printed on an additional page and mailed
* with a check that you've requested Increase print. This must be a PDF whose
* pages are all US letter size and all have the same orientation.
* - `check_voucher_image` - An image to be used as the check voucher image, which
* is printed in the middle of the trifold area of a check. This must be a
* 2550x1100 pixel PNG.
* - `check_signature` - A signature image to be printed on a check. This must be a
* 1320x120 pixel PNG.
* - `form_ss_4` - IRS Form SS-4.
* - `identity_document` - An image of a government-issued ID.
* - `loan_application_supplemental_document` - A supplemental document for a Loan
* Application.
* - `other` - A file purpose not covered by any of the other cases.
* - `trust_formation_document` - A legal document forming a trust.
* - `digital_wallet_artwork` - A card image to be rendered inside digital wallet
* apps. This must be a 1536x969 pixel PNG.
* - `digital_wallet_app_icon` - An icon for you app to be rendered inside digital
* wallet apps. This must be a 100x100 pixel PNG.
* - `physical_card_front` - A card image to be printed on the front of a physical
* card. This must be a 2100x1344 pixel PNG with no other color but black.
* - `physical_card_carrier` - An image representing the entirety of the carrier
* used for a physical card. This must be a 2550x3300 pixel PNG with no other
* color but black.
* - `document_request` - A document requested by Increase.
* - `entity_supplemental_document` - A supplemental document associated an an
* Entity.
* - `unusual_activity_report_attachment` - An attachment to an Unusual Activity
* Report.
* - `proof_of_authorization_request_submission` - A file containing additional
* evidence for a Proof of Authorization Request Submission.
*/
purpose:
| 'card_dispute_attachment'
| 'check_image_front'
| 'check_image_back'
| 'mailed_check_image'
| 'check_attachment'
| 'check_voucher_image'
| 'check_signature'
| 'form_ss_4'
| 'identity_document'
| 'loan_application_supplemental_document'
| 'other'
| 'trust_formation_document'
| 'digital_wallet_artwork'
| 'digital_wallet_app_icon'
| 'physical_card_front'
| 'physical_card_carrier'
| 'document_request'
| 'entity_supplemental_document'
| 'unusual_activity_report_attachment'
| 'proof_of_authorization_request_submission';
/**
* The description you choose to give the File.
*/
description?: string;
[k: string]: unknown;
}
export interface FileListParams extends PageParams {
created_at?: FileListParams.CreatedAt;
/**
* Filter records to the one with the specified `idempotency_key` you chose for
* that object. This value is unique across Increase and is used to ensure that a
* request is only processed once. Learn more about
* [idempotency](https://increase.com/documentation/idempotency-keys).
*/
idempotency_key?: string;
purpose?: FileListParams.Purpose;
}
export namespace FileListParams {
export interface CreatedAt {
/**
* Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
* timestamp.
*/
after?: string;
/**
* Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
* timestamp.
*/
before?: string;
/**
* Return results on or after this
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
*/
on_or_after?: string;
/**
* Return results on or before this
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
*/
on_or_before?: string;
}
export interface Purpose {
/**
* Filter Files for those with the specified purpose or purposes. For GET requests,
* this should be encoded as a comma-delimited string, such as `?in=one,two,three`.
*/
in?: Array<
| 'card_dispute_attachment'
| 'check_image_front'
| 'check_image_back'
| 'processed_check_image_front'
| 'processed_check_image_back'
| 'mailed_check_image'
| 'check_attachment'
| 'check_voucher_image'
| 'check_signature'
| 'inbound_mail_item'
| 'form_1099_int'
| 'form_1099_misc'
| 'form_ss_4'
| 'identity_document'
| 'increase_statement'
| 'loan_application_supplemental_document'
| 'other'
| 'trust_formation_document'
| 'digital_wallet_artwork'
| 'digital_wallet_app_icon'
| 'physical_card_front'
| 'physical_card_back'
| 'physical_card_carrier'
| 'document_request'
| 'entity_supplemental_document'
| 'export'
| 'fee_statement'
| 'unusual_activity_report_attachment'
| 'deposit_account_control_agreement'
| 'proof_of_authorization_request_submission'
| 'account_verification_letter'
| 'funding_instructions'
| 'hold_harmless_letter'
>;
}
}
export declare namespace Files {
export {
type File as File,
type FilesPage as FilesPage,
type FileCreateParams as FileCreateParams,
type FileListParams as FileListParams,
};
}