Skip to content

Commit 558702b

Browse files
committed
add type declare for method in BucketManager
- putBucketAccessStyleMode - putBucketMaxAge - putBucketAccessMode - putBucketQuota - getBucketQuota
1 parent 113d646 commit 558702b

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

StorageResponseInterface.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,9 @@ export interface GetBucketInfoV2Result {
231231
remark: string;
232232
ctime: string;
233233
}
234+
235+
export interface GetBucketQuotaResult {
236+
[k: string]: any;
237+
size: number;
238+
count: number;
239+
}

index.d.ts

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import { Readable } from "stream";
99
import {
1010
BatchOpsResult,
1111
FetchObjectResult,
12-
GetBucketCorsRulesResult, GetBucketDomainsV3Result,
12+
GetBucketCorsRulesResult,
13+
GetBucketDomainsV3Result,
1314
GetBucketEventsResult,
1415
GetBucketInfoV2Result,
16+
GetBucketQuotaResult,
1517
GetBucketRulesResult,
1618
GetBucketsResult,
1719
GetObjectsResult,
@@ -1489,6 +1491,71 @@ export declare namespace rs {
14891491
* @param callbackFunc - 回调函数
14901492
*/
14911493
getCorsRules(bucket: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketCorsRulesResult>>
1494+
1495+
/**
1496+
* 设置空间原图保护
1497+
* @param bucket 空间名
1498+
* @param mode 为 1 表示开启原图保护,0 表示关闭
1499+
* @param callbackFunc 回调函数
1500+
*/
1501+
putBucketAccessStyleMode(bucket: string, mode: number, callbackFunc?: callback): Promise<httpc.ResponseWrapper<void>>
1502+
1503+
/**
1504+
* 设置缓存策略的 max-age 属性
1505+
* @param bucket
1506+
* @param options
1507+
* @param options.maxAge 为 0 或者负数表示为默认值(31536000)
1508+
* @param callbackFunc 回调函数
1509+
*/
1510+
putBucketMaxAge(
1511+
bucket: string,
1512+
options: {
1513+
maxAge: number
1514+
},
1515+
callbackFunc?: callback
1516+
): Promise<httpc.ResponseWrapper<void>>
1517+
1518+
/**
1519+
* 设置空间私有属性
1520+
* @param bucket
1521+
* @param options
1522+
* @param options.private 为 0 表示公开,为 1 表示私有,默认为 0
1523+
* @param callbackFunc
1524+
*/
1525+
putBucketAccessMode(
1526+
bucket: string,
1527+
options?: {
1528+
private?: number
1529+
},
1530+
callbackFunc?: callback
1531+
): Promise<httpc.ResponseWrapper<void>>
1532+
1533+
/**
1534+
* 设置配额
1535+
* @param bucket 空间名称,不支持授权空间
1536+
* @param options
1537+
* @param options.size 空间存储量配额,参数传入 0 或不传表示不更改当前配置,传入 -1 表示取消限额,新创建的空间默认没有限额。
1538+
* @param options.count 空间文件数配额,参数含义同<size>
1539+
* @param callbackFunc 回调函数
1540+
*/
1541+
putBucketQuota(
1542+
bucket: string,
1543+
options?: {
1544+
size?: number,
1545+
count?: number
1546+
},
1547+
callbackFunc?: callback
1548+
): Promise<httpc.ResponseWrapper<void>>
1549+
1550+
/**
1551+
* 获取配额
1552+
* @param bucket 空间名称,不支持授权空间
1553+
* @param callbackFunc 回调函数
1554+
*/
1555+
getBucketQuota(
1556+
bucket: string,
1557+
callbackFunc?: callback
1558+
): Promise<httpc.ResponseWrapper<GetBucketQuotaResult>>
14921559
}
14931560

14941561
/**

qiniu/storage/rs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,7 @@ BucketManager.prototype.getCorsRules = function (bucket, callbackFunc) {
13771377
};
13781378

13791379
/**
1380+
* 设置空间原图保护
13801381
* @param {string} bucket 空间名称
13811382
* @param {number} mode 为 1 表示开启原图保护,0 表示关闭
13821383
* @param {BucketOperationCallback} [callbackFunc]
@@ -1431,7 +1432,7 @@ BucketManager.prototype.putBucketMaxAge = function (bucket, options, callbackFun
14311432
* 设置空间私有属性
14321433
* @param {string} bucket
14331434
* @param {Object} options
1434-
* @param {number} [options.private] 为 0 表示公开,为 1 表示私有
1435+
* @param {number} [options.private] 为 0 表示公开,为 1 表示私有,默认为 0
14351436
* @param {BucketOperationCallback} [callbackFunc]
14361437
*/
14371438
BucketManager.prototype.putBucketAccessMode = function (bucket, options, callbackFunc) {

0 commit comments

Comments
 (0)