Skip to content

Commit

Permalink
add support for new apis
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r3n committed Jan 31, 2024
1 parent f8c1fa6 commit 1354768
Show file tree
Hide file tree
Showing 10 changed files with 785 additions and 127 deletions.
67 changes: 64 additions & 3 deletions Conductor/Api/IWorkflowResourceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,19 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <summary>
/// Update the value of the workflow variables for the given workflow id
/// </summary>
/// <param name="workflow"></param>
/// <returns>ApiResponse of Object(void)</returns>
Object UpdateWorkflowVariables(Workflow workflow);
/// <param name="workflowId"></param>
/// /// <param name="variables"></param>
/// <returns>Workflow</returns>
Workflow UpdateWorkflowVariables(string workflowId, Dictionary<string, Object> variables);

/// <summary>
/// Update the value of the workflow variables for the given workflow id and return api response
/// </summary>
/// <param name="workflowId"></param>
/// /// <param name="variables"></param>
/// <returns>Workflow</returns>
ApiResponse<Workflow> UpdateWorkflowVariablesWithHttpInfo(string workflowId, Dictionary<string, Object> variables);

/// <summary>
/// Execute a workflow synchronously
/// </summary>
Expand Down Expand Up @@ -672,6 +682,57 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <param name="request"></param>
/// <returns>ApiResponse of Workflow</returns>
ApiResponse<Workflow> TestWorkflowWithHttpInfo(WorkflowTestRequest request);

/// <summary>
/// Update a workflow state by updating variables or in progress task Updates the workflow variables, tasks and triggers evaluation.
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="request"></param>
/// <param name="workflowId"></param>
/// <param name="waitUntilTaskRefs"> (optional)</param>
/// <param name="waitForSeconds"> (optional, default to 10)</param>
/// <returns>WorkflowRun</returns>
WorkflowRun UpdateWorkflow(string workflowId, WorkflowStateUpdate request,
List<string> waitUntilTaskRefs = null, int? waitForSeconds = null);


/// <summary>
/// Update a workflow state by updating variables or in progress task Updates the workflow variables, tasks and triggers evaluation.
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="request"></param>
/// <param name="workflowId"></param>
/// <param name="waitUntilTaskRefs"> (optional)</param>
/// <param name="waitForSeconds"> (optional, default to 10)</param>
/// <returns>WorkflowRun</returns>
ApiResponse<WorkflowRun> UpdateWorkflowWithHttpInfo(string workflowId, WorkflowStateUpdate request,
List<string> waitUntilTaskRefs = null, int? waitForSeconds = null);

/// <summary>
/// Gets the workflow by workflow id
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="workflowId"></param>
/// <param name="includeTasks"> (optional, default to true)</param>
/// <returns>Workflow</returns>
Workflow GetWorkflow(string workflowId, bool includeTasks);


/// <summary>
/// Gets the workflow by workflow id
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="workflowId"></param>
/// <param name="includeTasks"> (optional, default to true)</param>
/// <returns>Workflow</returns>
ApiResponse<Workflow> GetWorkflowWithHttpInfo(string workflowId, bool includeTasks);

#endregion Synchronous Operations
}
}
141 changes: 133 additions & 8 deletions Conductor/Api/TaskResourceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,38 @@ public interface ITaskResourceApi : IApiAccessor
/// <param name="status"></param>
/// <returns>ApiResponse of string</returns>
ApiResponse<string> UpdateTaskWithHttpInfo(Dictionary<string, Object> body, string workflowId, string taskRefName, string status, string workerid = null);


//aa
/// <summary>
/// Update a task By Ref Name, evaluates the workflow and returns the updated workflow
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="output"></param>
/// <param name="workflowId"></param>
/// <param name="taskRefName"></param>
/// <param name="status"></param>
/// <param name="workerid"> (optional)</param>
/// <returns>Workflow</returns>
Workflow UpdateTaskSync(Dictionary<string, Object> output, string workflowId, string taskRefName, TaskResult.StatusEnum status, string workerid = null);

/// <summary>
/// Update a task By Ref Name
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="output"></param>
/// <param name="workflowId"></param>
/// <param name="taskRefName"></param>
/// <param name="status"></param>
/// <returns>ApiResponse of Workflow</returns>
ApiResponse<Workflow> UpdateTaskSyncWithHttpInfo(Dictionary<string, Object> output, string workflowId, string taskRefName, TaskResult.StatusEnum status, string workerid = null);
//aaa
#endregion Synchronous Operations
}

Expand Down Expand Up @@ -1704,14 +1736,107 @@ public ApiResponse<string> UpdateTaskWithHttpInfo(Dictionary<string, Object> bod
(string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string)));
}

// public ExternalStorageLocation GetExternalStorageLocation(string path, string operation, string payloadType)
// {
// throw new NotImplementedException();
// }
/// <summary>
/// Update a task By Ref Name
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="output"></param>
/// <param name="workflowId"></param>
/// <param name="taskRefName"></param>
/// <param name="status"></param>
/// <param name="workerid"> (optional)</param>
/// <returns>string</returns>
public Workflow UpdateTaskSync(Dictionary<string, Object> output, string workflowId, string taskRefName, TaskResult.StatusEnum status, string workerid = null)
{
ApiResponse<Workflow> localVarResponse = UpdateTaskSyncWithHttpInfo(output, workflowId, taskRefName, status, workerid);
return localVarResponse.Data;
}

/// <summary>
/// Update a task By Ref Name
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="output"></param>
/// <param name="workflowId"></param>
/// <param name="taskRefName"></param>
/// <param name="status"></param>
/// <returns>ApiResponse of string</returns>
public ApiResponse<Workflow> UpdateTaskSyncWithHttpInfo(Dictionary<string, Object> output, string workflowId, string taskRefName, TaskResult.StatusEnum status, string workerid = null)
{
// verify the required parameter 'body' is set
if (output == null)
throw new ApiException(400, "Missing required parameter 'body' when calling TaskResourceApi->UpdateTask");
// verify the required parameter 'workflowId' is set
if (workflowId == null)
throw new ApiException(400, "Missing required parameter 'workflowId' when calling TaskResourceApi->UpdateTask");
// verify the required parameter 'taskRefName' is set
if (taskRefName == null)
throw new ApiException(400, "Missing required parameter 'taskRefName' when calling TaskResourceApi->UpdateTask");
// verify the required parameter 'status' is set
if (status == null)
throw new ApiException(400, "Missing required parameter 'status' when calling TaskResourceApi->UpdateTask");

var localVarPath = "/tasks/{workflowId}/{taskRefName}/{status}/sync";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
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 (workerid == null)
{
workerid = Environment.MachineName;
}

// public ApiResponse<ExternalStorageLocation> GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType)
// {
// throw new NotImplementedException();
// }
if (workflowId != null) localVarPathParams.Add("workflowId", this.Configuration.ApiClient.ParameterToString(workflowId)); // path parameter
if (taskRefName != null) localVarPathParams.Add("taskRefName", this.Configuration.ApiClient.ParameterToString(taskRefName)); // path parameter
if (status != null) localVarPathParams.Add("status", this.Configuration.ApiClient.ParameterToString(status)); // path parameter
if (workerid != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "workerid", workerid)); // query parameter
if (output != null && output.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(output); // http body (model) parameter
}
else
{
localVarPostBody = output; // 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("UpdateTask", localVarResponse);
if (exception != null) throw exception;
}

return new ApiResponse<Workflow>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Workflow)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Workflow)));
}
}
}
Loading

0 comments on commit 1354768

Please sign in to comment.