From d214c4b048d45fd10f07ae65399163afaddfdb5f Mon Sep 17 00:00:00 2001 From: Mkatari3700 <58773431+Mkatari3700@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:09:26 +0530 Subject: [PATCH] [New] Human Task Resource API (#105) * Human task APIs --------- Co-authored-by: Katari.Manikanta --- Conductor/Api/HumanTaskResourceApi.cs | 2830 +++++++++++++++++ Conductor/Api/IHumanTaskResourceApi.cs | 446 +++ Conductor/Client/ApiClient.cs | 18 + Conductor/Client/Constants.cs | 14 + .../Client/Models/HumanTaskAssignment.cs | 122 + .../Client/Models/HumanTaskDefinition.cs | 191 ++ Conductor/Client/Models/HumanTaskEntry.cs | 387 +++ Conductor/Client/Models/HumanTaskSearch.cs | 393 +++ .../Client/Models/HumanTaskSearchResult.cs | 172 + Conductor/Client/Models/HumanTaskTemplate.cs | 254 ++ Conductor/Client/Models/HumanTaskTrigger.cs | 160 + Conductor/Client/Models/HumanTaskUser.cs | 150 + Conductor/Client/Models/UserFormTemplate.cs | 122 + Tests/Api/HumanTaskResourceApiTest.cs | 46 + Tests/Api/WorkflowResourceApiTest.cs | 275 +- csharp-examples/HumanTaskExamples.cs | 24 + csharp-examples/WorkFlowExamples.cs | 25 +- 17 files changed, 5476 insertions(+), 153 deletions(-) create mode 100644 Conductor/Api/HumanTaskResourceApi.cs create mode 100644 Conductor/Api/IHumanTaskResourceApi.cs create mode 100644 Conductor/Client/Constants.cs create mode 100644 Conductor/Client/Models/HumanTaskAssignment.cs create mode 100644 Conductor/Client/Models/HumanTaskDefinition.cs create mode 100644 Conductor/Client/Models/HumanTaskEntry.cs create mode 100644 Conductor/Client/Models/HumanTaskSearch.cs create mode 100644 Conductor/Client/Models/HumanTaskSearchResult.cs create mode 100644 Conductor/Client/Models/HumanTaskTemplate.cs create mode 100644 Conductor/Client/Models/HumanTaskTrigger.cs create mode 100644 Conductor/Client/Models/HumanTaskUser.cs create mode 100644 Conductor/Client/Models/UserFormTemplate.cs create mode 100644 Tests/Api/HumanTaskResourceApiTest.cs create mode 100644 csharp-examples/HumanTaskExamples.cs diff --git a/Conductor/Api/HumanTaskResourceApi.cs b/Conductor/Api/HumanTaskResourceApi.cs new file mode 100644 index 0000000..d7249ad --- /dev/null +++ b/Conductor/Api/HumanTaskResourceApi.cs @@ -0,0 +1,2830 @@ +using Conductor.Client; +using Conductor.Client.Models; +using conductor_csharp.Api; +using RestSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using ThreadTask = System.Threading.Tasks; + +namespace Conductor.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class HumanTaskResourceApi : IHumanTaskResourceApi + { + private ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public HumanTaskResourceApi(String basePath) + { + this.Configuration = new Configuration { BasePath = basePath }; + + ExceptionFactory = Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// + /// + public HumanTaskResourceApi() + { + this.Configuration = Configuration.Default; + + ExceptionFactory = Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public HumanTaskResourceApi(Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.Options.BaseUrl.ToString(); + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Claim a task to an external user + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// HumanTaskEntry + public HumanTaskEntry AssignAndClaim(string taskId, string userId, bool? overrideAssignment = null) + { + ApiResponse localVarResponse = AssignAndClaimWithHttpInfo(taskId, userId, overrideAssignment); + return localVarResponse.Data; + } + + /// + /// Claim a task to an external user + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// ApiResponse of HumanTaskEntry + public ApiResponse AssignAndClaimWithHttpInfo(string taskId, string userId, bool? overrideAssignment = null) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->AssignAndClaim"); + // verify the required parameter 'userId' is set + if (userId == null) + throw new ApiException(400, "Missing required parameter 'userId' when calling HumanTaskApi->AssignAndClaim"); + + var localVarPath = "/human/tasks/{taskId}/externalUser/{userId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (userId != null) localVarPathParams.Add("userId", this.Configuration.ApiClient.ParameterToString(userId)); // path parameter + if (overrideAssignment != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "overrideAssignment", overrideAssignment)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("AssignAndClaim", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskEntry)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskEntry))); + } + + /// + /// Claim a task to an external user + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// Task of HumanTaskEntry + public async ThreadTask.Task AssignAndClaimAsync(string taskId, string userId, bool? overrideAssignment = null) + { + ApiResponse localVarResponse = await AssignAndClaimAsyncWithHttpInfo(taskId, userId, overrideAssignment); + return localVarResponse.Data; + + } + + /// + /// Claim a task to an external user + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// Task of ApiResponse (HumanTaskEntry) + public async ThreadTask.Task> AssignAndClaimAsyncWithHttpInfo(string taskId, string userId, bool? overrideAssignment = null) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->AssignAndClaim"); + // verify the required parameter 'userId' is set + if (userId == null) + throw new ApiException(400, "Missing required parameter 'userId' when calling HumanTaskApi->AssignAndClaim"); + + var localVarPath = "/human/tasks/{taskId}/externalUser/{userId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (userId != null) localVarPathParams.Add("userId", this.Configuration.ApiClient.ParameterToString(userId)); // path parameter + if (overrideAssignment != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "overrideAssignment", overrideAssignment)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("AssignAndClaim", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskEntry)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskEntry))); + } + + /// + /// Claim a task by authenticated Conductor user + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// HumanTaskEntry + public HumanTaskEntry ClaimTask(string taskId, bool? overrideAssignment = null) + { + ApiResponse localVarResponse = ClaimTaskWithHttpInfo(taskId, overrideAssignment); + return localVarResponse.Data; + } + + /// + /// Claim a task by authenticated Conductor user + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of HumanTaskEntry + public ApiResponse ClaimTaskWithHttpInfo(string taskId, bool? overrideAssignment = null) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->ClaimTask"); + + var localVarPath = "/human/tasks/{taskId}/claim"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (overrideAssignment != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "overrideAssignment", overrideAssignment)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ClaimTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskEntry)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskEntry))); + } + + /// + /// Claim a task by authenticated Conductor user + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of HumanTaskEntry + public async ThreadTask.Task ClaimTaskAsync(string taskId, bool? overrideAssignment = null) + { + ApiResponse localVarResponse = await ClaimTaskAsyncWithHttpInfo(taskId, overrideAssignment); + return localVarResponse.Data; + + } + + /// + /// Claim a task by authenticated Conductor user + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of ApiResponse (HumanTaskEntry) + public async ThreadTask.Task> ClaimTaskAsyncWithHttpInfo(string taskId, bool? overrideAssignment = null) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->ClaimTask"); + + var localVarPath = "/human/tasks/{taskId}/claim"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (overrideAssignment != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "overrideAssignment", overrideAssignment)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ClaimTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskEntry)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskEntry))); + } + + /// + /// Delete all versions of user form template by name + /// + /// Thrown when fails to make API call + /// + /// + public void DeleteTemplateByName(string name) + { + DeleteTemplateByNameWithHttpInfo(name); + } + + /// + /// Delete all versions of user form template by name + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse DeleteTemplateByNameWithHttpInfo(string name) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling HumanTaskApi->DeleteTemplateByName"); + + var localVarPath = "/human/template/{name}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteTemplateByName", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Delete all versions of user form template by name + /// + /// Thrown when fails to make API call + /// + /// Task of void + public async ThreadTask.Task DeleteTemplateByNameAsync(string name) + { + await DeleteTemplateByNameAsyncWithHttpInfo(name); + + } + + /// + /// Delete all versions of user form template by name + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + public async ThreadTask.Task> DeleteTemplateByNameAsyncWithHttpInfo(string name) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling HumanTaskApi->DeleteTemplateByName"); + + var localVarPath = "/human/template/{name}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteTemplateByName", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Delete a version of form template by name + /// + /// Thrown when fails to make API call + /// + /// + /// + public void DeleteTemplatesByNameAndVersion(string name, int? version) + { + DeleteTemplatesByNameAndVersionWithHttpInfo(name, version); + } + + /// + /// Delete a version of form template by name + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of Object(void) + public ApiResponse DeleteTemplatesByNameAndVersionWithHttpInfo(string name, int? version) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling HumanTaskApi->DeleteTemplatesByNameAndVersion"); + // verify the required parameter 'version' is set + if (version == null) + throw new ApiException(400, "Missing required parameter 'version' when calling HumanTaskApi->DeleteTemplatesByNameAndVersion"); + + var localVarPath = "/human/template/{name}/{version}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + if (version != null) localVarPathParams.Add("version", this.Configuration.ApiClient.ParameterToString(version)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteTemplatesByNameAndVersion", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Delete a version of form template by name + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + public async ThreadTask.Task DeleteTemplatesByNameAndVersionAsync(string name, int? version) + { + await DeleteTemplatesByNameAndVersionAsyncWithHttpInfo(name, version); + + } + + /// + /// Delete a version of form template by name + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse + public async ThreadTask.Task> DeleteTemplatesByNameAndVersionAsyncWithHttpInfo(string name, int? version) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling HumanTaskApi->DeleteTemplatesByNameAndVersion"); + // verify the required parameter 'version' is set + if (version == null) + throw new ApiException(400, "Missing required parameter 'version' when calling HumanTaskApi->DeleteTemplatesByNameAndVersion"); + + var localVarPath = "/human/template/{name}/{version}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + if (version != null) localVarPathParams.Add("version", this.Configuration.ApiClient.ParameterToString(version)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteTemplatesByNameAndVersion", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// List all user form templates or get templates by name, or a template by name and version + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional) + /// List<HumanTaskTemplate> + public List GetAllTemplates(string name = null, int? version = null) + { + ApiResponse> localVarResponse = GetAllTemplatesWithHttpInfo(name, version); + return localVarResponse.Data; + } + + /// + /// List all user form templates or get templates by name, or a template by name and version + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional) + /// ApiResponse of List<HumanTaskTemplate> + public ApiResponse> GetAllTemplatesWithHttpInfo(string name = null, int? version = null) + { + + var localVarPath = "/human/template"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "name", name)); // query parameter + if (version != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImtqbVlNWThEV2VOU1lKZmZSSjFXNSJ9.eyJnaXZlbl9uYW1lIjoiSml0aGVzaCIsImZhbWlseV9uYW1lIjoiUG9vamFyeSIsIm5pY2tuYW1lIjoiaml0aGVzaHBvb2phcnkwNCIsIm5hbWUiOiJKaXRoZXNoIFBvb2phcnkiLCJwaWN0dXJlIjoiaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUNnOG9jS05XLUVyUXlvZ0JGY25fZ1BFaEs5b1o1TldUU19JUlMxTHhJQURBRkJtcmp3PXM5Ni1jIiwibG9jYWxlIjoiZW4tR0IiLCJ1cGRhdGVkX2F0IjoiMjAyNC0wMi0yMVQwNDoyNjo1Mi42MTdaIiwiZW1haWwiOiJqaXRoZXNocG9vamFyeTA0QGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJpc3MiOiJodHRwczovL2F1dGgub3JrZXMuaW8vIiwiYXVkIjoiczRITGRWYm5hSk1HdlBTZ3gyWUxweW5mSmxXN0dWMmUiLCJpYXQiOjE3MDg0ODk2MTQsImV4cCI6MTcwODUyNTYxNCwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDQ0NTAzNjIwODI1MjU1MDQ3NzgiLCJzaWQiOiI0QTlJdlJ0cWJwN05EQVNCMkkwN242VXROM3piajBtViIsIm5vbmNlIjoiZFdReE1FUjFXakkwVFhZNU1UQXlTVXc1VFZKSFJVUkpkVmRRZFd4MFNrMHlkMUprUlVaMFkxbG1UQT09In0.LHrepFFKeL97ERgYT-wx2sXMvnR6jRySFSFUJwtVW5iwdUPSAIaMwaYBjJD3zXWH5Xn0_13hr1oE_xk39J4uCfzT8s4zySn7ctnKXHCvdMLynBaG-QKYn6oG5f-ChLmLuEijTyd9-2mjjVZ0z7rSZ6-6bps2t2zPZIHSGzsIn3cSJ7jTBbJSy8Aa4RUuoWiKPkyWXKWxVUdtZnvNPz69VHbG_0Ga310X1Hu87wgKVUJjt4ErZ6BU2hP6ykgsedsJ7xSwjFUX2YGspuXEt9jOV6dk0CjROAVm-Ie2sTgqjJHZq9nOX_xzaqf-kREtBM7VHaDGHK4G5ydkgtfSgSUsmg"; + //this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetAllTemplates", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (List)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); + } + + /// + /// List all user form templates or get templates by name, or a template by name and version + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional) + /// Task of List<HumanTaskTemplate> + public async ThreadTask.Task> GetAllTemplatesAsync(string name = null, int? version = null) + { + ApiResponse> localVarResponse = await GetAllTemplatesAsyncWithHttpInfo(name, version); + return localVarResponse.Data; + + } + + /// + /// List all user form templates or get templates by name, or a template by name and version + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional) + /// Task of ApiResponse (List<HumanTaskTemplate>) + public async ThreadTask.Task>> GetAllTemplatesAsyncWithHttpInfo(string name = null, int? version = null) + { + + var localVarPath = "/human/template"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "name", name)); // query parameter + if (version != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetAllTemplates", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (List)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); + } + + /// + /// Get a task + /// + /// Thrown when fails to make API call + /// + /// HumanTaskEntry + public HumanTaskEntry GetTask(string taskId) + { + ApiResponse localVarResponse = GetTaskWithHttpInfo(taskId); + return localVarResponse.Data; + } + + /// + /// Get a task + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of HumanTaskEntry + public ApiResponse GetTaskWithHttpInfo(string taskId) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->GetTask"); + + var localVarPath = "/human/tasks/{taskId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskEntry)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskEntry))); + } + + /// + /// Get a task + /// + /// Thrown when fails to make API call + /// + /// Task of HumanTaskEntry + public async ThreadTask.Task GetTaskAsync(string taskId) + { + ApiResponse localVarResponse = await GetTaskAsyncWithHttpInfo(taskId); + return localVarResponse.Data; + + } + + /// + /// Get a task + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse (HumanTaskEntry) + public async ThreadTask.Task> GetTaskAsyncWithHttpInfo(string taskId) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->GetTask"); + + var localVarPath = "/human/tasks/{taskId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskEntry)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskEntry))); + } + + /// + /// Get list of task display names applicable for the user + /// + /// Thrown when fails to make API call + /// + /// List<string> + public List GetTaskDisplayNames(string searchType) + { + ApiResponse> localVarResponse = GetTaskDisplayNamesWithHttpInfo(searchType); + return localVarResponse.Data; + } + + /// + /// Get list of task display names applicable for the user + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of List<string> + public ApiResponse> GetTaskDisplayNamesWithHttpInfo(string searchType) + { + // verify the required parameter 'searchType' is set + if (searchType == null) + throw new ApiException(400, "Missing required parameter 'searchType' when calling HumanTaskApi->GetTaskDisplayNames"); + + var localVarPath = "/human/tasks/getTaskDisplayNames"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (searchType != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "searchType", searchType)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTaskDisplayNames", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (List)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); + } + + /// + /// Get list of task display names applicable for the user + /// + /// Thrown when fails to make API call + /// + /// Task of List<string> + public async ThreadTask.Task> GetTaskDisplayNamesAsync(string searchType) + { + ApiResponse> localVarResponse = await GetTaskDisplayNamesAsyncWithHttpInfo(searchType); + return localVarResponse.Data; + + } + + /// + /// Get list of task display names applicable for the user + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse (List<string>) + public async ThreadTask.Task>> GetTaskDisplayNamesAsyncWithHttpInfo(string searchType) + { + // verify the required parameter 'searchType' is set + if (searchType == null) + throw new ApiException(400, "Missing required parameter 'searchType' when calling HumanTaskApi->GetTaskDisplayNames"); + + var localVarPath = "/human/tasks/getTaskDisplayNames"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (searchType != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "searchType", searchType)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTaskDisplayNames", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (List)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); + } + + /// + /// Get user form template by name and version + /// + /// Thrown when fails to make API call + /// + /// + /// HumanTaskTemplate + public HumanTaskTemplate GetTemplateByNameAndVersion(string name, int? version) + { + ApiResponse localVarResponse = GetTemplateByNameAndVersionWithHttpInfo(name, version); + return localVarResponse.Data; + } + + /// + /// Get user form template by name and version + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of HumanTaskTemplate + public ApiResponse GetTemplateByNameAndVersionWithHttpInfo(string name, int? version) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling HumanTaskApi->GetTemplateByNameAndVersion"); + // verify the required parameter 'version' is set + if (version == null) + throw new ApiException(400, "Missing required parameter 'version' when calling HumanTaskApi->GetTemplateByNameAndVersion"); + + var localVarPath = "/human/template/{name}/{version}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + if (version != null) localVarPathParams.Add("version", this.Configuration.ApiClient.ParameterToString(version)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTemplateByNameAndVersion", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskTemplate))); + } + + /// + /// Get user form template by name and version + /// + /// Thrown when fails to make API call + /// + /// + /// Task of HumanTaskTemplate + public async ThreadTask.Task GetTemplateByNameAndVersionAsync(string name, int? version) + { + ApiResponse localVarResponse = await GetTemplateByNameAndVersionAsyncWithHttpInfo(name, version); + return localVarResponse.Data; + + } + + /// + /// Get user form template by name and version + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse (HumanTaskTemplate) + public async ThreadTask.Task> GetTemplateByNameAndVersionAsyncWithHttpInfo(string name, int? version) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling HumanTaskApi->GetTemplateByNameAndVersion"); + // verify the required parameter 'version' is set + if (version == null) + throw new ApiException(400, "Missing required parameter 'version' when calling HumanTaskApi->GetTemplateByNameAndVersion"); + + var localVarPath = "/human/template/{name}/{version}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + if (version != null) localVarPathParams.Add("version", this.Configuration.ApiClient.ParameterToString(version)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTemplateByNameAndVersion", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskTemplate))); + } + + /// + /// Get user form by human task id + /// + /// Thrown when fails to make API call + /// + /// HumanTaskTemplate + public HumanTaskTemplate GetTemplateByTaskId(string humanTaskId) + { + ApiResponse localVarResponse = GetTemplateByTaskIdWithHttpInfo(humanTaskId); + return localVarResponse.Data; + } + + /// + /// Get user form by human task id + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of HumanTaskTemplate + public ApiResponse GetTemplateByTaskIdWithHttpInfo(string humanTaskId) + { + // verify the required parameter 'humanTaskId' is set + if (humanTaskId == null) + throw new ApiException(400, "Missing required parameter 'humanTaskId' when calling HumanTaskApi->GetTemplateByTaskId"); + + var localVarPath = "/human/template/{humanTaskId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (humanTaskId != null) localVarPathParams.Add("humanTaskId", this.Configuration.ApiClient.ParameterToString(humanTaskId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTemplateByTaskId", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskTemplate))); + } + + /// + /// Get user form by human task id + /// + /// Thrown when fails to make API call + /// + /// Task of HumanTaskTemplate + public async ThreadTask.Task GetTemplateByTaskIdAsync(string humanTaskId) + { + ApiResponse localVarResponse = await GetTemplateByTaskIdAsyncWithHttpInfo(humanTaskId); + return localVarResponse.Data; + + } + + /// + /// Get user form by human task id + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse (HumanTaskTemplate) + public async ThreadTask.Task> GetTemplateByTaskIdAsyncWithHttpInfo(string humanTaskId) + { + // verify the required parameter 'humanTaskId' is set + if (humanTaskId == null) + throw new ApiException(400, "Missing required parameter 'humanTaskId' when calling HumanTaskApi->GetTemplateByTaskId"); + + var localVarPath = "/human/template/{humanTaskId}"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (humanTaskId != null) localVarPathParams.Add("humanTaskId", this.Configuration.ApiClient.ParameterToString(humanTaskId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetTemplateByTaskId", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskTemplate))); + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// + /// + public void ReassignTask(List body, string taskId) + { + ReassignTaskWithHttpInfo(body, taskId); + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of Object(void) + public ApiResponse ReassignTaskWithHttpInfo(List body, string taskId) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->ReassignTask"); + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->ReassignTask"); + + var localVarPath = "/human/tasks/{taskId}/reassign"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ReassignTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + public async ThreadTask.Task ReassignTaskAsync(List body, string taskId) + { + await ReassignTaskAsyncWithHttpInfo(body, taskId); + + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse + public async ThreadTask.Task> ReassignTaskAsyncWithHttpInfo(List body, string taskId) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->ReassignTask"); + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->ReassignTask"); + + var localVarPath = "/human/tasks/{taskId}/reassign"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ReassignTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// + public void ReleaseTask(string taskId) + { + ReleaseTaskWithHttpInfo(taskId); + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse ReleaseTaskWithHttpInfo(string taskId) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->ReleaseTask"); + + var localVarPath = "/human/tasks/{taskId}/release"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ReleaseTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// Task of void + public async ThreadTask.Task ReleaseTaskAsync(string taskId) + { + await ReleaseTaskAsyncWithHttpInfo(taskId); + + } + + /// + /// Release a task without completing it + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + public async ThreadTask.Task> ReleaseTaskAsyncWithHttpInfo(string taskId) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->ReleaseTask"); + + var localVarPath = "/human/tasks/{taskId}/release"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ReleaseTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// HumanTaskTemplate + public HumanTaskTemplate SaveTemplate(HumanTaskTemplate body, bool? newVersion = null) + { + ApiResponse localVarResponse = SaveTemplateWithHttpInfo(body, newVersion); + return localVarResponse.Data; + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of HumanTaskTemplate + public ApiResponse SaveTemplateWithHttpInfo(HumanTaskTemplate body, bool? newVersion = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->SaveTemplate"); + + var localVarPath = "/human/template"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (newVersion != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "newVersion", newVersion)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SaveTemplate", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskTemplate))); + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of HumanTaskTemplate + public async ThreadTask.Task SaveTemplateAsync(HumanTaskTemplate body, bool? newVersion = null) + { + ApiResponse localVarResponse = await SaveTemplateAsyncWithHttpInfo(body, newVersion); + return localVarResponse.Data; + + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of ApiResponse (HumanTaskTemplate) + public async ThreadTask.Task> SaveTemplateAsyncWithHttpInfo(HumanTaskTemplate body, bool? newVersion = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->SaveTemplate"); + + var localVarPath = "/human/template"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (newVersion != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "newVersion", newVersion)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SaveTemplate", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskTemplate))); + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// List<HumanTaskTemplate> + public List SaveTemplates(List body, bool? newVersion = null) + { + ApiResponse> localVarResponse = SaveTemplatesWithHttpInfo(body, newVersion); + return localVarResponse.Data; + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of List<HumanTaskTemplate> + public ApiResponse> SaveTemplatesWithHttpInfo(List body, bool? newVersion = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->SaveTemplates"); + + var localVarPath = "/human/template/bulk"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (newVersion != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "newVersion", newVersion)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SaveTemplates", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (List)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of List<HumanTaskTemplate> + public async ThreadTask.Task> SaveTemplatesAsync(List body, bool? newVersion = null) + { + ApiResponse> localVarResponse = await SaveTemplatesAsyncWithHttpInfo(body, newVersion); + return localVarResponse.Data; + + } + + /// + /// Save user form template + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of ApiResponse (List<HumanTaskTemplate>) + public async ThreadTask.Task>> SaveTemplatesAsyncWithHttpInfo(List body, bool? newVersion = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->SaveTemplates"); + + var localVarPath = "/human/template/bulk"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (newVersion != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "newVersion", newVersion)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SaveTemplates", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (List)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); + } + + /// + /// Search human tasks + /// + /// Thrown when fails to make API call + /// + /// HumanTaskSearchResult + public HumanTaskSearchResult Search(HumanTaskSearch body) + { + ApiResponse localVarResponse = SearchWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Search human tasks + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of HumanTaskSearchResult + public ApiResponse SearchWithHttpInfo(HumanTaskSearch body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->Search"); + + var localVarPath = "/human/tasks/search"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Search", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskSearchResult)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskSearchResult))); + } + + /// + /// Search human tasks + /// + /// Thrown when fails to make API call + /// + /// Task of HumanTaskSearchResult + public async ThreadTask.Task SearchAsync(HumanTaskSearch body) + { + ApiResponse localVarResponse = await SearchAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Search human tasks + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse (HumanTaskSearchResult) + public async ThreadTask.Task> SearchAsyncWithHttpInfo(HumanTaskSearch body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->Search"); + + var localVarPath = "/human/tasks/search"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Search", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (HumanTaskSearchResult)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(HumanTaskSearchResult))); + } + + /// + /// If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// + public void SkipTask(string taskId, string reason = null) + { + SkipTaskWithHttpInfo(taskId, reason); + } + + /// + /// If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// ApiResponse of Object(void) + public ApiResponse SkipTaskWithHttpInfo(string taskId, string reason = null) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->SkipTask"); + + var localVarPath = "/human/tasks/{taskId}/skip"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (reason != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "reason", reason)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SkipTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// Task of void + public async ThreadTask.Task SkipTaskAsync(string taskId, string reason = null) + { + await SkipTaskAsyncWithHttpInfo(taskId, reason); + + } + + /// + /// If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// Task of ApiResponse + public async ThreadTask.Task> SkipTaskAsyncWithHttpInfo(string taskId, string reason = null) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->SkipTask"); + + var localVarPath = "/human/tasks/{taskId}/skip"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (reason != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "reason", reason)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SkipTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// + public void UpdateTaskOutput(Dictionary body, string taskId, bool? complete = null) + { + UpdateTaskOutputWithHttpInfo(body, taskId, complete); + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse UpdateTaskOutputWithHttpInfo(Dictionary body, string taskId, bool? complete = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->UpdateTaskOutput"); + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->UpdateTaskOutput"); + + var localVarPath = "/human/tasks/{taskId}/update"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (complete != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "complete", complete)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdateTaskOutput", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// Task of void + public async ThreadTask.Task UpdateTaskOutputAsync(Dictionary body, string taskId, bool? complete = null) + { + await UpdateTaskOutputAsyncWithHttpInfo(body, taskId, complete); + + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// Task of ApiResponse + public async ThreadTask.Task> UpdateTaskOutputAsyncWithHttpInfo(Dictionary body, string taskId, bool? complete = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->UpdateTaskOutput"); + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskApi->UpdateTaskOutput"); + + var localVarPath = "/human/tasks/{taskId}/update"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + if (complete != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "complete", complete)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdateTaskOutput", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// + /// (optional, default to false) + /// Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty (optional) + /// + public void UpdateTaskOutputByRef(Dictionary body, string workflowId, string taskRefName, bool? complete = null, List iteration = null) + { + UpdateTaskOutputByRefWithHttpInfo(body, workflowId, taskRefName, complete, iteration); + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// + /// (optional, default to false) + /// Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty (optional) + /// ApiResponse of Object(void) + public ApiResponse UpdateTaskOutputByRefWithHttpInfo(Dictionary body, string workflowId, string taskRefName, bool? complete = null, List iteration = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->UpdateTaskOutputByRef"); + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling HumanTaskApi->UpdateTaskOutputByRef"); + // verify the required parameter 'taskRefName' is set + if (taskRefName == null) + throw new ApiException(400, "Missing required parameter 'taskRefName' when calling HumanTaskApi->UpdateTaskOutputByRef"); + + var localVarPath = "/human/tasks/update/taskRef"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (workflowId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "workflowId", workflowId)); // query parameter + if (taskRefName != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "taskRefName", taskRefName)); // query parameter + if (complete != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "complete", complete)); // query parameter + if (iteration != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("multi", "iteration", iteration)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdateTaskOutputByRef", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// + /// (optional, default to false) + /// Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty (optional) + /// Task of void + public async ThreadTask.Task UpdateTaskOutputByRefAsync(Dictionary body, string workflowId, string taskRefName, bool? complete = null, List iteration = null) + { + await UpdateTaskOutputByRefAsyncWithHttpInfo(body, workflowId, taskRefName, complete, iteration); + + } + + /// + /// Update task output, optionally complete + /// + /// Thrown when fails to make API call + /// + /// + /// + /// (optional, default to false) + /// Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty (optional) + /// Task of ApiResponse + public async ThreadTask.Task> UpdateTaskOutputByRefAsyncWithHttpInfo(Dictionary body, string workflowId, string taskRefName, bool? complete = null, List iteration = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling HumanTaskApi->UpdateTaskOutputByRef"); + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling HumanTaskApi->UpdateTaskOutputByRef"); + // verify the required parameter 'taskRefName' is set + if (taskRefName == null) + throw new ApiException(400, "Missing required parameter 'taskRefName' when calling HumanTaskApi->UpdateTaskOutputByRef"); + + var localVarPath = "/human/tasks/update/taskRef"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (workflowId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "workflowId", workflowId)); // query parameter + if (taskRefName != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "taskRefName", taskRefName)); // query parameter + if (complete != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "complete", complete)); // query parameter + if (iteration != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("multi", "iteration", iteration)); // query parameter + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdateTaskOutputByRef", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + + /// + /// Get Conductor task by id (for human tasks only) + /// + /// Thrown when fails to make API call + /// + /// Task + public Task GetConductorTaskById(string taskId) + { + ApiResponse localVarResponse = GetConductorTaskByIdWithHttpInfo(taskId); + return localVarResponse.Data; + } + + /// + /// Get Conductor task by id (for human tasks only) + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Task + public ApiResponse GetConductorTaskByIdWithHttpInfo(string taskId) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskResourceApi->GetConductorTaskById"); + + var localVarPath = "/human/tasks/{taskId}/conductorTask"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetConductorTaskById", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Task)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Task))); + } + + /// + /// Get Conductor task by id (for human tasks only) + /// + /// Thrown when fails to make API call + /// + /// Task of Task + public async ThreadTask.Task GetConductorTaskByIdAsync(string taskId) + { + ApiResponse localVarResponse = await GetConductorTaskByIdAsyncWithHttpInfo(taskId); + return localVarResponse.Data; + + } + + /// + /// Get Conductor task by id (for human tasks only) + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse (Task) + public async ThreadTask.Task> GetConductorTaskByIdAsyncWithHttpInfo(string taskId) + { + // verify the required parameter 'taskId' is set + if (taskId == null) + throw new ApiException(400, "Missing required parameter 'taskId' when calling HumanTaskResourceApi->GetConductorTaskById"); + + var localVarPath = "/human/tasks/{taskId}/conductorTask"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (taskId != null) localVarPathParams.Add("taskId", this.Configuration.ApiClient.ParameterToString(taskId)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetConductorTaskById", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Task)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Task))); + } + } +} diff --git a/Conductor/Api/IHumanTaskResourceApi.cs b/Conductor/Api/IHumanTaskResourceApi.cs new file mode 100644 index 0000000..5284d76 --- /dev/null +++ b/Conductor/Api/IHumanTaskResourceApi.cs @@ -0,0 +1,446 @@ +using Conductor.Client; +using Conductor.Client.Models; +using System; +using System.Collections.Generic; + +namespace conductor_csharp.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IHumanTaskResourceApi : IApiAccessor + { + #region Synchronous Operations + /// + /// Claim a task to an external user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// HumanTaskEntry + HumanTaskEntry AssignAndClaim(string taskId, string userId, bool? overrideAssignment = null); + + /// + /// Claim a task by authenticated Conductor user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// HumanTaskEntry + HumanTaskEntry ClaimTask(string taskId, bool? overrideAssignment = null); + + /// + /// Delete all versions of user form template by name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void DeleteTemplateByName(string name); + + /// + /// Delete a version of form template by name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + void DeleteTemplatesByNameAndVersion(string name, int? version); + + /// + /// List all user form templates or get templates by name, or a template by name and version + /// + /// + /// + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional) + /// List<HumanTaskTemplate> + List GetAllTemplates(string name = null, int? version = null); + + /// + /// Get a task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// HumanTaskEntry + HumanTaskEntry GetTask(string taskId); + + /// + /// Get list of task display names applicable for the user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// List<string> + List GetTaskDisplayNames(string searchType); + + /// + /// Get user form template by name and version + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// HumanTaskTemplate + HumanTaskTemplate GetTemplateByNameAndVersion(string name, int? version); + + /// + /// Get user form by human task id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// HumanTaskTemplate + HumanTaskTemplate GetTemplateByTaskId(string humanTaskId); + + /// + /// Release a task without completing it + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + void ReassignTask(List body, string taskId); + + /// + /// Release a task without completing it + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void ReleaseTask(string taskId); + + /// + /// Save user form template + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// HumanTaskTemplate + HumanTaskTemplate SaveTemplate(HumanTaskTemplate body, bool? newVersion = null); + + /// + /// Save user form template + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// List<HumanTaskTemplate> + List SaveTemplates(List body, bool? newVersion = null); + + /// + /// Search human tasks + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// HumanTaskSearchResult + HumanTaskSearchResult Search(HumanTaskSearch body); + + /// + /// If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// + void SkipTask(string taskId, string reason = null); + + /// + /// Update task output, optionally complete + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// + void UpdateTaskOutput(Dictionary body, string taskId, bool? complete = null); + + /// + /// Update task output, optionally complete + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// (optional, default to false) + /// Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty (optional) + /// + void UpdateTaskOutputByRef(Dictionary body, string workflowId, string taskRefName, bool? complete = null, List iteration = null); + + /// + /// Get Conductor task by id (for human tasks only) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task + Task GetConductorTaskById(string taskId); + + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// Claim a task to an external user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// Task of HumanTaskEntry + System.Threading.Tasks.Task AssignAndClaimAsync(string taskId, string userId, bool? overrideAssignment = null); + + /// + /// Claim a task by authenticated Conductor user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of HumanTaskEntry + System.Threading.Tasks.Task ClaimTaskAsync(string taskId, bool? overrideAssignment = null); + + /// + /// Delete all versions of user form template by name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of void + System.Threading.Tasks.Task DeleteTemplateByNameAsync(string name); + + /// + /// Delete a version of form template by name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + System.Threading.Tasks.Task DeleteTemplatesByNameAndVersionAsync(string name, int? version); + + /// + /// List all user form templates or get templates by name, or a template by name and version + /// + /// + /// + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional) + /// Task of List<HumanTaskTemplate> + System.Threading.Tasks.Task> GetAllTemplatesAsync(string name = null, int? version = null); + + /// + /// Get a task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of HumanTaskEntry + System.Threading.Tasks.Task GetTaskAsync(string taskId); + + /// + /// Get list of task display names applicable for the user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of List<string> + System.Threading.Tasks.Task> GetTaskDisplayNamesAsync(string searchType); + + /// + /// Get user form template by name and version + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of HumanTaskTemplate + System.Threading.Tasks.Task GetTemplateByNameAndVersionAsync(string name, int? version); + + /// + /// Get user form by human task id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of HumanTaskTemplate + System.Threading.Tasks.Task GetTemplateByTaskIdAsync(string humanTaskId); + + /// + /// Reassign a task without completing it + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + System.Threading.Tasks.Task ReassignTaskAsync(List body, string taskId); + + /// + /// Release a task without completing it + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of void + System.Threading.Tasks.Task ReleaseTaskAsync(string taskId); + + /// + /// Save user form template + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of HumanTaskTemplate + System.Threading.Tasks.Task SaveTemplateAsync(HumanTaskTemplate body, bool? newVersion = null); + + /// + /// Save user form template + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// Task of List<HumanTaskTemplate> + System.Threading.Tasks.Task> SaveTemplatesAsync(List body, bool? newVersion = null); + + /// + /// Search human tasks + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of HumanTaskSearchResult + System.Threading.Tasks.Task SearchAsync(HumanTaskSearch body); + + /// + /// If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// Task of void + System.Threading.Tasks.Task SkipTaskAsync(string taskId, string reason = null); + + /// + /// Update task output, optionally complete + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// Task of void + System.Threading.Tasks.Task UpdateTaskOutputAsync(Dictionary body, string taskId, bool? complete = null); + + /// + /// Update task output, optionally complete + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// (optional, default to false) + /// Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty (optional) + /// Task of void + System.Threading.Tasks.Task UpdateTaskOutputByRefAsync(Dictionary body, string workflowId, string taskRefName, bool? complete = null, List iteration = null); + + /// + /// Get Conductor task by id (for human tasks only) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Task of Task + System.Threading.Tasks.Task GetConductorTaskByIdAsync(string taskId); + + #endregion Asynchronous Operations + } +} diff --git a/Conductor/Client/ApiClient.cs b/Conductor/Client/ApiClient.cs index 29876f4..beaccf8 100644 --- a/Conductor/Client/ApiClient.cs +++ b/Conductor/Client/ApiClient.cs @@ -8,6 +8,7 @@ using System.Text; using Newtonsoft.Json; using RestSharp; +using System.Threading.Tasks; namespace Conductor.Client { @@ -175,6 +176,23 @@ public Object CallApi( return (Object)response; } + public async Task CallApiAsync( + String path, RestSharp.Method method, List> queryParams, Object postBody, + Dictionary headerParams, Dictionary formParams, + Dictionary fileParams, Dictionary pathParams, + String contentType) + { + var request = PrepareRequest( + path, method, queryParams, postBody, headerParams, formParams, fileParams, + pathParams, contentType); + + InterceptRequest(request); + var response = await RestClient.ExecuteAsync(request, method); + InterceptResponse(request, response); + FormatHeaders(response); + return (object)response; + } + /// /// To combine the header of same key with different value into one. /// diff --git a/Conductor/Client/Constants.cs b/Conductor/Client/Constants.cs new file mode 100644 index 0000000..2879382 --- /dev/null +++ b/Conductor/Client/Constants.cs @@ -0,0 +1,14 @@ +namespace Conductor.Client +{ + /// + /// Global level constant variables + /// + public static class Constants + { + public const string KEY_ID = ""; + public const string KEY_SECRET = ""; + public const string OWNER_EMAIL = ""; + public const int REST_CLIENT_REQUEST_TIME_OUT = 20000; + + } +} diff --git a/Conductor/Client/Models/HumanTaskAssignment.cs b/Conductor/Client/Models/HumanTaskAssignment.cs new file mode 100644 index 0000000..59f21ee --- /dev/null +++ b/Conductor/Client/Models/HumanTaskAssignment.cs @@ -0,0 +1,122 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskAssignment + /// + [DataContract] + public partial class HumanTaskAssignment : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// assignee. + /// slaMinutes. + public HumanTaskAssignment(HumanTaskUser assignee = default(HumanTaskUser), long? slaMinutes = default(long?)) + { + this.Assignee = assignee; + this.SlaMinutes = slaMinutes; + } + + /// + /// Gets or Sets Assignee + /// + [DataMember(Name = "assignee", EmitDefaultValue = false)] + public HumanTaskUser Assignee { get; set; } + + /// + /// Gets or Sets SlaMinutes + /// + [DataMember(Name = "slaMinutes", EmitDefaultValue = false)] + public long? SlaMinutes { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskAssignment {\n"); + sb.Append(" Assignee: ").Append(Assignee).Append("\n"); + sb.Append(" SlaMinutes: ").Append(SlaMinutes).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskAssignment); + } + + /// + /// Returns true if HumanTaskAssignment instances are equal + /// + /// Instance of HumanTaskAssignment to be compared + /// Boolean + public bool Equals(HumanTaskAssignment input) + { + if (input == null) + return false; + + return + ( + this.Assignee == input.Assignee || + (this.Assignee != null && + this.Assignee.Equals(input.Assignee)) + ) && + ( + this.SlaMinutes == input.SlaMinutes || + (this.SlaMinutes != null && + this.SlaMinutes.Equals(input.SlaMinutes)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Assignee != null) + hashCode = hashCode * 59 + this.Assignee.GetHashCode(); + if (this.SlaMinutes != null) + hashCode = hashCode * 59 + this.SlaMinutes.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskDefinition.cs b/Conductor/Client/Models/HumanTaskDefinition.cs new file mode 100644 index 0000000..472020c --- /dev/null +++ b/Conductor/Client/Models/HumanTaskDefinition.cs @@ -0,0 +1,191 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskDefinition + /// + [DataContract] + public partial class HumanTaskDefinition : IEquatable, IValidatableObject + { + /// + /// Defines AssignmentCompletionStrategy + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AssignmentCompletionStrategyEnum + { + /// + /// Enum LEAVEOPEN for value: LEAVE_OPEN + /// + [EnumMember(Value = "LEAVE_OPEN")] + LEAVEOPEN = 1, + /// + /// Enum TERMINATE for value: TERMINATE + /// + [EnumMember(Value = "TERMINATE")] + TERMINATE = 2 + } + /// + /// Gets or Sets AssignmentCompletionStrategy + /// + [DataMember(Name = "assignmentCompletionStrategy", EmitDefaultValue = false)] + public AssignmentCompletionStrategyEnum? AssignmentCompletionStrategy { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// assignmentCompletionStrategy. + /// assignments. + /// displayName. + /// taskTriggers. + /// userFormTemplate. + public HumanTaskDefinition(AssignmentCompletionStrategyEnum? assignmentCompletionStrategy = default(AssignmentCompletionStrategyEnum?), List assignments = default(List), string displayName = default(string), List taskTriggers = default(List), UserFormTemplate userFormTemplate = default(UserFormTemplate)) + { + this.AssignmentCompletionStrategy = assignmentCompletionStrategy; + this.Assignments = assignments; + this.DisplayName = displayName; + this.TaskTriggers = taskTriggers; + this.UserFormTemplate = userFormTemplate; + } + + + /// + /// Gets or Sets Assignments + /// + [DataMember(Name = "assignments", EmitDefaultValue = false)] + public List Assignments { get; set; } + + /// + /// Gets or Sets DisplayName + /// + [DataMember(Name = "displayName", EmitDefaultValue = false)] + public string DisplayName { get; set; } + + /// + /// Gets or Sets TaskTriggers + /// + [DataMember(Name = "taskTriggers", EmitDefaultValue = false)] + public List TaskTriggers { get; set; } + + /// + /// Gets or Sets UserFormTemplate + /// + [DataMember(Name = "userFormTemplate", EmitDefaultValue = false)] + public UserFormTemplate UserFormTemplate { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskDefinition {\n"); + sb.Append(" AssignmentCompletionStrategy: ").Append(AssignmentCompletionStrategy).Append("\n"); + sb.Append(" Assignments: ").Append(Assignments).Append("\n"); + sb.Append(" DisplayName: ").Append(DisplayName).Append("\n"); + sb.Append(" TaskTriggers: ").Append(TaskTriggers).Append("\n"); + sb.Append(" UserFormTemplate: ").Append(UserFormTemplate).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskDefinition); + } + + /// + /// Returns true if HumanTaskDefinition instances are equal + /// + /// Instance of HumanTaskDefinition to be compared + /// Boolean + public bool Equals(HumanTaskDefinition input) + { + if (input == null) + return false; + + return + ( + this.AssignmentCompletionStrategy == input.AssignmentCompletionStrategy || + (this.AssignmentCompletionStrategy != null && + this.AssignmentCompletionStrategy.Equals(input.AssignmentCompletionStrategy)) + ) && + ( + this.Assignments == input.Assignments || + this.Assignments != null && + input.Assignments != null && + this.Assignments.SequenceEqual(input.Assignments) + ) && + ( + this.DisplayName == input.DisplayName || + (this.DisplayName != null && + this.DisplayName.Equals(input.DisplayName)) + ) && + ( + this.TaskTriggers == input.TaskTriggers || + this.TaskTriggers != null && + input.TaskTriggers != null && + this.TaskTriggers.SequenceEqual(input.TaskTriggers) + ) && + ( + this.UserFormTemplate == input.UserFormTemplate || + (this.UserFormTemplate != null && + this.UserFormTemplate.Equals(input.UserFormTemplate)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AssignmentCompletionStrategy != null) + hashCode = hashCode * 59 + this.AssignmentCompletionStrategy.GetHashCode(); + if (this.Assignments != null) + hashCode = hashCode * 59 + this.Assignments.GetHashCode(); + if (this.DisplayName != null) + hashCode = hashCode * 59 + this.DisplayName.GetHashCode(); + if (this.TaskTriggers != null) + hashCode = hashCode * 59 + this.TaskTriggers.GetHashCode(); + if (this.UserFormTemplate != null) + hashCode = hashCode * 59 + this.UserFormTemplate.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskEntry.cs b/Conductor/Client/Models/HumanTaskEntry.cs new file mode 100644 index 0000000..0a9f100 --- /dev/null +++ b/Conductor/Client/Models/HumanTaskEntry.cs @@ -0,0 +1,387 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskEntry + /// + [DataContract] + public partial class HumanTaskEntry : IEquatable, IValidatableObject + { + /// + /// Defines State + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum StateEnum + { + /// + /// Enum PENDING for value: PENDING + /// + [EnumMember(Value = "PENDING")] + PENDING = 1, + /// + /// Enum ASSIGNED for value: ASSIGNED + /// + [EnumMember(Value = "ASSIGNED")] + ASSIGNED = 2, + /// + /// Enum INPROGRESS for value: IN_PROGRESS + /// + [EnumMember(Value = "IN_PROGRESS")] + INPROGRESS = 3, + /// + /// Enum COMPLETED for value: COMPLETED + /// + [EnumMember(Value = "COMPLETED")] + COMPLETED = 4, + /// + /// Enum TIMEDOUT for value: TIMED_OUT + /// + [EnumMember(Value = "TIMED_OUT")] + TIMEDOUT = 5, + /// + /// Enum DELETED for value: DELETED + /// + [EnumMember(Value = "DELETED")] + DELETED = 6 + } + /// + /// Gets or Sets State + /// + [DataMember(Name = "state", EmitDefaultValue = false)] + public StateEnum? State { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// assignee. + /// claimant. + /// createdBy. + /// createdOn. + /// definitionName. + /// displayName. + /// humanTaskDef. + /// input. + /// output. + /// state. + /// taskId. + /// taskRefName. + /// updatedBy. + /// updatedOn. + /// workflowId. + /// workflowName. + public HumanTaskEntry(HumanTaskUser assignee = default(HumanTaskUser), HumanTaskUser claimant = default(HumanTaskUser), string createdBy = default(string), long? createdOn = default(long?), string definitionName = default(string), string displayName = default(string), HumanTaskDefinition humanTaskDef = default(HumanTaskDefinition), Dictionary input = default(Dictionary), Dictionary output = default(Dictionary), StateEnum? state = default(StateEnum?), string taskId = default(string), string taskRefName = default(string), string updatedBy = default(string), long? updatedOn = default(long?), string workflowId = default(string), string workflowName = default(string)) + { + this.Assignee = assignee; + this.Claimant = claimant; + this.CreatedBy = createdBy; + this.CreatedOn = createdOn; + this.DefinitionName = definitionName; + this.DisplayName = displayName; + this.HumanTaskDef = humanTaskDef; + this.Input = input; + this.Output = output; + this.State = state; + this.TaskId = taskId; + this.TaskRefName = taskRefName; + this.UpdatedBy = updatedBy; + this.UpdatedOn = updatedOn; + this.WorkflowId = workflowId; + this.WorkflowName = workflowName; + } + + /// + /// Gets or Sets Assignee + /// + [DataMember(Name = "assignee", EmitDefaultValue = false)] + public HumanTaskUser Assignee { get; set; } + + /// + /// Gets or Sets Claimant + /// + [DataMember(Name = "claimant", EmitDefaultValue = false)] + public HumanTaskUser Claimant { get; set; } + + /// + /// Gets or Sets CreatedBy + /// + [DataMember(Name = "createdBy", EmitDefaultValue = false)] + public string CreatedBy { get; set; } + + /// + /// Gets or Sets CreatedOn + /// + [DataMember(Name = "createdOn", EmitDefaultValue = false)] + public long? CreatedOn { get; set; } + + /// + /// Gets or Sets DefinitionName + /// + [DataMember(Name = "definitionName", EmitDefaultValue = false)] + public string DefinitionName { get; set; } + + /// + /// Gets or Sets DisplayName + /// + [DataMember(Name = "displayName", EmitDefaultValue = false)] + public string DisplayName { get; set; } + + /// + /// Gets or Sets HumanTaskDef + /// + [DataMember(Name = "humanTaskDef", EmitDefaultValue = false)] + public HumanTaskDefinition HumanTaskDef { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public Dictionary Input { get; set; } + + /// + /// Gets or Sets Output + /// + [DataMember(Name = "output", EmitDefaultValue = false)] + public Dictionary Output { get; set; } + + + /// + /// Gets or Sets TaskId + /// + [DataMember(Name = "taskId", EmitDefaultValue = false)] + public string TaskId { get; set; } + + /// + /// Gets or Sets TaskRefName + /// + [DataMember(Name = "taskRefName", EmitDefaultValue = false)] + public string TaskRefName { get; set; } + + /// + /// Gets or Sets UpdatedBy + /// + [DataMember(Name = "updatedBy", EmitDefaultValue = false)] + public string UpdatedBy { get; set; } + + /// + /// Gets or Sets UpdatedOn + /// + [DataMember(Name = "updatedOn", EmitDefaultValue = false)] + public long? UpdatedOn { get; set; } + + /// + /// Gets or Sets WorkflowId + /// + [DataMember(Name = "workflowId", EmitDefaultValue = false)] + public string WorkflowId { get; set; } + + /// + /// Gets or Sets WorkflowName + /// + [DataMember(Name = "workflowName", EmitDefaultValue = false)] + public string WorkflowName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskEntry {\n"); + sb.Append(" Assignee: ").Append(Assignee).Append("\n"); + sb.Append(" Claimant: ").Append(Claimant).Append("\n"); + sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n"); + sb.Append(" CreatedOn: ").Append(CreatedOn).Append("\n"); + sb.Append(" DefinitionName: ").Append(DefinitionName).Append("\n"); + sb.Append(" DisplayName: ").Append(DisplayName).Append("\n"); + sb.Append(" HumanTaskDef: ").Append(HumanTaskDef).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" Output: ").Append(Output).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" TaskId: ").Append(TaskId).Append("\n"); + sb.Append(" TaskRefName: ").Append(TaskRefName).Append("\n"); + sb.Append(" UpdatedBy: ").Append(UpdatedBy).Append("\n"); + sb.Append(" UpdatedOn: ").Append(UpdatedOn).Append("\n"); + sb.Append(" WorkflowId: ").Append(WorkflowId).Append("\n"); + sb.Append(" WorkflowName: ").Append(WorkflowName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskEntry); + } + + /// + /// Returns true if HumanTaskEntry instances are equal + /// + /// Instance of HumanTaskEntry to be compared + /// Boolean + public bool Equals(HumanTaskEntry input) + { + if (input == null) + return false; + + return + ( + this.Assignee == input.Assignee || + (this.Assignee != null && + this.Assignee.Equals(input.Assignee)) + ) && + ( + this.Claimant == input.Claimant || + (this.Claimant != null && + this.Claimant.Equals(input.Claimant)) + ) && + ( + this.CreatedBy == input.CreatedBy || + (this.CreatedBy != null && + this.CreatedBy.Equals(input.CreatedBy)) + ) && + ( + this.CreatedOn == input.CreatedOn || + (this.CreatedOn != null && + this.CreatedOn.Equals(input.CreatedOn)) + ) && + ( + this.DefinitionName == input.DefinitionName || + (this.DefinitionName != null && + this.DefinitionName.Equals(input.DefinitionName)) + ) && + ( + this.DisplayName == input.DisplayName || + (this.DisplayName != null && + this.DisplayName.Equals(input.DisplayName)) + ) && + ( + this.HumanTaskDef == input.HumanTaskDef || + (this.HumanTaskDef != null && + this.HumanTaskDef.Equals(input.HumanTaskDef)) + ) && + ( + this.Input == input.Input || + this.Input != null && + input.Input != null && + this.Input.SequenceEqual(input.Input) + ) && + ( + this.Output == input.Output || + this.Output != null && + input.Output != null && + this.Output.SequenceEqual(input.Output) + ) && + ( + this.State == input.State || + (this.State != null && + this.State.Equals(input.State)) + ) && + ( + this.TaskId == input.TaskId || + (this.TaskId != null && + this.TaskId.Equals(input.TaskId)) + ) && + ( + this.TaskRefName == input.TaskRefName || + (this.TaskRefName != null && + this.TaskRefName.Equals(input.TaskRefName)) + ) && + ( + this.UpdatedBy == input.UpdatedBy || + (this.UpdatedBy != null && + this.UpdatedBy.Equals(input.UpdatedBy)) + ) && + ( + this.UpdatedOn == input.UpdatedOn || + (this.UpdatedOn != null && + this.UpdatedOn.Equals(input.UpdatedOn)) + ) && + ( + this.WorkflowId == input.WorkflowId || + (this.WorkflowId != null && + this.WorkflowId.Equals(input.WorkflowId)) + ) && + ( + this.WorkflowName == input.WorkflowName || + (this.WorkflowName != null && + this.WorkflowName.Equals(input.WorkflowName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Assignee != null) + hashCode = hashCode * 59 + this.Assignee.GetHashCode(); + if (this.Claimant != null) + hashCode = hashCode * 59 + this.Claimant.GetHashCode(); + if (this.CreatedBy != null) + hashCode = hashCode * 59 + this.CreatedBy.GetHashCode(); + if (this.CreatedOn != null) + hashCode = hashCode * 59 + this.CreatedOn.GetHashCode(); + if (this.DefinitionName != null) + hashCode = hashCode * 59 + this.DefinitionName.GetHashCode(); + if (this.DisplayName != null) + hashCode = hashCode * 59 + this.DisplayName.GetHashCode(); + if (this.HumanTaskDef != null) + hashCode = hashCode * 59 + this.HumanTaskDef.GetHashCode(); + if (this.Input != null) + hashCode = hashCode * 59 + this.Input.GetHashCode(); + if (this.Output != null) + hashCode = hashCode * 59 + this.Output.GetHashCode(); + if (this.State != null) + hashCode = hashCode * 59 + this.State.GetHashCode(); + if (this.TaskId != null) + hashCode = hashCode * 59 + this.TaskId.GetHashCode(); + if (this.TaskRefName != null) + hashCode = hashCode * 59 + this.TaskRefName.GetHashCode(); + if (this.UpdatedBy != null) + hashCode = hashCode * 59 + this.UpdatedBy.GetHashCode(); + if (this.UpdatedOn != null) + hashCode = hashCode * 59 + this.UpdatedOn.GetHashCode(); + if (this.WorkflowId != null) + hashCode = hashCode * 59 + this.WorkflowId.GetHashCode(); + if (this.WorkflowName != null) + hashCode = hashCode * 59 + this.WorkflowName.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskSearch.cs b/Conductor/Client/Models/HumanTaskSearch.cs new file mode 100644 index 0000000..09d395c --- /dev/null +++ b/Conductor/Client/Models/HumanTaskSearch.cs @@ -0,0 +1,393 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskSearch + /// + [DataContract] + public partial class HumanTaskSearch : IEquatable, IValidatableObject + { + /// + /// Defines SearchType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SearchTypeEnum + { + /// + /// Enum ADMIN for value: ADMIN + /// + [EnumMember(Value = "ADMIN")] + ADMIN = 1, + /// + /// Enum INBOX for value: INBOX + /// + [EnumMember(Value = "INBOX")] + INBOX = 2 + } + /// + /// Gets or Sets SearchType + /// + [DataMember(Name = "searchType", EmitDefaultValue = false)] + public SearchTypeEnum? SearchType { get; set; } + /// + /// Defines States + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum StatesEnum + { + /// + /// Enum PENDING for value: PENDING + /// + [EnumMember(Value = "PENDING")] + PENDING = 1, + /// + /// Enum ASSIGNED for value: ASSIGNED + /// + [EnumMember(Value = "ASSIGNED")] + ASSIGNED = 2, + /// + /// Enum INPROGRESS for value: IN_PROGRESS + /// + [EnumMember(Value = "IN_PROGRESS")] + INPROGRESS = 3, + /// + /// Enum COMPLETED for value: COMPLETED + /// + [EnumMember(Value = "COMPLETED")] + COMPLETED = 4, + /// + /// Enum TIMEDOUT for value: TIMED_OUT + /// + [EnumMember(Value = "TIMED_OUT")] + TIMEDOUT = 5, + /// + /// Enum DELETED for value: DELETED + /// + [EnumMember(Value = "DELETED")] + DELETED = 6 + } + /// + /// Gets or Sets States + /// + [DataMember(Name = "states", EmitDefaultValue = false)] + public List States { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// assignees. + /// claimants. + /// definitionNames. + /// displayNames. + /// fullTextQuery. + /// searchType. + /// size. + /// start. + /// states. + /// taskInputQuery. + /// taskOutputQuery. + /// taskRefNames. + /// updateEndTime. + /// updateStartTime. + /// workflowNames. + public HumanTaskSearch(List assignees = default(List), List claimants = default(List), List definitionNames = default(List), List displayNames = default(List), string fullTextQuery = default(string), SearchTypeEnum? searchType = default(SearchTypeEnum?), int? size = default(int?), int? start = default(int?), List states = default(List), string taskInputQuery = default(string), string taskOutputQuery = default(string), List taskRefNames = default(List), long? updateEndTime = default(long?), long? updateStartTime = default(long?), List workflowNames = default(List)) + { + this.Assignees = assignees; + this.Claimants = claimants; + this.DefinitionNames = definitionNames; + this.DisplayNames = displayNames; + this.FullTextQuery = fullTextQuery; + this.SearchType = searchType; + this.Size = size; + this.Start = start; + this.States = states; + this.TaskInputQuery = taskInputQuery; + this.TaskOutputQuery = taskOutputQuery; + this.TaskRefNames = taskRefNames; + this.UpdateEndTime = updateEndTime; + this.UpdateStartTime = updateStartTime; + this.WorkflowNames = workflowNames; + } + + /// + /// Gets or Sets Assignees + /// + [DataMember(Name = "assignees", EmitDefaultValue = false)] + public List Assignees { get; set; } + + /// + /// Gets or Sets Claimants + /// + [DataMember(Name = "claimants", EmitDefaultValue = false)] + public List Claimants { get; set; } + + /// + /// Gets or Sets DefinitionNames + /// + [DataMember(Name = "definitionNames", EmitDefaultValue = false)] + public List DefinitionNames { get; set; } + + /// + /// Gets or Sets DisplayNames + /// + [DataMember(Name = "displayNames", EmitDefaultValue = false)] + public List DisplayNames { get; set; } + + /// + /// Gets or Sets FullTextQuery + /// + [DataMember(Name = "fullTextQuery", EmitDefaultValue = false)] + public string FullTextQuery { get; set; } + + + /// + /// Gets or Sets Size + /// + [DataMember(Name = "size", EmitDefaultValue = false)] + public int? Size { get; set; } + + /// + /// Gets or Sets Start + /// + [DataMember(Name = "start", EmitDefaultValue = false)] + public int? Start { get; set; } + + + /// + /// Gets or Sets TaskInputQuery + /// + [DataMember(Name = "taskInputQuery", EmitDefaultValue = false)] + public string TaskInputQuery { get; set; } + + /// + /// Gets or Sets TaskOutputQuery + /// + [DataMember(Name = "taskOutputQuery", EmitDefaultValue = false)] + public string TaskOutputQuery { get; set; } + + /// + /// Gets or Sets TaskRefNames + /// + [DataMember(Name = "taskRefNames", EmitDefaultValue = false)] + public List TaskRefNames { get; set; } + + /// + /// Gets or Sets UpdateEndTime + /// + [DataMember(Name = "updateEndTime", EmitDefaultValue = false)] + public long? UpdateEndTime { get; set; } + + /// + /// Gets or Sets UpdateStartTime + /// + [DataMember(Name = "updateStartTime", EmitDefaultValue = false)] + public long? UpdateStartTime { get; set; } + + /// + /// Gets or Sets WorkflowNames + /// + [DataMember(Name = "workflowNames", EmitDefaultValue = false)] + public List WorkflowNames { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskSearch {\n"); + sb.Append(" Assignees: ").Append(Assignees).Append("\n"); + sb.Append(" Claimants: ").Append(Claimants).Append("\n"); + sb.Append(" DefinitionNames: ").Append(DefinitionNames).Append("\n"); + sb.Append(" DisplayNames: ").Append(DisplayNames).Append("\n"); + sb.Append(" FullTextQuery: ").Append(FullTextQuery).Append("\n"); + sb.Append(" SearchType: ").Append(SearchType).Append("\n"); + sb.Append(" Size: ").Append(Size).Append("\n"); + sb.Append(" Start: ").Append(Start).Append("\n"); + sb.Append(" States: ").Append(States).Append("\n"); + sb.Append(" TaskInputQuery: ").Append(TaskInputQuery).Append("\n"); + sb.Append(" TaskOutputQuery: ").Append(TaskOutputQuery).Append("\n"); + sb.Append(" TaskRefNames: ").Append(TaskRefNames).Append("\n"); + sb.Append(" UpdateEndTime: ").Append(UpdateEndTime).Append("\n"); + sb.Append(" UpdateStartTime: ").Append(UpdateStartTime).Append("\n"); + sb.Append(" WorkflowNames: ").Append(WorkflowNames).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskSearch); + } + + /// + /// Returns true if HumanTaskSearch instances are equal + /// + /// Instance of HumanTaskSearch to be compared + /// Boolean + public bool Equals(HumanTaskSearch input) + { + if (input == null) + return false; + + return + ( + this.Assignees == input.Assignees || + this.Assignees != null && + input.Assignees != null && + this.Assignees.SequenceEqual(input.Assignees) + ) && + ( + this.Claimants == input.Claimants || + this.Claimants != null && + input.Claimants != null && + this.Claimants.SequenceEqual(input.Claimants) + ) && + ( + this.DefinitionNames == input.DefinitionNames || + this.DefinitionNames != null && + input.DefinitionNames != null && + this.DefinitionNames.SequenceEqual(input.DefinitionNames) + ) && + ( + this.DisplayNames == input.DisplayNames || + this.DisplayNames != null && + input.DisplayNames != null && + this.DisplayNames.SequenceEqual(input.DisplayNames) + ) && + ( + this.FullTextQuery == input.FullTextQuery || + (this.FullTextQuery != null && + this.FullTextQuery.Equals(input.FullTextQuery)) + ) && + ( + this.SearchType == input.SearchType || + (this.SearchType != null && + this.SearchType.Equals(input.SearchType)) + ) && + ( + this.Size == input.Size || + (this.Size != null && + this.Size.Equals(input.Size)) + ) && + ( + this.Start == input.Start || + (this.Start != null && + this.Start.Equals(input.Start)) + ) && + ( + this.States == input.States || + this.States != null && + input.States != null && + this.States.SequenceEqual(input.States) + ) && + ( + this.TaskInputQuery == input.TaskInputQuery || + (this.TaskInputQuery != null && + this.TaskInputQuery.Equals(input.TaskInputQuery)) + ) && + ( + this.TaskOutputQuery == input.TaskOutputQuery || + (this.TaskOutputQuery != null && + this.TaskOutputQuery.Equals(input.TaskOutputQuery)) + ) && + ( + this.TaskRefNames == input.TaskRefNames || + this.TaskRefNames != null && + input.TaskRefNames != null && + this.TaskRefNames.SequenceEqual(input.TaskRefNames) + ) && + ( + this.UpdateEndTime == input.UpdateEndTime || + (this.UpdateEndTime != null && + this.UpdateEndTime.Equals(input.UpdateEndTime)) + ) && + ( + this.UpdateStartTime == input.UpdateStartTime || + (this.UpdateStartTime != null && + this.UpdateStartTime.Equals(input.UpdateStartTime)) + ) && + ( + this.WorkflowNames == input.WorkflowNames || + this.WorkflowNames != null && + input.WorkflowNames != null && + this.WorkflowNames.SequenceEqual(input.WorkflowNames) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Assignees != null) + hashCode = hashCode * 59 + this.Assignees.GetHashCode(); + if (this.Claimants != null) + hashCode = hashCode * 59 + this.Claimants.GetHashCode(); + if (this.DefinitionNames != null) + hashCode = hashCode * 59 + this.DefinitionNames.GetHashCode(); + if (this.DisplayNames != null) + hashCode = hashCode * 59 + this.DisplayNames.GetHashCode(); + if (this.FullTextQuery != null) + hashCode = hashCode * 59 + this.FullTextQuery.GetHashCode(); + if (this.SearchType != null) + hashCode = hashCode * 59 + this.SearchType.GetHashCode(); + if (this.Size != null) + hashCode = hashCode * 59 + this.Size.GetHashCode(); + if (this.Start != null) + hashCode = hashCode * 59 + this.Start.GetHashCode(); + if (this.States != null) + hashCode = hashCode * 59 + this.States.GetHashCode(); + if (this.TaskInputQuery != null) + hashCode = hashCode * 59 + this.TaskInputQuery.GetHashCode(); + if (this.TaskOutputQuery != null) + hashCode = hashCode * 59 + this.TaskOutputQuery.GetHashCode(); + if (this.TaskRefNames != null) + hashCode = hashCode * 59 + this.TaskRefNames.GetHashCode(); + if (this.UpdateEndTime != null) + hashCode = hashCode * 59 + this.UpdateEndTime.GetHashCode(); + if (this.UpdateStartTime != null) + hashCode = hashCode * 59 + this.UpdateStartTime.GetHashCode(); + if (this.WorkflowNames != null) + hashCode = hashCode * 59 + this.WorkflowNames.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskSearchResult.cs b/Conductor/Client/Models/HumanTaskSearchResult.cs new file mode 100644 index 0000000..32e2190 --- /dev/null +++ b/Conductor/Client/Models/HumanTaskSearchResult.cs @@ -0,0 +1,172 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskSearchResult + /// + [DataContract] + public partial class HumanTaskSearchResult : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// hits. + /// pageSizeLimit. + /// results. + /// start. + /// totalHits. + public HumanTaskSearchResult(int? hits = default(int?), int? pageSizeLimit = default(int?), List results = default(List), int? start = default(int?), long? totalHits = default(long?)) + { + this.Hits = hits; + this.PageSizeLimit = pageSizeLimit; + this.Results = results; + this.Start = start; + this.TotalHits = totalHits; + } + + /// + /// Gets or Sets Hits + /// + [DataMember(Name = "hits", EmitDefaultValue = false)] + public int? Hits { get; set; } + + /// + /// Gets or Sets PageSizeLimit + /// + [DataMember(Name = "pageSizeLimit", EmitDefaultValue = false)] + public int? PageSizeLimit { get; set; } + + /// + /// Gets or Sets Results + /// + [DataMember(Name = "results", EmitDefaultValue = false)] + public List Results { get; set; } + + /// + /// Gets or Sets Start + /// + [DataMember(Name = "start", EmitDefaultValue = false)] + public int? Start { get; set; } + + /// + /// Gets or Sets TotalHits + /// + [DataMember(Name = "totalHits", EmitDefaultValue = false)] + public long? TotalHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskSearchResult {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" PageSizeLimit: ").Append(PageSizeLimit).Append("\n"); + sb.Append(" Results: ").Append(Results).Append("\n"); + sb.Append(" Start: ").Append(Start).Append("\n"); + sb.Append(" TotalHits: ").Append(TotalHits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskSearchResult); + } + + /// + /// Returns true if HumanTaskSearchResult instances are equal + /// + /// Instance of HumanTaskSearchResult to be compared + /// Boolean + public bool Equals(HumanTaskSearchResult input) + { + if (input == null) + return false; + + return + ( + this.Hits == input.Hits || + (this.Hits != null && + this.Hits.Equals(input.Hits)) + ) && + ( + this.PageSizeLimit == input.PageSizeLimit || + (this.PageSizeLimit != null && + this.PageSizeLimit.Equals(input.PageSizeLimit)) + ) && + ( + this.Results == input.Results || + this.Results != null && + input.Results != null && + this.Results.SequenceEqual(input.Results) + ) && + ( + this.Start == input.Start || + (this.Start != null && + this.Start.Equals(input.Start)) + ) && + ( + this.TotalHits == input.TotalHits || + (this.TotalHits != null && + this.TotalHits.Equals(input.TotalHits)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + hashCode = hashCode * 59 + this.Hits.GetHashCode(); + if (this.PageSizeLimit != null) + hashCode = hashCode * 59 + this.PageSizeLimit.GetHashCode(); + if (this.Results != null) + hashCode = hashCode * 59 + this.Results.GetHashCode(); + if (this.Start != null) + hashCode = hashCode * 59 + this.Start.GetHashCode(); + if (this.TotalHits != null) + hashCode = hashCode * 59 + this.TotalHits.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskTemplate.cs b/Conductor/Client/Models/HumanTaskTemplate.cs new file mode 100644 index 0000000..d95cada --- /dev/null +++ b/Conductor/Client/Models/HumanTaskTemplate.cs @@ -0,0 +1,254 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskTemplate + /// + [DataContract] + public partial class HumanTaskTemplate : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// createdBy. + /// createdOn. + /// jsonSchema (required). + /// name (required). + /// templateUI (required). + /// updatedBy. + /// updatedOn. + /// version (required). + public HumanTaskTemplate(string createdBy = default(string), long? createdOn = default(long?), Dictionary jsonSchema = default(Dictionary), string name = default(string), Dictionary templateUI = default(Dictionary), string updatedBy = default(string), long? updatedOn = default(long?), int? version = default(int?)) + { + // to ensure "jsonSchema" is required (not null) + if (jsonSchema == null) + { + throw new InvalidDataException("jsonSchema is a required property for HumanTaskTemplate and cannot be null"); + } + else + { + this.JsonSchema = jsonSchema; + } + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for HumanTaskTemplate and cannot be null"); + } + else + { + this.Name = name; + } + // to ensure "templateUI" is required (not null) + if (templateUI == null) + { + throw new InvalidDataException("templateUI is a required property for HumanTaskTemplate and cannot be null"); + } + else + { + this.TemplateUI = templateUI; + } + // to ensure "version" is required (not null) + if (version == null) + { + throw new InvalidDataException("version is a required property for HumanTaskTemplate and cannot be null"); + } + else + { + this.Version = version; + } + this.CreatedBy = createdBy; + this.CreatedOn = createdOn; + this.UpdatedBy = updatedBy; + this.UpdatedOn = updatedOn; + } + + /// + /// Gets or Sets CreatedBy + /// + [DataMember(Name = "createdBy", EmitDefaultValue = false)] + public string CreatedBy { get; set; } + + /// + /// Gets or Sets CreatedOn + /// + [DataMember(Name = "createdOn", EmitDefaultValue = false)] + public long? CreatedOn { get; set; } + + /// + /// Gets or Sets JsonSchema + /// + [DataMember(Name = "jsonSchema", EmitDefaultValue = false)] + public Dictionary JsonSchema { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets TemplateUI + /// + [DataMember(Name = "templateUI", EmitDefaultValue = false)] + public Dictionary TemplateUI { get; set; } + + /// + /// Gets or Sets UpdatedBy + /// + [DataMember(Name = "updatedBy", EmitDefaultValue = false)] + public string UpdatedBy { get; set; } + + /// + /// Gets or Sets UpdatedOn + /// + [DataMember(Name = "updatedOn", EmitDefaultValue = false)] + public long? UpdatedOn { get; set; } + + /// + /// Gets or Sets Version + /// + [DataMember(Name = "version", EmitDefaultValue = false)] + public int? Version { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskTemplate {\n"); + sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n"); + sb.Append(" CreatedOn: ").Append(CreatedOn).Append("\n"); + sb.Append(" JsonSchema: ").Append(JsonSchema).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" TemplateUI: ").Append(TemplateUI).Append("\n"); + sb.Append(" UpdatedBy: ").Append(UpdatedBy).Append("\n"); + sb.Append(" UpdatedOn: ").Append(UpdatedOn).Append("\n"); + sb.Append(" Version: ").Append(Version).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskTemplate); + } + + /// + /// Returns true if HumanTaskTemplate instances are equal + /// + /// Instance of HumanTaskTemplate to be compared + /// Boolean + public bool Equals(HumanTaskTemplate input) + { + if (input == null) + return false; + + return + ( + this.CreatedBy == input.CreatedBy || + (this.CreatedBy != null && + this.CreatedBy.Equals(input.CreatedBy)) + ) && + ( + this.CreatedOn == input.CreatedOn || + (this.CreatedOn != null && + this.CreatedOn.Equals(input.CreatedOn)) + ) && + ( + this.JsonSchema == input.JsonSchema || + this.JsonSchema != null && + input.JsonSchema != null && + this.JsonSchema.SequenceEqual(input.JsonSchema) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.TemplateUI == input.TemplateUI || + this.TemplateUI != null && + input.TemplateUI != null && + this.TemplateUI.SequenceEqual(input.TemplateUI) + ) && + ( + this.UpdatedBy == input.UpdatedBy || + (this.UpdatedBy != null && + this.UpdatedBy.Equals(input.UpdatedBy)) + ) && + ( + this.UpdatedOn == input.UpdatedOn || + (this.UpdatedOn != null && + this.UpdatedOn.Equals(input.UpdatedOn)) + ) && + ( + this.Version == input.Version || + (this.Version != null && + this.Version.Equals(input.Version)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.CreatedBy != null) + hashCode = hashCode * 59 + this.CreatedBy.GetHashCode(); + if (this.CreatedOn != null) + hashCode = hashCode * 59 + this.CreatedOn.GetHashCode(); + if (this.JsonSchema != null) + hashCode = hashCode * 59 + this.JsonSchema.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.TemplateUI != null) + hashCode = hashCode * 59 + this.TemplateUI.GetHashCode(); + if (this.UpdatedBy != null) + hashCode = hashCode * 59 + this.UpdatedBy.GetHashCode(); + if (this.UpdatedOn != null) + hashCode = hashCode * 59 + this.UpdatedOn.GetHashCode(); + if (this.Version != null) + hashCode = hashCode * 59 + this.Version.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskTrigger.cs b/Conductor/Client/Models/HumanTaskTrigger.cs new file mode 100644 index 0000000..b820098 --- /dev/null +++ b/Conductor/Client/Models/HumanTaskTrigger.cs @@ -0,0 +1,160 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskTrigger + /// + [DataContract] + public partial class HumanTaskTrigger : IEquatable, IValidatableObject + { + /// + /// Defines TriggerType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TriggerTypeEnum + { + /// + /// Enum ASSIGNEECHANGED for value: ASSIGNEE_CHANGED + /// + [EnumMember(Value = "ASSIGNEE_CHANGED")] + ASSIGNEECHANGED = 1, + /// + /// Enum PENDING for value: PENDING + /// + [EnumMember(Value = "PENDING")] + PENDING = 2, + /// + /// Enum INPROGRESS for value: IN_PROGRESS + /// + [EnumMember(Value = "IN_PROGRESS")] + INPROGRESS = 3, + /// + /// Enum ASSIGNED for value: ASSIGNED + /// + [EnumMember(Value = "ASSIGNED")] + ASSIGNED = 4, + /// + /// Enum COMPLETED for value: COMPLETED + /// + [EnumMember(Value = "COMPLETED")] + COMPLETED = 5, + /// + /// Enum TIMEDOUT for value: TIMED_OUT + /// + [EnumMember(Value = "TIMED_OUT")] + TIMEDOUT = 6 + } + /// + /// Gets or Sets TriggerType + /// + [DataMember(Name = "triggerType", EmitDefaultValue = false)] + public TriggerTypeEnum? TriggerType { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// startWorkflowRequest. + /// triggerType. + public HumanTaskTrigger(StartWorkflowRequest startWorkflowRequest = default(StartWorkflowRequest), TriggerTypeEnum? triggerType = default(TriggerTypeEnum?)) + { + this.StartWorkflowRequest = startWorkflowRequest; + this.TriggerType = triggerType; + } + + /// + /// Gets or Sets StartWorkflowRequest + /// + [DataMember(Name = "startWorkflowRequest", EmitDefaultValue = false)] + public StartWorkflowRequest StartWorkflowRequest { get; set; } + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskTrigger {\n"); + sb.Append(" StartWorkflowRequest: ").Append(StartWorkflowRequest).Append("\n"); + sb.Append(" TriggerType: ").Append(TriggerType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskTrigger); + } + + /// + /// Returns true if HumanTaskTrigger instances are equal + /// + /// Instance of HumanTaskTrigger to be compared + /// Boolean + public bool Equals(HumanTaskTrigger input) + { + if (input == null) + return false; + + return + ( + this.StartWorkflowRequest == input.StartWorkflowRequest || + (this.StartWorkflowRequest != null && + this.StartWorkflowRequest.Equals(input.StartWorkflowRequest)) + ) && + ( + this.TriggerType == input.TriggerType || + (this.TriggerType != null && + this.TriggerType.Equals(input.TriggerType)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StartWorkflowRequest != null) + hashCode = hashCode * 59 + this.StartWorkflowRequest.GetHashCode(); + if (this.TriggerType != null) + hashCode = hashCode * 59 + this.TriggerType.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/HumanTaskUser.cs b/Conductor/Client/Models/HumanTaskUser.cs new file mode 100644 index 0000000..ddc54ee --- /dev/null +++ b/Conductor/Client/Models/HumanTaskUser.cs @@ -0,0 +1,150 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// HumanTaskUser + /// + [DataContract] + public partial class HumanTaskUser : IEquatable, IValidatableObject + { + /// + /// Defines UserType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UserTypeEnum + { + /// + /// Enum EXTERNALUSER for value: EXTERNAL_USER + /// + [EnumMember(Value = "EXTERNAL_USER")] + EXTERNALUSER = 1, + /// + /// Enum EXTERNALGROUP for value: EXTERNAL_GROUP + /// + [EnumMember(Value = "EXTERNAL_GROUP")] + EXTERNALGROUP = 2, + /// + /// Enum CONDUCTORUSER for value: CONDUCTOR_USER + /// + [EnumMember(Value = "CONDUCTOR_USER")] + CONDUCTORUSER = 3, + /// + /// Enum CONDUCTORGROUP for value: CONDUCTOR_GROUP + /// + [EnumMember(Value = "CONDUCTOR_GROUP")] + CONDUCTORGROUP = 4 + } + /// + /// Gets or Sets UserType + /// + [DataMember(Name = "userType", EmitDefaultValue = false)] + public UserTypeEnum? UserType { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// user. + /// userType. + public HumanTaskUser(string user = default(string), UserTypeEnum? userType = default(UserTypeEnum?)) + { + this.User = user; + this.UserType = userType; + } + + /// + /// Gets or Sets User + /// + [DataMember(Name = "user", EmitDefaultValue = false)] + public string User { get; set; } + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HumanTaskUser {\n"); + sb.Append(" User: ").Append(User).Append("\n"); + sb.Append(" UserType: ").Append(UserType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HumanTaskUser); + } + + /// + /// Returns true if HumanTaskUser instances are equal + /// + /// Instance of HumanTaskUser to be compared + /// Boolean + public bool Equals(HumanTaskUser input) + { + if (input == null) + return false; + + return + ( + this.User == input.User || + (this.User != null && + this.User.Equals(input.User)) + ) && + ( + this.UserType == input.UserType || + (this.UserType != null && + this.UserType.Equals(input.UserType)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.User != null) + hashCode = hashCode * 59 + this.User.GetHashCode(); + if (this.UserType != null) + hashCode = hashCode * 59 + this.UserType.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Conductor/Client/Models/UserFormTemplate.cs b/Conductor/Client/Models/UserFormTemplate.cs new file mode 100644 index 0000000..af384f5 --- /dev/null +++ b/Conductor/Client/Models/UserFormTemplate.cs @@ -0,0 +1,122 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using System.Text; + +namespace Conductor.Client.Models +{ + /// + /// UserFormTemplate + /// + [DataContract] + public partial class UserFormTemplate : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name. + /// version. + public UserFormTemplate(string name = default(string), int? version = default(int?)) + { + this.Name = name; + this.Version = version; + } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets Version + /// + [DataMember(Name = "version", EmitDefaultValue = false)] + public int? Version { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class UserFormTemplate {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Version: ").Append(Version).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UserFormTemplate); + } + + /// + /// Returns true if UserFormTemplate instances are equal + /// + /// Instance of UserFormTemplate to be compared + /// Boolean + public bool Equals(UserFormTemplate input) + { + if (input == null) + return false; + + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Version == input.Version || + (this.Version != null && + this.Version.Equals(input.Version)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.Version != null) + hashCode = hashCode * 59 + this.Version.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Tests/Api/HumanTaskResourceApiTest.cs b/Tests/Api/HumanTaskResourceApiTest.cs new file mode 100644 index 0000000..63d5553 --- /dev/null +++ b/Tests/Api/HumanTaskResourceApiTest.cs @@ -0,0 +1,46 @@ +using Conductor.Api; +using Conductor.Client; +using Conductor.Client.Extensions; +using Xunit; +using Xunit.Abstractions; + +namespace conductor_csharp.test.Api +{ + public class HumanTaskResourceApiTest + { + private readonly HumanTaskResourceApi _humanTaskResourceApi; + private readonly OrkesApiClient _orkesApiClient; + private const string UserFormName = "USER_FORM_NAME_TEST"; + private readonly ITestOutputHelper _testOutputHelper; + + public HumanTaskResourceApiTest(ITestOutputHelper testOutputHelper) + { + // dev local testing + //_orkesApiClient = new OrkesApiClient(new Configuration(), new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); + //_humanTaskResourceApi = _orkesApiClient.GetClient(); + + _testOutputHelper = testOutputHelper; + _humanTaskResourceApi = ApiExtensions.GetClient(); + } + + /// + /// Test case for HumanTaskResourceApi using BaseUrl:- 'https://sdkdev.orkesconductor.io/' + /// Get templates of user form based on name + /// + [Fact] + public void TestUserForm() + { + var templates = _humanTaskResourceApi.GetAllTemplates(UserFormName, null); + if (templates != null && templates.Count > 0) + { + _testOutputHelper.WriteLine($"UserFormName --> {UserFormName} and result count of templates --> {templates.Count}"); + Assert.NotEmpty(templates); + } + else + { + _testOutputHelper.WriteLine($"UserFormName --> {UserFormName} and result count of templates is 0"); + Assert.Empty(templates); + } + } + } +} diff --git a/Tests/Api/WorkflowResourceApiTest.cs b/Tests/Api/WorkflowResourceApiTest.cs index 97ffb35..f8bc370 100644 --- a/Tests/Api/WorkflowResourceApiTest.cs +++ b/Tests/Api/WorkflowResourceApiTest.cs @@ -25,14 +25,13 @@ public class WorkflowResourceApiTest private const string WORKFLOW_DESC = "Test Workflow With Variables"; private const int WORKFLOW_VERSION = 1; private const string OWNER_EMAIL = "developer@orkes.io"; - + private readonly WorkflowResourceApi _workflowClient; private readonly ITaskResourceApi _taskClient; private readonly MetadataResourceApi _metadataResourceApi; private readonly ILogger _logger; private readonly ITestOutputHelper _testOutputHelper; - public WorkflowResourceApiTest(ITestOutputHelper testOutputHelper) { _workflowClient = ApiExtensions.GetClient(); @@ -115,10 +114,10 @@ public async void UpdateWorkflowVariables() {WORKFLOW_VARIABLE_1,"Value1" }, {WORKFLOW_VARIABLE_2,"Value2" }, }; - + // Update the work flow variables var _updatedWorkFlow = _workflowClient.UpdateWorkflowVariables(workflowId, updateDict); - + // Verify workflow variables data is equal with input passed Assert.Equal(_updatedWorkFlow.Variables, updateDict); @@ -157,140 +156,140 @@ private void DeleteWorkflowExecution(string workflowId) } [Fact] - public void TestWorkflowOperations() - { - // Start Workflow - var correlationId = Guid.NewGuid().ToString(); - var startWorkflowRequest = new StartWorkflowRequest - { - Name = "csharp_sync_task_variable_updates", - Version = 1, - Input = new Dictionary(), - CorrelationId = correlationId - }; - var workflowId = _workflowClient.StartWorkflow(startWorkflowRequest); - _testOutputHelper.WriteLine($"Started workflow with id {workflowId}"); - - // Update a variable inside the workflow - _workflowClient.UpdateWorkflowVariables(workflowId, new Dictionary { { "case", "case1" } }); - - // Get workflow execution status - var workflow = _workflowClient.GetWorkflow(workflowId, true); - var lastTask = workflow.Tasks.Last(); - _testOutputHelper.WriteLine( - $"Workflow status is {workflow.Status} and currently running task is {lastTask.ReferenceTaskName}"); - - workflow = _taskClient.UpdateTaskSync(new Dictionary { { "a", "b" } }, workflowId, - lastTask.ReferenceTaskName, TaskResult.StatusEnum.COMPLETED, "test_worker"); - - // Get updated workflow status - lastTask = workflow.Tasks.Last(); - Assert.Equal(lastTask.Status, Task.StatusEnum.INPROGRESS); - _testOutputHelper.WriteLine( - $"Workflow status is {workflow.Status} and currently running task is {lastTask.ReferenceTaskName}"); - - // Terminate the workflow - _workflowClient.Terminate(workflowId, "testing termination"); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.TERMINATED, workflow.Status); - lastTask = workflow.Tasks.Last(); - _testOutputHelper.WriteLine( - $"Workflow status is {workflow.Status} and status of last task {lastTask.Status}"); - - // Retry the workflow - _workflowClient.Retry(workflowId); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.RUNNING, workflow.Status); - lastTask = workflow.Tasks.Last(); - _testOutputHelper.WriteLine( - $"Workflow status is {workflow.Status} and status of last task {lastTask.ReferenceTaskName} is {lastTask.Status}"); - - // Mark the WAIT task as completed by calling Task completion API - var taskResult = new TaskResult + public void TestWorkflowOperations() { - WorkflowInstanceId = workflowId, - TaskId = lastTask.TaskId, - Status = TaskResult.StatusEnum.COMPLETED, - OutputData = new Dictionary { { "greetings", "hello from Orkes" } } - }; - workflow = _taskClient.UpdateTaskSync( - new Dictionary { { "greetings", "hello from Orkes" } }, - workflowId, lastTask.ReferenceTaskName, TaskResult.StatusEnum.COMPLETED, ""); - - lastTask = workflow.Tasks.Last(); - Assert.Equal(Task.StatusEnum.SCHEDULED, lastTask.Status); - _testOutputHelper.WriteLine( - $"Workflow status is {workflow.Status} and status of last task {lastTask.ReferenceTaskName} is {lastTask.Status}"); - - // Terminate the workflow again - _workflowClient.Terminate(workflowId, "terminating for testing"); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.TERMINATED, workflow.Status); - - - // Rerun workflow from a specific task - var rerunRequest = new RerunWorkflowRequest - { - ReRunFromTaskId = workflow.Tasks[3].TaskId - }; - _workflowClient.Rerun(rerunRequest, workflowId); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.RUNNING, workflow.Status); - - - // Restart the workflow - _workflowClient.Terminate(workflowId, "terminating so we can do a restart"); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.TERMINATED, workflow.Status); - - _workflowClient.Restart(workflowId); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.RUNNING, workflow.Status); - - // Pause the workflow - _workflowClient.PauseWorkflow(workflowId); - workflow = _workflowClient.GetWorkflow(workflowId, true); - Assert.Equal(Workflow.StatusEnum.PAUSED, workflow.Status); - _testOutputHelper.WriteLine($"Workflow status is {workflow.Status}"); - - workflow = _workflowClient.GetWorkflow(workflowId, true); - // Wait task should have completed - var waitTask = workflow.Tasks[0]; - Assert.Equal(Task.StatusEnum.INPROGRESS, waitTask.Status); - _testOutputHelper.WriteLine($"Workflow status is {workflow.Status} and wait task is {waitTask.Status}"); - - - // Because workflow is paused, no further task should have been scheduled, making WAIT the last task - // Expecting only 1 task - _testOutputHelper.WriteLine($"Number of tasks in workflow is {workflow.Tasks.Count}"); - Assert.Single(workflow.Tasks); - - // Resume the workflow - _workflowClient.ResumeWorkflow(workflowId); - lastTask = workflow.Tasks.Last(); - workflow = _taskClient.UpdateTaskSync(new Dictionary { { "a", "b" } }, workflowId, - lastTask.ReferenceTaskName, TaskResult.StatusEnum.COMPLETED, "test_worker"); - - workflow = _workflowClient.GetWorkflow(workflowId, true); - - // There should be 3 tasks - _testOutputHelper.WriteLine( - $"Number of tasks in workflow is {workflow.Tasks.Count} and last task is {workflow.Tasks.Last().ReferenceTaskName}"); - Assert.Equal(3, workflow.Tasks.Count); - - // Search for workflows - var searchResults = _workflowClient.Search(start: 0, size: 100, freeText: "*", - query: $"correlationId = '{correlationId}'"); - _testOutputHelper.WriteLine( - $"Found {searchResults.Results.Count} execution with correlation_id '{correlationId}'"); - Assert.Single(searchResults.Results); - - correlationId = Guid.NewGuid().ToString(); - searchResults = _workflowClient.Search(start: 0, size: 100, freeText: "*", - query: $"status IN (RUNNING) AND correlationId = \"{correlationId}\""); - // Shouldn't find anything! - _testOutputHelper.WriteLine( - $"Found {searchResults.Results.Count} workflows with correlation id {correlationId}"); - } + // Start Workflow + var correlationId = Guid.NewGuid().ToString(); + var startWorkflowRequest = new StartWorkflowRequest + { + Name = "csharp_sync_task_variable_updates", + Version = 1, + Input = new Dictionary(), + CorrelationId = correlationId + }; + var workflowId = _workflowClient.StartWorkflow(startWorkflowRequest); + _testOutputHelper.WriteLine($"Started workflow with id {workflowId}"); + + // Update a variable inside the workflow + _workflowClient.UpdateWorkflowVariables(workflowId, new Dictionary { { "case", "case1" } }); + + // Get workflow execution status + var workflow = _workflowClient.GetWorkflow(workflowId, true); + var lastTask = workflow.Tasks.Last(); + _testOutputHelper.WriteLine( + $"Workflow status is {workflow.Status} and currently running task is {lastTask.ReferenceTaskName}"); + + workflow = _taskClient.UpdateTaskSync(new Dictionary { { "a", "b" } }, workflowId, + lastTask.ReferenceTaskName, TaskResult.StatusEnum.COMPLETED, "test_worker"); + + // Get updated workflow status + lastTask = workflow.Tasks.Last(); + Assert.Equal(lastTask.Status, Task.StatusEnum.INPROGRESS); + _testOutputHelper.WriteLine( + $"Workflow status is {workflow.Status} and currently running task is {lastTask.ReferenceTaskName}"); + + // Terminate the workflow + _workflowClient.Terminate(workflowId, "testing termination"); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.TERMINATED, workflow.Status); + lastTask = workflow.Tasks.Last(); + _testOutputHelper.WriteLine( + $"Workflow status is {workflow.Status} and status of last task {lastTask.Status}"); + + // Retry the workflow + _workflowClient.Retry(workflowId); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.RUNNING, workflow.Status); + lastTask = workflow.Tasks.Last(); + _testOutputHelper.WriteLine( + $"Workflow status is {workflow.Status} and status of last task {lastTask.ReferenceTaskName} is {lastTask.Status}"); + + // Mark the WAIT task as completed by calling Task completion API + var taskResult = new TaskResult + { + WorkflowInstanceId = workflowId, + TaskId = lastTask.TaskId, + Status = TaskResult.StatusEnum.COMPLETED, + OutputData = new Dictionary { { "greetings", "hello from Orkes" } } + }; + workflow = _taskClient.UpdateTaskSync( + new Dictionary { { "greetings", "hello from Orkes" } }, + workflowId, lastTask.ReferenceTaskName, TaskResult.StatusEnum.COMPLETED, ""); + + lastTask = workflow.Tasks.Last(); + Assert.Equal(Task.StatusEnum.SCHEDULED, lastTask.Status); + _testOutputHelper.WriteLine( + $"Workflow status is {workflow.Status} and status of last task {lastTask.ReferenceTaskName} is {lastTask.Status}"); + + // Terminate the workflow again + _workflowClient.Terminate(workflowId, "terminating for testing"); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.TERMINATED, workflow.Status); + + + // Rerun workflow from a specific task + var rerunRequest = new RerunWorkflowRequest + { + ReRunFromTaskId = workflow.Tasks[3].TaskId + }; + _workflowClient.Rerun(rerunRequest, workflowId); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.RUNNING, workflow.Status); + + + // Restart the workflow + _workflowClient.Terminate(workflowId, "terminating so we can do a restart"); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.TERMINATED, workflow.Status); + + _workflowClient.Restart(workflowId); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.RUNNING, workflow.Status); + + // Pause the workflow + _workflowClient.PauseWorkflow(workflowId); + workflow = _workflowClient.GetWorkflow(workflowId, true); + Assert.Equal(Workflow.StatusEnum.PAUSED, workflow.Status); + _testOutputHelper.WriteLine($"Workflow status is {workflow.Status}"); + + workflow = _workflowClient.GetWorkflow(workflowId, true); + // Wait task should have completed + var waitTask = workflow.Tasks[0]; + Assert.Equal(Task.StatusEnum.INPROGRESS, waitTask.Status); + _testOutputHelper.WriteLine($"Workflow status is {workflow.Status} and wait task is {waitTask.Status}"); + + + // Because workflow is paused, no further task should have been scheduled, making WAIT the last task + // Expecting only 1 task + _testOutputHelper.WriteLine($"Number of tasks in workflow is {workflow.Tasks.Count}"); + Assert.Single(workflow.Tasks); + + // Resume the workflow + _workflowClient.ResumeWorkflow(workflowId); + lastTask = workflow.Tasks.Last(); + workflow = _taskClient.UpdateTaskSync(new Dictionary { { "a", "b" } }, workflowId, + lastTask.ReferenceTaskName, TaskResult.StatusEnum.COMPLETED, "test_worker"); + + workflow = _workflowClient.GetWorkflow(workflowId, true); + + // There should be 3 tasks + _testOutputHelper.WriteLine( + $"Number of tasks in workflow is {workflow.Tasks.Count} and last task is {workflow.Tasks.Last().ReferenceTaskName}"); + Assert.Equal(3, workflow.Tasks.Count); + + // Search for workflows + var searchResults = _workflowClient.Search(start: 0, size: 100, freeText: "*", + query: $"correlationId = '{correlationId}'"); + _testOutputHelper.WriteLine( + $"Found {searchResults.Results.Count} execution with correlation_id '{correlationId}'"); + Assert.Single(searchResults.Results); + + correlationId = Guid.NewGuid().ToString(); + searchResults = _workflowClient.Search(start: 0, size: 100, freeText: "*", + query: $"status IN (RUNNING) AND correlationId = \"{correlationId}\""); + // Shouldn't find anything! + _testOutputHelper.WriteLine( + $"Found {searchResults.Results.Count} workflows with correlation id {correlationId}"); + } } } diff --git a/csharp-examples/HumanTaskExamples.cs b/csharp-examples/HumanTaskExamples.cs new file mode 100644 index 0000000..c7bf5d7 --- /dev/null +++ b/csharp-examples/HumanTaskExamples.cs @@ -0,0 +1,24 @@ +using Conductor.Api; +using Conductor.Client.Authentication; +using Conductor.Client; + +namespace csharp_examples +{ + public class HumanTaskExamples + { + public void GetUserFormTemplatesBasedOnName(string name) + { + var orkesApiClient = new OrkesApiClient(new Configuration(), + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); + var workflowClient = orkesApiClient.GetClient(); + var responseTemplate = workflowClient.GetAllTemplates(name, null); + if (responseTemplate != null && responseTemplate.Count > 0) + { + responseTemplate.ForEach(x => + { + Console.WriteLine(x.Name); + }); + } + } + } +} diff --git a/csharp-examples/WorkFlowExamples.cs b/csharp-examples/WorkFlowExamples.cs index c359586..3b55d90 100644 --- a/csharp-examples/WorkFlowExamples.cs +++ b/csharp-examples/WorkFlowExamples.cs @@ -11,10 +11,6 @@ namespace csharp_examples public class WorkFlowExamples { - private const string KEY_ID = ""; - private const string KEY_SECRET = ""; - private const string OWNER_EMAIL = ""; - private const string WORKFLOW_ID = ""; private const string WORKFLOW_NAME = ""; private const string WORKFLOW_DESCRIPTION = ""; @@ -26,7 +22,6 @@ public class WorkFlowExamples private const string VARIABLE_NEW_VALUE_1 = ""; private const string VARIABLE_NAME_2 = ""; private const string VARIABLE_NEW_VALUE_2 = ""; - private const int REST_CLIENT_REQUEST_TIME_OUT = 20000; public void RegisterWorkFlow() { @@ -41,9 +36,9 @@ public void RegisterWorkFlow() // Step 2:- Use overloaded constructor of Configuration and pass the JsonSerializer Settings // Restclient internally use the settings to serialize on request/response while making a call to serialize/deserialize - Configuration configuration = new Configuration(jsonSerializerSettings, REST_CLIENT_REQUEST_TIME_OUT) + Configuration configuration = new Configuration(jsonSerializerSettings, Constants.REST_CLIENT_REQUEST_TIME_OUT) { - AuthenticationSettings = new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET) + AuthenticationSettings = new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET) }; WorkflowExecutor executor = new WorkflowExecutor(configuration); @@ -70,7 +65,7 @@ private ConductorWorkflow GetConductorWorkflow() var conductorWorkFlow = new ConductorWorkflow() .WithName(WORKFLOW_NAME).WithDescription(WORKFLOW_DESCRIPTION) .WithTask(new SimpleTask(TASK_NAME, TASK_REFERENCE)) - .WithOwner(OWNER_EMAIL); + .WithOwner(Constants.OWNER_EMAIL); var workflowVariableTobeAdded = new Dictionary { @@ -88,7 +83,7 @@ private ConductorWorkflow GetConductorWorkflow() public void TestUpdateWorkflowVariablesWithWorkFlowId() { var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); var workFlowVariables = new Dictionary { @@ -106,7 +101,7 @@ public void TestUpdateWorkflowVariablesWithWorkFlowId() public void TestTerminateWorkflowExecution(String WorkflowId) { var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); workflowClient.Terminate(WORKFLOW_ID, null, null); } @@ -118,7 +113,7 @@ public void TestTerminateWorkflowExecution(String WorkflowId) public void TestRemoveWorkflow(String WorkflowId) { var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); workflowClient.Delete(WorkflowId, null); } @@ -130,7 +125,7 @@ public void TestRemoveWorkflow(String WorkflowId) public void TestRetryLastFailedTask(String WorkflowId) { var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); workflowClient.Retry(WorkflowId, null); } @@ -142,7 +137,7 @@ public void TestRetryLastFailedTask(String WorkflowId) public void TestPauseworkflow(String WorkflowId) { var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); workflowClient.PauseWorkflow(WorkflowId); } @@ -154,7 +149,7 @@ public void TestPauseworkflow(String WorkflowId) public void TestGetWorkflowByWorkflowId(String WorkflowId) { var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); workflowClient.GetExecutionStatus(WorkflowId, null); } @@ -169,7 +164,7 @@ public void TestResumeWorkflow(String WorkflowId) configuration.BasePath = "https://play.orkes.io/api"; var orkesApiClient = new OrkesApiClient(new Configuration(timeOut: 20000), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); var workflowClient = orkesApiClient.GetClient(); workflowClient.ResumeWorkflow(WorkflowId); }