@@ -142,6 +142,23 @@ def next_task(self, provider_ids: list[str], task_types: list[str]) -> dict[str,
142142 return r
143143 return {}
144144
145+ def next_task_batch (
146+ self , provider_ids : list [str ], task_types : list [str ], number_of_tasks : int
147+ ) -> dict [str , typing .Any ]:
148+ """Get the next n task processing tasks from Nextcloud.
149+
150+ Available starting with Nextcloud 33
151+ Returns: {tasks: [{task: Task, provider: string}], has_more: bool}
152+ """
153+ with contextlib .suppress (NextcloudException ):
154+ if r := self ._session .ocs (
155+ "GET" ,
156+ "/ocs/v2.php/taskprocessing/tasks_provider/next_batch" ,
157+ json = {"providerIds" : provider_ids , "taskTypeIds" : task_types , "numberOfTasks" : number_of_tasks },
158+ ):
159+ return r
160+ return {"tasks" : [], "has_more" : False }
161+
145162 def set_progress (self , task_id : int , progress : float ) -> dict [str , typing .Any ]:
146163 """Report new progress value of the task to Nextcloud. Progress should be in range from 0.0 to 100.0."""
147164 with contextlib .suppress (NextcloudException ):
@@ -220,6 +237,23 @@ async def next_task(self, provider_ids: list[str], task_types: list[str]) -> dic
220237 return r
221238 return {}
222239
240+ async def next_task_batch (
241+ self , provider_ids : list [str ], task_types : list [str ], number_of_tasks : int
242+ ) -> dict [str , typing .Any ]:
243+ """Get the next n task processing tasks from Nextcloud.
244+
245+ Available starting with Nextcloud 33
246+ Returns: {tasks: [{task: Task, provider: string}], has_more: bool}
247+ """
248+ with contextlib .suppress (NextcloudException ):
249+ if r := await self ._session .ocs (
250+ "GET" ,
251+ "/ocs/v2.php/taskprocessing/tasks_provider/next_batch" ,
252+ json = {"providerIds" : provider_ids , "taskTypeIds" : task_types , "numberOfTasks" : number_of_tasks },
253+ ):
254+ return r
255+ return {"tasks" : [], "has_more" : False }
256+
223257 async def set_progress (self , task_id : int , progress : float ) -> dict [str , typing .Any ]:
224258 """Report new progress value of the task to Nextcloud. Progress should be in range from 0.0 to 100.0."""
225259 with contextlib .suppress (NextcloudException ):
0 commit comments