Skip to content

Commit 1c66e39

Browse files
authored
🤖 Merge PR DefinitelyTyped#74488 [ali-oss] Add ListV2ObjectResult definition & Fix README.zh-Hans typo by @Subilan
1 parent 3494c53 commit 1c66e39

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

README.zh-Hans.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ declare module "libname" {
105105

106106
你可直接编辑 `node_modules/@types/foo/index.d.ts` 来验证你的修改。接着,请使用下文所述的步骤将这些修改加入本仓库。
107107

108-
你亦可以使用[模块扩充(Module Argumentation)](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)来向 Definitely Typed 模块中添加类型,或使用上文所示的 `declare module` 方法来覆盖 `node_modules` 中的版本。
108+
你亦可以使用[模块扩充(Module Augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)来向 Definitely Typed 模块中添加类型,或使用上文所示的 `declare module` 方法来覆盖 `node_modules` 中的版本。
109109

110110
#### 为新增的软件包添加测试
111111

types/ali-oss/ali-oss-tests.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ client.getSymlink("newfile.png");
2323
client.getSymlink("newfile.png", { versionId: "123" });
2424

2525
client.listV2({ "max-keys": 1000 });
26+
27+
async function listV2Exhaustive() {
28+
let continuationToken = "";
29+
30+
while (true) {
31+
let res = await client.listV2({
32+
"max-keys": 1000,
33+
"continuation-token": continuationToken,
34+
});
35+
36+
if (res.isTruncated) {
37+
continuationToken = res.nextContinuationToken;
38+
} else {
39+
continuationToken = "";
40+
break;
41+
}
42+
}
43+
}
44+
2645
client.copy("newfile.png", "sourcefile.png");
2746
client.copy("newfile.png", "sourcefile.png", { timeout: 1000 });
2847
client.copy("newfile.png", "sourcefile.png", "sourceBucket");

types/ali-oss/index.d.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@ declare namespace OSS {
317317
res: NormalSuccessResponse;
318318
}
319319

320+
interface ListV2ObjectResult {
321+
objects: ObjectMeta[];
322+
prefixes: string[];
323+
isTruncated: boolean;
324+
nextContinuationToken: string;
325+
keyCount: number;
326+
res: NormalSuccessResponse;
327+
}
328+
320329
interface PutObjectOptions {
321330
/** the operation timeout */
322331
timeout?: number | undefined;
@@ -680,7 +689,7 @@ declare namespace OSS {
680689
/**
681690
* @since 6.12.0
682691
*/
683-
listV2(query: ListV2ObjectsQuery | null, options?: RequestOptions): Promise<ListObjectResult>;
692+
listV2(query: ListV2ObjectsQuery | null, options?: RequestOptions): Promise<ListV2ObjectResult>;
684693

685694
put(name: string, file: any, options?: PutObjectOptions): Promise<PutObjectResult>;
686695

@@ -1017,7 +1026,7 @@ declare class OSS {
10171026
/**
10181027
* List Objects in the bucket.(V2)
10191028
*/
1020-
listV2(query: OSS.ListV2ObjectsQuery | null, options?: OSS.RequestOptions): Promise<OSS.ListObjectResult>;
1029+
listV2(query: OSS.ListV2ObjectsQuery | null, options?: OSS.RequestOptions): Promise<OSS.ListV2ObjectResult>;
10211030

10221031
/**
10231032
* Add an object to the bucket.

0 commit comments

Comments
 (0)