Skip to content

Commit 191f716

Browse files
committed
refactor: update delete method to handle a single object and improve documentation
1 parent f055fa4 commit 191f716

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/managers/objects.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,19 @@ export class ObjectsManager {
8686
}
8787

8888
/**
89-
* Deletes multiple objects.
89+
* Delete an object from the storage.
9090
*
91-
* @param objects - An array of object IDs
91+
* @param object - An array of object IDs
9292
*
9393
* @example
9494
* ```js
95-
* blob.objects.delete([
96-
* "userId/prefix/name1_xxx-xxx.mp4",
97-
* "userId/prefix/name_xxx-xxx-xxx.png"
98-
* ]);
95+
* blob.object.delete("userId/prefix/name1_xxx-xxx.mp4");
9996
* ```
10097
*/
101-
async delete(objects: string[]) {
98+
async delete(object: string) {
10299
const { status } = await this.client.api.request("objects", {
103100
method: "DELETE",
104-
body: { objects },
101+
body: { object },
105102
});
106103

107104
return status === "success";

test/delete.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { blob } from "./index.test";
22

3-
const objectsToDelete: string[] = [];
3+
const objectToDelete: string = "test.png";
44

5-
// Delete objects
6-
7-
blob.objects.delete(objectsToDelete).then(console.log);
5+
// Delete object
6+
blob.objects.delete(objectToDelete).then(console.log);

0 commit comments

Comments
 (0)