@@ -142,6 +142,21 @@ 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 (self , provider_ids : list [str ], task_types : list [str ], number_of_tasks : int ) -> dict [str , typing .Any ]:
146+ """
147+ Get the next n task processing tasks from Nextcloud.
148+ Available starting with Nextcloud 33
149+ Returns: {tasks: [{task: Task, provider: string}], has_more: bool}
150+ """
151+ with contextlib .suppress (NextcloudException ):
152+ if r := self ._session .ocs (
153+ "GET" ,
154+ "/ocs/v2.php/taskprocessing/tasks_provider/next_batch" ,
155+ json = {"providerIds" : provider_ids , "taskTypeIds" : task_types , "numberOfTasks" : number_of_tasks },
156+ ):
157+ return r
158+ return {"tasks" : [], "has_more" : False }
159+
145160 def set_progress (self , task_id : int , progress : float ) -> dict [str , typing .Any ]:
146161 """Report new progress value of the task to Nextcloud. Progress should be in range from 0.0 to 100.0."""
147162 with contextlib .suppress (NextcloudException ):
@@ -220,6 +235,21 @@ async def next_task(self, provider_ids: list[str], task_types: list[str]) -> dic
220235 return r
221236 return {}
222237
238+ async def next_task_batch (self , provider_ids : list [str ], task_types : list [str ], number_of_tasks : int ) -> dict [str , typing .Any ]:
239+ """
240+ Get the next n task processing tasks from Nextcloud.
241+ Available starting with Nextcloud 33
242+ Returns: {tasks: [{task: Task, provider: string}], has_more: bool}
243+ """
244+ with contextlib .suppress (NextcloudException ):
245+ if r := await self ._session .ocs (
246+ "GET" ,
247+ "/ocs/v2.php/taskprocessing/tasks_provider/next_batch" ,
248+ json = {"providerIds" : provider_ids , "taskTypeIds" : task_types , "numberOfTasks" : number_of_tasks },
249+ ):
250+ return r
251+ return {"tasks" : [], "has_more" : False }
252+
223253 async def set_progress (self , task_id : int , progress : float ) -> dict [str , typing .Any ]:
224254 """Report new progress value of the task to Nextcloud. Progress should be in range from 0.0 to 100.0."""
225255 with contextlib .suppress (NextcloudException ):
0 commit comments