Class TaskuraiClient
A TaskuraiClient provides access to the Taskurai api.
Assembly: Taskurai.dll
public class TaskuraiClient : TaskuraiBaseClient
Inheritance: System.Object
-> Taskurai.TaskuraiBaseClient
Methods
GetLogsClient()
Create a new Taskurai.TaskuraiLogsClient object. The new Taskurai.TaskuraiLogsClient uses the same request policy pipeline as the Taskurai.TaskuraiClient.
public virtual TaskuraiLogsClient GetLogsClient()
Returns
Taskurai.TaskuraiLogsClient: A Taskurai.TaskuraiLogsClient for the logs client.### GetStateClient() Create a new Taskurai.TaskuraiStateClient object. The new Taskurai.TaskuraiStateClient uses the same request policy pipeline and isolation mode as the Taskurai.TaskuraiClient.
public virtual TaskuraiStateClient GetStateClient()
Returns
Taskurai.TaskuraiStateClient: A Taskurai.TaskuraiStateClient for the logs client.### Authorize(string, CancellationToken) Authorize against the Taskurai service (Required worker or scopes are not evaluated).
public virtual void Authorize(string pat, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
System.String | pat | Access Token |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if authorization request fails.
AuthorizeAsync(string, CancellationToken)
Authorize against the Taskurai service (Required worker or scopes are not evaluated).
public virtual Task AuthorizeAsync(string pat, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.String | pat | Access Token |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if authorization request fails.
TokenInfo(TokenInfoInput, CancellationToken)
Validate access token and return token info.
public virtual TokenInfoResponse TokenInfo(TokenInfoInput input, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TokenInfoResponse: Taskurai.Models.TokenInfoResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.TokenInfoInput | input | Taskurai.Models.TokenInfoInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if authorization request fails.
TokenInfoAsync(TokenInfoInput, CancellationToken)
Validate access token and return token info.
public virtual Task<TokenInfoResponse> TokenInfoAsync(TokenInfoInput input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TokenInfoResponse>
: Taskurai.Models.TokenInfoResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.TokenInfoInput | input | Taskurai.Models.TokenInfoInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if authorization request fails.
CreateTask(TaskConfig, CancellationToken)
Creates a task.
Required scope: Taskurai.Task.Create
public virtual TaskResponse CreateTask(TaskConfig input, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.TaskConfig | input | Taskurai.Models.TaskConfig. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
CreateTaskAsync(TaskConfig, CancellationToken)
Creates a task.
Required scope: Taskurai.Task.Create
public virtual Task<TaskResponse> CreateTaskAsync(TaskConfig input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>
: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.TaskConfig | input | Taskurai.Models.TaskConfig. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
CreateTaskAndWait(TaskConfig, CancellationToken)
Creates a task and returns operation to wait for a task to be completed.
Required scope: Taskurai.Task.Create
public virtual CreateTaskAndWaitOperation CreateTaskAndWait(TaskConfig input, CancellationToken cancellationToken = default)
Returns
Taskurai.CreateTaskAndWaitOperation: Taskurai.CreateTaskAndWaitOperation
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.TaskConfig | input | Taskurai.Models.TaskConfig. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
CreateTaskAndWaitAsync(TaskConfig, CancellationToken)
Creates a task and returns operation to wait for a task to be completed.
Required scope: Taskurai.Task.Create
public virtual Task<CreateTaskAndWaitOperation> CreateTaskAndWaitAsync(TaskConfig input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.CreateTaskAndWaitOperation>
: Taskurai.CreateTaskAndWaitOperation
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.TaskConfig | input | Taskurai.Models.TaskConfig. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
ListTasks(ListTasksOptions, CancellationToken)
Enumerate tasks.
Required scope: Taskurai.Task.Read
public virtual IEnumerable<TaskResponse> ListTasks(ListTasksOptions options = null, CancellationToken cancellationToken = default)
Returns
System.Collections.Generic.IEnumerable<Taskurai.Models.TaskResponse>
: System.Collections.Generic.IEnumerable%601
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.ListTasksOptions | options | Taskurai.Models.ListTasksOptions. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
ListTasksAsync(ListTasksOptions, CancellationToken)
Enumerate tasks.
Required scope: Taskurai.Task.Read
public virtual Task<IEnumerable<TaskResponse>> ListTasksAsync(ListTasksOptions options = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Taskurai.Models.TaskResponse>>
: System.Collections.Generic.IEnumerable%601
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.ListTasksOptions | options | Taskurai.Models.ListTasksOptions. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
GetTask(string, CancellationToken)
Get task by ID.
Required scope: Taskurai.Task.Read
public virtual TaskResponse GetTask(string id, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
GetTaskAsync(string, CancellationToken)
Get task by ID.
Required scope: Taskurai.Task.Read
public virtual Task<TaskResponse> GetTaskAsync(string id, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>
: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
UpdateTask(string, UpdateTaskInput, CancellationToken)
Updates a task.
Required scope: Taskurai.Task.Update
public virtual TaskResponse UpdateTask(string id, UpdateTaskInput input, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
Taskurai.Models.UpdateTaskInput | input | Taskurai.Models.UpdateTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
UpdateTaskAsync(string, UpdateTaskInput, CancellationToken)
Updates a task.
Required scope: Taskurai.Task.Update
public virtual Task<TaskResponse> UpdateTaskAsync(string id, UpdateTaskInput input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>
: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
Taskurai.Models.UpdateTaskInput | input | Taskurai.Models.UpdateTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
DeleteTask(string, CancellationToken)
Deletes a task.
Required scope: Taskurai.Task.Delete
public virtual void DeleteTask(string id, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
DeleteTaskAsync(string, CancellationToken)
Deletes a task.
Required scope: Taskurai.Task.Delete
public virtual Task DeleteTaskAsync(string id, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
RetrieveQueuedTask(RetrieveQueuedTaskInput, CancellationToken)
Retrieve the first queued task, making it invisible for other workers for a given time (default = 5 minutes, maximum 7 days). If the task is not completed within the invisible time, another worker can pick the task up.
Required scope: Taskurai.Task.Update
It is advised to call this command using the task context.
public virtual TaskDequeueResponse RetrieveQueuedTask(RetrieveQueuedTaskInput input, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskDequeueResponse: Taskurai.Models.TaskDequeueResponse, returns null if no more tasks are found for this worker
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.RetrieveQueuedTaskInput | input | Taskurai.Models.RetrieveQueuedTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
RetrieveQueuedTaskAsync(RetrieveQueuedTaskInput, CancellationToken)
Retrieve the first queued task, making it invisible for other workers for a given time (default = 5 minutes, maximum 7 days). If the task is not completed within the invisible time, another worker can pick the task up.
Required scope: Taskurai.Task.Update
It is advised to call this command using the task context.
public virtual Task<TaskDequeueResponse> RetrieveQueuedTaskAsync(RetrieveQueuedTaskInput input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskDequeueResponse>
: Taskurai.Models.TaskDequeueResponse, returns null if no more tasks are found for this worker
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.RetrieveQueuedTaskInput | input | Taskurai.Models.RetrieveQueuedTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
ExtendTask(string, ExtendTaskInput, CancellationToken)
Extend the task visibility timeout to other worker instances.
Required scope: Taskurai.Task.Update
The newly returned task token should be used for further actions (Update, Complete task). Previous tokens are valid for the original granted duration.
It is advised to call this command using the task context.
public virtual TaskExtendResponse ExtendTask(string taskToken, ExtendTaskInput input, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskExtendResponse: Taskurai.Models.TaskExtendResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | taskToken | Task token (returned by RetrieveQueuedTask or ExtendTask) |
Taskurai.Models.ExtendTaskInput | input | Taskurai.Models.ExtendTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
ExtendTaskAsync(string, ExtendTaskInput, CancellationToken)
Extend the task visibility timeout to other worker instances
Required scope: Taskurai.Task.Update
The newly returned task token should be used for further actions (Update, Complete task). Previous tokens are valid for the original granted duration.
It is advised to call this command using the task context.
public virtual Task<TaskExtendResponse> ExtendTaskAsync(string taskToken, ExtendTaskInput input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskExtendResponse>
: Taskurai.Models.TaskExtendResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | taskToken | Task token (returned by RetrieveQueuedTask or ExtendTask) |
Taskurai.Models.ExtendTaskInput | input | Taskurai.Models.ExtendTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
CompleteTask(string, CompleteTaskInput, CancellationToken)
Mark the task as completed and report the status (Succeeded, Failed, ...).
Required scope: Taskurai.Task.Update
It is advised to call this command using the task context.
public virtual TaskResponse CompleteTask(string taskToken, CompleteTaskInput input, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | taskToken | Task token (returned by RetrieveQueuedTask) |
Taskurai.Models.CompleteTaskInput | input | Taskurai.Models.CompleteTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
CompleteTaskAsync(string, CompleteTaskInput, CancellationToken)
Mark the task as completed and report the status (Succeeded, Failed, ...).
Required scope: Taskurai.Task.Update
It is advised to call this command using the task context.
public virtual Task<TaskResponse> CompleteTaskAsync(string taskToken, CompleteTaskInput input, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>
: Taskurai.Models.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | taskToken | Task token (returned by RetrieveQueuedTask) |
Taskurai.Models.CompleteTaskInput | input | Taskurai.Models.CompleteTaskInput. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
ListTaskHistory(string, ListTaskHistoryOptions, CancellationToken)
List task history, includes all previous runs and the current task.
Required scope: Taskurai.Task.Read
public virtual IEnumerable<TaskHistoryResponse> ListTaskHistory(string id, ListTaskHistoryOptions options = null, CancellationToken cancellationToken = default)
Returns
System.Collections.Generic.IEnumerable<Taskurai.Models.TaskHistoryResponse>
: System.Collections.Generic.IEnumerable%601
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
Taskurai.Models.ListTaskHistoryOptions | options | Taskurai.Models.ListTaskHistoryOptions. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
ListTaskHistoryAsync(string, ListTaskHistoryOptions, CancellationToken)
List task history, includes all previous runs and the current task.
Required scope: Taskurai.Task.Read
public virtual Task<IEnumerable<TaskHistoryResponse>> ListTaskHistoryAsync(string id, ListTaskHistoryOptions options = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Taskurai.Models.TaskHistoryResponse>>
: System.Collections.Generic.IEnumerable%601
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
Taskurai.Models.ListTaskHistoryOptions | options | Taskurai.Models.ListTaskHistoryOptions. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
GetTaskHistory(string, long, CancellationToken)
Get a task history by run count, can also retrieve the current task.
Required scope: Taskurai.Task.Read
public virtual TaskHistoryResponse GetTaskHistory(string id, long runCount, CancellationToken cancellationToken = default)
Returns
Taskurai.Models.TaskHistoryResponse: Taskurai.Models.TaskHistoryResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
System.Int64 | runCount | Task run count |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.
GetTaskHistoryAsync(string, long, CancellationToken)
Get a task history by run count, can also retrieve the current task.
Required scope: Taskurai.Task.Read
public virtual Task<TaskHistoryResponse> GetTaskHistoryAsync(string id, long runCount, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskHistoryResponse>
: Taskurai.Models.TaskHistoryResponse
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Task ID |
System.Int64 | runCount | Task run count |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken |
Exceptions
Azure.RequestFailedException
Throws if request fails.