From 67d56b41ecbd4e55722f04b7af70c7e367a99e86 Mon Sep 17 00:00:00 2001 From: "Jithesh.Poojary" Date: Wed, 10 Jan 2024 13:11:22 +0530 Subject: [PATCH 1/5] Changes to address the below 1. update variables functionality, 2. Inprogress throws exception when default param value after callbackAfterSeconds --- Conductor/Api/WorkflowResourceApi.cs | 6026 +++++++++-------- .../Extensions/ConductorTaskExtensions.cs | 2 +- Conductor/Definition/ConductorWorkflow.cs | 144 +- Tests/Api/WorkflowResourceApiTest.cs | 97 + csharp-examples/WorkFlowExamples.cs | 77 + 5 files changed, 3300 insertions(+), 3046 deletions(-) create mode 100644 Tests/Api/WorkflowResourceApiTest.cs create mode 100644 csharp-examples/WorkFlowExamples.cs diff --git a/Conductor/Api/WorkflowResourceApi.cs b/Conductor/Api/WorkflowResourceApi.cs index f0969e27..ec58d438 100644 --- a/Conductor/Api/WorkflowResourceApi.cs +++ b/Conductor/Api/WorkflowResourceApi.cs @@ -7,2981 +7,3053 @@ namespace Conductor.Api { - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IWorkflowResourceApi : IApiAccessor - { - #region Synchronous Operations - /// - /// Starts the decision task for a workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void Decide(string workflowId); - - /// - /// Starts the decision task for a workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse DecideWithHttpInfo(string workflowId); - /// - /// Removes the workflow from the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// - void Delete(string workflowId, bool? archiveWorkflow = null); - - /// - /// Removes the workflow from the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// ApiResponse of Object(void) - ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null); - /// - /// Execute a workflow synchronously - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// WorkflowRun - WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); - - /// - /// Execute a workflow synchronously - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// ApiResponse of WorkflowRun - ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// Workflow - Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null); - - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// ApiResponse of Workflow - ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null); - /// - /// Gets the workflow tasks by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// TaskListSearchResultSummary - TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null); - - /// - /// Gets the workflow tasks by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// ApiResponse of TaskListSearchResultSummary - ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null); - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ExternalStorageLocation - ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType); - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of ExternalStorageLocation - ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType); - /// - /// Retrieve all the running workflows - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// List<string> - List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null); - - /// - /// Retrieve all the running workflows - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// ApiResponse of List<string> - ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null); - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// WorkflowStatus - WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null); - - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of WorkflowStatus - ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null); - /// - /// Lists workflows for the given correlation id list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null); - - /// - /// Lists workflows for the given correlation id list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null); - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); - - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); - /// - /// Lists workflows for the given correlation id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// List<Workflow> - List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); - - /// - /// Lists workflows for the given correlation id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of List<Workflow> - ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); - /// - /// Pauses the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void PauseWorkflow(string workflowId); - - /// - /// Pauses the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse PauseWorkflowWithHttpInfo(string workflowId); - /// - /// Jump workflow execution to given task - /// - /// - /// Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// - void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null); - - /// - /// Jump workflow execution to given task - /// - /// - /// Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// ApiResponse of Object(void) - ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null); - - /// - /// Reruns the workflow from a specific task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// string - string Rerun(RerunWorkflowRequest body, string workflowId); - - /// - /// Reruns the workflow from a specific task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// ApiResponse of string - ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId); - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void ResetWorkflow(string workflowId); - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse ResetWorkflowWithHttpInfo(string workflowId); - /// - /// Restarts a completed workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - void Restart(string workflowId, bool? useLatestDefinitions = null); - - /// - /// Restarts a completed workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null); - /// - /// Resumes the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void ResumeWorkflow(string workflowId); - - /// - /// Resumes the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse ResumeWorkflowWithHttpInfo(string workflowId); - /// - /// Retries the last failed task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - void Retry(string workflowId, bool? resumeSubworkflowTasks = null); - - /// - /// Retries the last failed task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null); - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ScrollableSearchResultWorkflowSummary - ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); - - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ApiResponse of ScrollableSearchResultWorkflowSummary - ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflowSummary - SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflowSummary - ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - /// - /// Skips a given task from a current running workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); - - /// - /// Skips a given task from a current running workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of Object(void) - ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// string - string StartWorkflow(StartWorkflowRequest body); - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of string - ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body); - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// string - string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); - - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// ApiResponse of string - ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); - /// - /// Terminate workflow execution - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// - void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); - - /// - /// Terminate workflow execution - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// ApiResponse of Object(void) - ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); - /// - /// Test workflow execution using mock data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Workflow - Workflow TestWorkflow(WorkflowTestRequest body); - - /// - /// Test workflow execution using mock data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Workflow - ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body); - /// - /// Force upload all completed workflows to document store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Object - Object UploadCompletedWorkflows(); - - /// - /// Force upload all completed workflows to document store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ApiResponse of Object - ApiResponse UploadCompletedWorkflowsWithHttpInfo(); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class WorkflowResourceApi : IWorkflowResourceApi - { - private Conductor.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public WorkflowResourceApi(String basePath) - { - this.Configuration = new Conductor.Client.Configuration { BasePath = basePath }; - - ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// - /// - public WorkflowResourceApi() - { - this.Configuration = Conductor.Client.Configuration.Default; - - ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public WorkflowResourceApi(Conductor.Client.Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Conductor.Client.Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Conductor.Client.Configuration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Conductor.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Starts the decision task for a workflow - /// - /// Thrown when fails to make API call - /// - /// - public void Decide(string workflowId) - { - DecideWithHttpInfo(workflowId); - } - - /// - /// Starts the decision task for a workflow - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse DecideWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Decide"); - - var localVarPath = "/workflow/decide/{workflowId}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("Decide", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Removes the workflow from the system - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// - public void Delete(string workflowId, bool? archiveWorkflow = null) - { - DeleteWithHttpInfo(workflowId, archiveWorkflow); - } - - /// - /// Removes the workflow from the system - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// ApiResponse of Object(void) - public ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Delete"); - - var localVarPath = "/workflow/{workflowId}/remove"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (archiveWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "archiveWorkflow", archiveWorkflow)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Delete", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Execute a workflow synchronously - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// WorkflowRun - public WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) - { - ApiResponse localVarResponse = ExecuteWorkflowWithHttpInfo(body, requestId, name, version, waitUntilTaskRef); - return localVarResponse.Data; - } - - /// - /// Execute a workflow synchronously - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// ApiResponse of WorkflowRun - public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->ExecuteWorkflow"); - // verify the required parameter 'requestId' is set - if (requestId == null) - throw new ApiException(400, "Missing required parameter 'requestId' when calling WorkflowResourceApi->ExecuteWorkflow"); - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->ExecuteWorkflow"); - // verify the required parameter 'version' is set - if (version == null) - throw new ApiException(400, "Missing required parameter 'version' when calling WorkflowResourceApi->ExecuteWorkflow"); - - var localVarPath = "/workflow/execute/{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[] { - "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 (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 - if (requestId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "requestId", requestId)); // query parameter - if (waitUntilTaskRef != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "waitUntilTaskRef", waitUntilTaskRef)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("ExecuteWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (WorkflowRun)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowRun))); - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// Workflow - public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) - { - ApiResponse localVarResponse = GetExecutionStatusWithHttpInfo(workflowId, includeTasks, summarize); - return localVarResponse.Data; - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// ApiResponse of Workflow - public ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatus"); - - var localVarPath = "/workflow/{workflowId}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter - if (summarize != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "summarize", summarize)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatus", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); - } - - /// - /// Gets the workflow tasks by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// TaskListSearchResultSummary - public TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null) - { - ApiResponse localVarResponse = GetExecutionStatusTaskListWithHttpInfo(workflowId, start, count, status); - return localVarResponse.Data; - } - - /// - /// Gets the workflow tasks by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// ApiResponse of TaskListSearchResultSummary - public ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatusTaskList"); - - var localVarPath = "/workflow/{workflowId}/tasks"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (count != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "count", count)); // query parameter - if (status != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "status", status)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatusTaskList", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (TaskListSearchResultSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(TaskListSearchResultSummary))); - } - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ExternalStorageLocation - public ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType) - { - ApiResponse localVarResponse = GetExternalStorageLocationWithHttpInfo(path, operation, payloadType); - return localVarResponse.Data; - } - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of ExternalStorageLocation - public ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType) - { - // verify the required parameter 'path' is set - if (path == null) - throw new ApiException(400, "Missing required parameter 'path' when calling WorkflowResourceApi->GetExternalStorageLocation"); - // verify the required parameter 'operation' is set - if (operation == null) - throw new ApiException(400, "Missing required parameter 'operation' when calling WorkflowResourceApi->GetExternalStorageLocation"); - // verify the required parameter 'payloadType' is set - if (payloadType == null) - throw new ApiException(400, "Missing required parameter 'payloadType' when calling WorkflowResourceApi->GetExternalStorageLocation"); - - var localVarPath = "/workflow/externalstoragelocation"; - 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 (path != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "path", path)); // query parameter - if (operation != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "operation", operation)); // query parameter - if (payloadType != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "payloadType", payloadType)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetExternalStorageLocation", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (ExternalStorageLocation)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ExternalStorageLocation))); - } - - /// - /// Retrieve all the running workflows - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// List<string> - public List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null) - { - ApiResponse> localVarResponse = GetRunningWorkflowWithHttpInfo(name, version, startTime, endTime); - return localVarResponse.Data; - } - - /// - /// Retrieve all the running workflows - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// ApiResponse of List<string> - public ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null) - { - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetRunningWorkflow"); - - var localVarPath = "/workflow/running/{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 - if (version != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter - if (startTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "startTime", startTime)); // query parameter - if (endTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "endTime", endTime)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetRunningWorkflow", 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))); - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// WorkflowStatus - public WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null) - { - ApiResponse localVarResponse = GetWorkflowStatusSummaryWithHttpInfo(workflowId, includeOutput, includeVariables); - return localVarResponse.Data; - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of WorkflowStatus - public ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetWorkflowStatusSummary"); - - var localVarPath = "/workflow/{workflowId}/status"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (includeOutput != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeOutput", includeOutput)); // query parameter - if (includeVariables != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeVariables", includeVariables)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflowStatusSummary", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (WorkflowStatus)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowStatus))); - } - - /// - /// Lists workflows for the given correlation id list - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - public Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null) - { - ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, name, includeClosed, includeTasks); - return localVarResponse.Data; - } - - /// - /// Lists workflows for the given correlation id list - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - public ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); - - var localVarPath = "/workflow/{name}/correlated"; - 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 (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter - if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); - } - - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - public Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) - { - ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, includeClosed, includeTasks); - return localVarResponse.Data; - } - - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - public ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); - - var localVarPath = "/workflow/correlated/batch"; - 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 (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); - } - - /// - /// Lists workflows for the given correlation id - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// List<Workflow> - public List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) - { - ApiResponse> localVarResponse = GetWorkflowsWithHttpInfo(name, correlationId, includeClosed, includeTasks); - return localVarResponse.Data; - } - - /// - /// Lists workflows for the given correlation id - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of List<Workflow> - public ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) - { - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); - // verify the required parameter 'correlationId' is set - if (correlationId == null) - throw new ApiException(400, "Missing required parameter 'correlationId' when calling WorkflowResourceApi->GetWorkflows"); - - var localVarPath = "/workflow/{name}/correlated/{correlationId}"; - 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 (correlationId != null) localVarPathParams.Add("correlationId", this.Configuration.ApiClient.ParameterToString(correlationId)); // path parameter - if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", 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))); - } - - /// - /// Pauses the workflow - /// - /// Thrown when fails to make API call - /// - /// - public void PauseWorkflow(string workflowId) - { - PauseWorkflowWithHttpInfo(workflowId); - } - - /// - /// Pauses the workflow - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse PauseWorkflowWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->PauseWorkflow"); - - var localVarPath = "/workflow/{workflowId}/pause"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("PauseWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - - /// - /// Jump workflow execution to given task Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// - public void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null) - { - JumpToTaskWithHttpInfo(input, workflowId, taskReferenceName); - } - - - /// - /// Jump workflow execution to given task Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// ApiResponse of Object(void) - public ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'input' when calling WorkflowResourceApi->JumpToTask"); - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->JumpToTask"); - - var localVarPath = "/workflow/{workflowId}/jump/{taskReferenceName}"; - 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) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (taskReferenceName != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "taskReferenceName", taskReferenceName)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("JumpToTask", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - - /// - /// Reruns the workflow from a specific task - /// - /// Thrown when fails to make API call - /// - /// - /// string - public string Rerun(RerunWorkflowRequest body, string workflowId) - { - ApiResponse localVarResponse = RerunWithHttpInfo(body, workflowId); - return localVarResponse.Data; - } - - /// - /// Reruns the workflow from a specific task - /// - /// Thrown when fails to make API call - /// - /// - /// ApiResponse of string - public ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Rerun"); - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Rerun"); - - var localVarPath = "/workflow/{workflowId}/rerun"; - 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[] { - "text/plain" - }; - String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("Rerun", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - } - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// Thrown when fails to make API call - /// - /// - public void ResetWorkflow(string workflowId) - { - ResetWorkflowWithHttpInfo(workflowId); - } - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse ResetWorkflowWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResetWorkflow"); - - var localVarPath = "/workflow/{workflowId}/resetcallbacks"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("ResetWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Restarts a completed workflow - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - public void Restart(string workflowId, bool? useLatestDefinitions = null) - { - RestartWithHttpInfo(workflowId, useLatestDefinitions); - } - - /// - /// Restarts a completed workflow - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - public ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Restart"); - - var localVarPath = "/workflow/{workflowId}/restart"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (useLatestDefinitions != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "useLatestDefinitions", useLatestDefinitions)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Restart", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Resumes the workflow - /// - /// Thrown when fails to make API call - /// - /// - public void ResumeWorkflow(string workflowId) - { - ResumeWorkflowWithHttpInfo(workflowId); - } - - /// - /// Resumes the workflow - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse ResumeWorkflowWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResumeWorkflow"); - - var localVarPath = "/workflow/{workflowId}/resume"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("ResumeWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Retries the last failed task - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - public void Retry(string workflowId, bool? resumeSubworkflowTasks = null) - { - RetryWithHttpInfo(workflowId, resumeSubworkflowTasks); - } - - /// - /// Retries the last failed task - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - public ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Retry"); - - var localVarPath = "/workflow/{workflowId}/retry"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (resumeSubworkflowTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "resumeSubworkflowTasks", resumeSubworkflowTasks)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Retry", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ScrollableSearchResultWorkflowSummary - public ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) - { - ApiResponse localVarResponse = SearchWithHttpInfo(queryId, start, size, sort, freeText, query, skipCache); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ApiResponse of ScrollableSearchResultWorkflowSummary - public ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) - { - - var localVarPath = "/workflow/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[] { - }; - 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 (queryId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "queryId", queryId)); // query parameter - if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - if (skipCache != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipCache", skipCache)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Search", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (ScrollableSearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ScrollableSearchResultWorkflowSummary))); - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - public SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - ApiResponse localVarResponse = SearchV2WithHttpInfo(start, size, sort, freeText, query); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - public ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - - var localVarPath = "/workflow/search-v2"; - 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("SearchV2", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflowSummary - public SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - ApiResponse localVarResponse = SearchWorkflowsByTasksWithHttpInfo(start, size, sort, freeText, query); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflowSummary - public ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - - var localVarPath = "/workflow/search-by-tasks"; - 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasks", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (SearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflowSummary))); - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - public SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - ApiResponse localVarResponse = SearchWorkflowsByTasksV2WithHttpInfo(start, size, sort, freeText, query); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - public ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - - var localVarPath = "/workflow/search-by-tasks-v2"; - 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasksV2", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); - } - - /// - /// Skips a given task from a current running workflow - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - public void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) - { - SkipTaskFromWorkflowWithHttpInfo(workflowId, taskReferenceName, skipTaskRequest); - } - - /// - /// Skips a given task from a current running workflow - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of Object(void) - public ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); - // verify the required parameter 'taskReferenceName' is set - if (taskReferenceName == null) - throw new ApiException(400, "Missing required parameter 'taskReferenceName' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); - // verify the required parameter 'skipTaskRequest' is set - if (skipTaskRequest == null) - throw new ApiException(400, "Missing required parameter 'skipTaskRequest' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); - - var localVarPath = "/workflow/{workflowId}/skiptask/{taskReferenceName}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (taskReferenceName != null) localVarPathParams.Add("taskReferenceName", this.Configuration.ApiClient.ParameterToString(taskReferenceName)); // path parameter - if (skipTaskRequest != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipTaskRequest", skipTaskRequest)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("SkipTaskFromWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// Thrown when fails to make API call - /// - /// string - public string StartWorkflow(StartWorkflowRequest body) - { - ApiResponse localVarResponse = StartWorkflowWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of string - public ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); - - var localVarPath = "/workflow"; - 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[] { - "text/plain" - }; - 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 - IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - } - - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// string - public string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) - { - ApiResponse localVarResponse = StartWorkflowWithHttpInfo(name, body, version, correlationId, priority); - return localVarResponse.Data; - } - - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// ApiResponse of string - public ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->StartWorkflow"); - - var localVarPath = "/workflow/{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[] { - "application/json" - }; - String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "text/plain" - }; - 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) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter - if (correlationId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "correlationId", correlationId)); // query parameter - if (priority != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "priority", priority)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - } - - /// - /// Terminate workflow execution - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// - public void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) - { - TerminateWithHttpInfo(workflowId, reason, triggerFailureWorkflow); - } - - /// - /// Terminate workflow execution - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// ApiResponse of Object(void) - public ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Terminate"); - - var localVarPath = "/workflow/{workflowId}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (reason != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "reason", reason)); // query parameter - if (triggerFailureWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "triggerFailureWorkflow", triggerFailureWorkflow)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Terminate", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Test workflow execution using mock data - /// - /// Thrown when fails to make API call - /// - /// Workflow - public Workflow TestWorkflow(WorkflowTestRequest body) - { - ApiResponse localVarResponse = TestWorkflowWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Test workflow execution using mock data - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Workflow - public ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->TestWorkflow"); - - var localVarPath = "/workflow/test"; - 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 - IRestResponse localVarResponse = (IRestResponse)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("TestWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); - } - - /// - /// Force upload all completed workflows to document store - /// - /// Thrown when fails to make API call - /// Object - public Object UploadCompletedWorkflows() - { - ApiResponse localVarResponse = UploadCompletedWorkflowsWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Force upload all completed workflows to document store - /// - /// Thrown when fails to make API call - /// ApiResponse of Object - public ApiResponse UploadCompletedWorkflowsWithHttpInfo() - { - - var localVarPath = "/workflow/document-store/upload"; - 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); - - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("UploadCompletedWorkflows", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); - } - } + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IWorkflowResourceApi : IApiAccessor + { + #region Synchronous Operations + /// + /// Starts the decision task for a workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void Decide(string workflowId); + + /// + /// Starts the decision task for a workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse DecideWithHttpInfo(string workflowId); + /// + /// Removes the workflow from the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// + void Delete(string workflowId, bool? archiveWorkflow = null); + + /// + /// Removes the workflow from the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// ApiResponse of Object(void) + ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null); + /// + /// Execute a workflow synchronously + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// WorkflowRun + WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); + /// + /// Update the value of the workflow variables for the given workflow id + /// + /// + /// ApiResponse of Object(void) + Object UpdateWorkflowVariables(Workflow workflow); + /// + /// Execute a workflow synchronously + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// ApiResponse of WorkflowRun + ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// Workflow + Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null); + + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// ApiResponse of Workflow + ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null); + /// + /// Gets the workflow tasks by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// TaskListSearchResultSummary + TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null); + + /// + /// Gets the workflow tasks by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// ApiResponse of TaskListSearchResultSummary + ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null); + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ExternalStorageLocation + ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType); + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of ExternalStorageLocation + ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType); + /// + /// Retrieve all the running workflows + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// List<string> + List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null); + + /// + /// Retrieve all the running workflows + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// ApiResponse of List<string> + ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null); + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// WorkflowStatus + WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null); + + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of WorkflowStatus + ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null); + /// + /// Lists workflows for the given correlation id list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null); + + /// + /// Lists workflows for the given correlation id list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null); + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); + + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); + /// + /// Lists workflows for the given correlation id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// List<Workflow> + List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); + + /// + /// Lists workflows for the given correlation id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of List<Workflow> + ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); + /// + /// Pauses the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void PauseWorkflow(string workflowId); + + /// + /// Pauses the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse PauseWorkflowWithHttpInfo(string workflowId); + /// + /// Jump workflow execution to given task + /// + /// + /// Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// + void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null); + + /// + /// Jump workflow execution to given task + /// + /// + /// Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// ApiResponse of Object(void) + ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null); + + /// + /// Reruns the workflow from a specific task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// string + string Rerun(RerunWorkflowRequest body, string workflowId); + + /// + /// Reruns the workflow from a specific task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of string + ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId); + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void ResetWorkflow(string workflowId); + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse ResetWorkflowWithHttpInfo(string workflowId); + /// + /// Restarts a completed workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + void Restart(string workflowId, bool? useLatestDefinitions = null); + + /// + /// Restarts a completed workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null); + /// + /// Resumes the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void ResumeWorkflow(string workflowId); + + /// + /// Resumes the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse ResumeWorkflowWithHttpInfo(string workflowId); + /// + /// Retries the last failed task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + void Retry(string workflowId, bool? resumeSubworkflowTasks = null); + + /// + /// Retries the last failed task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null); + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ScrollableSearchResultWorkflowSummary + ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); + + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ApiResponse of ScrollableSearchResultWorkflowSummary + ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflowSummary + SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflowSummary + ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + /// + /// Skips a given task from a current running workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); + + /// + /// Skips a given task from a current running workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of Object(void) + ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// string + string StartWorkflow(StartWorkflowRequest body); + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of string + ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body); + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// string + string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); + + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// ApiResponse of string + ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); + /// + /// Terminate workflow execution + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// + void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); + + /// + /// Terminate workflow execution + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// ApiResponse of Object(void) + ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); + /// + /// Test workflow execution using mock data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Workflow + Workflow TestWorkflow(WorkflowTestRequest body); + + /// + /// Test workflow execution using mock data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Workflow + ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body); + /// + /// Force upload all completed workflows to document store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Object + Object UploadCompletedWorkflows(); + + /// + /// Force upload all completed workflows to document store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of Object + ApiResponse UploadCompletedWorkflowsWithHttpInfo(); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class WorkflowResourceApi : IWorkflowResourceApi + { + private Conductor.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public WorkflowResourceApi(String basePath) + { + this.Configuration = new Conductor.Client.Configuration { BasePath = basePath }; + + ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// + /// + public WorkflowResourceApi() + { + this.Configuration = Conductor.Client.Configuration.Default; + + ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public WorkflowResourceApi(Conductor.Client.Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Conductor.Client.Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Conductor.Client.Configuration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Conductor.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Starts the decision task for a workflow + /// + /// Thrown when fails to make API call + /// + /// + public void Decide(string workflowId) + { + DecideWithHttpInfo(workflowId); + } + + /// + /// Starts the decision task for a workflow + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse DecideWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Decide"); + + var localVarPath = "/workflow/decide/{workflowId}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Decide", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Removes the workflow from the system + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// + public void Delete(string workflowId, bool? archiveWorkflow = null) + { + DeleteWithHttpInfo(workflowId, archiveWorkflow); + } + + /// + /// Removes the workflow from the system + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// ApiResponse of Object(void) + public ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Delete"); + + var localVarPath = "/workflow/{workflowId}/remove"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (archiveWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "archiveWorkflow", archiveWorkflow)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Delete", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Execute a workflow synchronously + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// WorkflowRun + public WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) + { + ApiResponse localVarResponse = ExecuteWorkflowWithHttpInfo(body, requestId, name, version, waitUntilTaskRef); + return localVarResponse.Data; + } + + /// + /// Execute a workflow synchronously + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// ApiResponse of WorkflowRun + public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->ExecuteWorkflow"); + // verify the required parameter 'requestId' is set + if (requestId == null) + throw new ApiException(400, "Missing required parameter 'requestId' when calling WorkflowResourceApi->ExecuteWorkflow"); + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->ExecuteWorkflow"); + // verify the required parameter 'version' is set + if (version == null) + throw new ApiException(400, "Missing required parameter 'version' when calling WorkflowResourceApi->ExecuteWorkflow"); + + var localVarPath = "/workflow/execute/{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[] { + "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 (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 + if (requestId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "requestId", requestId)); // query parameter + if (waitUntilTaskRef != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "waitUntilTaskRef", waitUntilTaskRef)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("ExecuteWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (WorkflowRun)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowRun))); + } + + public Object UpdateWorkflowVariables(Workflow workflow) + { + ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); + return localVarResponse.Data; + } + + public ApiResponse UpdateWorkflowVariablesWithHttpInfo(Workflow workflow) + { + // verify the required parameter 'body' is set + if (workflow == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Update"); + + if (string.IsNullOrEmpty(workflow.WorkflowId)) + throw new ApiException(400, "Missing required parameter 'WorkflowId' when calling WorkflowResourceApi->Update"); + + if (workflow.Variables == null) + throw new ApiException(400, "Missing required parameter 'Variables' when calling WorkflowResourceApi->Update"); + + var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; + 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 (workflow != null && workflow.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(workflow.Variables); + } + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + IRestResponse localVarResponse = (IRestResponse)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("Update", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// Workflow + public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) + { + ApiResponse localVarResponse = GetExecutionStatusWithHttpInfo(workflowId, includeTasks, summarize); + return localVarResponse.Data; + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// ApiResponse of Workflow + public ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatus"); + + var localVarPath = "/workflow/{workflowId}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter + if (summarize != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "summarize", summarize)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatus", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); + } + + /// + /// Gets the workflow tasks by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// TaskListSearchResultSummary + public TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null) + { + ApiResponse localVarResponse = GetExecutionStatusTaskListWithHttpInfo(workflowId, start, count, status); + return localVarResponse.Data; + } + + /// + /// Gets the workflow tasks by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// ApiResponse of TaskListSearchResultSummary + public ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatusTaskList"); + + var localVarPath = "/workflow/{workflowId}/tasks"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (count != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "count", count)); // query parameter + if (status != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "status", status)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatusTaskList", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (TaskListSearchResultSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(TaskListSearchResultSummary))); + } + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ExternalStorageLocation + public ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType) + { + ApiResponse localVarResponse = GetExternalStorageLocationWithHttpInfo(path, operation, payloadType); + return localVarResponse.Data; + } + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of ExternalStorageLocation + public ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType) + { + // verify the required parameter 'path' is set + if (path == null) + throw new ApiException(400, "Missing required parameter 'path' when calling WorkflowResourceApi->GetExternalStorageLocation"); + // verify the required parameter 'operation' is set + if (operation == null) + throw new ApiException(400, "Missing required parameter 'operation' when calling WorkflowResourceApi->GetExternalStorageLocation"); + // verify the required parameter 'payloadType' is set + if (payloadType == null) + throw new ApiException(400, "Missing required parameter 'payloadType' when calling WorkflowResourceApi->GetExternalStorageLocation"); + + var localVarPath = "/workflow/externalstoragelocation"; + 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 (path != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "path", path)); // query parameter + if (operation != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "operation", operation)); // query parameter + if (payloadType != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "payloadType", payloadType)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetExternalStorageLocation", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (ExternalStorageLocation)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ExternalStorageLocation))); + } + + /// + /// Retrieve all the running workflows + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// List<string> + public List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null) + { + ApiResponse> localVarResponse = GetRunningWorkflowWithHttpInfo(name, version, startTime, endTime); + return localVarResponse.Data; + } + + /// + /// Retrieve all the running workflows + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// ApiResponse of List<string> + public ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetRunningWorkflow"); + + var localVarPath = "/workflow/running/{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 + if (version != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter + if (startTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "startTime", startTime)); // query parameter + if (endTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "endTime", endTime)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetRunningWorkflow", 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))); + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// WorkflowStatus + public WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null) + { + ApiResponse localVarResponse = GetWorkflowStatusSummaryWithHttpInfo(workflowId, includeOutput, includeVariables); + return localVarResponse.Data; + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of WorkflowStatus + public ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetWorkflowStatusSummary"); + + var localVarPath = "/workflow/{workflowId}/status"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (includeOutput != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeOutput", includeOutput)); // query parameter + if (includeVariables != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeVariables", includeVariables)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflowStatusSummary", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (WorkflowStatus)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowStatus))); + } + + /// + /// Lists workflows for the given correlation id list + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + public Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null) + { + ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, name, includeClosed, includeTasks); + return localVarResponse.Data; + } + + /// + /// Lists workflows for the given correlation id list + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + public ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); + + var localVarPath = "/workflow/{name}/correlated"; + 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 (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); + } + + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + public Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) + { + ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, includeClosed, includeTasks); + return localVarResponse.Data; + } + + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + public ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); + + var localVarPath = "/workflow/correlated/batch"; + 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 (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); + } + + /// + /// Lists workflows for the given correlation id + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// List<Workflow> + public List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) + { + ApiResponse> localVarResponse = GetWorkflowsWithHttpInfo(name, correlationId, includeClosed, includeTasks); + return localVarResponse.Data; + } + + /// + /// Lists workflows for the given correlation id + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of List<Workflow> + public ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); + // verify the required parameter 'correlationId' is set + if (correlationId == null) + throw new ApiException(400, "Missing required parameter 'correlationId' when calling WorkflowResourceApi->GetWorkflows"); + + var localVarPath = "/workflow/{name}/correlated/{correlationId}"; + 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 (correlationId != null) localVarPathParams.Add("correlationId", this.Configuration.ApiClient.ParameterToString(correlationId)); // path parameter + if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", 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))); + } + + /// + /// Pauses the workflow + /// + /// Thrown when fails to make API call + /// + /// + public void PauseWorkflow(string workflowId) + { + PauseWorkflowWithHttpInfo(workflowId); + } + + /// + /// Pauses the workflow + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse PauseWorkflowWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->PauseWorkflow"); + + var localVarPath = "/workflow/{workflowId}/pause"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("PauseWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + + /// + /// Jump workflow execution to given task Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// + public void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null) + { + JumpToTaskWithHttpInfo(input, workflowId, taskReferenceName); + } + + + /// + /// Jump workflow execution to given task Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// ApiResponse of Object(void) + public ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'input' when calling WorkflowResourceApi->JumpToTask"); + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->JumpToTask"); + + var localVarPath = "/workflow/{workflowId}/jump/{taskReferenceName}"; + 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) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (taskReferenceName != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "taskReferenceName", taskReferenceName)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("JumpToTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + + /// + /// Reruns the workflow from a specific task + /// + /// Thrown when fails to make API call + /// + /// + /// string + public string Rerun(RerunWorkflowRequest body, string workflowId) + { + ApiResponse localVarResponse = RerunWithHttpInfo(body, workflowId); + return localVarResponse.Data; + } + + /// + /// Reruns the workflow from a specific task + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of string + public ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Rerun"); + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Rerun"); + + var localVarPath = "/workflow/{workflowId}/rerun"; + 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[] { + "text/plain" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("Rerun", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); + } + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// Thrown when fails to make API call + /// + /// + public void ResetWorkflow(string workflowId) + { + ResetWorkflowWithHttpInfo(workflowId); + } + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse ResetWorkflowWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResetWorkflow"); + + var localVarPath = "/workflow/{workflowId}/resetcallbacks"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("ResetWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Restarts a completed workflow + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + public void Restart(string workflowId, bool? useLatestDefinitions = null) + { + RestartWithHttpInfo(workflowId, useLatestDefinitions); + } + + /// + /// Restarts a completed workflow + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Restart"); + + var localVarPath = "/workflow/{workflowId}/restart"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (useLatestDefinitions != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "useLatestDefinitions", useLatestDefinitions)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Restart", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Resumes the workflow + /// + /// Thrown when fails to make API call + /// + /// + public void ResumeWorkflow(string workflowId) + { + ResumeWorkflowWithHttpInfo(workflowId); + } + + /// + /// Resumes the workflow + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse ResumeWorkflowWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResumeWorkflow"); + + var localVarPath = "/workflow/{workflowId}/resume"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ResumeWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Retries the last failed task + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + public void Retry(string workflowId, bool? resumeSubworkflowTasks = null) + { + RetryWithHttpInfo(workflowId, resumeSubworkflowTasks); + } + + /// + /// Retries the last failed task + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Retry"); + + var localVarPath = "/workflow/{workflowId}/retry"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (resumeSubworkflowTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "resumeSubworkflowTasks", resumeSubworkflowTasks)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Retry", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ScrollableSearchResultWorkflowSummary + public ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) + { + ApiResponse localVarResponse = SearchWithHttpInfo(queryId, start, size, sort, freeText, query, skipCache); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ApiResponse of ScrollableSearchResultWorkflowSummary + public ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) + { + + var localVarPath = "/workflow/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[] { + }; + 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 (queryId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "queryId", queryId)); // query parameter + if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + if (skipCache != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipCache", skipCache)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Search", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (ScrollableSearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ScrollableSearchResultWorkflowSummary))); + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + public SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + ApiResponse localVarResponse = SearchV2WithHttpInfo(start, size, sort, freeText, query); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + public ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + + var localVarPath = "/workflow/search-v2"; + 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("SearchV2", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflowSummary + public SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + ApiResponse localVarResponse = SearchWorkflowsByTasksWithHttpInfo(start, size, sort, freeText, query); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflowSummary + public ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + + var localVarPath = "/workflow/search-by-tasks"; + 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasks", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (SearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflowSummary))); + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + public SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + ApiResponse localVarResponse = SearchWorkflowsByTasksV2WithHttpInfo(start, size, sort, freeText, query); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + public ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + + var localVarPath = "/workflow/search-by-tasks-v2"; + 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasksV2", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); + } + + /// + /// Skips a given task from a current running workflow + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + public void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) + { + SkipTaskFromWorkflowWithHttpInfo(workflowId, taskReferenceName, skipTaskRequest); + } + + /// + /// Skips a given task from a current running workflow + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of Object(void) + public ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); + // verify the required parameter 'taskReferenceName' is set + if (taskReferenceName == null) + throw new ApiException(400, "Missing required parameter 'taskReferenceName' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); + // verify the required parameter 'skipTaskRequest' is set + if (skipTaskRequest == null) + throw new ApiException(400, "Missing required parameter 'skipTaskRequest' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); + + var localVarPath = "/workflow/{workflowId}/skiptask/{taskReferenceName}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (taskReferenceName != null) localVarPathParams.Add("taskReferenceName", this.Configuration.ApiClient.ParameterToString(taskReferenceName)); // path parameter + if (skipTaskRequest != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipTaskRequest", skipTaskRequest)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SkipTaskFromWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// Thrown when fails to make API call + /// + /// string + public string StartWorkflow(StartWorkflowRequest body) + { + ApiResponse localVarResponse = StartWorkflowWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of string + public ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); + + var localVarPath = "/workflow"; + 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[] { + "text/plain" + }; + 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 + IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); + } + + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// string + public string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) + { + ApiResponse localVarResponse = StartWorkflowWithHttpInfo(name, body, version, correlationId, priority); + return localVarResponse.Data; + } + + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// ApiResponse of string + public ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->StartWorkflow"); + + var localVarPath = "/workflow/{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[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "text/plain" + }; + 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) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter + if (correlationId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "correlationId", correlationId)); // query parameter + if (priority != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "priority", priority)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); + } + + /// + /// Terminate workflow execution + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// + public void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) + { + TerminateWithHttpInfo(workflowId, reason, triggerFailureWorkflow); + } + + /// + /// Terminate workflow execution + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Terminate"); + + var localVarPath = "/workflow/{workflowId}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (reason != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "reason", reason)); // query parameter + if (triggerFailureWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "triggerFailureWorkflow", triggerFailureWorkflow)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Terminate", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Test workflow execution using mock data + /// + /// Thrown when fails to make API call + /// + /// Workflow + public Workflow TestWorkflow(WorkflowTestRequest body) + { + ApiResponse localVarResponse = TestWorkflowWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test workflow execution using mock data + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Workflow + public ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->TestWorkflow"); + + var localVarPath = "/workflow/test"; + 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 + IRestResponse localVarResponse = (IRestResponse)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("TestWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); + } + + /// + /// Force upload all completed workflows to document store + /// + /// Thrown when fails to make API call + /// Object + public Object UploadCompletedWorkflows() + { + ApiResponse localVarResponse = UploadCompletedWorkflowsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Force upload all completed workflows to document store + /// + /// Thrown when fails to make API call + /// ApiResponse of Object + public ApiResponse UploadCompletedWorkflowsWithHttpInfo() + { + + var localVarPath = "/workflow/document-store/upload"; + 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); + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("UploadCompletedWorkflows", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + } + } } diff --git a/Conductor/Client/Extensions/ConductorTaskExtensions.cs b/Conductor/Client/Extensions/ConductorTaskExtensions.cs index b56968e9..b7303ec6 100644 --- a/Conductor/Client/Extensions/ConductorTaskExtensions.cs +++ b/Conductor/Client/Extensions/ConductorTaskExtensions.cs @@ -18,7 +18,7 @@ public static TaskResult InProgress(this Task task, string log = null, long? cal { new TaskExecLog { TaskId = task.TaskId, Log = log, CreatedTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() } }, - callbackAfterSeconds: callbackAfterSeconds.Value + callbackAfterSeconds: callbackAfterSeconds ); } diff --git a/Conductor/Definition/ConductorWorkflow.cs b/Conductor/Definition/ConductorWorkflow.cs index f7d44657..0a6d5948 100644 --- a/Conductor/Definition/ConductorWorkflow.cs +++ b/Conductor/Definition/ConductorWorkflow.cs @@ -3,83 +3,91 @@ namespace Conductor.Definition { - public class ConductorWorkflow : WorkflowDef - { - public ConductorWorkflow() : base(name: "", tasks: new List(), timeoutSeconds: 0) - { - InputParameters = new List(); - } + public class ConductorWorkflow : WorkflowDef + { + public ConductorWorkflow() : base(name: "", tasks: new List(), timeoutSeconds: 0) + { + InputParameters = new List(); + } - public ConductorWorkflow WithName(string name) - { - Name = name; - return this; - } + public ConductorWorkflow WithName(string name) + { + Name = name; + return this; + } - public ConductorWorkflow WithVersion(int version) - { - Version = version; - return this; - } + public ConductorWorkflow WithVersion(int version) + { + Version = version; + return this; + } - public ConductorWorkflow WithDescription(string description) - { - Description = description; - return this; - } + public ConductorWorkflow WithDescription(string description) + { + Description = description; + return this; + } - public ConductorWorkflow WithTimeoutPolicy(WorkflowDef.TimeoutPolicyEnum timeoutPolicy, int timeoutSeconds) - { - TimeoutPolicy = timeoutPolicy; - TimeoutSeconds = timeoutSeconds; - return this; - } + public ConductorWorkflow WithTimeoutPolicy(WorkflowDef.TimeoutPolicyEnum timeoutPolicy, int timeoutSeconds) + { + TimeoutPolicy = timeoutPolicy; + TimeoutSeconds = timeoutSeconds; + return this; + } - public ConductorWorkflow WithTask(params WorkflowTask[] tasks) - { - foreach (WorkflowTask task in tasks) - { - Tasks.Add(task); - } - return this; - } + public ConductorWorkflow WithTask(params WorkflowTask[] tasks) + { + foreach (WorkflowTask task in tasks) + { + Tasks.Add(task); + } + return this; + } - public ConductorWorkflow WithFailureWorkflow(string failureWorkflow) - { - FailureWorkflow = failureWorkflow; - return this; - } + public ConductorWorkflow WithFailureWorkflow(string failureWorkflow) + { + FailureWorkflow = failureWorkflow; + return this; + } - public ConductorWorkflow WithRestartable(bool restartable) - { - Restartable = restartable; - return this; - } + public ConductorWorkflow WithRestartable(bool restartable) + { + Restartable = restartable; + return this; + } - public ConductorWorkflow WithOutputParameter(string key, object value) - { - OutputParameters.Add(key, value); - return this; - } + public ConductorWorkflow WithOutputParameter(string key, object value) + { + OutputParameters.Add(key, value); + return this; + } - public ConductorWorkflow WithOwner(string ownerEmail) - { - OwnerEmail = ownerEmail; - return this; - } + public ConductorWorkflow WithVariable(string key, object value) + { + if (Variables == null) // if workflow does not have any variables, initialize with empty collection + Variables = new Dictionary(); + Variables.Add(key, value); + return this; + } - public ConductorWorkflow WithInputParameter(string key) - { - InputParameters.Add(key); - return this; - } + public ConductorWorkflow WithOwner(string ownerEmail) + { + OwnerEmail = ownerEmail; + return this; + } - public StartWorkflowRequest GetStartWorkflowRequest() - { - return new StartWorkflowRequest( - name: Name, - version: Version - ); - } - } + public ConductorWorkflow WithInputParameter(string key) + { + InputParameters.Add(key); + return this; + } + + public StartWorkflowRequest GetStartWorkflowRequest() + { + return new StartWorkflowRequest( + name: Name, + version: Version + ); + } + } } diff --git a/Tests/Api/WorkflowResourceApiTest.cs b/Tests/Api/WorkflowResourceApiTest.cs new file mode 100644 index 00000000..527ea411 --- /dev/null +++ b/Tests/Api/WorkflowResourceApiTest.cs @@ -0,0 +1,97 @@ +using conductor.csharp.Client.Extensions; +using Conductor.Api; +using Conductor.Client.Extensions; +using Conductor.Client.Models; +using Conductor.Definition; +using Conductor.Definition.TaskType; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using Tests.Worker; +using Xunit; + +namespace conductor_csharp.test.Api +{ + public class WorkflowResourceApiTest + { + private const string WORKFLOW_NAME = "TestToCreateVariables"; + private const string TASK_NAME = "TestToCreateVariables_Task"; + private const string WORKFLOW_VARIABLE_1 = "TestVariable1"; + private const string WORKFLOW_VARIABLE_2 = "TestVariable2"; + private const string WORKFLOW_DESC = "Test Workflow With Variables"; + private const int WORKFLOW_VERSION = 1; + + private readonly WorkflowResourceApi _workflowClient; + private readonly ILogger _logger; + + public WorkflowResourceApiTest() + { + _workflowClient = ApiExtensions.GetClient(); + _logger = ApplicationLogging.CreateLogger(); + } + + [Fact] + public async void UpdateWorkflowVariables() + { + // Prepare workflow + var _workflow = GetConductorWorkflow(); + ApiExtensions.GetWorkflowExecutor().RegisterWorkflow(_workflow, true); + var workflowId = ApiExtensions.GetWorkflowExecutor().StartWorkflow(_workflow); + await ExecuteWorkflowTasks(workflowCompletionTimeout: TimeSpan.FromSeconds(20)); + await ValidateWorkflowCompletion(workflowId); + + // Create variables collection with values to be updated + var updateDict = new Dictionary { + {WORKFLOW_VARIABLE_1,"Value1" }, + {WORKFLOW_VARIABLE_2,"Value2" }, + }; + var updateVariableData = new Workflow() { WorkflowId = workflowId, Variables = updateDict }; + // Update the work flow variables + _workflowClient.UpdateWorkflowVariables(updateVariableData); + // Fetch latest workflow data to validate the change in variables + var _updatedWorkFlow = _workflowClient.GetWorkflowStatusSummary(workflowId, includeVariables: true); + // Verify workflow variables data is equal with input passed + Assert.Equal(_updatedWorkFlow.Variables, updateDict); + } + + private async System.Threading.Tasks.Task ExecuteWorkflowTasks(TimeSpan workflowCompletionTimeout) + { + var host = WorkflowTaskHost.CreateWorkerHost(LogLevel.Information, new ClassWorker()); + await host.StartAsync(); + Thread.Sleep(workflowCompletionTimeout); + await host.StopAsync(); + } + + private ConductorWorkflow GetConductorWorkflow() + { + return new ConductorWorkflow() + .WithName(WORKFLOW_NAME) + .WithVersion(WORKFLOW_VERSION) + .WithDescription(WORKFLOW_DESC) + .WithTask(new SimpleTask(TASK_NAME, TASK_NAME)) + .WithVariable(WORKFLOW_VARIABLE_1, $"{WORKFLOW_VARIABLE_1}_Value") + .WithVariable(WORKFLOW_VARIABLE_2, $"{WORKFLOW_VARIABLE_2}_Value"); + } + + private async System.Threading.Tasks.Task ValidateWorkflowCompletion(params string[] workflowIdList) + { + var workflowStatusList = await WorkflowExtensions.GetWorkflowStatusList( + _workflowClient, + maxAllowedInParallel: 10, + workflowIdList + ); + var incompleteWorkflowCounter = 0; + workflowStatusList.ToList().ForEach(wf => + { + if (wf.Status.Value != WorkflowStatus.StatusEnum.COMPLETED) + { + incompleteWorkflowCounter += 1; + _logger.LogInformation($"Workflow not completed, workflowId: {wf.WorkflowId}"); + } + }); + Assert.Equal(0, incompleteWorkflowCounter); + } + } +} diff --git a/csharp-examples/WorkFlowExamples.cs b/csharp-examples/WorkFlowExamples.cs new file mode 100644 index 00000000..41c952f7 --- /dev/null +++ b/csharp-examples/WorkFlowExamples.cs @@ -0,0 +1,77 @@ +using Conductor.Client; +using Conductor.Definition.TaskType; +using Conductor.Definition; +using Conductor.Executor; +using Conductor.Api; +using Conductor.Client.Authentication; + +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 = ""; + private const string TASK_NAME = ""; + private const string TASK_REFERENCE = ""; + + private const string VARIABLE_OLD_VALUE = "SOME_OLD_VALUE"; + private const string VARIABLE_NAME_1 = ""; + private const string VARIABLE_VALUE_1 = ""; + private const string VARIABLE_NAME_2 = ""; + private const string VARIABLE_VALUE_2 = ""; + + + public void RegisterWorkFlow() + { + Configuration configuration = new Configuration() + { + AuthenticationSettings = new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET) + }; + + WorkflowExecutor executor = new WorkflowExecutor(configuration); + executor.RegisterWorkflow(GetConductorWorkflow(), true); + } + + private ConductorWorkflow GetConductorWorkflow() + { + var conductorWorkFlow = new ConductorWorkflow() + .WithName(WORKFLOW_NAME).WithDescription(WORKFLOW_DESCRIPTION) + .WithTask(new SimpleTask(TASK_NAME, TASK_REFERENCE)) + .WithOwner(OWNER_EMAIL); + + var workflowVariableTobeAdded = new Dictionary + { + { VARIABLE_NAME_1, VARIABLE_VALUE_1 }, + { VARIABLE_NAME_2, VARIABLE_VALUE_2 } + }; + + conductorWorkFlow.Variables = workflowVariableTobeAdded; + return conductorWorkFlow; + } + + public void UpdateWorkflowVariablesWithWorkFlowId() + { + var orkesApiClient = new OrkesApiClient(new Configuration(), + new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + var workflowClient = orkesApiClient.GetClient(); + var workFlowVariables = new Dictionary + { + { VARIABLE_NAME_1, VARIABLE_OLD_VALUE }, + { VARIABLE_NAME_2, VARIABLE_OLD_VALUE } + }; + + workflowClient.UpdateWorkflowVariables(new Conductor.Client.Models.Workflow() + { + WorkflowId = WORKFLOW_ID, + Variables = workFlowVariables + }); + } + + } +} From a09fdb2f538a186c441d1037e882f098dbc77c10 Mon Sep 17 00:00:00 2001 From: "Jithesh.Poojary" Date: Wed, 10 Jan 2024 13:18:05 +0530 Subject: [PATCH 2/5] Revert "Changes to address the below" This reverts commit 67d56b41ecbd4e55722f04b7af70c7e367a99e86. --- Conductor/Api/WorkflowResourceApi.cs | 6026 ++++++++--------- .../Extensions/ConductorTaskExtensions.cs | 2 +- Conductor/Definition/ConductorWorkflow.cs | 144 +- Tests/Api/WorkflowResourceApiTest.cs | 97 - csharp-examples/WorkFlowExamples.cs | 77 - 5 files changed, 3046 insertions(+), 3300 deletions(-) delete mode 100644 Tests/Api/WorkflowResourceApiTest.cs delete mode 100644 csharp-examples/WorkFlowExamples.cs diff --git a/Conductor/Api/WorkflowResourceApi.cs b/Conductor/Api/WorkflowResourceApi.cs index ec58d438..f0969e27 100644 --- a/Conductor/Api/WorkflowResourceApi.cs +++ b/Conductor/Api/WorkflowResourceApi.cs @@ -7,3053 +7,2981 @@ namespace Conductor.Api { - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IWorkflowResourceApi : IApiAccessor - { - #region Synchronous Operations - /// - /// Starts the decision task for a workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void Decide(string workflowId); - - /// - /// Starts the decision task for a workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse DecideWithHttpInfo(string workflowId); - /// - /// Removes the workflow from the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// - void Delete(string workflowId, bool? archiveWorkflow = null); - - /// - /// Removes the workflow from the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// ApiResponse of Object(void) - ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null); - /// - /// Execute a workflow synchronously - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// WorkflowRun - WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); - /// - /// Update the value of the workflow variables for the given workflow id - /// - /// - /// ApiResponse of Object(void) - Object UpdateWorkflowVariables(Workflow workflow); - /// - /// Execute a workflow synchronously - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// ApiResponse of WorkflowRun - ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// Workflow - Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null); - - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// ApiResponse of Workflow - ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null); - /// - /// Gets the workflow tasks by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// TaskListSearchResultSummary - TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null); - - /// - /// Gets the workflow tasks by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// ApiResponse of TaskListSearchResultSummary - ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null); - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ExternalStorageLocation - ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType); - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of ExternalStorageLocation - ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType); - /// - /// Retrieve all the running workflows - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// List<string> - List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null); - - /// - /// Retrieve all the running workflows - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// ApiResponse of List<string> - ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null); - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// WorkflowStatus - WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null); - - /// - /// Gets the workflow by workflow id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of WorkflowStatus - ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null); - /// - /// Lists workflows for the given correlation id list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null); - - /// - /// Lists workflows for the given correlation id list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null); - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); - - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); - /// - /// Lists workflows for the given correlation id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// List<Workflow> - List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); - - /// - /// Lists workflows for the given correlation id - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of List<Workflow> - ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); - /// - /// Pauses the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void PauseWorkflow(string workflowId); - - /// - /// Pauses the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse PauseWorkflowWithHttpInfo(string workflowId); - /// - /// Jump workflow execution to given task - /// - /// - /// Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// - void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null); - - /// - /// Jump workflow execution to given task - /// - /// - /// Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// ApiResponse of Object(void) - ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null); - - /// - /// Reruns the workflow from a specific task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// string - string Rerun(RerunWorkflowRequest body, string workflowId); - - /// - /// Reruns the workflow from a specific task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// ApiResponse of string - ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId); - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void ResetWorkflow(string workflowId); - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse ResetWorkflowWithHttpInfo(string workflowId); - /// - /// Restarts a completed workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - void Restart(string workflowId, bool? useLatestDefinitions = null); - - /// - /// Restarts a completed workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null); - /// - /// Resumes the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void ResumeWorkflow(string workflowId); - - /// - /// Resumes the workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse ResumeWorkflowWithHttpInfo(string workflowId); - /// - /// Retries the last failed task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - void Retry(string workflowId, bool? resumeSubworkflowTasks = null); - - /// - /// Retries the last failed task - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null); - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ScrollableSearchResultWorkflowSummary - ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); - - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ApiResponse of ScrollableSearchResultWorkflowSummary - ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - - /// - /// Search for workflows based on payload and other parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflowSummary - SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflowSummary - ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - - /// - /// Search for workflows based on task parameters - /// - /// - /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); - /// - /// Skips a given task from a current running workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); - - /// - /// Skips a given task from a current running workflow - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of Object(void) - ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// string - string StartWorkflow(StartWorkflowRequest body); - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of string - ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body); - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// string - string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); - - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// ApiResponse of string - ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); - /// - /// Terminate workflow execution - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// - void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); - - /// - /// Terminate workflow execution - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// ApiResponse of Object(void) - ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); - /// - /// Test workflow execution using mock data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Workflow - Workflow TestWorkflow(WorkflowTestRequest body); - - /// - /// Test workflow execution using mock data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Workflow - ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body); - /// - /// Force upload all completed workflows to document store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Object - Object UploadCompletedWorkflows(); - - /// - /// Force upload all completed workflows to document store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ApiResponse of Object - ApiResponse UploadCompletedWorkflowsWithHttpInfo(); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class WorkflowResourceApi : IWorkflowResourceApi - { - private Conductor.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public WorkflowResourceApi(String basePath) - { - this.Configuration = new Conductor.Client.Configuration { BasePath = basePath }; - - ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// - /// - public WorkflowResourceApi() - { - this.Configuration = Conductor.Client.Configuration.Default; - - ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public WorkflowResourceApi(Conductor.Client.Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Conductor.Client.Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Conductor.Client.Configuration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Conductor.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Starts the decision task for a workflow - /// - /// Thrown when fails to make API call - /// - /// - public void Decide(string workflowId) - { - DecideWithHttpInfo(workflowId); - } - - /// - /// Starts the decision task for a workflow - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse DecideWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Decide"); - - var localVarPath = "/workflow/decide/{workflowId}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("Decide", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Removes the workflow from the system - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// - public void Delete(string workflowId, bool? archiveWorkflow = null) - { - DeleteWithHttpInfo(workflowId, archiveWorkflow); - } - - /// - /// Removes the workflow from the system - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// ApiResponse of Object(void) - public ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Delete"); - - var localVarPath = "/workflow/{workflowId}/remove"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (archiveWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "archiveWorkflow", archiveWorkflow)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Delete", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Execute a workflow synchronously - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// WorkflowRun - public WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) - { - ApiResponse localVarResponse = ExecuteWorkflowWithHttpInfo(body, requestId, name, version, waitUntilTaskRef); - return localVarResponse.Data; - } - - /// - /// Execute a workflow synchronously - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// ApiResponse of WorkflowRun - public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->ExecuteWorkflow"); - // verify the required parameter 'requestId' is set - if (requestId == null) - throw new ApiException(400, "Missing required parameter 'requestId' when calling WorkflowResourceApi->ExecuteWorkflow"); - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->ExecuteWorkflow"); - // verify the required parameter 'version' is set - if (version == null) - throw new ApiException(400, "Missing required parameter 'version' when calling WorkflowResourceApi->ExecuteWorkflow"); - - var localVarPath = "/workflow/execute/{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[] { - "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 (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 - if (requestId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "requestId", requestId)); // query parameter - if (waitUntilTaskRef != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "waitUntilTaskRef", waitUntilTaskRef)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("ExecuteWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (WorkflowRun)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowRun))); - } - - public Object UpdateWorkflowVariables(Workflow workflow) - { - ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); - return localVarResponse.Data; - } - - public ApiResponse UpdateWorkflowVariablesWithHttpInfo(Workflow workflow) - { - // verify the required parameter 'body' is set - if (workflow == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Update"); - - if (string.IsNullOrEmpty(workflow.WorkflowId)) - throw new ApiException(400, "Missing required parameter 'WorkflowId' when calling WorkflowResourceApi->Update"); - - if (workflow.Variables == null) - throw new ApiException(400, "Missing required parameter 'Variables' when calling WorkflowResourceApi->Update"); - - var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; - 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 (workflow != null && workflow.GetType() != typeof(byte[])) - { - localVarPostBody = this.Configuration.ApiClient.Serialize(workflow.Variables); - } - - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - IRestResponse localVarResponse = (IRestResponse)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("Update", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// Workflow - public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) - { - ApiResponse localVarResponse = GetExecutionStatusWithHttpInfo(workflowId, includeTasks, summarize); - return localVarResponse.Data; - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// ApiResponse of Workflow - public ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatus"); - - var localVarPath = "/workflow/{workflowId}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter - if (summarize != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "summarize", summarize)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatus", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); - } - - /// - /// Gets the workflow tasks by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// TaskListSearchResultSummary - public TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null) - { - ApiResponse localVarResponse = GetExecutionStatusTaskListWithHttpInfo(workflowId, start, count, status); - return localVarResponse.Data; - } - - /// - /// Gets the workflow tasks by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 0) - /// (optional, default to 15) - /// (optional) - /// ApiResponse of TaskListSearchResultSummary - public ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatusTaskList"); - - var localVarPath = "/workflow/{workflowId}/tasks"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (count != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "count", count)); // query parameter - if (status != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "status", status)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatusTaskList", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (TaskListSearchResultSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(TaskListSearchResultSummary))); - } - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ExternalStorageLocation - public ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType) - { - ApiResponse localVarResponse = GetExternalStorageLocationWithHttpInfo(path, operation, payloadType); - return localVarResponse.Data; - } - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of ExternalStorageLocation - public ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType) - { - // verify the required parameter 'path' is set - if (path == null) - throw new ApiException(400, "Missing required parameter 'path' when calling WorkflowResourceApi->GetExternalStorageLocation"); - // verify the required parameter 'operation' is set - if (operation == null) - throw new ApiException(400, "Missing required parameter 'operation' when calling WorkflowResourceApi->GetExternalStorageLocation"); - // verify the required parameter 'payloadType' is set - if (payloadType == null) - throw new ApiException(400, "Missing required parameter 'payloadType' when calling WorkflowResourceApi->GetExternalStorageLocation"); - - var localVarPath = "/workflow/externalstoragelocation"; - 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 (path != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "path", path)); // query parameter - if (operation != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "operation", operation)); // query parameter - if (payloadType != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "payloadType", payloadType)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetExternalStorageLocation", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (ExternalStorageLocation)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ExternalStorageLocation))); - } - - /// - /// Retrieve all the running workflows - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// List<string> - public List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null) - { - ApiResponse> localVarResponse = GetRunningWorkflowWithHttpInfo(name, version, startTime, endTime); - return localVarResponse.Data; - } - - /// - /// Retrieve all the running workflows - /// - /// Thrown when fails to make API call - /// - /// (optional, default to 1) - /// (optional) - /// (optional) - /// ApiResponse of List<string> - public ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null) - { - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetRunningWorkflow"); - - var localVarPath = "/workflow/running/{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 - if (version != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter - if (startTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "startTime", startTime)); // query parameter - if (endTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "endTime", endTime)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetRunningWorkflow", 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))); - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// WorkflowStatus - public WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null) - { - ApiResponse localVarResponse = GetWorkflowStatusSummaryWithHttpInfo(workflowId, includeOutput, includeVariables); - return localVarResponse.Data; - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of WorkflowStatus - public ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetWorkflowStatusSummary"); - - var localVarPath = "/workflow/{workflowId}/status"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (includeOutput != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeOutput", includeOutput)); // query parameter - if (includeVariables != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeVariables", includeVariables)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflowStatusSummary", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (WorkflowStatus)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowStatus))); - } - - /// - /// Lists workflows for the given correlation id list - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - public Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null) - { - ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, name, includeClosed, includeTasks); - return localVarResponse.Data; - } - - /// - /// Lists workflows for the given correlation id list - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - public ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); - - var localVarPath = "/workflow/{name}/correlated"; - 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 (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter - if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); - } - - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// Dictionary<string, List<Workflow>> - public Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) - { - ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, includeClosed, includeTasks); - return localVarResponse.Data; - } - - /// - /// Lists workflows for the given correlation id list and workflow name list - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of Dictionary<string, List<Workflow>> - public ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); - - var localVarPath = "/workflow/correlated/batch"; - 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 (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); - } - - /// - /// Lists workflows for the given correlation id - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// List<Workflow> - public List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) - { - ApiResponse> localVarResponse = GetWorkflowsWithHttpInfo(name, correlationId, includeClosed, includeTasks); - return localVarResponse.Data; - } - - /// - /// Lists workflows for the given correlation id - /// - /// Thrown when fails to make API call - /// - /// - /// (optional, default to false) - /// (optional, default to false) - /// ApiResponse of List<Workflow> - public ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) - { - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); - // verify the required parameter 'correlationId' is set - if (correlationId == null) - throw new ApiException(400, "Missing required parameter 'correlationId' when calling WorkflowResourceApi->GetWorkflows"); - - var localVarPath = "/workflow/{name}/correlated/{correlationId}"; - 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 (correlationId != null) localVarPathParams.Add("correlationId", this.Configuration.ApiClient.ParameterToString(correlationId)); // path parameter - if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter - if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", 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))); - } - - /// - /// Pauses the workflow - /// - /// Thrown when fails to make API call - /// - /// - public void PauseWorkflow(string workflowId) - { - PauseWorkflowWithHttpInfo(workflowId); - } - - /// - /// Pauses the workflow - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse PauseWorkflowWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->PauseWorkflow"); - - var localVarPath = "/workflow/{workflowId}/pause"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("PauseWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - - /// - /// Jump workflow execution to given task Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// - public void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null) - { - JumpToTaskWithHttpInfo(input, workflowId, taskReferenceName); - } - - - /// - /// Jump workflow execution to given task Jump workflow execution to given task. - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// ApiResponse of Object(void) - public ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'input' when calling WorkflowResourceApi->JumpToTask"); - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->JumpToTask"); - - var localVarPath = "/workflow/{workflowId}/jump/{taskReferenceName}"; - 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) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (taskReferenceName != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "taskReferenceName", taskReferenceName)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("JumpToTask", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - - /// - /// Reruns the workflow from a specific task - /// - /// Thrown when fails to make API call - /// - /// - /// string - public string Rerun(RerunWorkflowRequest body, string workflowId) - { - ApiResponse localVarResponse = RerunWithHttpInfo(body, workflowId); - return localVarResponse.Data; - } - - /// - /// Reruns the workflow from a specific task - /// - /// Thrown when fails to make API call - /// - /// - /// ApiResponse of string - public ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Rerun"); - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Rerun"); - - var localVarPath = "/workflow/{workflowId}/rerun"; - 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[] { - "text/plain" - }; - String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("Rerun", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - } - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// Thrown when fails to make API call - /// - /// - public void ResetWorkflow(string workflowId) - { - ResetWorkflowWithHttpInfo(workflowId); - } - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse ResetWorkflowWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResetWorkflow"); - - var localVarPath = "/workflow/{workflowId}/resetcallbacks"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("ResetWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Restarts a completed workflow - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - public void Restart(string workflowId, bool? useLatestDefinitions = null) - { - RestartWithHttpInfo(workflowId, useLatestDefinitions); - } - - /// - /// Restarts a completed workflow - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - public ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Restart"); - - var localVarPath = "/workflow/{workflowId}/restart"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (useLatestDefinitions != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "useLatestDefinitions", useLatestDefinitions)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Restart", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Resumes the workflow - /// - /// Thrown when fails to make API call - /// - /// - public void ResumeWorkflow(string workflowId) - { - ResumeWorkflowWithHttpInfo(workflowId); - } - - /// - /// Resumes the workflow - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public ApiResponse ResumeWorkflowWithHttpInfo(string workflowId) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResumeWorkflow"); - - var localVarPath = "/workflow/{workflowId}/resume"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("ResumeWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Retries the last failed task - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// - public void Retry(string workflowId, bool? resumeSubworkflowTasks = null) - { - RetryWithHttpInfo(workflowId, resumeSubworkflowTasks); - } - - /// - /// Retries the last failed task - /// - /// Thrown when fails to make API call - /// - /// (optional, default to false) - /// ApiResponse of Object(void) - public ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Retry"); - - var localVarPath = "/workflow/{workflowId}/retry"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (resumeSubworkflowTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "resumeSubworkflowTasks", resumeSubworkflowTasks)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Retry", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ScrollableSearchResultWorkflowSummary - public ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) - { - ApiResponse localVarResponse = SearchWithHttpInfo(queryId, start, size, sort, freeText, query, skipCache); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional) - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// (optional, default to false) - /// ApiResponse of ScrollableSearchResultWorkflowSummary - public ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) - { - - var localVarPath = "/workflow/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[] { - }; - 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 (queryId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "queryId", queryId)); // query parameter - if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - if (skipCache != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipCache", skipCache)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Search", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (ScrollableSearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ScrollableSearchResultWorkflowSummary))); - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - public SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - ApiResponse localVarResponse = SearchV2WithHttpInfo(start, size, sort, freeText, query); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - public ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - - var localVarPath = "/workflow/search-v2"; - 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("SearchV2", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflowSummary - public SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - ApiResponse localVarResponse = SearchWorkflowsByTasksWithHttpInfo(start, size, sort, freeText, query); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflowSummary - public ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - - var localVarPath = "/workflow/search-by-tasks"; - 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasks", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (SearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflowSummary))); - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// SearchResultWorkflow - public SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - ApiResponse localVarResponse = SearchWorkflowsByTasksV2WithHttpInfo(start, size, sort, freeText, query); - return localVarResponse.Data; - } - - /// - /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC - /// - /// Thrown when fails to make API call - /// (optional, default to 0) - /// (optional, default to 100) - /// (optional) - /// (optional, default to *) - /// (optional) - /// ApiResponse of SearchResultWorkflow - public ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) - { - - var localVarPath = "/workflow/search-by-tasks-v2"; - 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter - if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter - if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter - if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter - if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasksV2", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); - } - - /// - /// Skips a given task from a current running workflow - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - public void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) - { - SkipTaskFromWorkflowWithHttpInfo(workflowId, taskReferenceName, skipTaskRequest); - } - - /// - /// Skips a given task from a current running workflow - /// - /// Thrown when fails to make API call - /// - /// - /// - /// ApiResponse of Object(void) - public ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); - // verify the required parameter 'taskReferenceName' is set - if (taskReferenceName == null) - throw new ApiException(400, "Missing required parameter 'taskReferenceName' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); - // verify the required parameter 'skipTaskRequest' is set - if (skipTaskRequest == null) - throw new ApiException(400, "Missing required parameter 'skipTaskRequest' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); - - var localVarPath = "/workflow/{workflowId}/skiptask/{taskReferenceName}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (taskReferenceName != null) localVarPathParams.Add("taskReferenceName", this.Configuration.ApiClient.ParameterToString(taskReferenceName)); // path parameter - if (skipTaskRequest != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipTaskRequest", skipTaskRequest)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int)localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("SkipTaskFromWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// Thrown when fails to make API call - /// - /// string - public string StartWorkflow(StartWorkflowRequest body) - { - ApiResponse localVarResponse = StartWorkflowWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of string - public ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); - - var localVarPath = "/workflow"; - 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[] { - "text/plain" - }; - 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 - IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - } - - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// string - public string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) - { - ApiResponse localVarResponse = StartWorkflowWithHttpInfo(name, body, version, correlationId, priority); - return localVarResponse.Data; - } - - /// - /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking - /// - /// Thrown when fails to make API call - /// - /// - /// (optional) - /// (optional) - /// (optional, default to 0) - /// ApiResponse of string - public ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); - // verify the required parameter 'name' is set - if (name == null) - throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->StartWorkflow"); - - var localVarPath = "/workflow/{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[] { - "application/json" - }; - String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "text/plain" - }; - 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) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter - if (correlationId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "correlationId", correlationId)); // query parameter - if (priority != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "priority", priority)); // 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 - IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - } - - /// - /// Terminate workflow execution - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// - public void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) - { - TerminateWithHttpInfo(workflowId, reason, triggerFailureWorkflow); - } - - /// - /// Terminate workflow execution - /// - /// Thrown when fails to make API call - /// - /// (optional) - /// (optional, default to false) - /// ApiResponse of Object(void) - public ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) - { - // verify the required parameter 'workflowId' is set - if (workflowId == null) - throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Terminate"); - - var localVarPath = "/workflow/{workflowId}"; - 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter - if (reason != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "reason", reason)); // query parameter - if (triggerFailureWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "triggerFailureWorkflow", triggerFailureWorkflow)); // query parameter - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("Terminate", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - null); - } - - /// - /// Test workflow execution using mock data - /// - /// Thrown when fails to make API call - /// - /// Workflow - public Workflow TestWorkflow(WorkflowTestRequest body) - { - ApiResponse localVarResponse = TestWorkflowWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Test workflow execution using mock data - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Workflow - public ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->TestWorkflow"); - - var localVarPath = "/workflow/test"; - 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 - IRestResponse localVarResponse = (IRestResponse)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("TestWorkflow", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); - } - - /// - /// Force upload all completed workflows to document store - /// - /// Thrown when fails to make API call - /// Object - public Object UploadCompletedWorkflows() - { - ApiResponse localVarResponse = UploadCompletedWorkflowsWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Force upload all completed workflows to document store - /// - /// Thrown when fails to make API call - /// ApiResponse of Object - public ApiResponse UploadCompletedWorkflowsWithHttpInfo() - { - - var localVarPath = "/workflow/document-store/upload"; - 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); - - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse)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("UploadCompletedWorkflows", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); - } - } + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IWorkflowResourceApi : IApiAccessor + { + #region Synchronous Operations + /// + /// Starts the decision task for a workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void Decide(string workflowId); + + /// + /// Starts the decision task for a workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse DecideWithHttpInfo(string workflowId); + /// + /// Removes the workflow from the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// + void Delete(string workflowId, bool? archiveWorkflow = null); + + /// + /// Removes the workflow from the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// ApiResponse of Object(void) + ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null); + /// + /// Execute a workflow synchronously + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// WorkflowRun + WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); + + /// + /// Execute a workflow synchronously + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// ApiResponse of WorkflowRun + ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// Workflow + Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null); + + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// ApiResponse of Workflow + ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null); + /// + /// Gets the workflow tasks by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// TaskListSearchResultSummary + TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null); + + /// + /// Gets the workflow tasks by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// ApiResponse of TaskListSearchResultSummary + ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null); + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ExternalStorageLocation + ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType); + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of ExternalStorageLocation + ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType); + /// + /// Retrieve all the running workflows + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// List<string> + List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null); + + /// + /// Retrieve all the running workflows + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// ApiResponse of List<string> + ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null); + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// WorkflowStatus + WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null); + + /// + /// Gets the workflow by workflow id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of WorkflowStatus + ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null); + /// + /// Lists workflows for the given correlation id list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null); + + /// + /// Lists workflows for the given correlation id list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null); + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); + + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null); + /// + /// Lists workflows for the given correlation id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// List<Workflow> + List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); + + /// + /// Lists workflows for the given correlation id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of List<Workflow> + ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null); + /// + /// Pauses the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void PauseWorkflow(string workflowId); + + /// + /// Pauses the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse PauseWorkflowWithHttpInfo(string workflowId); + /// + /// Jump workflow execution to given task + /// + /// + /// Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// + void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null); + + /// + /// Jump workflow execution to given task + /// + /// + /// Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// ApiResponse of Object(void) + ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null); + + /// + /// Reruns the workflow from a specific task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// string + string Rerun(RerunWorkflowRequest body, string workflowId); + + /// + /// Reruns the workflow from a specific task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of string + ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId); + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void ResetWorkflow(string workflowId); + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse ResetWorkflowWithHttpInfo(string workflowId); + /// + /// Restarts a completed workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + void Restart(string workflowId, bool? useLatestDefinitions = null); + + /// + /// Restarts a completed workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null); + /// + /// Resumes the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + void ResumeWorkflow(string workflowId); + + /// + /// Resumes the workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse ResumeWorkflowWithHttpInfo(string workflowId); + /// + /// Retries the last failed task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + void Retry(string workflowId, bool? resumeSubworkflowTasks = null); + + /// + /// Retries the last failed task + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null); + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ScrollableSearchResultWorkflowSummary + ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); + + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ApiResponse of ScrollableSearchResultWorkflowSummary + ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null); + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + + /// + /// Search for workflows based on payload and other parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflowSummary + SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflowSummary + ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + + /// + /// Search for workflows based on task parameters + /// + /// + /// use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null); + /// + /// Skips a given task from a current running workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); + + /// + /// Skips a given task from a current running workflow + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of Object(void) + ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest); + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// string + string StartWorkflow(StartWorkflowRequest body); + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of string + ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body); + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// string + string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); + + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// ApiResponse of string + ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null); + /// + /// Terminate workflow execution + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// + void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); + + /// + /// Terminate workflow execution + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// ApiResponse of Object(void) + ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null); + /// + /// Test workflow execution using mock data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Workflow + Workflow TestWorkflow(WorkflowTestRequest body); + + /// + /// Test workflow execution using mock data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Workflow + ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body); + /// + /// Force upload all completed workflows to document store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Object + Object UploadCompletedWorkflows(); + + /// + /// Force upload all completed workflows to document store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of Object + ApiResponse UploadCompletedWorkflowsWithHttpInfo(); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class WorkflowResourceApi : IWorkflowResourceApi + { + private Conductor.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public WorkflowResourceApi(String basePath) + { + this.Configuration = new Conductor.Client.Configuration { BasePath = basePath }; + + ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// + /// + public WorkflowResourceApi() + { + this.Configuration = Conductor.Client.Configuration.Default; + + ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public WorkflowResourceApi(Conductor.Client.Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Conductor.Client.Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Conductor.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Conductor.Client.Configuration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Conductor.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Starts the decision task for a workflow + /// + /// Thrown when fails to make API call + /// + /// + public void Decide(string workflowId) + { + DecideWithHttpInfo(workflowId); + } + + /// + /// Starts the decision task for a workflow + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse DecideWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Decide"); + + var localVarPath = "/workflow/decide/{workflowId}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Decide", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Removes the workflow from the system + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// + public void Delete(string workflowId, bool? archiveWorkflow = null) + { + DeleteWithHttpInfo(workflowId, archiveWorkflow); + } + + /// + /// Removes the workflow from the system + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// ApiResponse of Object(void) + public ApiResponse DeleteWithHttpInfo(string workflowId, bool? archiveWorkflow = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Delete"); + + var localVarPath = "/workflow/{workflowId}/remove"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (archiveWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "archiveWorkflow", archiveWorkflow)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Delete", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Execute a workflow synchronously + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// WorkflowRun + public WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) + { + ApiResponse localVarResponse = ExecuteWorkflowWithHttpInfo(body, requestId, name, version, waitUntilTaskRef); + return localVarResponse.Data; + } + + /// + /// Execute a workflow synchronously + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// ApiResponse of WorkflowRun + public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->ExecuteWorkflow"); + // verify the required parameter 'requestId' is set + if (requestId == null) + throw new ApiException(400, "Missing required parameter 'requestId' when calling WorkflowResourceApi->ExecuteWorkflow"); + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->ExecuteWorkflow"); + // verify the required parameter 'version' is set + if (version == null) + throw new ApiException(400, "Missing required parameter 'version' when calling WorkflowResourceApi->ExecuteWorkflow"); + + var localVarPath = "/workflow/execute/{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[] { + "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 (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 + if (requestId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "requestId", requestId)); // query parameter + if (waitUntilTaskRef != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "waitUntilTaskRef", waitUntilTaskRef)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("ExecuteWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (WorkflowRun)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowRun))); + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// Workflow + public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) + { + ApiResponse localVarResponse = GetExecutionStatusWithHttpInfo(workflowId, includeTasks, summarize); + return localVarResponse.Data; + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// ApiResponse of Workflow + public ApiResponse GetExecutionStatusWithHttpInfo(string workflowId, bool? includeTasks = null, bool? summarize = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatus"); + + var localVarPath = "/workflow/{workflowId}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter + if (summarize != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "summarize", summarize)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatus", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); + } + + /// + /// Gets the workflow tasks by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// TaskListSearchResultSummary + public TaskListSearchResultSummary GetExecutionStatusTaskList(string workflowId, int? start = null, int? count = null, string status = null) + { + ApiResponse localVarResponse = GetExecutionStatusTaskListWithHttpInfo(workflowId, start, count, status); + return localVarResponse.Data; + } + + /// + /// Gets the workflow tasks by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 0) + /// (optional, default to 15) + /// (optional) + /// ApiResponse of TaskListSearchResultSummary + public ApiResponse GetExecutionStatusTaskListWithHttpInfo(string workflowId, int? start = null, int? count = null, string status = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetExecutionStatusTaskList"); + + var localVarPath = "/workflow/{workflowId}/tasks"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (count != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "count", count)); // query parameter + if (status != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "status", status)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetExecutionStatusTaskList", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (TaskListSearchResultSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(TaskListSearchResultSummary))); + } + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ExternalStorageLocation + public ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType) + { + ApiResponse localVarResponse = GetExternalStorageLocationWithHttpInfo(path, operation, payloadType); + return localVarResponse.Data; + } + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of ExternalStorageLocation + public ApiResponse GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType) + { + // verify the required parameter 'path' is set + if (path == null) + throw new ApiException(400, "Missing required parameter 'path' when calling WorkflowResourceApi->GetExternalStorageLocation"); + // verify the required parameter 'operation' is set + if (operation == null) + throw new ApiException(400, "Missing required parameter 'operation' when calling WorkflowResourceApi->GetExternalStorageLocation"); + // verify the required parameter 'payloadType' is set + if (payloadType == null) + throw new ApiException(400, "Missing required parameter 'payloadType' when calling WorkflowResourceApi->GetExternalStorageLocation"); + + var localVarPath = "/workflow/externalstoragelocation"; + 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 (path != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "path", path)); // query parameter + if (operation != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "operation", operation)); // query parameter + if (payloadType != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "payloadType", payloadType)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetExternalStorageLocation", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (ExternalStorageLocation)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ExternalStorageLocation))); + } + + /// + /// Retrieve all the running workflows + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// List<string> + public List GetRunningWorkflow(string name, int? version = null, long? startTime = null, long? endTime = null) + { + ApiResponse> localVarResponse = GetRunningWorkflowWithHttpInfo(name, version, startTime, endTime); + return localVarResponse.Data; + } + + /// + /// Retrieve all the running workflows + /// + /// Thrown when fails to make API call + /// + /// (optional, default to 1) + /// (optional) + /// (optional) + /// ApiResponse of List<string> + public ApiResponse> GetRunningWorkflowWithHttpInfo(string name, int? version = null, long? startTime = null, long? endTime = null) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetRunningWorkflow"); + + var localVarPath = "/workflow/running/{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 + if (version != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter + if (startTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "startTime", startTime)); // query parameter + if (endTime != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "endTime", endTime)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetRunningWorkflow", 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))); + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// WorkflowStatus + public WorkflowStatus GetWorkflowStatusSummary(string workflowId, bool? includeOutput = null, bool? includeVariables = null) + { + ApiResponse localVarResponse = GetWorkflowStatusSummaryWithHttpInfo(workflowId, includeOutput, includeVariables); + return localVarResponse.Data; + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of WorkflowStatus + public ApiResponse GetWorkflowStatusSummaryWithHttpInfo(string workflowId, bool? includeOutput = null, bool? includeVariables = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->GetWorkflowStatusSummary"); + + var localVarPath = "/workflow/{workflowId}/status"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (includeOutput != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeOutput", includeOutput)); // query parameter + if (includeVariables != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeVariables", includeVariables)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflowStatusSummary", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (WorkflowStatus)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowStatus))); + } + + /// + /// Lists workflows for the given correlation id list + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + public Dictionary> GetWorkflows(List body, string name, bool? includeClosed = null, bool? includeTasks = null) + { + ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, name, includeClosed, includeTasks); + return localVarResponse.Data; + } + + /// + /// Lists workflows for the given correlation id list + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + public ApiResponse>> GetWorkflowsWithHttpInfo(List body, string name, bool? includeClosed = null, bool? includeTasks = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); + + var localVarPath = "/workflow/{name}/correlated"; + 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 (name != null) localVarPathParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); // path parameter + if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); + } + + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// Dictionary<string, List<Workflow>> + public Dictionary> GetWorkflows(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) + { + ApiResponse>> localVarResponse = GetWorkflowsWithHttpInfo(body, includeClosed, includeTasks); + return localVarResponse.Data; + } + + /// + /// Lists workflows for the given correlation id list and workflow name list + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of Dictionary<string, List<Workflow>> + public ApiResponse>> GetWorkflowsWithHttpInfo(CorrelationIdsSearchRequest body, bool? includeClosed = null, bool? includeTasks = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->GetWorkflows"); + + var localVarPath = "/workflow/correlated/batch"; + 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 (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse>>(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Dictionary>)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary>))); + } + + /// + /// Lists workflows for the given correlation id + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// List<Workflow> + public List GetWorkflows(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) + { + ApiResponse> localVarResponse = GetWorkflowsWithHttpInfo(name, correlationId, includeClosed, includeTasks); + return localVarResponse.Data; + } + + /// + /// Lists workflows for the given correlation id + /// + /// Thrown when fails to make API call + /// + /// + /// (optional, default to false) + /// (optional, default to false) + /// ApiResponse of List<Workflow> + public ApiResponse> GetWorkflowsWithHttpInfo(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null) + { + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->GetWorkflows"); + // verify the required parameter 'correlationId' is set + if (correlationId == null) + throw new ApiException(400, "Missing required parameter 'correlationId' when calling WorkflowResourceApi->GetWorkflows"); + + var localVarPath = "/workflow/{name}/correlated/{correlationId}"; + 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 (correlationId != null) localVarPathParams.Add("correlationId", this.Configuration.ApiClient.ParameterToString(correlationId)); // path parameter + if (includeClosed != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeClosed", includeClosed)); // query parameter + if (includeTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "includeTasks", includeTasks)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("GetWorkflows", 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))); + } + + /// + /// Pauses the workflow + /// + /// Thrown when fails to make API call + /// + /// + public void PauseWorkflow(string workflowId) + { + PauseWorkflowWithHttpInfo(workflowId); + } + + /// + /// Pauses the workflow + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse PauseWorkflowWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->PauseWorkflow"); + + var localVarPath = "/workflow/{workflowId}/pause"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("PauseWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + + /// + /// Jump workflow execution to given task Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// + public void JumpToTask(string workflowId, Dictionary input, string taskReferenceName = null) + { + JumpToTaskWithHttpInfo(input, workflowId, taskReferenceName); + } + + + /// + /// Jump workflow execution to given task Jump workflow execution to given task. + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// ApiResponse of Object(void) + public ApiResponse JumpToTaskWithHttpInfo(Dictionary body, string workflowId, string taskReferenceName = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'input' when calling WorkflowResourceApi->JumpToTask"); + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->JumpToTask"); + + var localVarPath = "/workflow/{workflowId}/jump/{taskReferenceName}"; + 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) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (taskReferenceName != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "taskReferenceName", taskReferenceName)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("JumpToTask", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + + /// + /// Reruns the workflow from a specific task + /// + /// Thrown when fails to make API call + /// + /// + /// string + public string Rerun(RerunWorkflowRequest body, string workflowId) + { + ApiResponse localVarResponse = RerunWithHttpInfo(body, workflowId); + return localVarResponse.Data; + } + + /// + /// Reruns the workflow from a specific task + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of string + public ApiResponse RerunWithHttpInfo(RerunWorkflowRequest body, string workflowId) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Rerun"); + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Rerun"); + + var localVarPath = "/workflow/{workflowId}/rerun"; + 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[] { + "text/plain" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("Rerun", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); + } + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// Thrown when fails to make API call + /// + /// + public void ResetWorkflow(string workflowId) + { + ResetWorkflowWithHttpInfo(workflowId); + } + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse ResetWorkflowWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResetWorkflow"); + + var localVarPath = "/workflow/{workflowId}/resetcallbacks"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("ResetWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Restarts a completed workflow + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + public void Restart(string workflowId, bool? useLatestDefinitions = null) + { + RestartWithHttpInfo(workflowId, useLatestDefinitions); + } + + /// + /// Restarts a completed workflow + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse RestartWithHttpInfo(string workflowId, bool? useLatestDefinitions = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Restart"); + + var localVarPath = "/workflow/{workflowId}/restart"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (useLatestDefinitions != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "useLatestDefinitions", useLatestDefinitions)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Restart", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Resumes the workflow + /// + /// Thrown when fails to make API call + /// + /// + public void ResumeWorkflow(string workflowId) + { + ResumeWorkflowWithHttpInfo(workflowId); + } + + /// + /// Resumes the workflow + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse ResumeWorkflowWithHttpInfo(string workflowId) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->ResumeWorkflow"); + + var localVarPath = "/workflow/{workflowId}/resume"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("ResumeWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Retries the last failed task + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// + public void Retry(string workflowId, bool? resumeSubworkflowTasks = null) + { + RetryWithHttpInfo(workflowId, resumeSubworkflowTasks); + } + + /// + /// Retries the last failed task + /// + /// Thrown when fails to make API call + /// + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse RetryWithHttpInfo(string workflowId, bool? resumeSubworkflowTasks = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Retry"); + + var localVarPath = "/workflow/{workflowId}/retry"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (resumeSubworkflowTasks != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "resumeSubworkflowTasks", resumeSubworkflowTasks)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Retry", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ScrollableSearchResultWorkflowSummary + public ScrollableSearchResultWorkflowSummary Search(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) + { + ApiResponse localVarResponse = SearchWithHttpInfo(queryId, start, size, sort, freeText, query, skipCache); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional) + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// (optional, default to false) + /// ApiResponse of ScrollableSearchResultWorkflowSummary + public ApiResponse SearchWithHttpInfo(string queryId = null, int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, bool? skipCache = null) + { + + var localVarPath = "/workflow/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[] { + }; + 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 (queryId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "queryId", queryId)); // query parameter + if (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + if (skipCache != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipCache", skipCache)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Search", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (ScrollableSearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ScrollableSearchResultWorkflowSummary))); + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + public SearchResultWorkflow SearchV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + ApiResponse localVarResponse = SearchV2WithHttpInfo(start, size, sort, freeText, query); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on payload and other parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + public ApiResponse SearchV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + + var localVarPath = "/workflow/search-v2"; + 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("SearchV2", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflowSummary + public SearchResultWorkflowSummary SearchWorkflowsByTasks(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + ApiResponse localVarResponse = SearchWorkflowsByTasksWithHttpInfo(start, size, sort, freeText, query); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflowSummary + public ApiResponse SearchWorkflowsByTasksWithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + + var localVarPath = "/workflow/search-by-tasks"; + 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasks", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (SearchResultWorkflowSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflowSummary))); + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// SearchResultWorkflow + public SearchResultWorkflow SearchWorkflowsByTasksV2(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + ApiResponse localVarResponse = SearchWorkflowsByTasksV2WithHttpInfo(start, size, sort, freeText, query); + return localVarResponse.Data; + } + + /// + /// Search for workflows based on task parameters use sort options as sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// Thrown when fails to make API call + /// (optional, default to 0) + /// (optional, default to 100) + /// (optional) + /// (optional, default to *) + /// (optional) + /// ApiResponse of SearchResultWorkflow + public ApiResponse SearchWorkflowsByTasksV2WithHttpInfo(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null) + { + + var localVarPath = "/workflow/search-by-tasks-v2"; + 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 (start != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "start", start)); // query parameter + if (size != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "size", size)); // query parameter + if (sort != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "sort", sort)); // query parameter + if (freeText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "freeText", freeText)); // query parameter + if (query != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "query", query)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("SearchWorkflowsByTasksV2", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (SearchResultWorkflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultWorkflow))); + } + + /// + /// Skips a given task from a current running workflow + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + public void SkipTaskFromWorkflow(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) + { + SkipTaskFromWorkflowWithHttpInfo(workflowId, taskReferenceName, skipTaskRequest); + } + + /// + /// Skips a given task from a current running workflow + /// + /// Thrown when fails to make API call + /// + /// + /// + /// ApiResponse of Object(void) + public ApiResponse SkipTaskFromWorkflowWithHttpInfo(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); + // verify the required parameter 'taskReferenceName' is set + if (taskReferenceName == null) + throw new ApiException(400, "Missing required parameter 'taskReferenceName' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); + // verify the required parameter 'skipTaskRequest' is set + if (skipTaskRequest == null) + throw new ApiException(400, "Missing required parameter 'skipTaskRequest' when calling WorkflowResourceApi->SkipTaskFromWorkflow"); + + var localVarPath = "/workflow/{workflowId}/skiptask/{taskReferenceName}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (taskReferenceName != null) localVarPathParams.Add("taskReferenceName", this.Configuration.ApiClient.ParameterToString(taskReferenceName)); // path parameter + if (skipTaskRequest != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "skipTaskRequest", skipTaskRequest)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("SkipTaskFromWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// Thrown when fails to make API call + /// + /// string + public string StartWorkflow(StartWorkflowRequest body) + { + ApiResponse localVarResponse = StartWorkflowWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of string + public ApiResponse StartWorkflowWithHttpInfo(StartWorkflowRequest body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); + + var localVarPath = "/workflow"; + 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[] { + "text/plain" + }; + 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 + IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); + } + + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// string + public string StartWorkflow(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) + { + ApiResponse localVarResponse = StartWorkflowWithHttpInfo(name, body, version, correlationId, priority); + return localVarResponse.Data; + } + + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// Thrown when fails to make API call + /// + /// + /// (optional) + /// (optional) + /// (optional, default to 0) + /// ApiResponse of string + public ApiResponse StartWorkflowWithHttpInfo(string name, Dictionary body, int? version = null, string correlationId = null, int? priority = null) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->StartWorkflow"); + // verify the required parameter 'name' is set + if (name == null) + throw new ApiException(400, "Missing required parameter 'name' when calling WorkflowResourceApi->StartWorkflow"); + + var localVarPath = "/workflow/{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[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "text/plain" + }; + 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) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "version", version)); // query parameter + if (correlationId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "correlationId", correlationId)); // query parameter + if (priority != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "priority", priority)); // 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 + IRestResponse localVarResponse = (IRestResponse)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("StartWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); + } + + /// + /// Terminate workflow execution + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// + public void Terminate(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) + { + TerminateWithHttpInfo(workflowId, reason, triggerFailureWorkflow); + } + + /// + /// Terminate workflow execution + /// + /// Thrown when fails to make API call + /// + /// (optional) + /// (optional, default to false) + /// ApiResponse of Object(void) + public ApiResponse TerminateWithHttpInfo(string workflowId, string reason = null, bool? triggerFailureWorkflow = null) + { + // verify the required parameter 'workflowId' is set + if (workflowId == null) + throw new ApiException(400, "Missing required parameter 'workflowId' when calling WorkflowResourceApi->Terminate"); + + var localVarPath = "/workflow/{workflowId}"; + 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 (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter + if (reason != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "reason", reason)); // query parameter + if (triggerFailureWorkflow != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "triggerFailureWorkflow", triggerFailureWorkflow)); // query parameter + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("Terminate", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + null); + } + + /// + /// Test workflow execution using mock data + /// + /// Thrown when fails to make API call + /// + /// Workflow + public Workflow TestWorkflow(WorkflowTestRequest body) + { + ApiResponse localVarResponse = TestWorkflowWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test workflow execution using mock data + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Workflow + public ApiResponse TestWorkflowWithHttpInfo(WorkflowTestRequest body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->TestWorkflow"); + + var localVarPath = "/workflow/test"; + 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 + IRestResponse localVarResponse = (IRestResponse)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("TestWorkflow", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow))); + } + + /// + /// Force upload all completed workflows to document store + /// + /// Thrown when fails to make API call + /// Object + public Object UploadCompletedWorkflows() + { + ApiResponse localVarResponse = UploadCompletedWorkflowsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Force upload all completed workflows to document store + /// + /// Thrown when fails to make API call + /// ApiResponse of Object + public ApiResponse UploadCompletedWorkflowsWithHttpInfo() + { + + var localVarPath = "/workflow/document-store/upload"; + 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); + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse)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("UploadCompletedWorkflows", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + } + } } diff --git a/Conductor/Client/Extensions/ConductorTaskExtensions.cs b/Conductor/Client/Extensions/ConductorTaskExtensions.cs index b7303ec6..b56968e9 100644 --- a/Conductor/Client/Extensions/ConductorTaskExtensions.cs +++ b/Conductor/Client/Extensions/ConductorTaskExtensions.cs @@ -18,7 +18,7 @@ public static TaskResult InProgress(this Task task, string log = null, long? cal { new TaskExecLog { TaskId = task.TaskId, Log = log, CreatedTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() } }, - callbackAfterSeconds: callbackAfterSeconds + callbackAfterSeconds: callbackAfterSeconds.Value ); } diff --git a/Conductor/Definition/ConductorWorkflow.cs b/Conductor/Definition/ConductorWorkflow.cs index 0a6d5948..f7d44657 100644 --- a/Conductor/Definition/ConductorWorkflow.cs +++ b/Conductor/Definition/ConductorWorkflow.cs @@ -3,91 +3,83 @@ namespace Conductor.Definition { - public class ConductorWorkflow : WorkflowDef - { - public ConductorWorkflow() : base(name: "", tasks: new List(), timeoutSeconds: 0) - { - InputParameters = new List(); - } + public class ConductorWorkflow : WorkflowDef + { + public ConductorWorkflow() : base(name: "", tasks: new List(), timeoutSeconds: 0) + { + InputParameters = new List(); + } - public ConductorWorkflow WithName(string name) - { - Name = name; - return this; - } + public ConductorWorkflow WithName(string name) + { + Name = name; + return this; + } - public ConductorWorkflow WithVersion(int version) - { - Version = version; - return this; - } + public ConductorWorkflow WithVersion(int version) + { + Version = version; + return this; + } - public ConductorWorkflow WithDescription(string description) - { - Description = description; - return this; - } + public ConductorWorkflow WithDescription(string description) + { + Description = description; + return this; + } - public ConductorWorkflow WithTimeoutPolicy(WorkflowDef.TimeoutPolicyEnum timeoutPolicy, int timeoutSeconds) - { - TimeoutPolicy = timeoutPolicy; - TimeoutSeconds = timeoutSeconds; - return this; - } + public ConductorWorkflow WithTimeoutPolicy(WorkflowDef.TimeoutPolicyEnum timeoutPolicy, int timeoutSeconds) + { + TimeoutPolicy = timeoutPolicy; + TimeoutSeconds = timeoutSeconds; + return this; + } - public ConductorWorkflow WithTask(params WorkflowTask[] tasks) - { - foreach (WorkflowTask task in tasks) - { - Tasks.Add(task); - } - return this; - } + public ConductorWorkflow WithTask(params WorkflowTask[] tasks) + { + foreach (WorkflowTask task in tasks) + { + Tasks.Add(task); + } + return this; + } - public ConductorWorkflow WithFailureWorkflow(string failureWorkflow) - { - FailureWorkflow = failureWorkflow; - return this; - } + public ConductorWorkflow WithFailureWorkflow(string failureWorkflow) + { + FailureWorkflow = failureWorkflow; + return this; + } - public ConductorWorkflow WithRestartable(bool restartable) - { - Restartable = restartable; - return this; - } + public ConductorWorkflow WithRestartable(bool restartable) + { + Restartable = restartable; + return this; + } - public ConductorWorkflow WithOutputParameter(string key, object value) - { - OutputParameters.Add(key, value); - return this; - } + public ConductorWorkflow WithOutputParameter(string key, object value) + { + OutputParameters.Add(key, value); + return this; + } - public ConductorWorkflow WithVariable(string key, object value) - { - if (Variables == null) // if workflow does not have any variables, initialize with empty collection - Variables = new Dictionary(); - Variables.Add(key, value); - return this; - } + public ConductorWorkflow WithOwner(string ownerEmail) + { + OwnerEmail = ownerEmail; + return this; + } - public ConductorWorkflow WithOwner(string ownerEmail) - { - OwnerEmail = ownerEmail; - return this; - } + public ConductorWorkflow WithInputParameter(string key) + { + InputParameters.Add(key); + return this; + } - public ConductorWorkflow WithInputParameter(string key) - { - InputParameters.Add(key); - return this; - } - - public StartWorkflowRequest GetStartWorkflowRequest() - { - return new StartWorkflowRequest( - name: Name, - version: Version - ); - } - } + public StartWorkflowRequest GetStartWorkflowRequest() + { + return new StartWorkflowRequest( + name: Name, + version: Version + ); + } + } } diff --git a/Tests/Api/WorkflowResourceApiTest.cs b/Tests/Api/WorkflowResourceApiTest.cs deleted file mode 100644 index 527ea411..00000000 --- a/Tests/Api/WorkflowResourceApiTest.cs +++ /dev/null @@ -1,97 +0,0 @@ -using conductor.csharp.Client.Extensions; -using Conductor.Api; -using Conductor.Client.Extensions; -using Conductor.Client.Models; -using Conductor.Definition; -using Conductor.Definition.TaskType; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using Tests.Worker; -using Xunit; - -namespace conductor_csharp.test.Api -{ - public class WorkflowResourceApiTest - { - private const string WORKFLOW_NAME = "TestToCreateVariables"; - private const string TASK_NAME = "TestToCreateVariables_Task"; - private const string WORKFLOW_VARIABLE_1 = "TestVariable1"; - private const string WORKFLOW_VARIABLE_2 = "TestVariable2"; - private const string WORKFLOW_DESC = "Test Workflow With Variables"; - private const int WORKFLOW_VERSION = 1; - - private readonly WorkflowResourceApi _workflowClient; - private readonly ILogger _logger; - - public WorkflowResourceApiTest() - { - _workflowClient = ApiExtensions.GetClient(); - _logger = ApplicationLogging.CreateLogger(); - } - - [Fact] - public async void UpdateWorkflowVariables() - { - // Prepare workflow - var _workflow = GetConductorWorkflow(); - ApiExtensions.GetWorkflowExecutor().RegisterWorkflow(_workflow, true); - var workflowId = ApiExtensions.GetWorkflowExecutor().StartWorkflow(_workflow); - await ExecuteWorkflowTasks(workflowCompletionTimeout: TimeSpan.FromSeconds(20)); - await ValidateWorkflowCompletion(workflowId); - - // Create variables collection with values to be updated - var updateDict = new Dictionary { - {WORKFLOW_VARIABLE_1,"Value1" }, - {WORKFLOW_VARIABLE_2,"Value2" }, - }; - var updateVariableData = new Workflow() { WorkflowId = workflowId, Variables = updateDict }; - // Update the work flow variables - _workflowClient.UpdateWorkflowVariables(updateVariableData); - // Fetch latest workflow data to validate the change in variables - var _updatedWorkFlow = _workflowClient.GetWorkflowStatusSummary(workflowId, includeVariables: true); - // Verify workflow variables data is equal with input passed - Assert.Equal(_updatedWorkFlow.Variables, updateDict); - } - - private async System.Threading.Tasks.Task ExecuteWorkflowTasks(TimeSpan workflowCompletionTimeout) - { - var host = WorkflowTaskHost.CreateWorkerHost(LogLevel.Information, new ClassWorker()); - await host.StartAsync(); - Thread.Sleep(workflowCompletionTimeout); - await host.StopAsync(); - } - - private ConductorWorkflow GetConductorWorkflow() - { - return new ConductorWorkflow() - .WithName(WORKFLOW_NAME) - .WithVersion(WORKFLOW_VERSION) - .WithDescription(WORKFLOW_DESC) - .WithTask(new SimpleTask(TASK_NAME, TASK_NAME)) - .WithVariable(WORKFLOW_VARIABLE_1, $"{WORKFLOW_VARIABLE_1}_Value") - .WithVariable(WORKFLOW_VARIABLE_2, $"{WORKFLOW_VARIABLE_2}_Value"); - } - - private async System.Threading.Tasks.Task ValidateWorkflowCompletion(params string[] workflowIdList) - { - var workflowStatusList = await WorkflowExtensions.GetWorkflowStatusList( - _workflowClient, - maxAllowedInParallel: 10, - workflowIdList - ); - var incompleteWorkflowCounter = 0; - workflowStatusList.ToList().ForEach(wf => - { - if (wf.Status.Value != WorkflowStatus.StatusEnum.COMPLETED) - { - incompleteWorkflowCounter += 1; - _logger.LogInformation($"Workflow not completed, workflowId: {wf.WorkflowId}"); - } - }); - Assert.Equal(0, incompleteWorkflowCounter); - } - } -} diff --git a/csharp-examples/WorkFlowExamples.cs b/csharp-examples/WorkFlowExamples.cs deleted file mode 100644 index 41c952f7..00000000 --- a/csharp-examples/WorkFlowExamples.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Conductor.Client; -using Conductor.Definition.TaskType; -using Conductor.Definition; -using Conductor.Executor; -using Conductor.Api; -using Conductor.Client.Authentication; - -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 = ""; - private const string TASK_NAME = ""; - private const string TASK_REFERENCE = ""; - - private const string VARIABLE_OLD_VALUE = "SOME_OLD_VALUE"; - private const string VARIABLE_NAME_1 = ""; - private const string VARIABLE_VALUE_1 = ""; - private const string VARIABLE_NAME_2 = ""; - private const string VARIABLE_VALUE_2 = ""; - - - public void RegisterWorkFlow() - { - Configuration configuration = new Configuration() - { - AuthenticationSettings = new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET) - }; - - WorkflowExecutor executor = new WorkflowExecutor(configuration); - executor.RegisterWorkflow(GetConductorWorkflow(), true); - } - - private ConductorWorkflow GetConductorWorkflow() - { - var conductorWorkFlow = new ConductorWorkflow() - .WithName(WORKFLOW_NAME).WithDescription(WORKFLOW_DESCRIPTION) - .WithTask(new SimpleTask(TASK_NAME, TASK_REFERENCE)) - .WithOwner(OWNER_EMAIL); - - var workflowVariableTobeAdded = new Dictionary - { - { VARIABLE_NAME_1, VARIABLE_VALUE_1 }, - { VARIABLE_NAME_2, VARIABLE_VALUE_2 } - }; - - conductorWorkFlow.Variables = workflowVariableTobeAdded; - return conductorWorkFlow; - } - - public void UpdateWorkflowVariablesWithWorkFlowId() - { - var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); - var workflowClient = orkesApiClient.GetClient(); - var workFlowVariables = new Dictionary - { - { VARIABLE_NAME_1, VARIABLE_OLD_VALUE }, - { VARIABLE_NAME_2, VARIABLE_OLD_VALUE } - }; - - workflowClient.UpdateWorkflowVariables(new Conductor.Client.Models.Workflow() - { - WorkflowId = WORKFLOW_ID, - Variables = workFlowVariables - }); - } - - } -} From 2ae6a33dbdd043d288ea84866e5cbc5c06b88a9a Mon Sep 17 00:00:00 2001 From: "Jithesh.Poojary" Date: Wed, 10 Jan 2024 15:10:29 +0530 Subject: [PATCH 3/5] Changes to address the below 1. update variables functionality, 2. Inprogress throws exception when default param value after callbackAfterSeconds --- Conductor/Api/WorkflowResourceApi.cs | 119 ++++++++++++++---- .../Extensions/ConductorTaskExtensions.cs | 2 +- Conductor/Definition/ConductorWorkflow.cs | 9 +- Tests/Api/WorkflowResourceApiTest.cs | 97 ++++++++++++++ csharp-examples/WorkFlowExamples.cs | 77 ++++++++++++ 5 files changed, 279 insertions(+), 25 deletions(-) create mode 100644 Tests/Api/WorkflowResourceApiTest.cs create mode 100644 csharp-examples/WorkFlowExamples.cs diff --git a/Conductor/Api/WorkflowResourceApi.cs b/Conductor/Api/WorkflowResourceApi.cs index f0969e27..4cd83b41 100644 --- a/Conductor/Api/WorkflowResourceApi.cs +++ b/Conductor/Api/WorkflowResourceApi.cs @@ -72,20 +72,26 @@ public interface IWorkflowResourceApi : IApiAccessor /// WorkflowRun WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); - /// - /// Execute a workflow synchronously - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// ApiResponse of WorkflowRun - ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); + /// + /// Update the value of the workflow variables for the given workflow id + /// + /// + /// ApiResponse of Object(void) + Object UpdateWorkflowVariables(Workflow workflow); + /// + /// Execute a workflow synchronously + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// ApiResponse of WorkflowRun + ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); /// /// Gets the workflow by workflow id /// @@ -1029,15 +1035,82 @@ public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest (WorkflowRun)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowRun))); } - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// Workflow - public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) + public Object UpdateWorkflowVariables(Workflow workflow) + { + ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); + return localVarResponse.Data; + } + + public ApiResponse UpdateWorkflowVariablesWithHttpInfo(Workflow workflow) + { + // verify the required parameter 'body' is set + if (workflow == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Update"); + + if (string.IsNullOrEmpty(workflow.WorkflowId)) + throw new ApiException(400, "Missing required parameter 'WorkflowId' when calling WorkflowResourceApi->Update"); + + if (workflow.Variables == null) + throw new ApiException(400, "Missing required parameter 'Variables' when calling WorkflowResourceApi->Update"); + + var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; + 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 (workflow != null && workflow.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(workflow.Variables); + } + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + IRestResponse localVarResponse = (IRestResponse)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("Update", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// Workflow + public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) { ApiResponse localVarResponse = GetExecutionStatusWithHttpInfo(workflowId, includeTasks, summarize); return localVarResponse.Data; diff --git a/Conductor/Client/Extensions/ConductorTaskExtensions.cs b/Conductor/Client/Extensions/ConductorTaskExtensions.cs index b56968e9..b7303ec6 100644 --- a/Conductor/Client/Extensions/ConductorTaskExtensions.cs +++ b/Conductor/Client/Extensions/ConductorTaskExtensions.cs @@ -18,7 +18,7 @@ public static TaskResult InProgress(this Task task, string log = null, long? cal { new TaskExecLog { TaskId = task.TaskId, Log = log, CreatedTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() } }, - callbackAfterSeconds: callbackAfterSeconds.Value + callbackAfterSeconds: callbackAfterSeconds ); } diff --git a/Conductor/Definition/ConductorWorkflow.cs b/Conductor/Definition/ConductorWorkflow.cs index f7d44657..31629573 100644 --- a/Conductor/Definition/ConductorWorkflow.cs +++ b/Conductor/Definition/ConductorWorkflow.cs @@ -62,7 +62,14 @@ public ConductorWorkflow WithOutputParameter(string key, object value) return this; } - public ConductorWorkflow WithOwner(string ownerEmail) + public ConductorWorkflow WithVariable(string key, object value) + { + if (Variables == null) // if workflow does not have any variables, initialize with empty collection + Variables = new Dictionary(); + Variables.Add(key, value); + return this; + } + public ConductorWorkflow WithOwner(string ownerEmail) { OwnerEmail = ownerEmail; return this; diff --git a/Tests/Api/WorkflowResourceApiTest.cs b/Tests/Api/WorkflowResourceApiTest.cs new file mode 100644 index 00000000..527ea411 --- /dev/null +++ b/Tests/Api/WorkflowResourceApiTest.cs @@ -0,0 +1,97 @@ +using conductor.csharp.Client.Extensions; +using Conductor.Api; +using Conductor.Client.Extensions; +using Conductor.Client.Models; +using Conductor.Definition; +using Conductor.Definition.TaskType; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using Tests.Worker; +using Xunit; + +namespace conductor_csharp.test.Api +{ + public class WorkflowResourceApiTest + { + private const string WORKFLOW_NAME = "TestToCreateVariables"; + private const string TASK_NAME = "TestToCreateVariables_Task"; + private const string WORKFLOW_VARIABLE_1 = "TestVariable1"; + private const string WORKFLOW_VARIABLE_2 = "TestVariable2"; + private const string WORKFLOW_DESC = "Test Workflow With Variables"; + private const int WORKFLOW_VERSION = 1; + + private readonly WorkflowResourceApi _workflowClient; + private readonly ILogger _logger; + + public WorkflowResourceApiTest() + { + _workflowClient = ApiExtensions.GetClient(); + _logger = ApplicationLogging.CreateLogger(); + } + + [Fact] + public async void UpdateWorkflowVariables() + { + // Prepare workflow + var _workflow = GetConductorWorkflow(); + ApiExtensions.GetWorkflowExecutor().RegisterWorkflow(_workflow, true); + var workflowId = ApiExtensions.GetWorkflowExecutor().StartWorkflow(_workflow); + await ExecuteWorkflowTasks(workflowCompletionTimeout: TimeSpan.FromSeconds(20)); + await ValidateWorkflowCompletion(workflowId); + + // Create variables collection with values to be updated + var updateDict = new Dictionary { + {WORKFLOW_VARIABLE_1,"Value1" }, + {WORKFLOW_VARIABLE_2,"Value2" }, + }; + var updateVariableData = new Workflow() { WorkflowId = workflowId, Variables = updateDict }; + // Update the work flow variables + _workflowClient.UpdateWorkflowVariables(updateVariableData); + // Fetch latest workflow data to validate the change in variables + var _updatedWorkFlow = _workflowClient.GetWorkflowStatusSummary(workflowId, includeVariables: true); + // Verify workflow variables data is equal with input passed + Assert.Equal(_updatedWorkFlow.Variables, updateDict); + } + + private async System.Threading.Tasks.Task ExecuteWorkflowTasks(TimeSpan workflowCompletionTimeout) + { + var host = WorkflowTaskHost.CreateWorkerHost(LogLevel.Information, new ClassWorker()); + await host.StartAsync(); + Thread.Sleep(workflowCompletionTimeout); + await host.StopAsync(); + } + + private ConductorWorkflow GetConductorWorkflow() + { + return new ConductorWorkflow() + .WithName(WORKFLOW_NAME) + .WithVersion(WORKFLOW_VERSION) + .WithDescription(WORKFLOW_DESC) + .WithTask(new SimpleTask(TASK_NAME, TASK_NAME)) + .WithVariable(WORKFLOW_VARIABLE_1, $"{WORKFLOW_VARIABLE_1}_Value") + .WithVariable(WORKFLOW_VARIABLE_2, $"{WORKFLOW_VARIABLE_2}_Value"); + } + + private async System.Threading.Tasks.Task ValidateWorkflowCompletion(params string[] workflowIdList) + { + var workflowStatusList = await WorkflowExtensions.GetWorkflowStatusList( + _workflowClient, + maxAllowedInParallel: 10, + workflowIdList + ); + var incompleteWorkflowCounter = 0; + workflowStatusList.ToList().ForEach(wf => + { + if (wf.Status.Value != WorkflowStatus.StatusEnum.COMPLETED) + { + incompleteWorkflowCounter += 1; + _logger.LogInformation($"Workflow not completed, workflowId: {wf.WorkflowId}"); + } + }); + Assert.Equal(0, incompleteWorkflowCounter); + } + } +} diff --git a/csharp-examples/WorkFlowExamples.cs b/csharp-examples/WorkFlowExamples.cs new file mode 100644 index 00000000..777519f2 --- /dev/null +++ b/csharp-examples/WorkFlowExamples.cs @@ -0,0 +1,77 @@ +using Conductor.Client; +using Conductor.Definition.TaskType; +using Conductor.Definition; +using Conductor.Executor; +using Conductor.Api; +using Conductor.Client.Authentication; + +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 = ""; + private const string TASK_NAME = ""; + private const string TASK_REFERENCE = ""; + + private const string VARIABLE_OLD_VALUE = "SOME_OLD_VALUE"; + private const string VARIABLE_NAME_1 = ""; + private const string VARIABLE_NEW_VALUE_1 = ""; + private const string VARIABLE_NAME_2 = ""; + private const string VARIABLE_NEW_VALUE_2 = ""; + + + public void RegisterWorkFlow() + { + Configuration configuration = new Configuration() + { + AuthenticationSettings = new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET) + }; + + WorkflowExecutor executor = new WorkflowExecutor(configuration); + executor.RegisterWorkflow(GetConductorWorkflow(), true); + } + + private ConductorWorkflow GetConductorWorkflow() + { + var conductorWorkFlow = new ConductorWorkflow() + .WithName(WORKFLOW_NAME).WithDescription(WORKFLOW_DESCRIPTION) + .WithTask(new SimpleTask(TASK_NAME, TASK_REFERENCE)) + .WithOwner(OWNER_EMAIL); + + var workflowVariableTobeAdded = new Dictionary + { + { VARIABLE_NAME_1, VARIABLE_OLD_VALUE}, + { VARIABLE_NAME_2, VARIABLE_OLD_VALUE } + }; + + conductorWorkFlow.Variables = workflowVariableTobeAdded; + return conductorWorkFlow; + } + + public void UpdateWorkflowVariablesWithWorkFlowId() + { + var orkesApiClient = new OrkesApiClient(new Configuration(), + new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + var workflowClient = orkesApiClient.GetClient(); + var workFlowVariables = new Dictionary + { + { VARIABLE_NAME_1, VARIABLE_NEW_VALUE_1 }, + { VARIABLE_NAME_2, VARIABLE_NEW_VALUE_2 } + }; + + workflowClient.UpdateWorkflowVariables(new Conductor.Client.Models.Workflow() + { + WorkflowId = WORKFLOW_ID, + Variables = workFlowVariables + }); + } + + } +} From cf4449e0d634f02063478e799a6cc38b2e5107dd Mon Sep 17 00:00:00 2001 From: "Jithesh.Poojary" Date: Wed, 10 Jan 2024 16:09:29 +0530 Subject: [PATCH 4/5] Resolved lint whitespace errors --- Conductor/Api/WorkflowResourceApi.cs | 192 +++++++++++----------- Conductor/Definition/ConductorWorkflow.cs | 16 +- 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/Conductor/Api/WorkflowResourceApi.cs b/Conductor/Api/WorkflowResourceApi.cs index 4cd83b41..6331f259 100644 --- a/Conductor/Api/WorkflowResourceApi.cs +++ b/Conductor/Api/WorkflowResourceApi.cs @@ -72,26 +72,26 @@ public interface IWorkflowResourceApi : IApiAccessor /// WorkflowRun WorkflowRun ExecuteWorkflow(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); - /// - /// Update the value of the workflow variables for the given workflow id - /// - /// - /// ApiResponse of Object(void) - Object UpdateWorkflowVariables(Workflow workflow); - /// - /// Execute a workflow synchronously - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// (optional) - /// ApiResponse of WorkflowRun - ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); + /// + /// Update the value of the workflow variables for the given workflow id + /// + /// + /// ApiResponse of Object(void) + Object UpdateWorkflowVariables(Workflow workflow); + /// + /// Execute a workflow synchronously + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// (optional) + /// ApiResponse of WorkflowRun + ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest body, string requestId, string name, int? version, string waitUntilTaskRef = null); /// /// Gets the workflow by workflow id /// @@ -1035,82 +1035,82 @@ public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest (WorkflowRun)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkflowRun))); } - public Object UpdateWorkflowVariables(Workflow workflow) - { - ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); - return localVarResponse.Data; - } - - public ApiResponse UpdateWorkflowVariablesWithHttpInfo(Workflow workflow) - { - // verify the required parameter 'body' is set - if (workflow == null) - throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Update"); - - if (string.IsNullOrEmpty(workflow.WorkflowId)) - throw new ApiException(400, "Missing required parameter 'WorkflowId' when calling WorkflowResourceApi->Update"); - - if (workflow.Variables == null) - throw new ApiException(400, "Missing required parameter 'Variables' when calling WorkflowResourceApi->Update"); - - var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; - 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 (workflow != null && workflow.GetType() != typeof(byte[])) - { - localVarPostBody = this.Configuration.ApiClient.Serialize(workflow.Variables); - } - - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } - - IRestResponse localVarResponse = (IRestResponse)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("Update", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); - } - - /// - /// Gets the workflow by workflow id - /// - /// Thrown when fails to make API call - /// - /// (optional, default to true) - /// (optional, default to false) - /// Workflow - public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) + public Object UpdateWorkflowVariables(Workflow workflow) + { + ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); + return localVarResponse.Data; + } + + public ApiResponse UpdateWorkflowVariablesWithHttpInfo(Workflow workflow) + { + // verify the required parameter 'body' is set + if (workflow == null) + throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Update"); + + if (string.IsNullOrEmpty(workflow.WorkflowId)) + throw new ApiException(400, "Missing required parameter 'WorkflowId' when calling WorkflowResourceApi->Update"); + + if (workflow.Variables == null) + throw new ApiException(400, "Missing required parameter 'Variables' when calling WorkflowResourceApi->Update"); + + var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; + 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 (workflow != null && workflow.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(workflow.Variables); + } + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; + } + + IRestResponse localVarResponse = (IRestResponse)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("Update", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + } + + /// + /// Gets the workflow by workflow id + /// + /// Thrown when fails to make API call + /// + /// (optional, default to true) + /// (optional, default to false) + /// Workflow + public Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = null) { ApiResponse localVarResponse = GetExecutionStatusWithHttpInfo(workflowId, includeTasks, summarize); return localVarResponse.Data; diff --git a/Conductor/Definition/ConductorWorkflow.cs b/Conductor/Definition/ConductorWorkflow.cs index 31629573..3a50bbbb 100644 --- a/Conductor/Definition/ConductorWorkflow.cs +++ b/Conductor/Definition/ConductorWorkflow.cs @@ -62,14 +62,14 @@ public ConductorWorkflow WithOutputParameter(string key, object value) return this; } - public ConductorWorkflow WithVariable(string key, object value) - { - if (Variables == null) // if workflow does not have any variables, initialize with empty collection - Variables = new Dictionary(); - Variables.Add(key, value); - return this; - } - public ConductorWorkflow WithOwner(string ownerEmail) + public ConductorWorkflow WithVariable(string key, object value) + { + if (Variables == null) // if workflow does not have any variables, initialize with empty collection + Variables = new Dictionary(); + Variables.Add(key, value); + return this; + } + public ConductorWorkflow WithOwner(string ownerEmail) { OwnerEmail = ownerEmail; return this; From 293ef61c8da9707f769070fdf043b4cc5912d4f4 Mon Sep 17 00:00:00 2001 From: "Jithesh.Poojary" Date: Wed, 10 Jan 2024 16:26:48 +0530 Subject: [PATCH 5/5] Fixing the space issues --- Conductor/Api/WorkflowResourceApi.cs | 70 +++++------ Conductor/Definition/ConductorWorkflow.cs | 6 +- Tests/Api/WorkflowResourceApiTest.cs | 146 +++++++++++----------- csharp-examples/Runner.cs | 4 +- csharp-examples/WorkFlowExamples.cs | 110 ++++++++-------- 5 files changed, 168 insertions(+), 168 deletions(-) diff --git a/Conductor/Api/WorkflowResourceApi.cs b/Conductor/Api/WorkflowResourceApi.cs index 6331f259..409632af 100644 --- a/Conductor/Api/WorkflowResourceApi.cs +++ b/Conductor/Api/WorkflowResourceApi.cs @@ -1037,67 +1037,67 @@ public ApiResponse ExecuteWorkflowWithHttpInfo(StartWorkflowRequest public Object UpdateWorkflowVariables(Workflow workflow) { - ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); - return localVarResponse.Data; + ApiResponse localVarResponse = UpdateWorkflowVariablesWithHttpInfo(workflow); + return localVarResponse.Data; } public ApiResponse UpdateWorkflowVariablesWithHttpInfo(Workflow workflow) { - // verify the required parameter 'body' is set - if (workflow == null) + // verify the required parameter 'body' is set + if (workflow == null) throw new ApiException(400, "Missing required parameter 'body' when calling WorkflowResourceApi->Update"); - if (string.IsNullOrEmpty(workflow.WorkflowId)) + if (string.IsNullOrEmpty(workflow.WorkflowId)) throw new ApiException(400, "Missing required parameter 'WorkflowId' when calling WorkflowResourceApi->Update"); - if (workflow.Variables == null) + if (workflow.Variables == null) throw new ApiException(400, "Missing required parameter 'Variables' when calling WorkflowResourceApi->Update"); - var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; - 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; + var localVarPath = $"/workflow/{workflow.WorkflowId}/variables"; + 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[] { + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { "application/json" - }; - String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { "*/*" - }; - String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (workflow != null && workflow.GetType() != typeof(byte[])) - { + if (workflow != null && workflow.GetType() != typeof(byte[])) + { localVarPostBody = this.Configuration.ApiClient.Serialize(workflow.Variables); - } + } - // authentication (api_key) required - if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) - { + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken; - } + } - IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, + IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); - int localVarStatusCode = (int)localVarResponse.StatusCode; + int localVarStatusCode = (int)localVarResponse.StatusCode; - if (ExceptionFactory != null) - { + if (ExceptionFactory != null) + { Exception exception = ExceptionFactory("Update", localVarResponse); if (exception != null) throw exception; - } + } - return new ApiResponse(localVarStatusCode, + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); } diff --git a/Conductor/Definition/ConductorWorkflow.cs b/Conductor/Definition/ConductorWorkflow.cs index 3a50bbbb..e22a01a9 100644 --- a/Conductor/Definition/ConductorWorkflow.cs +++ b/Conductor/Definition/ConductorWorkflow.cs @@ -64,10 +64,10 @@ public ConductorWorkflow WithOutputParameter(string key, object value) public ConductorWorkflow WithVariable(string key, object value) { - if (Variables == null) // if workflow does not have any variables, initialize with empty collection + if (Variables == null) // if workflow does not have any variables, initialize with empty collection Variables = new Dictionary(); - Variables.Add(key, value); - return this; + Variables.Add(key, value); + return this; } public ConductorWorkflow WithOwner(string ownerEmail) { diff --git a/Tests/Api/WorkflowResourceApiTest.cs b/Tests/Api/WorkflowResourceApiTest.cs index 527ea411..343c3bc7 100644 --- a/Tests/Api/WorkflowResourceApiTest.cs +++ b/Tests/Api/WorkflowResourceApiTest.cs @@ -14,84 +14,84 @@ namespace conductor_csharp.test.Api { - public class WorkflowResourceApiTest - { - private const string WORKFLOW_NAME = "TestToCreateVariables"; - private const string TASK_NAME = "TestToCreateVariables_Task"; - private const string WORKFLOW_VARIABLE_1 = "TestVariable1"; - private const string WORKFLOW_VARIABLE_2 = "TestVariable2"; - private const string WORKFLOW_DESC = "Test Workflow With Variables"; - private const int WORKFLOW_VERSION = 1; + public class WorkflowResourceApiTest + { + private const string WORKFLOW_NAME = "TestToCreateVariables"; + private const string TASK_NAME = "TestToCreateVariables_Task"; + private const string WORKFLOW_VARIABLE_1 = "TestVariable1"; + private const string WORKFLOW_VARIABLE_2 = "TestVariable2"; + private const string WORKFLOW_DESC = "Test Workflow With Variables"; + private const int WORKFLOW_VERSION = 1; - private readonly WorkflowResourceApi _workflowClient; - private readonly ILogger _logger; + private readonly WorkflowResourceApi _workflowClient; + private readonly ILogger _logger; - public WorkflowResourceApiTest() - { - _workflowClient = ApiExtensions.GetClient(); - _logger = ApplicationLogging.CreateLogger(); - } + public WorkflowResourceApiTest() + { + _workflowClient = ApiExtensions.GetClient(); + _logger = ApplicationLogging.CreateLogger(); + } - [Fact] - public async void UpdateWorkflowVariables() - { - // Prepare workflow - var _workflow = GetConductorWorkflow(); - ApiExtensions.GetWorkflowExecutor().RegisterWorkflow(_workflow, true); - var workflowId = ApiExtensions.GetWorkflowExecutor().StartWorkflow(_workflow); - await ExecuteWorkflowTasks(workflowCompletionTimeout: TimeSpan.FromSeconds(20)); - await ValidateWorkflowCompletion(workflowId); + [Fact] + public async void UpdateWorkflowVariables() + { + // Prepare workflow + var _workflow = GetConductorWorkflow(); + ApiExtensions.GetWorkflowExecutor().RegisterWorkflow(_workflow, true); + var workflowId = ApiExtensions.GetWorkflowExecutor().StartWorkflow(_workflow); + await ExecuteWorkflowTasks(workflowCompletionTimeout: TimeSpan.FromSeconds(20)); + await ValidateWorkflowCompletion(workflowId); - // Create variables collection with values to be updated - var updateDict = new Dictionary { - {WORKFLOW_VARIABLE_1,"Value1" }, - {WORKFLOW_VARIABLE_2,"Value2" }, - }; - var updateVariableData = new Workflow() { WorkflowId = workflowId, Variables = updateDict }; - // Update the work flow variables - _workflowClient.UpdateWorkflowVariables(updateVariableData); - // Fetch latest workflow data to validate the change in variables - var _updatedWorkFlow = _workflowClient.GetWorkflowStatusSummary(workflowId, includeVariables: true); - // Verify workflow variables data is equal with input passed - Assert.Equal(_updatedWorkFlow.Variables, updateDict); - } + // Create variables collection with values to be updated + var updateDict = new Dictionary { + {WORKFLOW_VARIABLE_1,"Value1" }, + {WORKFLOW_VARIABLE_2,"Value2" }, + }; + var updateVariableData = new Workflow() { WorkflowId = workflowId, Variables = updateDict }; + // Update the work flow variables + _workflowClient.UpdateWorkflowVariables(updateVariableData); + // Fetch latest workflow data to validate the change in variables + var _updatedWorkFlow = _workflowClient.GetWorkflowStatusSummary(workflowId, includeVariables: true); + // Verify workflow variables data is equal with input passed + Assert.Equal(_updatedWorkFlow.Variables, updateDict); + } - private async System.Threading.Tasks.Task ExecuteWorkflowTasks(TimeSpan workflowCompletionTimeout) - { - var host = WorkflowTaskHost.CreateWorkerHost(LogLevel.Information, new ClassWorker()); - await host.StartAsync(); - Thread.Sleep(workflowCompletionTimeout); - await host.StopAsync(); - } + private async System.Threading.Tasks.Task ExecuteWorkflowTasks(TimeSpan workflowCompletionTimeout) + { + var host = WorkflowTaskHost.CreateWorkerHost(LogLevel.Information, new ClassWorker()); + await host.StartAsync(); + Thread.Sleep(workflowCompletionTimeout); + await host.StopAsync(); + } - private ConductorWorkflow GetConductorWorkflow() - { - return new ConductorWorkflow() - .WithName(WORKFLOW_NAME) - .WithVersion(WORKFLOW_VERSION) - .WithDescription(WORKFLOW_DESC) - .WithTask(new SimpleTask(TASK_NAME, TASK_NAME)) - .WithVariable(WORKFLOW_VARIABLE_1, $"{WORKFLOW_VARIABLE_1}_Value") - .WithVariable(WORKFLOW_VARIABLE_2, $"{WORKFLOW_VARIABLE_2}_Value"); - } + private ConductorWorkflow GetConductorWorkflow() + { + return new ConductorWorkflow() + .WithName(WORKFLOW_NAME) + .WithVersion(WORKFLOW_VERSION) + .WithDescription(WORKFLOW_DESC) + .WithTask(new SimpleTask(TASK_NAME, TASK_NAME)) + .WithVariable(WORKFLOW_VARIABLE_1, $"{WORKFLOW_VARIABLE_1}_Value") + .WithVariable(WORKFLOW_VARIABLE_2, $"{WORKFLOW_VARIABLE_2}_Value"); + } - private async System.Threading.Tasks.Task ValidateWorkflowCompletion(params string[] workflowIdList) - { - var workflowStatusList = await WorkflowExtensions.GetWorkflowStatusList( - _workflowClient, - maxAllowedInParallel: 10, - workflowIdList - ); - var incompleteWorkflowCounter = 0; - workflowStatusList.ToList().ForEach(wf => - { - if (wf.Status.Value != WorkflowStatus.StatusEnum.COMPLETED) - { - incompleteWorkflowCounter += 1; - _logger.LogInformation($"Workflow not completed, workflowId: {wf.WorkflowId}"); - } - }); - Assert.Equal(0, incompleteWorkflowCounter); - } - } + private async System.Threading.Tasks.Task ValidateWorkflowCompletion(params string[] workflowIdList) + { + var workflowStatusList = await WorkflowExtensions.GetWorkflowStatusList( + _workflowClient, + maxAllowedInParallel: 10, + workflowIdList + ); + var incompleteWorkflowCounter = 0; + workflowStatusList.ToList().ForEach(wf => + { + if (wf.Status.Value != WorkflowStatus.StatusEnum.COMPLETED) + { + incompleteWorkflowCounter += 1; + _logger.LogInformation($"Workflow not completed, workflowId: {wf.WorkflowId}"); + } + }); + Assert.Equal(0, incompleteWorkflowCounter); + } + } } diff --git a/csharp-examples/Runner.cs b/csharp-examples/Runner.cs index 02134d01..24123c5c 100644 --- a/csharp-examples/Runner.cs +++ b/csharp-examples/Runner.cs @@ -50,8 +50,8 @@ public async void StartTasks() } } - while (true) - Thread.Sleep(TimeSpan.FromDays(1)); // after 1 year will stop the service + while (true) + Thread.Sleep(TimeSpan.FromDays(1));// after 1 year will stop the service } catch (Exception e) diff --git a/csharp-examples/WorkFlowExamples.cs b/csharp-examples/WorkFlowExamples.cs index 777519f2..5922836e 100644 --- a/csharp-examples/WorkFlowExamples.cs +++ b/csharp-examples/WorkFlowExamples.cs @@ -7,71 +7,71 @@ namespace csharp_examples { - public class WorkFlowExamples - { + public class WorkFlowExamples + { - private const string KEY_ID = ""; - private const string KEY_SECRET = ""; - private const string OWNER_EMAIL = ""; + 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 = ""; - private const string TASK_NAME = ""; - private const string TASK_REFERENCE = ""; + private const string WORKFLOW_ID = ""; + private const string WORKFLOW_NAME = ""; + private const string WORKFLOW_DESCRIPTION = ""; + private const string TASK_NAME = ""; + private const string TASK_REFERENCE = ""; - private const string VARIABLE_OLD_VALUE = "SOME_OLD_VALUE"; - private const string VARIABLE_NAME_1 = ""; - private const string VARIABLE_NEW_VALUE_1 = ""; - private const string VARIABLE_NAME_2 = ""; - private const string VARIABLE_NEW_VALUE_2 = ""; + private const string VARIABLE_OLD_VALUE = "SOME_OLD_VALUE"; + private const string VARIABLE_NAME_1 = ""; + private const string VARIABLE_NEW_VALUE_1 = ""; + private const string VARIABLE_NAME_2 = ""; + private const string VARIABLE_NEW_VALUE_2 = ""; - public void RegisterWorkFlow() - { - Configuration configuration = new Configuration() - { - AuthenticationSettings = new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET) - }; + public void RegisterWorkFlow() + { + Configuration configuration = new Configuration() + { + AuthenticationSettings = new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET) + }; - WorkflowExecutor executor = new WorkflowExecutor(configuration); - executor.RegisterWorkflow(GetConductorWorkflow(), true); - } + WorkflowExecutor executor = new WorkflowExecutor(configuration); + executor.RegisterWorkflow(GetConductorWorkflow(), true); + } - private ConductorWorkflow GetConductorWorkflow() - { - var conductorWorkFlow = new ConductorWorkflow() - .WithName(WORKFLOW_NAME).WithDescription(WORKFLOW_DESCRIPTION) - .WithTask(new SimpleTask(TASK_NAME, TASK_REFERENCE)) - .WithOwner(OWNER_EMAIL); + private ConductorWorkflow GetConductorWorkflow() + { + var conductorWorkFlow = new ConductorWorkflow() + .WithName(WORKFLOW_NAME).WithDescription(WORKFLOW_DESCRIPTION) + .WithTask(new SimpleTask(TASK_NAME, TASK_REFERENCE)) + .WithOwner(OWNER_EMAIL); - var workflowVariableTobeAdded = new Dictionary - { - { VARIABLE_NAME_1, VARIABLE_OLD_VALUE}, - { VARIABLE_NAME_2, VARIABLE_OLD_VALUE } - }; + var workflowVariableTobeAdded = new Dictionary + { + { VARIABLE_NAME_1, VARIABLE_OLD_VALUE}, + { VARIABLE_NAME_2, VARIABLE_OLD_VALUE } + }; - conductorWorkFlow.Variables = workflowVariableTobeAdded; - return conductorWorkFlow; - } + conductorWorkFlow.Variables = workflowVariableTobeAdded; + return conductorWorkFlow; + } - public void UpdateWorkflowVariablesWithWorkFlowId() - { - var orkesApiClient = new OrkesApiClient(new Configuration(), - new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); - var workflowClient = orkesApiClient.GetClient(); - var workFlowVariables = new Dictionary - { - { VARIABLE_NAME_1, VARIABLE_NEW_VALUE_1 }, - { VARIABLE_NAME_2, VARIABLE_NEW_VALUE_2 } - }; + public void UpdateWorkflowVariablesWithWorkFlowId() + { + var orkesApiClient = new OrkesApiClient(new Configuration(), + new OrkesAuthenticationSettings(KEY_ID, KEY_SECRET)); + var workflowClient = orkesApiClient.GetClient(); + var workFlowVariables = new Dictionary + { + { VARIABLE_NAME_1, VARIABLE_NEW_VALUE_1 }, + { VARIABLE_NAME_2, VARIABLE_NEW_VALUE_2 } + }; - workflowClient.UpdateWorkflowVariables(new Conductor.Client.Models.Workflow() - { - WorkflowId = WORKFLOW_ID, - Variables = workFlowVariables - }); - } + workflowClient.UpdateWorkflowVariables(new Conductor.Client.Models.Workflow() + { + WorkflowId = WORKFLOW_ID, + Variables = workFlowVariables + }); + } - } + } }