Skip to main content

Class TaskuraiClient

A TaskuraiClient provides access to the Taskurai api.

Assembly: Taskurai.dll
Declaration
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.

Declaration
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.

Declaration
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).

Declaration
public virtual void Authorize(string pat, CancellationToken cancellationToken = default)
Parameters
TypeNameDescription
System.StringpatAccess Token
System.Threading.CancellationTokencancellationTokenSystem.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).

Declaration
public virtual Task AuthorizeAsync(string pat, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringpatAccess Token
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if authorization request fails.

TokenInfo(TokenInfoInput, CancellationToken)

Validate access token and return token info.

Declaration
public virtual TokenInfoResponse TokenInfo(TokenInfoInput input, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TokenInfoResponse: Taskurai.Models.TokenInfoResponse

Parameters
TypeNameDescription
Taskurai.Models.TokenInfoInputinputTaskurai.Models.TokenInfoInput.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if authorization request fails.

TokenInfoAsync(TokenInfoInput, CancellationToken)

Validate access token and return token info.

Declaration
public virtual Task<TokenInfoResponse> TokenInfoAsync(TokenInfoInput input, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TokenInfoResponse>: Taskurai.Models.TokenInfoResponse

Parameters
TypeNameDescription
Taskurai.Models.TokenInfoInputinputTaskurai.Models.TokenInfoInput.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if authorization request fails.

CreateTask(TaskConfig, CancellationToken)

Creates a task.

Required scope: Taskurai.Task.Create

Declaration
public virtual TaskResponse CreateTask(TaskConfig input, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
Taskurai.Models.TaskConfiginputTaskurai.Models.TaskConfig.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

CreateTaskAsync(TaskConfig, CancellationToken)

Creates a task.

Required scope: Taskurai.Task.Create

Declaration
public virtual Task<TaskResponse> CreateTaskAsync(TaskConfig input, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
Taskurai.Models.TaskConfiginputTaskurai.Models.TaskConfig.
System.Threading.CancellationTokencancellationTokenSystem.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

Declaration
public virtual CreateTaskAndWaitOperation CreateTaskAndWait(TaskConfig input, CancellationToken cancellationToken = default)
Returns

Taskurai.CreateTaskAndWaitOperation: Taskurai.CreateTaskAndWaitOperation

Parameters
TypeNameDescription
Taskurai.Models.TaskConfiginputTaskurai.Models.TaskConfig.
System.Threading.CancellationTokencancellationTokenSystem.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

Declaration
public virtual Task<CreateTaskAndWaitOperation> CreateTaskAndWaitAsync(TaskConfig input, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.CreateTaskAndWaitOperation>: Taskurai.CreateTaskAndWaitOperation

Parameters
TypeNameDescription
Taskurai.Models.TaskConfiginputTaskurai.Models.TaskConfig.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

ListTasks(ListTasksOptions, CancellationToken)

Enumerate tasks.

Required scope: Taskurai.Task.Read

Declaration
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
TypeNameDescription
Taskurai.Models.ListTasksOptionsoptionsTaskurai.Models.ListTasksOptions.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

ListTasksAsync(ListTasksOptions, CancellationToken)

Enumerate tasks.

Required scope: Taskurai.Task.Read

Declaration
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
TypeNameDescription
Taskurai.Models.ListTasksOptionsoptionsTaskurai.Models.ListTasksOptions.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

GetTask(string, CancellationToken)

Get task by ID.

Required scope: Taskurai.Task.Read

Declaration
public virtual TaskResponse GetTask(string id, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
System.StringidTask ID
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

GetTaskAsync(string, CancellationToken)

Get task by ID.

Required scope: Taskurai.Task.Read

Declaration
public virtual Task<TaskResponse> GetTaskAsync(string id, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
System.StringidTask ID
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

UpdateTask(string, UpdateTaskInput, CancellationToken)

Updates a task.

Required scope: Taskurai.Task.Update

Declaration
public virtual TaskResponse UpdateTask(string id, UpdateTaskInput input, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
System.StringidTask ID
Taskurai.Models.UpdateTaskInputinputTaskurai.Models.UpdateTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

UpdateTaskAsync(string, UpdateTaskInput, CancellationToken)

Updates a task.

Required scope: Taskurai.Task.Update

Declaration
public virtual Task<TaskResponse> UpdateTaskAsync(string id, UpdateTaskInput input, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
System.StringidTask ID
Taskurai.Models.UpdateTaskInputinputTaskurai.Models.UpdateTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

DeleteTask(string, CancellationToken)

Deletes a task.

Required scope: Taskurai.Task.Delete

Declaration
public virtual void DeleteTask(string id, CancellationToken cancellationToken = default)
Parameters
TypeNameDescription
System.StringidTask ID
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.

DeleteTaskAsync(string, CancellationToken)

Deletes a task.

Required scope: Taskurai.Task.Delete

Declaration
public virtual Task DeleteTaskAsync(string id, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringidTask ID
System.Threading.CancellationTokencancellationTokenSystem.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.

Declaration
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
TypeNameDescription
Taskurai.Models.RetrieveQueuedTaskInputinputTaskurai.Models.RetrieveQueuedTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.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.

Declaration
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
TypeNameDescription
Taskurai.Models.RetrieveQueuedTaskInputinputTaskurai.Models.RetrieveQueuedTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.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.

Declaration
public virtual TaskExtendResponse ExtendTask(string taskToken, ExtendTaskInput input, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TaskExtendResponse: Taskurai.Models.TaskExtendResponse

Parameters
TypeNameDescription
System.StringtaskTokenTask token (returned by RetrieveQueuedTask or ExtendTask)
Taskurai.Models.ExtendTaskInputinputTaskurai.Models.ExtendTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.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.

Declaration
public virtual Task<TaskExtendResponse> ExtendTaskAsync(string taskToken, ExtendTaskInput input, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskExtendResponse>: Taskurai.Models.TaskExtendResponse

Parameters
TypeNameDescription
System.StringtaskTokenTask token (returned by RetrieveQueuedTask or ExtendTask)
Taskurai.Models.ExtendTaskInputinputTaskurai.Models.ExtendTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.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.

Declaration
public virtual TaskResponse CompleteTask(string taskToken, CompleteTaskInput input, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TaskResponse: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
System.StringtaskTokenTask token (returned by RetrieveQueuedTask)
Taskurai.Models.CompleteTaskInputinputTaskurai.Models.CompleteTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.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.

Declaration
public virtual Task<TaskResponse> CompleteTaskAsync(string taskToken, CompleteTaskInput input, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Models.TaskResponse

Parameters
TypeNameDescription
System.StringtaskTokenTask token (returned by RetrieveQueuedTask)
Taskurai.Models.CompleteTaskInputinputTaskurai.Models.CompleteTaskInput.
System.Threading.CancellationTokencancellationTokenSystem.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

Declaration
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
TypeNameDescription
System.StringidTask ID
Taskurai.Models.ListTaskHistoryOptionsoptionsTaskurai.Models.ListTaskHistoryOptions.
System.Threading.CancellationTokencancellationTokenSystem.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

Declaration
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
TypeNameDescription
System.StringidTask ID
Taskurai.Models.ListTaskHistoryOptionsoptionsTaskurai.Models.ListTaskHistoryOptions.
System.Threading.CancellationTokencancellationTokenSystem.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

Declaration
public virtual TaskHistoryResponse GetTaskHistory(string id, long runCount, CancellationToken cancellationToken = default)
Returns

Taskurai.Models.TaskHistoryResponse: Taskurai.Models.TaskHistoryResponse

Parameters
TypeNameDescription
System.StringidTask ID
System.Int64runCountTask run count
System.Threading.CancellationTokencancellationTokenSystem.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

Declaration
public virtual Task<TaskHistoryResponse> GetTaskHistoryAsync(string id, long runCount, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskHistoryResponse>: Taskurai.Models.TaskHistoryResponse

Parameters
TypeNameDescription
System.StringidTask ID
System.Int64runCountTask run count
System.Threading.CancellationTokencancellationTokenSystem.Threading.CancellationToken
Exceptions

Azure.RequestFailedException
Throws if request fails.