forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
1227 lines (1053 loc) · 38.9 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
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for ali-oss 6.16
// Project: https://github.com/aliyun/oss-nodejs-sdk
// Definitions by: Ptrdu <https://github.com/ptrdu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3
export = OSS;
// basic OSS
declare namespace OSS {
interface Options {
/** access secret you create */
accessKeyId: string;
/** access secret you create */
accessKeySecret: string;
/** used by temporary authorization */
stsToken?: string | undefined;
/** the default bucket you want to access If you don't have any bucket, please use putBucket() create one first. */
bucket?: string | undefined;
/** oss region domain. It takes priority over region. */
endpoint?: string | undefined;
/** the bucket data region location, please see Data Regions, default is oss-cn-hangzhou. */
region?: string | undefined;
/** access OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set true to save lot of money. */
internal?: boolean | undefined;
/** instruct OSS client to use HTTPS (secure: true) or HTTP (secure: false) protocol. */
secure?: boolean | undefined;
/** instance level timeout for all operations, default is 60s */
timeout?: string | number | undefined;
/** use custom domain name */
cname?: boolean | undefined;
/** use time (ms) of refresh STSToken interval it should be less than sts info expire interval, default is 300000ms(5min) when sts info expires. */
refreshSTSTokenInterval?: number;
/** used by auto set stsToken、accessKeyId、accessKeySecret when sts info expires. return value must be object contains stsToken、accessKeyId、accessKeySecret */
refreshSTSToken?: () => Promise<{ accessKeyId: string, accessKeySecret: string, stsToken: string }>;
}
/**
* Generate STS Authorization
*/
class STS {
constructor(options: STSOptions);
assumeRole(
roleArn: string,
/**
* RAM Policy config object or valid JSON string
*/
policy?: object | string, // TODO: RAM policy type
expirationSeconds?: number,
session?: string,
options?: {
timeout: number;
/**
* ctx param in urllib's request param
*/
ctx: any;
},
): Promise<{ credentials: Credentials }>;
}
interface Credentials {
/**
* STS access key id.
*/
AccessKeyId: string;
/**
* STS access key secret.
*/
AccessKeySecret: string;
/**
* STS token.
*/
SecurityToken: string;
/**
* STS expiration UTC time in ISO format.
*/
Expiration: string;
}
interface STSOptions {
/**
* Access key id.
*/
accessKeyId: string;
/**
* Access key secret.
*/
accessKeySecret: string;
}
interface Bucket {
name: string;
region: string;
creationDate: string;
StorageClass: StorageType;
}
type StorageType = 'Standard' | 'IA' | 'Archive';
type ACLType = 'public-read-write' | 'public-read' | 'private';
type HTTPMethods = 'GET' | 'POST' | 'DELETE' | 'PUT';
type RedundancyType = 'LRS' | 'ZRS';
interface RequestOptions {
// the operation timeout
timeout?: number | undefined;
}
type RuleStatusType = 'Enabled' | 'Disabled';
interface LifecycleRule {
/** rule id, if not set, OSS will auto create it with random string. */
id?: string | undefined;
/** store prefix */
prefix: string;
/** rule status, allow values: Enabled or Disabled */
status: RuleStatusType;
/** expire after the days */
days?: number | string | undefined;
/** expire date, e.g.: 2022-10-11T00:00:00.000Z date and days only set one. */
date: string;
}
interface CORSRule {
/** configure for Access-Control-Allow-Origin header */
allowedOrigin: string | string[];
/** configure for Access-Control-Allow-Methods header */
allowedMethod: string | string[];
/** configure for Access-Control-Allow-Headers header */
allowedHeader?: string | string[] | undefined;
/** configure for Access-Control-Expose-Headers header */
exposeHeader?: string | string[] | undefined;
/** configure for Access-Control-Max-Age header */
maxAgeSeconds?: string | string[] | undefined;
}
interface OwnerType {
id: string;
displayName: string;
}
interface ObjectMeta {
/** object name on oss */
name: string;
/** object url */
url: string;
/** object last modified GMT date, e.g.: 2015-02-19T08:39:44.000Z */
lastModified: string;
/** object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE" */
etag: string;
/** object type, e.g.: Normal */
type: string;
/** object size, e.g.: 344606 */
size: number;
storageClass: StorageType;
owner?: OwnerType;
}
interface BucketPolicy {
Version: string;
Statement: Array<{
Action: string[];
Effect: 'Allow' | 'Deny';
Principal: string[];
Resource: string[];
}>;
}
interface NormalSuccessResponse {
/** response status */
status: number;
/** response headers */
/** todo the object in detail */
headers: object;
/** response size */
size: number;
/** request total use time (ms) */
rt: number;
}
/**
* @see x-oss-meta-* in https://help.aliyun.com/document_detail/31978.html for Aliyun user
* @see x-oss-meta-* in https://www.alibabacloud.com/help/en/doc-detail/31978.html for AlibabaCloud user
*/
interface UserMeta extends Record<string, string | number> {
uid: number;
pid: number;
}
interface ObjectCallback {
/** After a file is uploaded successfully, the OSS sends a callback request to this URL. */
url: string;
/** The host header value for initiating callback requests. */
host?: string | undefined;
/** The value of the request body when a callback is initiated, for example, key=$(key)&etag=$(etag)&my_var=$(x:my_var). */
body: string;
/** The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value. */
contentType?: string | undefined;
customValue?: object | undefined;
/** extra headers, detail see RFC 2616 */
headers?: object | undefined;
}
interface ModifyData {
/** object last modified GMT string */
lastModified: string;
/** object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE" */
etag: string;
}
interface Checkpoint {
/** The file object selected by the user, if the browser is restarted, it needs the user to manually trigger the settings */
file: any;
/** object key */
name: string;
fileSize: number;
partSize: number;
uploadId: string;
doneParts: Array<{ number: number; etag: string }>;
}
interface ObjectPart {
PartNumber: number;
/** {Date} Time when a part is uploaded. */
LastModified: any;
ETag: string;
size: number;
}
interface Upload {
name: string;
uploadId: string;
initiated: any;
}
interface Channel {
Name: string;
Description: string;
Status: string;
LastModified: string;
PublishUrls: string[];
PlayUrls: string[];
}
interface ChannelHistory {
StartTime: string;
EndTime: string;
/** the remote addr */
RemoteAddr: string;
}
// parameters type
interface ListBucketsQueryType {
/** search buckets using prefix key */
prefix?: string | undefined;
/** search start from marker, including marker key */
marker?: string | undefined;
/** max buckets, default is 100, limit to 1000 */
'max-keys'?: string | number | undefined;
}
interface PutBucketOptions {
acl: ACLType;
dataRedundancyType: RedundancyType;
timeout: number;
storageClass: StorageType;
}
interface PutBucketWebsiteConfig {
/** default page, e.g.: index.html */
index: string;
/** error page, e.g.: 'error.html' */
error?: string | undefined;
}
interface ListObjectsQuery {
/** search object using prefix key */
prefix?: string | undefined;
/** search start from marker, including marker key */
marker?: string | undefined;
/** only search current dir, not including subdir */
delimiter?: string | undefined; // delimiter search scope e.g.
/** max objects, default is 100, limit to 1000 */
'max-keys': string | number;
/** Specifies that the object names in the response are URL-encoded. */
'encoding-type'?: 'url' | '';
}
interface ListV2ObjectsQuery {
/** search object using prefix key */
prefix?: string;
/** search start from token, including token key */
'continuation-token'?: string;
/** only search current dir, not including subdir */
delimiter?: string | number;
/** max objects, default is 100, limit to 1000 */
'max-keys'?: string;
/**
* The name of the object from which the list operation begins.
* If this parameter is specified, objects whose names are alphabetically greater than the start-after parameter value are returned.
*/
'start-after'?: string;
/** Specifies whether to include the information about object owners in the response. */
'fetch-owner'?: boolean;
/** Specifies that the object names in the response are URL-encoded. */
'encoding-type'?: 'url' | '';
}
interface ListObjectResult {
objects: ObjectMeta[];
prefixes: string[];
isTruncated: boolean;
nextMarker: string;
res: NormalSuccessResponse;
}
interface PutObjectOptions {
/** the operation timeout */
timeout?: number | undefined;
/** custom mime, will send with Content-Type entity header */
mime?: string | undefined;
/** user meta, will send with x-oss-meta- prefix string e.g.: { uid: 123, pid: 110 } */
meta?: UserMeta | undefined;
callback?: ObjectCallback | undefined;
headers?: object | undefined;
}
interface PutObjectResult {
name: string;
url: string;
data: object;
res: NormalSuccessResponse;
}
interface PutStreamOptions {
/** the stream length, chunked encoding will be used if absent */
contentLength?: number | undefined;
/** the operation timeout */
timeout: number;
/** custom mime, will send with Content-Type entity header */
mime: string;
meta: UserMeta;
callback: ObjectCallback;
headers?: object | undefined;
}
interface AppendObjectOptions {
/** specify the position which is the content length of the latest object */
position?: string | undefined;
/** the operation timeout */
timeout?: number | undefined;
/** custom mime, will send with Content-Type entity header */
mime?: string | undefined;
meta?: UserMeta | undefined;
headers?: object | undefined;
}
interface AppendObjectResult {
name: string;
/** the url of oss */
url: string;
res: NormalSuccessResponse;
/** the next position */
nextAppendPosition: string;
}
interface HeadObjectOptions {
timeout?: number | undefined;
headers?: object | undefined;
}
interface HeadObjectResult {
/** response status, maybe 200 or 304 */
status: number;
meta: UserMeta;
res: NormalSuccessResponse;
}
interface GetObjectOptions {
timeout?: number | undefined;
/** The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value. */
process?: string | undefined;
headers?: object | undefined;
}
interface GetObjectResult {
/** file content buffer if file parameter is null or ignore */
content?: any;
res: NormalSuccessResponse;
}
interface GetStreamOptions {
timeout?: number | undefined;
/** The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value. */
process?: string | undefined;
headers?: object | undefined;
}
interface GetStreamResult {
/** readable stream instance if response status is not 200, stream will be null. */
stream?: any;
res: NormalSuccessResponse;
}
interface CopyObjectOptions {
timeout?: number | undefined;
meta?: UserMeta | undefined;
headers?: object | undefined;
}
interface CopyAndPutMetaResult {
data: ModifyData;
res: NormalSuccessResponse;
}
interface DeleteMultiOptions {
/** quite mode or verbose mode, default is false */
quiet?: boolean | undefined;
timeout?: number | undefined;
}
interface DeleteMultiResult {
/** deleted object names list */
deleted?: string[] | undefined;
res: NormalSuccessResponse;
}
interface ResponseHeaderType {
'content-type'?: string | undefined;
'content-disposition'?: string | undefined;
'cache-control'?: string | undefined;
}
interface SignatureUrlOptions {
/** after expires seconds, the url will become invalid, default is 1800 */
expires?: number | undefined;
/** the HTTP method, default is 'GET' */
method?: HTTPMethods | undefined;
/** set the request content type */
'Content-Type'?: string | undefined;
/** image process params, will send with x-oss-process e.g.: {process: 'image/resize,w_200'} */
process?: string | undefined;
/** traffic limit, range: 819200~838860800 */
trafficLimit?: number | undefined;
/** additional signature parameters in url */
subResource?: object | undefined;
/** set the response headers for download */
response?: ResponseHeaderType | undefined;
/** set the callback for the operation */
callback?: ObjectCallback | undefined;
}
interface GetACLResult {
acl: ACLType;
res: NormalSuccessResponse;
}
interface InitMultipartUploadOptions {
timeout?: number | undefined;
/** Mime file type */
mime?: string | undefined;
meta?: UserMeta | undefined;
headers?: object | undefined;
}
interface InitMultipartUploadResult {
res: { status: number; headers: object; size: number; rt: number };
/** bucket name */
bucket: string;
/** object name store on OSS */
name: string;
/** upload id, use for uploadPart, completeMultipart */
uploadId: string;
}
interface UploadPartResult {
name: string;
etag: string;
res: NormalSuccessResponse;
}
interface CompleteMultipartUploadOptions {
timeout?: number | undefined;
callback?: ObjectCallback | undefined;
headers?: object | undefined;
}
interface CompleteMultipartUploadResult {
bucket: string;
name: string;
etag: string;
data: object;
res: NormalSuccessResponse;
}
interface MultipartUploadOptions {
/** the number of parts to be uploaded in parallel */
parallel?: number | undefined;
/** the suggested size for each part */
partSize?: number | undefined;
/** the progress callback called after each successful upload of one part */
progress?: ((...args: any[]) => any) | undefined;
/** the checkpoint to resume upload, if this is provided, it will continue the upload from where interrupted, otherwise a new multipart upload will be created. */
checkpoint?: Checkpoint | undefined;
meta?: UserMeta | undefined;
mime?: string | undefined;
callback?: ObjectCallback | undefined;
headers?: object | undefined;
timeout?: number | undefined;
/** {Object} only uploadPartCopy api used, detail */
copyheaders?: object | undefined;
}
interface MultipartUploadResult {
bucket: string;
name: string;
etag: string;
data: object;
res: NormalSuccessResponse;
}
interface MultipartUploadCopyResult {
bucket: string;
name: string;
etag: string;
res: NormalSuccessResponse;
}
interface MultipartUploadCopySourceData {
/** the source object name */
sourceKey: string;
/** sourceData. the source bucket name */
sourceBucketName: string;
/** data copy start byte offset, e.g: 0 */
startOffset: number;
/** data copy end byte offset, e.g: 102400 */
endOffset: number;
}
interface ListPartsQuery {
/** The maximum part number in the response of the OSS. default value: 1000. */
'max-parts': number;
/** Starting position of a specific list. A part is listed only when the part number is greater than the value of this parameter. */
'part-number-marker': number;
/** Specify the encoding of the returned content and the encoding type. Optional value: url */
'encoding-type': string;
}
interface ListPartsResult {
uploadId: string;
bucket: string;
name: string;
PartNumberMarker: number;
nextPartNumberMarker: number;
maxParts: number;
isTruncated: boolean;
parts: ObjectPart[];
res: NormalSuccessResponse;
}
interface ListUploadsQuery {
prefix?: string | undefined;
'max-uploads'?: number | undefined;
'key-marker'?: string | undefined;
'upload-id-marker'?: string | undefined;
}
interface ListUploadsResult {
res: NormalSuccessResponse;
bucket: string;
nextKeyMarker: any;
nextUploadIdMarker: any;
isTruncated: boolean;
uploads: Upload[];
}
interface PutChannelConf {
Description?: string | undefined;
Status?: string | undefined;
Target?: {
Type: string;
FragDuration: number;
FragCount: number;
PlaylistName: string;
} | undefined;
}
interface PutChannelResult {
publishUrls: string[];
playUrls: string[];
res: NormalSuccessResponse;
}
interface GetChannelResult {
Status: string;
ConnectedTime?: string | undefined;
RemoteAddr?: string | undefined;
Video?: object | undefined;
Audio?: object | undefined;
res: NormalSuccessResponse;
}
interface ListChannelsQuery {
/** the channel id prefix (returns channels with this prefix) */
prefix: string;
/** the channel id marker (returns channels after this id) */
marker: string;
/** max number of channels to return */
'max-keys ': number;
}
interface ListChannelsResult {
channels: Channel[];
nextMarker: string | null;
isTruncated: boolean;
res: NormalSuccessResponse;
}
interface ChannelHistoryResult {
records: ChannelHistory;
res: NormalSuccessResponse;
}
interface GetRtmpUrlOptions {
/** the expire time in seconds of the url */
expires?: number | undefined;
/** the additional parameters for url, e.g.: {playlistName: 'play.m3u8'} */
params?: object | undefined;
/** the operation timeout */
timeout?: number | undefined;
}
interface GetBucketPolicyResult {
policy: BucketPolicy | null;
status: number;
res: NormalSuccessResponse;
}
interface PostObjectParams {
policy: string;
OSSAccessKeyId: string;
Signature: string;
}
}
// cluster
declare namespace OSS {
interface ClusterType {
host: string;
accessKeyId: string;
accessKeySecret: string;
}
interface ClusterOptions {
clusters: ClusterType[];
schedule?: string | undefined;
}
class ClusterClient {
constructor(options: ClusterOptions);
list(query: ListObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
/**
* @since 6.12.0
*/
listV2(query: ListV2ObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
put(name: string, file: any, options?: PutObjectOptions): Promise<PutObjectResult>;
putStream(
name: string,
stream: any,
options?: PutStreamOptions,
): Promise<{ name: string; res: NormalSuccessResponse }>;
head(name: string, options?: HeadObjectOptions): Promise<HeadObjectResult>;
get(name: string, file?: any, options?: GetObjectOptions): Promise<GetObjectResult>;
getStream(name?: string, options?: GetStreamOptions): Promise<GetStreamResult>;
delete(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
copy(name: string, sourceName: string, options?: CopyObjectOptions): Promise<CopyAndPutMetaResult>;
putMeta(name: string, meta: UserMeta, options: RequestOptions): Promise<CopyAndPutMetaResult>;
deleteMulti(names: string[], options?: DeleteMultiOptions): Promise<DeleteMultiResult>;
signatureUrl(name: string, options?: SignatureUrlOptions): string;
asyncSignatureUrl(name: string, options?: SignatureUrlOptions): Promise<string>;
putACL(name: string, acl: ACLType, options?: RequestOptions): Promise<NormalSuccessResponse>;
restore(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
}
}
// image
declare namespace OSS {
interface ImageClientOptions {
/** your image service domain that binding to a OSS bucket */
imageHost: string;
/** access key you create on aliyun console website */
accessKeyId: string;
/** access secret you create */
accessKeySecret: string;
/** the default bucket you want to access If you don't have any bucket, please use putBucket() create one first. */
bucket: string;
/** the bucket data region location, please see Data Regions, default is oss-cn-hangzhou */
region?: string | undefined;
/** access OSS with aliyun internal network or not, default is false If your servers are running on aliyun too, you can set true to save lot of money. */
internal?: boolean | undefined;
/** instance level timeout for all operations, default is 60s */
timeout?: string | number | undefined;
}
interface ImageGetOptions {
timeout?: number | undefined;
headers?: object | undefined;
}
interface StyleData {
/** style name */
Name: string;
/** style content */
Content: string;
/** style create time */
CreateTime: string;
/** style last modify time */
LastModifyTime: string;
}
class ImageClient {
constructor(options: ImageClientOptions);
/**
* Get an image from the image channel.
*/
get(name: string, file?: any, options?: ImageGetOptions): Promise<{ content: any; res: NormalSuccessResponse }>;
/**
* Get an image read stream.
*/
getStream(name: string, options?: ImageGetOptions): Promise<{ stream: any; res: NormalSuccessResponse }>;
/**
* Get a image exif info by image object name from the image channel.
*/
getExif(name: string, options?: RequestOptions): Promise<{ data: object; res: NormalSuccessResponse }>;
/**
* Get a image info and exif info by image object name from the image channel.
*/
getInfo(name: string, options?: RequestOptions): Promise<{ data: object; res: NormalSuccessResponse }>;
/**
* todo
*/
putStyle(
name: string,
style: string,
options?: RequestOptions,
): Promise<{ data: object; res: NormalSuccessResponse }>;
/**
* Get a style by name from the image channel.
*/
getStyle(name: string, options?: RequestOptions): Promise<{ data: StyleData; res: NormalSuccessResponse }>;
/**
* Get all styles from the image channel.
*/
listStyle(options?: RequestOptions): Promise<StyleData[]>;
/**
* todo
*/
deleteStyle(styleName: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
/**
* Create a signature url for directly download.
*/
signatureUrl(name: string, options?: { expires?: string | undefined; timeout?: string | undefined }): string;
/**
* Basically the same as signatureUrl, if refreshSTSToken is configured asyncSignatureUrl will refresh stsToken
*/
asyncSignatureUrl(name: string, options?: SignatureUrlOptions): Promise<string>;
}
}
declare class OSS {
constructor(options: OSS.Options);
/******************************************* the bucket operations *************************************************/
// base operators
/**
* List buckets in this account.
*/
listBuckets(query: OSS.ListBucketsQueryType | null, options?: OSS.RequestOptions): Promise<OSS.Bucket[]>;
/**
* Create a new bucket.
*/
putBucket(
name: string,
options?: OSS.PutBucketOptions,
): Promise<{ bucket: string; res: OSS.NormalSuccessResponse }>;
/**
* Use the bucket.
*/
useBucket(name: string): void;
/**
* Delete an empty bucket.
*/
deleteBucket(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
/**
* Get bucket information,include CreationDate、ExtranetEndpoint、IntranetEndpoint、Location、Name、StorageClass、 Owner、AccessControlList
*/
getBucketInfo(name: string): Promise<any>;
/**
* Get bucket location
*/
getBucketLocation(name: string): Promise<any>;
// ACL operations
/**
* Update the bucket ACL.
*/
putBucketACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
/**
* Get the bucket ACL.
* acl - acl settings string
*/
getBucketACL(name: string, options?: OSS.RequestOptions): Promise<{ acl: string; res: OSS.NormalSuccessResponse }>;
// logging operations
/**
* Update the bucket logging settings. Log file will create every one hour and name format: <prefix><bucket>-YYYY-mm-DD-HH-MM-SS-UniqueString.
*/
putBucketLogging(name: string, prefix?: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
/**
* Get the bucket logging settings.
*/
getBucketLogging(
name: string,
options?: OSS.RequestOptions,
): Promise<{ enable: boolean; prefix: string | null; res: OSS.NormalSuccessResponse }>;
/**
* Delete the bucket logging settings.
*/
deleteBucketLogging(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
// Website operations
/**
* Set the bucket as a static website.
*/
putBucketWebsite(name: string, config: OSS.PutBucketWebsiteConfig): Promise<OSS.NormalSuccessResponse>;
/**
* Get the bucket website config.
*/
getBucketWebsite(
name: string,
options?: OSS.RequestOptions,
): Promise<{ index: string; error: string; res: OSS.NormalSuccessResponse }>;
/**
* Delete the bucket website config.
*/
deleteBucketWebsite(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
// referer operations
/**
* Set the bucket request Referer white list.
*/
putBucketReferer(
name: string,
allowEmpty: boolean,
referers: string[],
options?: OSS.RequestOptions,
): Promise<OSS.NormalSuccessResponse>;
/**
* Get the bucket request Referer white list.
*/
getBucketReferer(
name: string,
options?: OSS.RequestOptions,
): Promise<{ allowEmpty: boolean; referers: string[]; res: OSS.NormalSuccessResponse }>;
/**
* Delete the bucket request Referer white list.
*/
deleteBucketReferer(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
// lifecycle operations
/**
* Set the bucket object lifecycle.
*/
putBucketLifecycle(
name: string,
rules: OSS.LifecycleRule[],
options?: OSS.RequestOptions,
): Promise<OSS.NormalSuccessResponse>;
/**
* Get the bucket object lifecycle.
*/
getBucketLifecycle(
name: string,
options?: OSS.RequestOptions,
): Promise<{ rules: OSS.LifecycleRule[]; res: OSS.NormalSuccessResponse }>;
/**
* Delete the bucket object lifecycle.
*/
deleteBucketLifecycle(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
// CORS operations
/**
* Set CORS rules of the bucket object
*/
putBucketCORS(
name: string,
rules: OSS.CORSRule[],
options?: OSS.RequestOptions,
): Promise<OSS.NormalSuccessResponse>;
/**
* Get CORS rules of the bucket object.
*/
getBucketCORS(name: string): Promise<{ rules: OSS.CORSRule[]; res: OSS.NormalSuccessResponse }>;
/**
* Delete CORS rules of the bucket object.
*/
deleteBucketCORS(name: string): Promise<OSS.NormalSuccessResponse>;
// policy operations
/**
* Adds or modify policy for a bucket.
*/
putBucketPolicy(
name: string,
policy: OSS.BucketPolicy,
options?: OSS.RequestOptions
): Promise<{
status: number,
res: OSS.NormalSuccessResponse,
}>;
/**
* Obtains the policy for a bucket.
*/
getBucketPolicy(name: string, options?: OSS.RequestOptions): Promise<OSS.GetBucketPolicyResult>;
/**
* Deletes the policy added for a bucket.
*/
deleteBucketPolicy(
name: string,
options?: OSS.RequestOptions
): Promise<{
status: number,
res: OSS.NormalSuccessResponse,
}>;
/********************************************************** Object operations ********************************************/
/**
* List objects in the bucket.
*/
list(query: OSS.ListObjectsQuery | null, options: OSS.RequestOptions): Promise<OSS.ListObjectResult>;
/**
* Add an object to the bucket.
*/
put(name: string, file: any, options?: OSS.PutObjectOptions): Promise<OSS.PutObjectResult>;
/**
* Add a stream object to the bucket.
*/