Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated set of APIs #103

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Conductor/Api/ITaskResourceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,23 @@ public interface ITaskResourceApi : IApiAccessor
/// <param name="workerid"> (optional)</param>
/// <returns>string</returns>
string UpdateTask(Dictionary<string, Object> body, string workflowId, string taskRefName, string status, string workerid = null);

/// <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);


#endregion Synchronous Operations

#region Asynchronous Operations
Expand Down Expand Up @@ -415,6 +431,22 @@ public interface ITaskResourceApi : IApiAccessor
/// <param name="workerid"> (optional)</param>
/// <returns>string</returns>
ThreadTask.Task<string> UpdateTaskAsync(Dictionary<string, Object> body, string workflowId, string taskRefName, string status, string workerid = null);

/// <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>
ThreadTask.Task<Workflow> UpdateTaskSyncAsync(Dictionary<string, Object> output, string workflowId, string taskRefName, TaskResult.StatusEnum status, string workerid = null);

#endregion Asynchronous Operations
}
}
66 changes: 59 additions & 7 deletions Conductor/Api/IWorkflowResourceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ 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>
/// Gets the workflow by workflow id
/// </summary>
Expand All @@ -70,6 +72,18 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <param name="summarize"> (optional, default to false)</param>
/// <returns>Workflow</returns>
Workflow GetExecutionStatus(string workflowId, bool? includeTasks = null, bool? summarize = 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 = null);

/// <summary>
/// Gets the workflow tasks by workflow id
Expand Down Expand Up @@ -383,7 +397,19 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Object</returns>
Object UploadCompletedWorkflows();


/// <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);

#endregion Synchronous Operations

#region Asynchronous Operations
Expand Down Expand Up @@ -428,9 +454,11 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <summary>
/// Asynchronous Update the value of the workflow variables for the given workflow id
/// </summary>
/// <param name="workflow"></param>
/// <returns>ApiResponse of Object(void)</returns>
ThreadTask.Task<Object> UpdateWorkflowVariablesAsync(Workflow workflow);
/// <param name="workflowId"></param>
/// /// <param name="variables"></param>
/// <returns>Workflow</returns>
ThreadTask.Task<Workflow> UpdateWorkflowVariablesAsync(string workflowId, Dictionary<string, Object> variables);


/// <summary>
/// Asynchronous Gets the workflow by workflow id
Expand All @@ -444,6 +472,18 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <param name="summarize"> (optional, default to false)</param>
/// <returns>Workflow</returns>
ThreadTask.Task<Workflow> GetExecutionStatusAsync(string workflowId, bool? includeTasks = null, bool? summarize = null);

/// <summary>
/// Asynchronous 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>
ThreadTask.Task<Workflow> GetWorkflowAsync(string workflowId, bool? includeTasks = null);

/// <summary>
/// Asynchronous Gets the workflow tasks by workflow id
Expand Down Expand Up @@ -757,6 +797,18 @@ public interface IWorkflowResourceApi : IApiAccessor
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Object</returns>
ThreadTask.Task<Object> UploadCompletedWorkflowsAsync();

/// <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>
ThreadTask.Task<WorkflowRun> UpdateWorkflowAsync(string workflowId, WorkflowStateUpdate request,
List<string> waitUntilTaskRefs = null, int? waitForSeconds = null);

#endregion Asynchronous Operations
}
Expand Down
135 changes: 126 additions & 9 deletions Conductor/Api/TaskResourceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,14 +1532,131 @@ 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();
// }

// public ApiResponse<ExternalStorageLocation> GetExternalStorageLocationWithHttpInfo(string path, string operation, string payloadType)
// {
// throw new NotImplementedException();
// }
/// <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>
public Workflow UpdateTaskSync(Dictionary<string, Object> output, string workflowId, string taskRefName,
TaskResult.StatusEnum status, string workerid = null)
{
var response = UpdateTaskSyncWithHttpInfo(output, workflowId, taskRefName, status, workerid);
return response.Data;
}

/// <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>
public async ThreadTask.Task<Workflow> UpdateTaskSyncAsync(Dictionary<string, Object> output, string workflowId,
string taskRefName, TaskResult.StatusEnum status, string workerid = null)
{
ApiResponse<Workflow> localVarResponse = await ThreadTask.Task.FromResult(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;
}

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
RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);

int localVarStatusCode = (int)localVarResponse.StatusCode;

if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("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