<a id=“SuperOffice_WebApi_Agents_BatchAgent”></a> Class BatchAgent
Namespace: SuperOffice.WebApi.AgentsAssembly: SuperOffice.WebApi.dll Start, stop and monitor predefined batch tasks
Inheritance
object ← AgentBase ← BatchAgentImplements
IBatchAgent, IAgentBase, IDisposableInherited Members
AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T>(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()Examples
<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“http://example.com/super/api”); mySession.Authorization = new AuthorizationUsernamePassword(“user”, “pass”); using (BatchAgent agent = new BatchAgent(mySession)) { // call methods on agent here… }</code></pre>Constructors
<a id=“SuperOffice_WebApi_Agents_BatchAgent__ctor_System_Net_Http_HttpClient_”></a> BatchAgent(HttpClient)
Constructor: Start, stop and monitor predefined batch tasksParameters
httpClient HttpClient
Use this HTTP client instead of making own HttpClient instance.
<a id=“SuperOffice_WebApi_Agents_BatchAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> BatchAgent(WebApiOptions, HttpClient)
Constructor: Start, stop and monitor predefined batch tasksParameters
options WebApiOptions
Base URL and authentication values.
httpClient HttpClient
Optional: Use this HTTP client instead of making a new one.
Methods
<a id=“SuperOffice_WebApi_Agents_BatchAgent_DeleteBatchTaskAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteBatchTaskAsync(int, RequestOptions)
Delete a batch task from the database.Parameters
batchTaskId int
The batchTask id to delete.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BatchAgent_DeleteBatchTasksAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> DeleteBatchTasksAsync(int[], RequestOptions)
Delete batch tasks from the database.Parameters
batchTaskIds int[]
Array of batchTask ids to delete.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetAllBatchTaskInfosByNameAndStateAsync_System_String_SuperOffice_WebApi_Data_BatchTaskState_SuperOffice_WebApi_RequestOptions_”></a> GetAllBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, RequestOptions)
Get an array of system and user BatchTaskInfo for the provided task name and state.Parameters
taskName string
A task name, NULL or blank to get all tasks
state BatchTaskState
The BatchTaskState to get batch tasks for.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of user and system BatchTaskInfos.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetAllBatchTaskInfosByNameAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetAllBatchTaskInfosByNameAsync(string, RequestOptions)
Get an array of system and user BatchTaskInfo for the provided task name.Parameters
taskName string
A task name, NULL or blank to get all tasks
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of user and system BatchTaskInfos.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetBatchTaskInfoAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBatchTaskInfoAsync(int, RequestOptions)
Get a single BatchTaskInfo based on Id.Parameters
id int
Id of the BatchTaskInfo to get.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo> Returns a BatchTaskInfo.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetBatchTaskInfosByAssociatesAndStateAsync_System_Int32___SuperOffice_WebApi_Data_BatchTaskState_SuperOffice_WebApi_RequestOptions_”></a> GetBatchTaskInfosByAssociatesAndStateAsync(int[], BatchTaskState, RequestOptions)
Get an array of BatchTaskInfo for the provided associate id’s and batch task state.Parameters
associateIds int[]
Array of associate id’s. Empty array for all. 0 for system tasks, -1 for all users, or specific user ids.
state BatchTaskState
The BatchTaskState to get batch tasks for.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of BatchTaskInfo.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetBatchTaskInfosByAssociatesAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetBatchTaskInfosByAssociatesAsync(int[], RequestOptions)
Get an array of BatchTaskInfo for the provided associate id’s.Parameters
associateIds int[]
Array of associate id’s. empty array = all tasks, 0 = system tasks, -1 = all user tasks.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of user’s BatchTaskInfo.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetBatchTaskInfosByNameAndAssociatesAsync_System_String_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetBatchTaskInfosByNameAndAssociatesAsync(string, int[], RequestOptions)
Get an array of BatchTaskInfo for the provided associate id’s and batch task definition name.Parameters
name string
Batchtask definition name. Blank for all tasks.
associateIds int[]
Array of associate id’s. Empty array for all. 0 for system tasks, -1 for all users, or specific user ids.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of BatchTaskInfo.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetBatchTaskInfosByNameAndStateAsync_System_String_SuperOffice_WebApi_Data_BatchTaskState_SuperOffice_WebApi_RequestOptions_”></a> GetBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, RequestOptions)
Gets an array of user BatchTaskInfo with state defined by a BatchTaskState and the batchtask definition name.Parameters
name string
Batchtask definition name. Blank for all tasks.
state BatchTaskState
The BatchTaskState to get batch tasks for.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of user BatchTaskInfo. System tasks are excluded.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetBatchTaskInfosByStateAsync_SuperOffice_WebApi_Data_BatchTaskState_SuperOffice_WebApi_RequestOptions_”></a> GetBatchTaskInfosByStateAsync(BatchTaskState, RequestOptions)
Gets an array of user BatchTaskInfo with state defined by a BatchTaskState.Parameters
state BatchTaskState
The BatchTaskState to get batch tasks for.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of user BatchTaskInfo. System tasks are excluded.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetSystemBatchTaskInfosByNameAndStateAsync_System_String_SuperOffice_WebApi_Data_BatchTaskState_SuperOffice_WebApi_RequestOptions_”></a> GetSystemBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, RequestOptions)
Get an array of system BatchTaskInfo for the provided task name and state.Parameters
taskName string
A task name, NULL or blank to get all tasks
state BatchTaskState
The BatchTaskState to get batch tasks for.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of system BatchTaskInfos.<a id=“SuperOffice_WebApi_Agents_BatchAgent_GetSystemBatchTaskInfosByNameAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetSystemBatchTaskInfosByNameAsync(string, RequestOptions)
Get an array of system BatchTaskInfo for the provided task name.Parameters
taskName string
A task name, NULL or blank to get all tasks
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BatchTaskInfo[]> Returns an array of system BatchTaskInfos.<a id=“SuperOffice_WebApi_Agents_BatchAgent_StartBatchJobAsync_SuperOffice_WebApi_Data_BatchTaskInfo_SuperOffice_WebApi_RequestOptions_”></a> StartBatchJobAsync(BatchTaskInfo, RequestOptions)
Start a batch job based on BatchTaskInfo.Parameters
batchTaskInfo BatchTaskInfo
Use BatchTaskInfo to describe the new batch job.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int> Returns the id of the created batch job.<a id=“SuperOffice_WebApi_Agents_BatchAgent_StopBatchJobAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> StopBatchJobAsync(int, RequestOptions)
Stop a batch job based on Id.Parameters
id int
Id of the batch job to stop.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<bool> Returns true if the job was stopped successfully.<a id=“SuperOffice_WebApi_Agents_BatchAgent_UpdateBatchTaskAsync_SuperOffice_WebApi_Data_BatchTaskInfo_SuperOffice_WebApi_RequestOptions_”></a> UpdateBatchTaskAsync(BatchTaskInfo, RequestOptions)
Update information about a BatchTask. Only the following properties can be updated: State, Description, Response and Request.Parameters
batchTaskInfo BatchTaskInfo
The updated information to save.
requestOptions RequestOptions
Override language/culture codes on this request.