Skip to content

Commit 9c86d39

Browse files
committed
add deprecated to listPrefixV2
1 parent 7199df4 commit 9c86d39

File tree

2 files changed

+47
-30
lines changed

2 files changed

+47
-30
lines changed

index.d.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,21 @@ export declare namespace rs {
775775
*
776776
* @param bucket 空间名称
777777
* @param options 列举操作的可选参数
778-
* @param callback
778+
* @param callback 回调函数
779779
*/
780780
listPrefix(bucket: string, options: ListPrefixOptions | null, callback: callback): void;
781781

782+
/**
783+
* 获取制定前缀的文件列表 V2
784+
*
785+
* @deprecated API 可能返回仅包含 marker,不包含 item 或 dir 的项,请使用 {@link listPrefix}
786+
*
787+
* @param bucket 空间名称
788+
* @param options 列举操作的可选参数
789+
* @param callback 回调函数
790+
*/
791+
listPrefixV2(bucket: string, options: ListPrefixOptions | null, callback: callback): void;
792+
782793
/**
783794
* 批量文件管理请求,支持stat,chgm,chtype,delete,copy,move
784795
* @param operations

qiniu/storage/rs.js

+35-29
Original file line numberDiff line numberDiff line change
@@ -412,16 +412,18 @@ BucketManager.prototype.unimage = function (bucket, callbackFunc) {
412412
rpc.postWithoutForm(requestURI, digest, callbackFunc);
413413
};
414414

415-
// 获取指定前缀的文件列表
416-
// @link https://developer.qiniu.com/kodo/api/1284/list
417-
//
418-
// @param bucket 空间名称
419-
// @param options 列举操作的可选参数
420-
// prefix 列举的文件前缀
421-
// marker 上一次列举返回的位置标记,作为本次列举的起点信息
422-
// limit 每次返回的最大列举文件数量
423-
// delimiter 指定目录分隔符
424-
// @param callbackFunc(err, respBody, respInfo) - 回调函数
415+
/**
416+
* 获取指定前缀的文件列表
417+
* @link https://developer.qiniu.com/kodo/api/1284/list
418+
*
419+
* @param { string } bucket 空间名称
420+
* @param { Object } options 列举操作的可选参数
421+
* @param { string } options.prefix 列举的文件前缀
422+
* @param { string } options.marker 上一次列举返回的位置标记,作为本次列举的起点信息
423+
* @param { number } options.limit 每次返回的最大列举文件数量
424+
* @param { string } options.delimiter 指定目录分隔符
425+
* @param { function } callbackFunc(err, respBody, respInfo) 回调函数
426+
*/
425427
BucketManager.prototype.listPrefix = function (bucket, options, callbackFunc) {
426428
util.prepareZone(this, this.mac.accessKey, bucket, function (err, ctx) {
427429
if (err) {
@@ -432,10 +434,10 @@ BucketManager.prototype.listPrefix = function (bucket, options, callbackFunc) {
432434
});
433435
};
434436

435-
function listPrefixReq(mac, config, bucket, options, callbackFunc) {
437+
function listPrefixReq (mac, config, bucket, options, callbackFunc) {
436438
options = options || {};
437439
// 必须参数
438-
var reqParams = {
440+
const reqParams = {
439441
bucket: bucket
440442
};
441443

@@ -463,9 +465,9 @@ function listPrefixReq(mac, config, bucket, options, callbackFunc) {
463465
reqParams.delimiter = '';
464466
}
465467

466-
var scheme = config.useHttpsDomain ? 'https://' : 'http://';
467-
var reqSpec = querystring.stringify(reqParams);
468-
var requestURI = scheme + config.zone.rsfHost + '/list?' + reqSpec;
468+
const scheme = config.useHttpsDomain ? 'https://' : 'http://';
469+
const reqSpec = querystring.stringify(reqParams);
470+
const requestURI = scheme + config.zone.rsfHost + '/list?' + reqSpec;
469471

470472
rpc.postWithOptions(
471473
requestURI,
@@ -477,15 +479,19 @@ function listPrefixReq(mac, config, bucket, options, callbackFunc) {
477479
);
478480
}
479481

480-
// 获取指定前缀的文件列表
481-
//
482-
// @param bucket 空间名称
483-
// @param options 列举操作的可选参数
484-
// prefix 列举的文件前缀
485-
// marker 上一次列举返回的位置标记,作为本次列举的起点信息
486-
// limit 每次返回的最大列举文件数量
487-
// delimiter 指定目录分隔符
488-
// @param callbackFunc(err, respBody, respInfo) - 回调函数
482+
/**
483+
* 获取指定前缀的文件列表 V2
484+
*
485+
* @deprecated API 可能返回仅包含 marker,不包含 item 或 dir 的项,请使用 {@link listPrefix}
486+
*
487+
* @param bucket 空间名称
488+
* @param { Object } options 列举操作的可选参数
489+
* @param { string } options.prefix 列举的文件前缀
490+
* @param { string } options.marker 上一次列举返回的位置标记,作为本次列举的起点信息
491+
* @param { number } options.limit 每次返回的最大列举文件数量
492+
* @param { string } options.delimiter 指定目录分隔符
493+
* @param { function } callbackFunc(err, respBody, respInfo) 回调函数
494+
*/
489495
BucketManager.prototype.listPrefixV2 = function (bucket, options, callbackFunc) {
490496
util.prepareZone(this, this.mac.accessKey, bucket, function (err, ctx) {
491497
if (err) {
@@ -496,10 +502,10 @@ BucketManager.prototype.listPrefixV2 = function (bucket, options, callbackFunc)
496502
});
497503
};
498504

499-
function listPrefixReqV2(mac, config, bucket, options, callbackFunc) {
505+
function listPrefixReqV2 (mac, config, bucket, options, callbackFunc) {
500506
options = options || {};
501507
// 必须参数
502-
var reqParams = {
508+
const reqParams = {
503509
bucket: bucket
504510
};
505511

@@ -527,9 +533,9 @@ function listPrefixReqV2(mac, config, bucket, options, callbackFunc) {
527533
reqParams.delimiter = '';
528534
}
529535

530-
var scheme = config.useHttpsDomain ? 'https://' : 'http://';
531-
var reqSpec = querystring.stringify(reqParams);
532-
var requestURI = scheme + config.zone.rsfHost + '/v2/list?' + reqSpec;
536+
const scheme = config.useHttpsDomain ? 'https://' : 'http://';
537+
const reqSpec = querystring.stringify(reqParams);
538+
const requestURI = scheme + config.zone.rsfHost + '/v2/list?' + reqSpec;
533539

534540
rpc.postWithOptions(
535541
requestURI,

0 commit comments

Comments
 (0)