-
Notifications
You must be signed in to change notification settings - Fork 240
/
index.d.ts
77 lines (69 loc) · 2.16 KB
/
index.d.ts
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
declare module 'react-s3-uploader' {
import { Component } from 'react';
export interface S3Response {
signedUrl: string;
publicUrl: string;
filename: string;
fileKey: string;
}
export interface ReactS3UploaderProps {
signingUrl?: string;
signingUrlMethod?: 'GET' | 'POST';
getSignedUrl?: (file: File, callback: (params: S3Response) => void) => void;
accept?: string;
s3path?: string;
preprocess?: (file: File, next: (file: File) => void) => void;
onSignedUrl?: (response: S3Response) => void;
onProgress?: (percent: number, status: string, file: File) => void;
onError?: (message: string) => void;
onFinish?: (result: S3Response, file: File) => void;
signingUrlHeaders?: {
additional: object;
};
signingUrlQueryParams?: {
additional: object;
};
signingUrlWithCredentials?: boolean;
uploadRequestHeaders?: object;
contentDisposition?: string;
server?: string;
inputRef?: (ref: HTMLInputElement) => any;
autoUpload?: boolean;
scrubFilename?: (filename: string) => string;
[key: string]: any;
}
class ReactS3Uploader extends Component<ReactS3UploaderProps, unknown> { }
export default ReactS3Uploader;
}
declare module 'react-s3-uploader/s3upload' {
import { ReactS3UploaderProps, S3Response } from 'react-s3-uploader';
export interface S3UploadOptions extends Pick<
ReactS3UploaderProps,
| 'contentDisposition'
| 'getSignedUrl'
| 'onProgress'
| 'onError'
| 'onSignedUrl'
| 'preprocess'
| 's3path'
| 'server'
| 'signingUrl'
| 'signingUrlHeaders'
| 'signingUrlMethod'
| 'signingUrlQueryParams'
| 'signingUrlWithCredentials'
| 'uploadRequestHeaders'> {
fileElement?: HTMLInputElement | null;
files?: HTMLInputElement['files'] | null;
onFinishS3Put?: ReactS3UploaderProps['onFinish'];
successResponses?: number[];
scrubFilename?: (filename: string) => string;
}
class S3Upload {
constructor(options: ReactS3UploaderProps);
abortUpload(): void;
uploadFile(file: File): Promise<S3Response>;
uploadToS3(file: File, signResult: S3Response): void;
}
export default S3Upload;
}