IManager
in
API surface for apps interacting with and making use of LanguageModel providers without known which providers are installed
Tags
Table of Contents
Methods
- cancelTask() : void
- deleteTask() : void
- Delete a task that has been scheduled before
- getAvailableTaskTypes() : array<string, ShapeEnumValue[][]}>
- getNextScheduledTask() : Task
- getPreferredProvider() : IProvider
- getProviders() : array<string|int, IProvider>
- getTask() : Task
- getTasks() : array<int, Task>
- getUserTask() : Task
- getUserTasks() : array<int, Task>
- getUserTasksByApp() : array<int, Task>
- hasProviders() : bool
- lockTask() : bool
- Changes the task status to STATUS_RUNNING and, if successful, returns True.
- prepareInputData() : array<string|int, array<int, (numeric)|string|File>|(numeric)|string|File>
- Prepare the task's input data, so it can be processed by the provider ie. this replaces file ids with File objects
- processTask() : bool
- Process task with a synchronous provider
- runTask() : Task
- Run the task and return the finished task
- scheduleTask() : void
- setTaskProgress() : bool
- setTaskResult() : void
- setTaskStatus() : void
Methods
cancelTask()
public
cancelTask(int $id) : void
Parameters
- $id : int
-
The id of the task
Tags
deleteTask()
Delete a task that has been scheduled before
public
deleteTask(Task $task) : void
Parameters
- $task : Task
-
The task to delete
Tags
getAvailableTaskTypes()
public
getAvailableTaskTypes() : array<string, ShapeEnumValue[][]}>
Tags
Return values
array<string, ShapeEnumValue[][]}>getNextScheduledTask()
public
getNextScheduledTask([array<int, string> $taskTypeIds = [] ][, array<int, int> $taskIdsToIgnore = [] ]) : Task
Parameters
- $taskTypeIds : array<int, string> = []
- $taskIdsToIgnore : array<int, int> = []
Tags
Return values
TaskgetPreferredProvider()
public
getPreferredProvider(string $taskTypeId) : IProvider
Parameters
- $taskTypeId : string
Tags
Return values
IProvidergetProviders()
public
getProviders() : array<string|int, IProvider>
Tags
Return values
array<string|int, IProvider>getTask()
public
getTask(int $id) : Task
Parameters
- $id : int
-
The id of the task
Tags
Return values
TaskgetTasks()
public
getTasks(string|null $userId[, string|null $taskTypeId = null ][, string|null $appId = null ][, string|null $customId = null ][, int|null $status = null ][, int|null $scheduleAfter = null ][, int|null $endedBefore = null ]) : array<int, Task>
Parameters
- $userId : string|null
-
The user id that scheduled the task
- $taskTypeId : string|null = null
-
The task type id to filter by
- $appId : string|null = null
-
The app ID of the app that submitted the task
- $customId : string|null = null
-
The custom task ID
- $status : int|null = null
-
The task status
- $scheduleAfter : int|null = null
-
Minimum schedule time filter
- $endedBefore : int|null = null
-
Maximum ending time filter
Tags
Return values
array<int, Task>getUserTask()
public
getUserTask(int $id, string|null $userId) : Task
Parameters
- $id : int
-
The id of the task
- $userId : string|null
-
The user id that scheduled the task
Tags
Return values
TaskgetUserTasks()
public
getUserTasks(string|null $userId[, string|null $taskTypeId = null ][, string|null $customId = null ]) : array<int, Task>
Parameters
- $userId : string|null
-
The user id that scheduled the task
- $taskTypeId : string|null = null
-
The task type id to filter by
- $customId : string|null = null
Tags
Return values
array<int, Task>getUserTasksByApp()
public
getUserTasksByApp(string|null $userId, string $appId[, string|null $customId = null ]) : array<int, Task>
Parameters
- $userId : string|null
- $appId : string
- $customId : string|null = null
Tags
Return values
array<int, Task>hasProviders()
public
hasProviders() : bool
Tags
Return values
boollockTask()
Changes the task status to STATUS_RUNNING and, if successful, returns True.
public
lockTask(Task $task) : bool
Parameters
- $task : Task
Tags
Return values
boolprepareInputData()
Prepare the task's input data, so it can be processed by the provider ie. this replaces file ids with File objects
public
prepareInputData(Task $task) : array<string|int, array<int, (numeric)|string|File>|(numeric)|string|File>
Parameters
- $task : Task
Tags
Return values
array<string|int, array<int, (numeric)|string|File>|(numeric)|string|File>processTask()
Process task with a synchronous provider
public
processTask(Task $task, ISynchronousProvider $provider) : bool
Prepare task input data and run the process method of the provider This should only be used by OC\TaskProcessing\SynchronousBackgroundJob::run() and OCP\TaskProcessing\IManager::runTask()
Parameters
- $task : Task
- $provider : ISynchronousProvider
Tags
Return values
bool —True if the task has run successfully
runTask()
Run the task and return the finished task
public
runTask(Task $task) : Task
Parameters
- $task : Task
-
The task to run
Tags
Return values
Task —The result task
scheduleTask()
public
scheduleTask(Task $task) : void
Parameters
- $task : Task
-
The task to run
Tags
setTaskProgress()
public
setTaskProgress(int $id, float $progress) : bool
Parameters
- $id : int
- $progress : float
Tags
Return values
bool —true
if the task should still be running; false
if the task has been cancelled in the meantime
setTaskResult()
public
setTaskResult(int $id, string|null $error, array<string|int, mixed>|null $result[, bool $isUsingFileIds = false ]) : void
Parameters
- $id : int
-
The id of the task
- $error : string|null
- $result : array<string|int, mixed>|null
- $isUsingFileIds : bool = false
Tags
setTaskStatus()
public
setTaskStatus(Task $task, int $status) : void
Parameters
- $task : Task
- $status : int