@@ -120,6 +120,47 @@ public function listObjects(int $workspaceId): array
120120 return $ result ;
121121 }
122122
123+ /**
124+ * Batch delete objects from a workspace. Waits for the async job to complete.
125+ *
126+ * @param list<string> $objects
127+ * @return array{deleted: list<array{objectName: string}>, failed: list<array{objectName: string, error: string}>}
128+ * @throws ClientException when any object deletion fails (stringCode: storage.workspace.batchDeleteFailed)
129+ */
130+ public function batchDeleteObjects (int $ workspaceId , array $ objects ): array
131+ {
132+ /**
133+ * @var array{
134+ * deleted: list<array{objectName: string}>,
135+ * failed: list<array{objectName: string, error: string}>
136+ * } $result
137+ */
138+ $ result = $ this ->client ->apiPostJson (
139+ "workspaces/ {$ workspaceId }/objects/batch-delete " ,
140+ ['objects ' => $ objects ],
141+ );
142+
143+ return $ result ;
144+ }
145+
146+ /**
147+ * Queue batch delete objects from a workspace. Returns job ID immediately.
148+ *
149+ * @param list<string> $objects
150+ * @return int jobId
151+ */
152+ public function queueBatchDeleteObjects (int $ workspaceId , array $ objects ): int
153+ {
154+ /** @var array{id: int} $job */
155+ $ job = $ this ->client ->apiPostJson (
156+ "workspaces/ {$ workspaceId }/objects/batch-delete " ,
157+ ['objects ' => $ objects ],
158+ false ,
159+ );
160+
161+ return (int ) $ job ['id ' ];
162+ }
163+
123164 /**
124165 * @param int $id
125166 * @param array $options (boolean) async
0 commit comments