1 | import { RequestResult, UploadProgressEvent } from "./utils/request";
|
2 | declare type Region = 'oss-cn-hangzhou' | 'oss-cn-shanghai' | 'oss-cn-qingdao' | 'oss-cn-beijing' | 'oss-cn-zhangjiakou' | 'oss-cn-huhehaote' | 'oss-cn-shenzhen' | 'oss-cn-heyuan' | 'oss-cn-chengdu' | 'oss-cn-hongkong' | 'oss-us-west-1' | 'oss-us-east-1' | 'oss-ap-southeast-1' | 'oss-ap-southeast-2' | 'oss-ap-southeast-3' | 'oss-ap-southeast-5' | 'oss-ap-northeast-1' | 'oss-ap-south-1' | 'oss-eu-central-1' | 'oss-eu-west-1' | 'oss-me-east-1' | string;
|
3 | export interface ClientOptions {
|
4 | |
5 |
|
6 |
|
7 | accessKeyId: string;
|
8 | |
9 |
|
10 |
|
11 | accessKeySecret: string;
|
12 | bucket?: string;
|
13 | |
14 |
|
15 |
|
16 | stsToken?: string;
|
17 | |
18 |
|
19 |
|
20 | endpoint?: string;
|
21 | |
22 |
|
23 |
|
24 | region?: Region;
|
25 | |
26 |
|
27 |
|
28 |
|
29 | internal?: boolean;
|
30 | |
31 |
|
32 |
|
33 | timeout?: number;
|
34 | secure?: boolean;
|
35 | |
36 |
|
37 |
|
38 | cname?: boolean;
|
39 | }
|
40 | export interface PostObjectOptions {
|
41 | dir?: string;
|
42 | policy?: string | {
|
43 | expiration: string;
|
44 | conditions: any[];
|
45 | };
|
46 | signature?: string;
|
47 | timeout?: number;
|
48 | onProgress?: (e: UploadProgressEvent) => void;
|
49 | onSuccess?: (result: RequestResult, xhr: XMLHttpRequest) => void;
|
50 | onError?: (e: Error) => void;
|
51 | onAbort?: () => void;
|
52 | success_action_status?: 200 | 201 | 204;
|
53 | success_action_redirect?: string;
|
54 | 'x-oss-object-acl'?: 'private' | 'public-read' | 'public-read-write';
|
55 | headers?: {
|
56 | [key: string]: string | number;
|
57 | };
|
58 | [key: string]: any;
|
59 | }
|
60 | declare class Client {
|
61 | protected opts: ClientOptions & {
|
62 | host: string;
|
63 | };
|
64 | constructor(options: ClientOptions);
|
65 | /**
|
66 | * post object as form/multi-part
|
67 | * @param name
|
68 | * @param file
|
69 | * @param options
|
70 | */
|
71 | postObject(name: string, file: File | Blob, options?: PostObjectOptions): {
|
72 | abort(): void;
|
73 | };
|
74 | |
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | generateObjectUrl(name: string, baseUrl?: string): string;
|
81 | }
|
82 | export default Client;
|