From 9638a8031d9b565a5ba03734ddf55a49a52ee173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:37:34 +0100 Subject: [PATCH 01/33] start refactor --- .sourcegen/conductorapi.json | 2785 ++++++++ src/ConductorSharp.Client/ApiException.cs | 28 + .../Response => }/ConductorErrorResponse.cs | 15 +- .../ConductorSharp.Client.csproj | 2 +- .../Generated/ConductorClient.cs | 5735 +++++++++++++++++ src/ConductorSharp.Client/Generated/Models.cs | 1629 +++++ .../Model/Common/EventHandlerDefinition.cs | 102 - .../Model/Common/TaskDefinition.cs | 119 - .../Model/Common/WorkflowDefinition.cs | 186 - .../Model/Request/QueueWorkflowRequest.cs | 17 - .../Model/Request/UpdateTaskRequest.cs | 40 - .../Model/Request/WorkflowSearchRequest.cs | 16 - .../Model/Request/WorkflowTestRequest.cs | 30 - .../Response/ConductorValidationError.cs | 13 - .../Model/Response/ExternalStorageResponse.cs | 8 - .../Response/GetAllTaskDefinitionsResponse.cs | 12 - .../GetAllWorkflowDefinitionsResponse.cs | 12 - .../Response/GetTaskDefinitionResponse.cs | 11 - .../Model/Response/GetTaskLogsResponse.cs | 16 - .../Response/GetWorkflowDefinitionResponse.cs | 11 - .../Model/Response/HealthResponse.cs | 42 - .../Model/Response/PollDataResponse.cs | 22 - .../Model/Response/PollTaskResponse.cs | 110 - .../Model/Response/TaskStatusResponse.cs | 41 - .../Response/ValidateWorkflowResponse.cs | 30 - .../Response/WorkflowDescriptorResponse.cs | 7 - .../Model/Response/WorkflowSearchResponse.cs | 42 - .../Model/Response/WorkflowStatusResponse.cs | 30 - .../WorkflowsNamesAndVersionsResponse.cs | 16 - .../Service/ConductorClient.cs | 146 - .../Service/HealthService.cs | 15 +- .../Service/IConductorClient.cs | 17 - .../Service/IHealthService.cs | 5 +- .../Service/IMetadataService.cs | 28 - .../Service/ITaskService.cs | 27 - .../Service/IWorkflowService.cs | 17 - src/ConductorSharp.Client/Util/ApiUrls.cs | 127 - .../ConductorSharp.Engine.csproj | 2 +- .../ConductorSharp.Patterns.csproj | 2 +- 39 files changed, 10203 insertions(+), 1310 deletions(-) create mode 100644 .sourcegen/conductorapi.json create mode 100644 src/ConductorSharp.Client/ApiException.cs rename src/ConductorSharp.Client/{Model/Response => }/ConductorErrorResponse.cs (59%) create mode 100644 src/ConductorSharp.Client/Generated/ConductorClient.cs create mode 100644 src/ConductorSharp.Client/Generated/Models.cs delete mode 100644 src/ConductorSharp.Client/Model/Common/EventHandlerDefinition.cs delete mode 100644 src/ConductorSharp.Client/Model/Common/TaskDefinition.cs delete mode 100644 src/ConductorSharp.Client/Model/Common/WorkflowDefinition.cs delete mode 100644 src/ConductorSharp.Client/Model/Request/QueueWorkflowRequest.cs delete mode 100644 src/ConductorSharp.Client/Model/Request/UpdateTaskRequest.cs delete mode 100644 src/ConductorSharp.Client/Model/Request/WorkflowSearchRequest.cs delete mode 100644 src/ConductorSharp.Client/Model/Request/WorkflowTestRequest.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/ConductorValidationError.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/ExternalStorageResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/GetAllTaskDefinitionsResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/GetAllWorkflowDefinitionsResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/GetTaskDefinitionResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/GetTaskLogsResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/GetWorkflowDefinitionResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/HealthResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/PollDataResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/PollTaskResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/TaskStatusResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/ValidateWorkflowResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/WorkflowDescriptorResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/WorkflowSearchResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/WorkflowStatusResponse.cs delete mode 100644 src/ConductorSharp.Client/Model/Response/WorkflowsNamesAndVersionsResponse.cs delete mode 100644 src/ConductorSharp.Client/Service/ConductorClient.cs delete mode 100644 src/ConductorSharp.Client/Service/IConductorClient.cs delete mode 100644 src/ConductorSharp.Client/Service/IMetadataService.cs delete mode 100644 src/ConductorSharp.Client/Service/ITaskService.cs delete mode 100644 src/ConductorSharp.Client/Service/IWorkflowService.cs delete mode 100644 src/ConductorSharp.Client/Util/ApiUrls.cs diff --git a/.sourcegen/conductorapi.json b/.sourcegen/conductorapi.json new file mode 100644 index 00000000..9caf2432 --- /dev/null +++ b/.sourcegen/conductorapi.json @@ -0,0 +1,2785 @@ +{ + "openapi": "3.0.1", + "info": { "title": "OpenAPI definition", "version": "v0" }, + "servers": [ + { "url": "http://dev.cxo.lab:8081", "description": "Generated server url" } + ], + "paths": { + "/api/workflow/{workflowId}/skiptask/{taskReferenceName}": { + "put": { + "tags": ["workflow-resource"], + "summary": "Skips a given task from a current running workflow", + "operationId": "skipTaskFromWorkflow", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "taskReferenceName", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "skipTaskRequest", + "in": "query", + "required": true, + "schema": { "$ref": "#/components/schemas/SkipTaskRequest" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/workflow/{workflowId}/resume": { + "put": { + "tags": ["workflow-resource"], + "summary": "Resumes the workflow", + "operationId": "resumeWorkflow", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/workflow/{workflowId}/pause": { + "put": { + "tags": ["workflow-resource"], + "summary": "Pauses the workflow", + "operationId": "pauseWorkflow", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/workflow/decide/{workflowId}": { + "put": { + "tags": ["workflow-resource"], + "summary": "Starts the decision task for a workflow", + "operationId": "decide", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/workflow/bulk/resume": { + "put": { + "tags": ["workflow-bulk-resource"], + "summary": "Resume the list of workflows", + "operationId": "resumeWorkflow_1", + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "array", "items": { "type": "string" } } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/BulkResponse" } + } + } + } + } + } + }, + "/api/workflow/bulk/pause": { + "put": { + "tags": ["workflow-bulk-resource"], + "summary": "Pause the list of workflows", + "operationId": "pauseWorkflow_1", + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "array", "items": { "type": "string" } } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/BulkResponse" } + } + } + } + } + } + }, + "/api/metadata/workflow": { + "get": { + "tags": ["metadata-resource"], + "summary": "Retrieves all workflow definition along with blueprint", + "operationId": "getAll", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowDef" } + } + } + } + } + } + }, + "put": { + "tags": ["metadata-resource"], + "summary": "Create or update workflow definition", + "operationId": "update", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowDef" } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/BulkResponse" } + } + } + } + } + }, + "post": { + "tags": ["metadata-resource"], + "summary": "Create a new workflow definition", + "operationId": "create", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/WorkflowDef" } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/metadata/taskdefs": { + "get": { + "tags": ["metadata-resource"], + "summary": "Gets all task definition", + "operationId": "getTaskDefs", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/TaskDef" } + } + } + } + } + } + }, + "put": { + "tags": ["metadata-resource"], + "summary": "Update an existing task", + "operationId": "registerTaskDef", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskDef" } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + }, + "post": { + "tags": ["metadata-resource"], + "summary": "Create new task definition(s)", + "operationId": "registerTaskDef_1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/TaskDef" } + } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/event": { + "get": { + "tags": ["event-resource"], + "summary": "Get all the event handlers", + "operationId": "getEventHandlers", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/EventHandler" } + } + } + } + } + } + }, + "put": { + "tags": ["event-resource"], + "summary": "Update an existing event handler.", + "operationId": "updateEventHandler", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/EventHandler" } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + }, + "post": { + "tags": ["event-resource"], + "summary": "Add a new event handler.", + "operationId": "addEventHandler", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/EventHandler" } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/workflow": { + "post": { + "tags": ["workflow-resource"], + "summary": "Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain", + "operationId": "startWorkflow", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/StartWorkflowRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/api/workflow/{workflowId}/retry": { + "post": { + "tags": ["workflow-resource"], + "summary": "Retries the last failed task", + "operationId": "retry", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "resumeSubworkflowTasks", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + } + ], + "responses": { "204": { "description": "No Content" } } + } + }, + "/api/workflow/{workflowId}/restart": { + "post": { + "tags": ["workflow-resource"], + "summary": "Restarts a completed workflow", + "operationId": "restart", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "useLatestDefinitions", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + } + ], + "responses": { "204": { "description": "No Content" } } + } + }, + "/api/workflow/{workflowId}/resetcallbacks": { + "post": { + "tags": ["workflow-resource"], + "summary": "Resets callback times of all non-terminal SIMPLE tasks to 0", + "operationId": "resetWorkflow", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { "204": { "description": "No Content" } } + } + }, + "/api/workflow/{workflowId}/rerun": { + "post": { + "tags": ["workflow-resource"], + "summary": "Reruns the workflow from a specific task", + "operationId": "rerun", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/RerunWorkflowRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/api/workflow/{name}": { + "post": { + "tags": ["workflow-resource"], + "summary": "Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking", + "operationId": "startWorkflow_1", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "version", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32" } + }, + { + "name": "correlationId", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "priority", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/api/workflow/{name}/correlated": { + "post": { + "tags": ["workflow-resource"], + "summary": "Lists workflows for the given correlation id list", + "operationId": "getWorkflows", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "includeClosed", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + }, + { + "name": "includeTasks", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "array", "items": { "type": "string" } } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/Workflow" } + } + } + } + } + } + } + } + }, + "/api/workflow/test": { + "post": { + "tags": ["workflow-resource"], + "summary": "Test workflow execution using mock data", + "operationId": "testWorkflow", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/WorkflowTestRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Workflow" } + } + } + } + } + } + }, + "/api/workflow/bulk/terminate": { + "post": { + "tags": ["workflow-bulk-resource"], + "summary": "Terminate workflows execution", + "operationId": "terminate", + "parameters": [ + { + "name": "reason", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "array", "items": { "type": "string" } } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/BulkResponse" } + } + } + } + } + } + }, + "/api/workflow/bulk/retry": { + "post": { + "tags": ["workflow-bulk-resource"], + "summary": "Retry the last failed task for each workflow from the list", + "operationId": "retry_1", + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "array", "items": { "type": "string" } } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/BulkResponse" } + } + } + } + } + } + }, + "/api/workflow/bulk/restart": { + "post": { + "tags": ["workflow-bulk-resource"], + "summary": "Restart the list of completed workflow", + "operationId": "restart_1", + "parameters": [ + { + "name": "useLatestDefinitions", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "array", "items": { "type": "string" } } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/BulkResponse" } + } + } + } + } + } + }, + "/api/tasks": { + "post": { + "tags": ["task-resource"], + "summary": "Update a task", + "operationId": "updateTask", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskResult" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/api/tasks/{taskId}/log": { + "get": { + "tags": ["task-resource"], + "summary": "Get Task Execution Logs", + "operationId": "getTaskLogs", + "parameters": [ + { + "name": "taskId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/TaskExecLog" } + } + } + } + } + } + }, + "post": { + "tags": ["task-resource"], + "summary": "Log Task Execution Details", + "operationId": "log", + "parameters": [ + { + "name": "taskId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "requestBody": { + "content": { "application/json": { "schema": { "type": "string" } } }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/tasks/queue/requeue/{taskType}": { + "post": { + "tags": ["task-resource"], + "summary": "Requeue pending tasks", + "operationId": "requeuePendingTask", + "parameters": [ + { + "name": "taskType", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/api/queue/update/{workflowId}/{taskRefName}/{status}": { + "post": { + "tags": ["queue-admin-resource"], + "summary": "Publish a message in queue to mark a wait task as completed.", + "operationId": "update_1", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "taskRefName", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "status", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "CANCELED", + "FAILED", + "FAILED_WITH_TERMINAL_ERROR", + "COMPLETED", + "COMPLETED_WITH_ERRORS", + "SCHEDULED", + "TIMED_OUT", + "SKIPPED" + ] + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/queue/update/{workflowId}/task/{taskId}/{status}": { + "post": { + "tags": ["queue-admin-resource"], + "summary": "Publish a message in queue to mark a wait task (by taskId) as completed.", + "operationId": "updateByTaskId", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "taskId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "status", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "CANCELED", + "FAILED", + "FAILED_WITH_TERMINAL_ERROR", + "COMPLETED", + "COMPLETED_WITH_ERRORS", + "SCHEDULED", + "TIMED_OUT", + "SKIPPED" + ] + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/metadata/workflow/validate": { + "post": { + "tags": ["metadata-resource"], + "summary": "Validates a new workflow definition", + "operationId": "validate", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/WorkflowDef" } + } + }, + "required": true + }, + "responses": { "200": { "description": "OK" } } + } + }, + "/api/admin/sweep/requeue/{workflowId}": { + "post": { + "tags": ["admin-resource"], + "summary": "Queue up all the running workflows for sweep", + "operationId": "requeueSweep", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/api/admin/consistency/verifyAndRepair/{workflowId}": { + "post": { + "tags": ["admin-resource"], + "summary": "Verify and repair workflow consistency", + "operationId": "verifyAndRepairWorkflowConsistency", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { "text/plain": { "schema": { "type": "string" } } } + } + } + } + }, + "/health": { + "get": { + "tags": ["health-check-resource"], + "operationId": "doCheck", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/HealthCheckStatus" } + } + } + } + } + } + }, + "/api/workflow/{workflowId}": { + "get": { + "tags": ["workflow-resource"], + "summary": "Gets the workflow by workflow id", + "operationId": "getExecutionStatus", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "includeTasks", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": true } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { "schema": { "$ref": "#/components/schemas/Workflow" } } + } + } + } + }, + "delete": { + "tags": ["workflow-resource"], + "summary": "Terminate workflow execution", + "operationId": "terminate_1", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "reason", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/workflow/{name}/correlated/{correlationId}": { + "get": { + "tags": ["workflow-resource"], + "summary": "Lists workflows for the given correlation id", + "operationId": "getWorkflows_1", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "correlationId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "includeClosed", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + }, + { + "name": "includeTasks", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/Workflow" } + } + } + } + } + } + } + }, + "/api/workflow/search": { + "get": { + "tags": ["workflow-resource"], + "summary": "Search for workflows based on payload and other parameters", + "description": "use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC.", + "operationId": "search", + "parameters": [ + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "freeText", + "in": "query", + "required": false, + "schema": { "type": "string", "default": "*" } + }, + { + "name": "query", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SearchResultWorkflowSummary" + } + } + } + } + } + } + }, + "/api/workflow/search-v2": { + "get": { + "tags": ["workflow-resource"], + "summary": "Search for workflows based on payload and other parameters", + "description": "use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC.", + "operationId": "searchV2", + "parameters": [ + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "freeText", + "in": "query", + "required": false, + "schema": { "type": "string", "default": "*" } + }, + { + "name": "query", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SearchResultWorkflow" + } + } + } + } + } + } + }, + "/api/workflow/search-by-tasks": { + "get": { + "tags": ["workflow-resource"], + "summary": "Search for workflows based on task parameters", + "description": "use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC", + "operationId": "searchWorkflowsByTasks", + "parameters": [ + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "freeText", + "in": "query", + "required": false, + "schema": { "type": "string", "default": "*" } + }, + { + "name": "query", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SearchResultWorkflowSummary" + } + } + } + } + } + } + }, + "/api/workflow/search-by-tasks-v2": { + "get": { + "tags": ["workflow-resource"], + "summary": "Search for workflows based on task parameters", + "description": "use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC", + "operationId": "searchWorkflowsByTasksV2", + "parameters": [ + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "freeText", + "in": "query", + "required": false, + "schema": { "type": "string", "default": "*" } + }, + { + "name": "query", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SearchResultWorkflow" + } + } + } + } + } + } + }, + "/api/workflow/running/{name}": { + "get": { + "tags": ["workflow-resource"], + "summary": "Retrieve all the running workflows", + "operationId": "getRunningWorkflow", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "version", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 1 } + }, + { + "name": "startTime", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int64" } + }, + { + "name": "endTime", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int64" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "type": "array", "items": { "type": "string" } } + } + } + } + } + } + }, + "/api/workflow/externalstoragelocation": { + "get": { + "tags": ["workflow-resource"], + "summary": "Get the uri and path of the external storage where the workflow payload is to be stored", + "operationId": "getExternalStorageLocation", + "parameters": [ + { + "name": "path", + "in": "query", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "operation", + "in": "query", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "payloadType", + "in": "query", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/ExternalStorageLocation" + } + } + } + } + } + } + }, + "/api/tasks/{taskId}": { + "get": { + "tags": ["task-resource"], + "summary": "Get task by Id", + "operationId": "getTask", + "parameters": [ + { + "name": "taskId", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { "schema": { "$ref": "#/components/schemas/Task" } } + } + } + } + } + }, + "/api/tasks/search": { + "get": { + "tags": ["task-resource"], + "summary": "Search for tasks based in payload and other parameters", + "description": "use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC", + "operationId": "search_1", + "parameters": [ + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "freeText", + "in": "query", + "required": false, + "schema": { "type": "string", "default": "*" } + }, + { + "name": "query", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SearchResultTaskSummary" + } + } + } + } + } + } + }, + "/api/tasks/search-v2": { + "get": { + "tags": ["task-resource"], + "summary": "Search for tasks based in payload and other parameters", + "description": "use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC", + "operationId": "searchV2_1", + "parameters": [ + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "freeText", + "in": "query", + "required": false, + "schema": { "type": "string", "default": "*" } + }, + { + "name": "query", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/SearchResultTask" } + } + } + } + } + } + }, + "/api/tasks/queue/sizes": { + "get": { + "tags": ["task-resource"], + "summary": "Deprecated. Please use /tasks/queue/size endpoint", + "operationId": "size", + "parameters": [ + { + "name": "taskType", + "in": "query", + "required": false, + "schema": { "type": "array", "items": { "type": "string" } } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "deprecated": true + } + }, + "/api/tasks/queue/size": { + "get": { + "tags": ["task-resource"], + "summary": "Get queue size for a task type.", + "operationId": "taskDepth", + "parameters": [ + { + "name": "taskType", + "in": "query", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "domain", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "isolationGroupId", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "executionNamespace", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { "schema": { "type": "integer", "format": "int32" } } + } + } + } + } + }, + "/api/tasks/queue/polldata": { + "get": { + "tags": ["task-resource"], + "summary": "Get the last poll data for a given task type", + "operationId": "getPollData", + "parameters": [ + { + "name": "taskType", + "in": "query", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/PollData" } + } + } + } + } + } + } + }, + "/api/tasks/queue/polldata/all": { + "get": { + "tags": ["task-resource"], + "summary": "Get the last poll data for all task types", + "operationId": "getAllPollData", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/PollData" } + } + } + } + } + } + } + }, + "/api/tasks/queue/all": { + "get": { + "tags": ["task-resource"], + "summary": "Get the details about each queue", + "operationId": "all", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + }, + "/api/tasks/queue/all/verbose": { + "get": { + "tags": ["task-resource"], + "summary": "Get the details about each queue", + "operationId": "allVerbose", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + } + } + }, + "/api/tasks/poll/{tasktype}": { + "get": { + "tags": ["task-resource"], + "summary": "Poll for a task of a certain type", + "operationId": "poll", + "parameters": [ + { + "name": "tasktype", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "workerid", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "domain", + "in": "query", + "required": false, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { "schema": { "$ref": "#/components/schemas/Task" } } + } + } + } + } + }, + "/api/tasks/poll/batch/{tasktype}": { + "get": { + "tags": ["task-resource"], + "summary": "Batch poll for a task of a certain type", + "operationId": "batchPoll", + "parameters": [ + { + "name": "tasktype", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "workerid", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "domain", + "in": "query", + "required": false, + "schema": { "type": "string" } + }, + { + "name": "count", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 1 } + }, + { + "name": "timeout", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/Task" } + } + } + } + } + } + } + }, + "/api/tasks/externalstoragelocation": { + "get": { + "tags": ["task-resource"], + "summary": "Get the external uri where the task payload is to be stored", + "operationId": "getExternalStorageLocation_1", + "parameters": [ + { + "name": "path", + "in": "query", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "operation", + "in": "query", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "payloadType", + "in": "query", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/ExternalStorageLocation" + } + } + } + } + } + } + }, + "/api/queue/size": { + "get": { + "tags": ["queue-admin-resource"], + "summary": "Get the queue length", + "operationId": "size_1", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + }, + "/api/queue/": { + "get": { + "tags": ["queue-admin-resource"], + "summary": "Get Queue Names", + "operationId": "names", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { "type": "string" } + } + } + } + } + } + } + }, + "/api/metadata/workflow/{name}": { + "get": { + "tags": ["metadata-resource"], + "summary": "Retrieves workflow definition along with blueprint", + "operationId": "get", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "version", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/WorkflowDef" } + } + } + } + } + } + }, + "/api/metadata/workflow/names-and-versions": { + "get": { + "tags": ["metadata-resource"], + "summary": "Returns workflow names and versions only (no definition bodies)", + "operationId": "getWorkflowNamesAndVersions", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + } + } + } + } + }, + "/api/metadata/workflow/latest-versions": { + "get": { + "tags": ["metadata-resource"], + "summary": "Returns only the latest version of all workflow definitions", + "operationId": "getAllWorkflowsWithLatestVersions", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowDef" } + } + } + } + } + } + } + }, + "/api/metadata/taskdefs/{tasktype}": { + "get": { + "tags": ["metadata-resource"], + "summary": "Gets the task definition", + "operationId": "getTaskDef", + "parameters": [ + { + "name": "tasktype", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { "schema": { "$ref": "#/components/schemas/TaskDef" } } + } + } + } + }, + "delete": { + "tags": ["metadata-resource"], + "summary": "Remove a task definition", + "operationId": "unregisterTaskDef", + "parameters": [ + { + "name": "tasktype", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/external/postgres/{externalPayloadPath}": { + "get": { + "tags": ["external-postgres-payload-resource"], + "summary": "Get task or workflow by externalPayloadPath from External PostgreSQL Storage", + "operationId": "getExternalStorageData", + "parameters": [ + { + "name": "externalPayloadPath", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { "schema": { "type": "string", "format": "binary" } } + } + } + } + } + }, + "/api/event/{event}": { + "get": { + "tags": ["event-resource"], + "summary": "Get event handlers for a given event", + "operationId": "getEventHandlersForEvent", + "parameters": [ + { + "name": "event", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "activeOnly", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": true } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/EventHandler" } + } + } + } + } + } + } + }, + "/api/admin/task/{tasktype}": { + "get": { + "tags": ["admin-resource"], + "summary": "Get the list of pending tasks for a given task type", + "operationId": "view", + "parameters": [ + { + "name": "tasktype", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "start", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 0 } + }, + { + "name": "count", + "in": "query", + "required": false, + "schema": { "type": "integer", "format": "int32", "default": 100 } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { "$ref": "#/components/schemas/Task" } + } + } + } + } + } + } + }, + "/api/admin/queues": { + "get": { + "tags": ["admin-resource"], + "summary": "Get registered queues", + "operationId": "getEventQueues", + "parameters": [ + { + "name": "verbose", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": false } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + } + } + } + } + }, + "/api/admin/config": { + "get": { + "tags": ["admin-resource"], + "summary": "Get all the configuration parameters", + "operationId": "getAllConfig", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + } + } + } + } + }, + "/api/workflow/{workflowId}/remove": { + "delete": { + "tags": ["workflow-resource"], + "summary": "Removes the workflow from the system", + "operationId": "delete", + "parameters": [ + { + "name": "workflowId", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "archiveWorkflow", + "in": "query", + "required": false, + "schema": { "type": "boolean", "default": true } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/metadata/workflow/{name}/{version}": { + "delete": { + "tags": ["metadata-resource"], + "summary": "Removes workflow definition. It does not remove workflows associated with the definition.", + "operationId": "unregisterWorkflowDef", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "version", + "in": "path", + "required": true, + "schema": { "type": "integer", "format": "int32" } + } + ], + "responses": { "200": { "description": "OK" } } + } + }, + "/api/event/{name}": { + "delete": { + "tags": ["event-resource"], + "summary": "Remove an event handler", + "operationId": "removeEventHandlerStatus", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { "200": { "description": "OK" } } + } + } + }, + "components": { + "schemas": { + "SkipTaskRequest": { + "type": "object", + "properties": { + "taskInput": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "taskOutput": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + }, + "BulkResponse": { + "type": "object", + "properties": { + "bulkErrorResults": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "bulkSuccessfulResults": { + "type": "array", + "items": { "type": "string" } + } + } + }, + "SubWorkflowParams": { + "required": ["name"], + "type": "object", + "properties": { + "name": { "type": "string" }, + "version": { "type": "integer", "format": "int32" }, + "taskToDomain": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "workflowDefinition": { "$ref": "#/components/schemas/WorkflowDef" } + } + }, + "TaskDef": { + "required": ["name", "timeoutSeconds"], + "type": "object", + "properties": { + "ownerApp": { "type": "string" }, + "createTime": { "type": "integer", "format": "int64" }, + "updateTime": { "type": "integer", "format": "int64" }, + "createdBy": { "type": "string" }, + "updatedBy": { "type": "string" }, + "accessPolicy": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "retryCount": { "minimum": 0, "type": "integer", "format": "int32" }, + "timeoutSeconds": { "type": "integer", "format": "int64" }, + "inputKeys": { "type": "array", "items": { "type": "string" } }, + "outputKeys": { "type": "array", "items": { "type": "string" } }, + "timeoutPolicy": { + "type": "string", + "enum": ["RETRY", "TIME_OUT_WF", "ALERT_ONLY"] + }, + "retryLogic": { + "type": "string", + "enum": ["FIXED", "EXPONENTIAL_BACKOFF", "LINEAR_BACKOFF"] + }, + "retryDelaySeconds": { "type": "integer", "format": "int32" }, + "responseTimeoutSeconds": { + "minimum": 1, + "type": "integer", + "format": "int64" + }, + "concurrentExecLimit": { "type": "integer", "format": "int32" }, + "inputTemplate": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "rateLimitPerFrequency": { "type": "integer", "format": "int32" }, + "rateLimitFrequencyInSeconds": { + "type": "integer", + "format": "int32" + }, + "isolationGroupId": { "type": "string" }, + "executionNameSpace": { "type": "string" }, + "ownerEmail": { "type": "string" }, + "pollTimeoutSeconds": { + "minimum": 0, + "type": "integer", + "format": "int32" + }, + "backoffScaleFactor": { + "minimum": 1, + "type": "integer", + "format": "int32" + } + } + }, + "WorkflowDef": { + "required": ["name", "tasks", "timeoutSeconds"], + "type": "object", + "properties": { + "ownerApp": { "type": "string" }, + "createTime": { "type": "integer", "format": "int64" }, + "updateTime": { "type": "integer", "format": "int64" }, + "createdBy": { "type": "string" }, + "updatedBy": { "type": "string" }, + "accessPolicy": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "version": { "type": "integer", "format": "int32" }, + "tasks": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowTask" } + }, + "inputParameters": { "type": "array", "items": { "type": "string" } }, + "outputParameters": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "failureWorkflow": { "type": "string" }, + "schemaVersion": { + "maximum": 2, + "minimum": 2, + "type": "integer", + "format": "int32" + }, + "restartable": { "type": "boolean" }, + "workflowStatusListenerEnabled": { "type": "boolean" }, + "ownerEmail": { "type": "string" }, + "timeoutPolicy": { + "type": "string", + "enum": ["TIME_OUT_WF", "ALERT_ONLY"] + }, + "timeoutSeconds": { "type": "integer", "format": "int64" }, + "variables": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "inputTemplate": { + "type": "object", + "additionalProperties": { "type": "object" } + } + } + }, + "WorkflowTask": { + "required": ["name", "taskReferenceName"], + "type": "object", + "properties": { + "name": { "type": "string" }, + "taskReferenceName": { "type": "string" }, + "description": { "type": "string" }, + "inputParameters": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "type": { "type": "string" }, + "dynamicTaskNameParam": { "type": "string" }, + "caseValueParam": { "type": "string", "deprecated": true }, + "caseExpression": { "type": "string", "deprecated": true }, + "scriptExpression": { "type": "string" }, + "decisionCases": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowTask" } + } + }, + "dynamicForkJoinTasksParam": { "type": "string", "deprecated": true }, + "dynamicForkTasksParam": { "type": "string" }, + "dynamicForkTasksInputParamName": { "type": "string" }, + "defaultCase": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowTask" } + }, + "forkTasks": { + "type": "array", + "items": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowTask" } + } + }, + "startDelay": { "type": "integer", "format": "int32" }, + "subWorkflowParam": { + "$ref": "#/components/schemas/SubWorkflowParams" + }, + "joinOn": { "type": "array", "items": { "type": "string" } }, + "sink": { "type": "string" }, + "optional": { "type": "boolean" }, + "taskDefinition": { "$ref": "#/components/schemas/TaskDef" }, + "rateLimited": { "type": "boolean" }, + "defaultExclusiveJoinTask": { + "type": "array", + "items": { "type": "string" } + }, + "asyncComplete": { "type": "boolean" }, + "loopCondition": { "type": "string" }, + "loopOver": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowTask" } + }, + "retryCount": { "type": "integer", "format": "int32" }, + "evaluatorType": { "type": "string" }, + "expression": { "type": "string" }, + "workflowTaskType": { + "type": "string", + "writeOnly": true, + "enum": [ + "SIMPLE", + "DYNAMIC", + "FORK_JOIN", + "FORK_JOIN_DYNAMIC", + "DECISION", + "SWITCH", + "JOIN", + "DO_WHILE", + "SUB_WORKFLOW", + "START_WORKFLOW", + "EVENT", + "WAIT", + "HUMAN", + "USER_DEFINED", + "HTTP", + "LAMBDA", + "INLINE", + "EXCLUSIVE_JOIN", + "TERMINATE", + "KAFKA_PUBLISH", + "JSON_JQ_TRANSFORM", + "SET_VARIABLE", + "NOOP" + ] + } + } + }, + "Action": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": ["start_workflow", "complete_task", "fail_task"] + }, + "start_workflow": { "$ref": "#/components/schemas/StartWorkflow" }, + "complete_task": { "$ref": "#/components/schemas/TaskDetails" }, + "fail_task": { "$ref": "#/components/schemas/TaskDetails" }, + "expandInlineJSON": { "type": "boolean" } + } + }, + "EventHandler": { + "required": ["actions", "event", "name"], + "type": "object", + "properties": { + "name": { "type": "string" }, + "event": { "type": "string" }, + "condition": { "type": "string" }, + "actions": { + "type": "array", + "items": { "$ref": "#/components/schemas/Action" } + }, + "active": { "type": "boolean" }, + "evaluatorType": { "type": "string" } + } + }, + "StartWorkflow": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "version": { "type": "integer", "format": "int32" }, + "correlationId": { "type": "string" }, + "input": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "taskToDomain": { + "type": "object", + "additionalProperties": { "type": "string" } + } + } + }, + "TaskDetails": { + "type": "object", + "properties": { + "workflowId": { "type": "string" }, + "taskRefName": { "type": "string" }, + "output": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "taskId": { "type": "string" } + } + }, + "StartWorkflowRequest": { + "required": ["name"], + "type": "object", + "properties": { + "name": { "type": "string" }, + "version": { "type": "integer", "format": "int32" }, + "correlationId": { "type": "string" }, + "input": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "taskToDomain": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "workflowDef": { "$ref": "#/components/schemas/WorkflowDef" }, + "externalInputPayloadStoragePath": { "type": "string" }, + "priority": { + "maximum": 99, + "minimum": 0, + "type": "integer", + "format": "int32" + } + } + }, + "RerunWorkflowRequest": { + "type": "object", + "properties": { + "reRunFromWorkflowId": { "type": "string" }, + "workflowInput": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "reRunFromTaskId": { "type": "string" }, + "taskInput": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "correlationId": { "type": "string" } + } + }, + "Task": { + "type": "object", + "properties": { + "taskType": { "type": "string" }, + "status": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "CANCELED", + "FAILED", + "FAILED_WITH_TERMINAL_ERROR", + "COMPLETED", + "COMPLETED_WITH_ERRORS", + "SCHEDULED", + "TIMED_OUT", + "SKIPPED" + ] + }, + "inputData": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "referenceTaskName": { "type": "string" }, + "retryCount": { "type": "integer", "format": "int32" }, + "seq": { "type": "integer", "format": "int32" }, + "correlationId": { "type": "string" }, + "pollCount": { "type": "integer", "format": "int32" }, + "taskDefName": { "type": "string" }, + "scheduledTime": { "type": "integer", "format": "int64" }, + "startTime": { "type": "integer", "format": "int64" }, + "endTime": { "type": "integer", "format": "int64" }, + "updateTime": { "type": "integer", "format": "int64" }, + "startDelayInSeconds": { "type": "integer", "format": "int32" }, + "retriedTaskId": { "type": "string" }, + "retried": { "type": "boolean" }, + "executed": { "type": "boolean" }, + "callbackFromWorker": { "type": "boolean" }, + "responseTimeoutSeconds": { "type": "integer", "format": "int64" }, + "workflowInstanceId": { "type": "string" }, + "workflowType": { "type": "string" }, + "taskId": { "type": "string" }, + "reasonForIncompletion": { "type": "string" }, + "callbackAfterSeconds": { "type": "integer", "format": "int64" }, + "workerId": { "type": "string" }, + "outputData": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "workflowTask": { "$ref": "#/components/schemas/WorkflowTask" }, + "domain": { "type": "string" }, + "rateLimitPerFrequency": { "type": "integer", "format": "int32" }, + "rateLimitFrequencyInSeconds": { + "type": "integer", + "format": "int32" + }, + "externalInputPayloadStoragePath": { "type": "string" }, + "externalOutputPayloadStoragePath": { "type": "string" }, + "workflowPriority": { "type": "integer", "format": "int32" }, + "executionNameSpace": { "type": "string" }, + "isolationGroupId": { "type": "string" }, + "iteration": { "type": "integer", "format": "int32" }, + "subWorkflowId": { "type": "string" }, + "subworkflowChanged": { "type": "boolean" }, + "taskDefinition": { "$ref": "#/components/schemas/TaskDef" }, + "queueWaitTime": { "type": "integer", "format": "int64" }, + "loopOverTask": { "type": "boolean" } + } + }, + "Workflow": { + "type": "object", + "properties": { + "ownerApp": { "type": "string" }, + "createTime": { "type": "integer", "format": "int64" }, + "updateTime": { "type": "integer", "format": "int64" }, + "createdBy": { "type": "string" }, + "updatedBy": { "type": "string" }, + "status": { + "type": "string", + "enum": [ + "RUNNING", + "COMPLETED", + "FAILED", + "TIMED_OUT", + "TERMINATED", + "PAUSED" + ] + }, + "endTime": { "type": "integer", "format": "int64" }, + "workflowId": { "type": "string" }, + "parentWorkflowId": { "type": "string" }, + "parentWorkflowTaskId": { "type": "string" }, + "tasks": { + "type": "array", + "items": { "$ref": "#/components/schemas/Task" } + }, + "input": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "output": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "correlationId": { "type": "string" }, + "reRunFromWorkflowId": { "type": "string" }, + "reasonForIncompletion": { "type": "string" }, + "event": { "type": "string" }, + "taskToDomain": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "failedReferenceTaskNames": { + "uniqueItems": true, + "type": "array", + "items": { "type": "string" } + }, + "workflowDefinition": { "$ref": "#/components/schemas/WorkflowDef" }, + "externalInputPayloadStoragePath": { "type": "string" }, + "externalOutputPayloadStoragePath": { "type": "string" }, + "priority": { + "maximum": 99, + "minimum": 0, + "type": "integer", + "format": "int32" + }, + "variables": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "lastRetriedTime": { "type": "integer", "format": "int64" }, + "failedTaskNames": { + "uniqueItems": true, + "type": "array", + "items": { "type": "string" } + }, + "startTime": { "type": "integer", "format": "int64" }, + "workflowName": { "type": "string" }, + "workflowVersion": { "type": "integer", "format": "int32" } + } + }, + "TaskMock": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "FAILED", + "FAILED_WITH_TERMINAL_ERROR", + "COMPLETED" + ] + }, + "output": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "executionTime": { "type": "integer", "format": "int64" }, + "queueWaitTime": { "type": "integer", "format": "int64" } + } + }, + "WorkflowTestRequest": { + "required": ["name"], + "type": "object", + "properties": { + "name": { "type": "string" }, + "version": { "type": "integer", "format": "int32" }, + "correlationId": { "type": "string" }, + "input": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "taskToDomain": { + "type": "object", + "additionalProperties": { "type": "string" } + }, + "workflowDef": { "$ref": "#/components/schemas/WorkflowDef" }, + "externalInputPayloadStoragePath": { "type": "string" }, + "priority": { + "maximum": 99, + "minimum": 0, + "type": "integer", + "format": "int32" + }, + "taskRefToMockOutput": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/TaskMock" } + } + }, + "subWorkflowTestRequest": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/WorkflowTestRequest" + } + } + } + }, + "TaskExecLog": { + "type": "object", + "properties": { + "log": { "type": "string" }, + "taskId": { "type": "string" }, + "createdTime": { "type": "integer", "format": "int64" } + } + }, + "TaskResult": { + "required": ["taskId", "workflowInstanceId"], + "type": "object", + "properties": { + "workflowInstanceId": { "type": "string" }, + "taskId": { "type": "string" }, + "reasonForIncompletion": { "type": "string" }, + "callbackAfterSeconds": { "type": "integer", "format": "int64" }, + "workerId": { "type": "string" }, + "status": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "FAILED", + "FAILED_WITH_TERMINAL_ERROR", + "COMPLETED" + ] + }, + "outputData": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "logs": { + "type": "array", + "items": { "$ref": "#/components/schemas/TaskExecLog" } + }, + "externalOutputPayloadStoragePath": { "type": "string" }, + "subWorkflowId": { "type": "string" }, + "extendLease": { "type": "boolean" } + } + }, + "Health": { + "type": "object", + "properties": { + "details": { + "type": "object", + "additionalProperties": { "type": "object" } + }, + "errorMessage": { "type": "string" }, + "healthy": { "type": "boolean" } + } + }, + "HealthCheckStatus": { + "type": "object", + "properties": { + "healthResults": { + "type": "array", + "items": { "$ref": "#/components/schemas/Health" } + }, + "suppressedHealthResults": { + "type": "array", + "items": { "$ref": "#/components/schemas/Health" } + }, + "healthy": { "type": "boolean" } + } + }, + "SearchResultWorkflowSummary": { + "type": "object", + "properties": { + "totalHits": { "type": "integer", "format": "int64" }, + "results": { + "type": "array", + "items": { "$ref": "#/components/schemas/WorkflowSummary" } + } + } + }, + "WorkflowSummary": { + "type": "object", + "properties": { + "workflowType": { "type": "string" }, + "version": { "type": "integer", "format": "int32" }, + "workflowId": { "type": "string" }, + "correlationId": { "type": "string" }, + "startTime": { "type": "string" }, + "updateTime": { "type": "string" }, + "endTime": { "type": "string" }, + "status": { + "type": "string", + "enum": [ + "RUNNING", + "COMPLETED", + "FAILED", + "TIMED_OUT", + "TERMINATED", + "PAUSED" + ] + }, + "input": { "type": "string" }, + "output": { "type": "string" }, + "reasonForIncompletion": { "type": "string" }, + "executionTime": { "type": "integer", "format": "int64" }, + "event": { "type": "string" }, + "failedReferenceTaskNames": { "type": "string" }, + "externalInputPayloadStoragePath": { "type": "string" }, + "externalOutputPayloadStoragePath": { "type": "string" }, + "priority": { "type": "integer", "format": "int32" }, + "failedTaskNames": { + "uniqueItems": true, + "type": "array", + "items": { "type": "string" } + }, + "inputSize": { "type": "integer", "format": "int64" }, + "outputSize": { "type": "integer", "format": "int64" } + } + }, + "SearchResultWorkflow": { + "type": "object", + "properties": { + "totalHits": { "type": "integer", "format": "int64" }, + "results": { + "type": "array", + "items": { "$ref": "#/components/schemas/Workflow" } + } + } + }, + "ExternalStorageLocation": { + "type": "object", + "properties": { + "uri": { "type": "string" }, + "path": { "type": "string" } + } + }, + "SearchResultTaskSummary": { + "type": "object", + "properties": { + "totalHits": { "type": "integer", "format": "int64" }, + "results": { + "type": "array", + "items": { "$ref": "#/components/schemas/TaskSummary" } + } + } + }, + "TaskSummary": { + "type": "object", + "properties": { + "workflowId": { "type": "string" }, + "workflowType": { "type": "string" }, + "correlationId": { "type": "string" }, + "scheduledTime": { "type": "string" }, + "startTime": { "type": "string" }, + "updateTime": { "type": "string" }, + "endTime": { "type": "string" }, + "status": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "CANCELED", + "FAILED", + "FAILED_WITH_TERMINAL_ERROR", + "COMPLETED", + "COMPLETED_WITH_ERRORS", + "SCHEDULED", + "TIMED_OUT", + "SKIPPED" + ] + }, + "reasonForIncompletion": { "type": "string" }, + "executionTime": { "type": "integer", "format": "int64" }, + "queueWaitTime": { "type": "integer", "format": "int64" }, + "taskDefName": { "type": "string" }, + "taskType": { "type": "string" }, + "input": { "type": "string" }, + "output": { "type": "string" }, + "taskId": { "type": "string" }, + "externalInputPayloadStoragePath": { "type": "string" }, + "externalOutputPayloadStoragePath": { "type": "string" }, + "workflowPriority": { "type": "integer", "format": "int32" }, + "domain": { "type": "string" } + } + }, + "SearchResultTask": { + "type": "object", + "properties": { + "totalHits": { "type": "integer", "format": "int64" }, + "results": { + "type": "array", + "items": { "$ref": "#/components/schemas/Task" } + } + } + }, + "PollData": { + "type": "object", + "properties": { + "queueName": { "type": "string" }, + "domain": { "type": "string" }, + "workerId": { "type": "string" }, + "lastPollTime": { "type": "integer", "format": "int64" } + } + } + } + } +} diff --git a/src/ConductorSharp.Client/ApiException.cs b/src/ConductorSharp.Client/ApiException.cs new file mode 100644 index 00000000..6fa8328c --- /dev/null +++ b/src/ConductorSharp.Client/ApiException.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace ConductorSharp.Client.Generated +{ + internal class ApiException : Exception + { + public ConductorErrorResponse Errors { get; private set; } + public int StatusCode { get; private set; } + public string ResponseData { get; private set; } + public IReadOnlyDictionary> Headers { get; private set; } + + public ApiException( + string message, + int statusCode, + string responseData, + IReadOnlyDictionary> headers, + JsonException exception + ) : base(message, exception) + { + Errors = JsonConvert.DeserializeObject(responseData); + StatusCode = statusCode; + Headers = headers; + ResponseData = responseData; + } + } +} diff --git a/src/ConductorSharp.Client/Model/Response/ConductorErrorResponse.cs b/src/ConductorSharp.Client/ConductorErrorResponse.cs similarity index 59% rename from src/ConductorSharp.Client/Model/Response/ConductorErrorResponse.cs rename to src/ConductorSharp.Client/ConductorErrorResponse.cs index 77742b84..3fa28cc3 100644 --- a/src/ConductorSharp.Client/Model/Response/ConductorErrorResponse.cs +++ b/src/ConductorSharp.Client/ConductorErrorResponse.cs @@ -1,8 +1,21 @@ using Newtonsoft.Json; +using System; using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -namespace ConductorSharp.Client.Model.Response +namespace ConductorSharp.Client { + public class ConductorValidationError + { + [JsonProperty("path")] + public string Path { get; set; } + + [JsonProperty("message")] + public string Message { get; set; } + } + public class ConductorErrorResponse { [JsonProperty("status")] diff --git a/src/ConductorSharp.Client/ConductorSharp.Client.csproj b/src/ConductorSharp.Client/ConductorSharp.Client.csproj index 817a393f..dec97f72 100644 --- a/src/ConductorSharp.Client/ConductorSharp.Client.csproj +++ b/src/ConductorSharp.Client/ConductorSharp.Client.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net6.0 preview Codaxy Codaxy diff --git a/src/ConductorSharp.Client/Generated/ConductorClient.cs b/src/ConductorSharp.Client/Generated/ConductorClient.cs new file mode 100644 index 00000000..dc31afc5 --- /dev/null +++ b/src/ConductorSharp.Client/Generated/ConductorClient.cs @@ -0,0 +1,5735 @@ +//---------------------- +// +// Generated using the NSwag toolchain v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" + +namespace ConductorSharp.Client.Generated +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ConductorClient + { + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public ConductorClient(System.Net.Http.HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Skips a given task from a current running workflow + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SkipTaskFromWorkflowAsync(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + if (taskReferenceName == null) + throw new System.ArgumentNullException("taskReferenceName"); + + if (skipTaskRequest == null) + throw new System.ArgumentNullException("skipTaskRequest"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/skiptask/{taskReferenceName}?"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{taskReferenceName}", System.Uri.EscapeDataString(ConvertToString(taskReferenceName, System.Globalization.CultureInfo.InvariantCulture))); + foreach (var item_ in skipTaskRequest.AdditionalProperties) { urlBuilder_.Append(System.Uri.EscapeDataString(item_.Key) + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_.Value, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Resumes the workflow + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ResumeWorkflowAsync(string workflowId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/resume"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Pauses the workflow + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PauseWorkflowAsync(string workflowId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/pause"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Starts the decision task for a workflow + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task DecideAsync(string workflowId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/decide/{workflowId}"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Resume the list of workflows + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ResumeWorkflow_1Async(System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/bulk/resume"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Pause the list of workflows + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PauseWorkflow_1Async(System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/bulk/pause"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Retrieves all workflow definition along with blueprint + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create or update workflow definition + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UpdateAsync(System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a new workflow definition + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CreateAsync(WorkflowDef body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Gets all task definition + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetTaskDefsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/taskdefs"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update an existing task + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RegisterTaskDefAsync(TaskDef body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/taskdefs"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create new task definition(s) + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RegisterTaskDef_1Async(System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/taskdefs"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get all the event handlers + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetEventHandlersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/event"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update an existing event handler. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UpdateEventHandlerAsync(EventHandler body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/event"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Add a new event handler. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AddEventHandlerAsync(EventHandler body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/event"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task StartWorkflowAsync(StartWorkflowRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Retries the last failed task + /// + /// No Content + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RetryAsync(string workflowId, bool? resumeSubworkflowTasks = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/retry?"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + if (resumeSubworkflowTasks != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("resumeSubworkflowTasks") + "=").Append(System.Uri.EscapeDataString(ConvertToString(resumeSubworkflowTasks, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Restarts a completed workflow + /// + /// No Content + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RestartAsync(string workflowId, bool? useLatestDefinitions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/restart?"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + if (useLatestDefinitions != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("useLatestDefinitions") + "=").Append(System.Uri.EscapeDataString(ConvertToString(useLatestDefinitions, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + /// No Content + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ResetWorkflowAsync(string workflowId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/resetcallbacks"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Reruns the workflow from a specific task + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RerunAsync(string workflowId, RerunWorkflowRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/rerun"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Start a new workflow. Returns the ID of the workflow instance that can be later used for tracking + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task StartWorkflow_1Async(string name, System.Collections.Generic.IDictionary body, int? version = null, string correlationId = null, int? priority = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (version != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (correlationId != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("correlationId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(correlationId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (priority != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("priority") + "=").Append(System.Uri.EscapeDataString(ConvertToString(priority, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Lists workflows for the given correlation id list + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task>> GetWorkflowsAsync(string name, System.Collections.Generic.IEnumerable body, bool? includeClosed = null, bool? includeTasks = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{name}/correlated?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (includeClosed != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("includeClosed") + "=").Append(System.Uri.EscapeDataString(ConvertToString(includeClosed, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (includeTasks != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("includeTasks") + "=").Append(System.Uri.EscapeDataString(ConvertToString(includeTasks, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Test workflow execution using mock data + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TestWorkflowAsync(WorkflowTestRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/test"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Terminate workflows execution + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TerminateAsync(System.Collections.Generic.IEnumerable body, string reason = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/bulk/terminate?"); + if (reason != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reason") + "=").Append(System.Uri.EscapeDataString(ConvertToString(reason, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Retry the last failed task for each workflow from the list + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task Retry_1Async(System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/bulk/retry"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Restart the list of completed workflow + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task Restart_1Async(System.Collections.Generic.IEnumerable body, bool? useLatestDefinitions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/bulk/restart?"); + if (useLatestDefinitions != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("useLatestDefinitions") + "=").Append(System.Uri.EscapeDataString(ConvertToString(useLatestDefinitions, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a task + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UpdateTaskAsync(TaskResult body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Task Execution Logs + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetTaskLogsAsync(string taskId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (taskId == null) + throw new System.ArgumentNullException("taskId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/{taskId}/log"); + urlBuilder_.Replace("{taskId}", System.Uri.EscapeDataString(ConvertToString(taskId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Log Task Execution Details + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task LogAsync(string taskId, string body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (taskId == null) + throw new System.ArgumentNullException("taskId"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/{taskId}/log"); + urlBuilder_.Replace("{taskId}", System.Uri.EscapeDataString(ConvertToString(taskId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Requeue pending tasks + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RequeuePendingTaskAsync(string taskType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (taskType == null) + throw new System.ArgumentNullException("taskType"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/requeue/{taskType}"); + urlBuilder_.Replace("{taskType}", System.Uri.EscapeDataString(ConvertToString(taskType, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Publish a message in queue to mark a wait task as completed. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task Update_1Async(string workflowId, string taskRefName, Status status, System.Collections.Generic.IDictionary body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + if (taskRefName == null) + throw new System.ArgumentNullException("taskRefName"); + + if (status == null) + throw new System.ArgumentNullException("status"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/queue/update/{workflowId}/{taskRefName}/{status}"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{taskRefName}", System.Uri.EscapeDataString(ConvertToString(taskRefName, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{status}", System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Publish a message in queue to mark a wait task (by taskId) as completed. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UpdateByTaskIdAsync(string workflowId, string taskId, Status2 status, System.Collections.Generic.IDictionary body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + if (taskId == null) + throw new System.ArgumentNullException("taskId"); + + if (status == null) + throw new System.ArgumentNullException("status"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/queue/update/{workflowId}/task/{taskId}/{status}"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{taskId}", System.Uri.EscapeDataString(ConvertToString(taskId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{status}", System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Validates a new workflow definition + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ValidateAsync(WorkflowDef body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow/validate"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Queue up all the running workflows for sweep + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RequeueSweepAsync(string workflowId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/admin/sweep/requeue/{workflowId}"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Verify and repair workflow consistency + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VerifyAndRepairWorkflowConsistencyAsync(string workflowId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/admin/consistency/verifyAndRepair/{workflowId}"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task DoCheckAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("health"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Gets the workflow by workflow id + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetExecutionStatusAsync(string workflowId, bool? includeTasks = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}?"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + if (includeTasks != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("includeTasks") + "=").Append(System.Uri.EscapeDataString(ConvertToString(includeTasks, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Terminate workflow execution + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task Terminate_1Async(string workflowId, string reason = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}?"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + if (reason != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reason") + "=").Append(System.Uri.EscapeDataString(ConvertToString(reason, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Lists workflows for the given correlation id + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetWorkflows_1Async(string name, string correlationId, bool? includeClosed = null, bool? includeTasks = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + if (correlationId == null) + throw new System.ArgumentNullException("correlationId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{name}/correlated/{correlationId}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{correlationId}", System.Uri.EscapeDataString(ConvertToString(correlationId, System.Globalization.CultureInfo.InvariantCulture))); + if (includeClosed != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("includeClosed") + "=").Append(System.Uri.EscapeDataString(ConvertToString(includeClosed, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (includeTasks != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("includeTasks") + "=").Append(System.Uri.EscapeDataString(ConvertToString(includeTasks, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// 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. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SearchAsync(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/search?"); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (freeText != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("freeText") + "=").Append(System.Uri.EscapeDataString(ConvertToString(freeText, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// 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. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SearchV2Async(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/search-v2?"); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (freeText != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("freeText") + "=").Append(System.Uri.EscapeDataString(ConvertToString(freeText, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// 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 + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SearchWorkflowsByTasksAsync(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/search-by-tasks?"); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (freeText != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("freeText") + "=").Append(System.Uri.EscapeDataString(ConvertToString(freeText, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// 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 + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SearchWorkflowsByTasksV2Async(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/search-by-tasks-v2?"); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (freeText != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("freeText") + "=").Append(System.Uri.EscapeDataString(ConvertToString(freeText, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Retrieve all the running workflows + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetRunningWorkflowAsync(string name, int? version = null, long? startTime = null, long? endTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/running/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (version != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (startTime != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("startTime") + "=").Append(System.Uri.EscapeDataString(ConvertToString(startTime, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (endTime != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("endTime") + "=").Append(System.Uri.EscapeDataString(ConvertToString(endTime, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetExternalStorageLocationAsync(string path, string operation, string payloadType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (path == null) + throw new System.ArgumentNullException("path"); + + if (operation == null) + throw new System.ArgumentNullException("operation"); + + if (payloadType == null) + throw new System.ArgumentNullException("payloadType"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/externalstoragelocation?"); + urlBuilder_.Append(System.Uri.EscapeDataString("path") + "=").Append(System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(System.Uri.EscapeDataString("operation") + "=").Append(System.Uri.EscapeDataString(ConvertToString(operation, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(System.Uri.EscapeDataString("payloadType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(payloadType, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get task by Id + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetTaskAsync(string taskId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (taskId == null) + throw new System.ArgumentNullException("taskId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/{taskId}"); + urlBuilder_.Replace("{taskId}", System.Uri.EscapeDataString(ConvertToString(taskId, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search for tasks based in 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 + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task Search_1Async(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/search?"); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (freeText != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("freeText") + "=").Append(System.Uri.EscapeDataString(ConvertToString(freeText, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search for tasks based in 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 + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SearchV2_1Async(int? start = null, int? size = null, string sort = null, string freeText = null, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/search-v2?"); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (freeText != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("freeText") + "=").Append(System.Uri.EscapeDataString(ConvertToString(freeText, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Deprecated. Please use /tasks/queue/size endpoint + /// + /// OK + /// A server side error occurred. + [System.Obsolete] + public virtual async System.Threading.Tasks.Task> SizeAsync(System.Collections.Generic.IEnumerable taskType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/sizes?"); + if (taskType != null) + { + foreach (var item_ in taskType) { urlBuilder_.Append(System.Uri.EscapeDataString("taskType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get queue size for a task type. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TaskDepthAsync(string taskType, string domain = null, string isolationGroupId = null, string executionNamespace = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (taskType == null) + throw new System.ArgumentNullException("taskType"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/size?"); + urlBuilder_.Append(System.Uri.EscapeDataString("taskType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(taskType, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (domain != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("domain") + "=").Append(System.Uri.EscapeDataString(ConvertToString(domain, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (isolationGroupId != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("isolationGroupId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(isolationGroupId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (executionNamespace != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("executionNamespace") + "=").Append(System.Uri.EscapeDataString(ConvertToString(executionNamespace, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the last poll data for a given task type + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetPollDataAsync(string taskType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (taskType == null) + throw new System.ArgumentNullException("taskType"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/polldata?"); + urlBuilder_.Append(System.Uri.EscapeDataString("taskType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(taskType, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the last poll data for all task types + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetAllPollDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/polldata/all"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the details about each queue + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> AllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/all"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the details about each queue + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task>>> AllVerboseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/queue/all/verbose"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>>>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Poll for a task of a certain type + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PollAsync(string tasktype, string workerid = null, string domain = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (tasktype == null) + throw new System.ArgumentNullException("tasktype"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/poll/{tasktype}?"); + urlBuilder_.Replace("{tasktype}", System.Uri.EscapeDataString(ConvertToString(tasktype, System.Globalization.CultureInfo.InvariantCulture))); + if (workerid != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("workerid") + "=").Append(System.Uri.EscapeDataString(ConvertToString(workerid, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (domain != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("domain") + "=").Append(System.Uri.EscapeDataString(ConvertToString(domain, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Batch poll for a task of a certain type + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> BatchPollAsync(string tasktype, string workerid = null, string domain = null, int? count = null, int? timeout = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (tasktype == null) + throw new System.ArgumentNullException("tasktype"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/poll/batch/{tasktype}?"); + urlBuilder_.Replace("{tasktype}", System.Uri.EscapeDataString(ConvertToString(tasktype, System.Globalization.CultureInfo.InvariantCulture))); + if (workerid != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("workerid") + "=").Append(System.Uri.EscapeDataString(ConvertToString(workerid, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (domain != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("domain") + "=").Append(System.Uri.EscapeDataString(ConvertToString(domain, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("count") + "=").Append(System.Uri.EscapeDataString(ConvertToString(count, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (timeout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("timeout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timeout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the external uri where the task payload is to be stored + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetExternalStorageLocation_1Async(string path, string operation, string payloadType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (path == null) + throw new System.ArgumentNullException("path"); + + if (operation == null) + throw new System.ArgumentNullException("operation"); + + if (payloadType == null) + throw new System.ArgumentNullException("payloadType"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/tasks/externalstoragelocation?"); + urlBuilder_.Append(System.Uri.EscapeDataString("path") + "=").Append(System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(System.Uri.EscapeDataString("operation") + "=").Append(System.Uri.EscapeDataString(ConvertToString(operation, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(System.Uri.EscapeDataString("payloadType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(payloadType, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the queue length + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> Size_1Async(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/queue/size"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Queue Names + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> NamesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/queue/"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Retrieves workflow definition along with blueprint + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetAsync(string name, int? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (version != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns workflow names and versions only (no definition bodies) + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetWorkflowNamesAndVersionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow/names-and-versions"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns only the latest version of all workflow definitions + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetAllWorkflowsWithLatestVersionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow/latest-versions"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Gets the task definition + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetTaskDefAsync(string tasktype, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (tasktype == null) + throw new System.ArgumentNullException("tasktype"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/taskdefs/{tasktype}"); + urlBuilder_.Replace("{tasktype}", System.Uri.EscapeDataString(ConvertToString(tasktype, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove a task definition + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UnregisterTaskDefAsync(string tasktype, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (tasktype == null) + throw new System.ArgumentNullException("tasktype"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/taskdefs/{tasktype}"); + urlBuilder_.Replace("{tasktype}", System.Uri.EscapeDataString(ConvertToString(tasktype, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get task or workflow by externalPayloadPath from External PostgreSQL Storage + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetExternalStorageDataAsync(string externalPayloadPath, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (externalPayloadPath == null) + throw new System.ArgumentNullException("externalPayloadPath"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/external/postgres/{externalPayloadPath}"); + urlBuilder_.Replace("{externalPayloadPath}", System.Uri.EscapeDataString(ConvertToString(externalPayloadPath, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); + disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse + return fileResponse_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get event handlers for a given event + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetEventHandlersForEventAsync(string @event, bool? activeOnly = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (@event == null) + throw new System.ArgumentNullException("@event"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/event/{event}?"); + urlBuilder_.Replace("{event}", System.Uri.EscapeDataString(ConvertToString(@event, System.Globalization.CultureInfo.InvariantCulture))); + if (activeOnly != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("activeOnly") + "=").Append(System.Uri.EscapeDataString(ConvertToString(activeOnly, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the list of pending tasks for a given task type + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ViewAsync(string tasktype, int? start = null, int? count = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (tasktype == null) + throw new System.ArgumentNullException("tasktype"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/admin/task/{tasktype}?"); + urlBuilder_.Replace("{tasktype}", System.Uri.EscapeDataString(ConvertToString(tasktype, System.Globalization.CultureInfo.InvariantCulture))); + if (start != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("start") + "=").Append(System.Uri.EscapeDataString(ConvertToString(start, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("count") + "=").Append(System.Uri.EscapeDataString(ConvertToString(count, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get registered queues + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetEventQueuesAsync(bool? verbose = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/admin/queues?"); + if (verbose != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("verbose") + "=").Append(System.Uri.EscapeDataString(ConvertToString(verbose, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get all the configuration parameters + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetAllConfigAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/admin/config"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("*/*")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Removes the workflow from the system + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task DeleteAsync(string workflowId, bool? archiveWorkflow = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (workflowId == null) + throw new System.ArgumentNullException("workflowId"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/workflow/{workflowId}/remove?"); + urlBuilder_.Replace("{workflowId}", System.Uri.EscapeDataString(ConvertToString(workflowId, System.Globalization.CultureInfo.InvariantCulture))); + if (archiveWorkflow != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("archiveWorkflow") + "=").Append(System.Uri.EscapeDataString(ConvertToString(archiveWorkflow, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Removes workflow definition. It does not remove workflows associated with the definition. + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UnregisterWorkflowDefAsync(string name, int version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + if (version == null) + throw new System.ArgumentNullException("version"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/metadata/workflow/{name}/{version}"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{version}", System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove an event handler + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RemoveEventHandlerStatusAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("api/event/{name}"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FileResponse : System.IDisposable + { + private System.IDisposable _client; + private System.IDisposable _response; + + public int StatusCode { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public System.IO.Stream Stream { get; private set; } + + public bool IsPartial + { + get { return StatusCode == 206; } + } + + public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictionary> headers, System.IO.Stream stream, System.IDisposable client, System.IDisposable response) + { + StatusCode = statusCode; + Headers = headers; + Stream = stream; + _client = client; + _response = response; + } + + public void Dispose() + { + Stream.Dispose(); + if (_response != null) + _response.Dispose(); + if (_client != null) + _client.Dispose(); + } + } + + + +} + +#pragma warning restore 1591 +#pragma warning restore 1573 +#pragma warning restore 472 +#pragma warning restore 114 +#pragma warning restore 108 +#pragma warning restore 3016 +#pragma warning restore 8603 \ No newline at end of file diff --git a/src/ConductorSharp.Client/Generated/Models.cs b/src/ConductorSharp.Client/Generated/Models.cs new file mode 100644 index 00000000..3a78abb1 --- /dev/null +++ b/src/ConductorSharp.Client/Generated/Models.cs @@ -0,0 +1,1629 @@ +//---------------------- +// +// Generated using the NSwag toolchain v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" + +namespace ConductorSharp.Client.Generated +{ + using System = global::System; + + + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SkipTaskRequest + { + [Newtonsoft.Json.JsonProperty("taskInput", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskInput { get; set; } + + [Newtonsoft.Json.JsonProperty("taskOutput", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskOutput { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class BulkResponse + { + [Newtonsoft.Json.JsonProperty("bulkErrorResults", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary BulkErrorResults { get; set; } + + [Newtonsoft.Json.JsonProperty("bulkSuccessfulResults", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection BulkSuccessfulResults { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SubWorkflowParams + { + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("taskToDomain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskToDomain { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowDefinition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public WorkflowDef WorkflowDefinition { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskDef + { + [Newtonsoft.Json.JsonProperty("ownerApp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OwnerApp { get; set; } + + [Newtonsoft.Json.JsonProperty("createTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long CreateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("updateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long UpdateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("updatedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UpdatedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("accessPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary AccessPolicy { get; set; } + + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + [Newtonsoft.Json.JsonProperty("retryCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] + public int RetryCount { get; set; } + + [Newtonsoft.Json.JsonProperty("timeoutSeconds", Required = Newtonsoft.Json.Required.Always)] + public long TimeoutSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("inputKeys", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection InputKeys { get; set; } + + [Newtonsoft.Json.JsonProperty("outputKeys", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection OutputKeys { get; set; } + + [Newtonsoft.Json.JsonProperty("timeoutPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskDefTimeoutPolicy TimeoutPolicy { get; set; } + + [Newtonsoft.Json.JsonProperty("retryLogic", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskDefRetryLogic RetryLogic { get; set; } + + [Newtonsoft.Json.JsonProperty("retryDelaySeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RetryDelaySeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("responseTimeoutSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(1D, double.MaxValue)] + public long ResponseTimeoutSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("concurrentExecLimit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int ConcurrentExecLimit { get; set; } + + [Newtonsoft.Json.JsonProperty("inputTemplate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary InputTemplate { get; set; } + + [Newtonsoft.Json.JsonProperty("rateLimitPerFrequency", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RateLimitPerFrequency { get; set; } + + [Newtonsoft.Json.JsonProperty("rateLimitFrequencyInSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RateLimitFrequencyInSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("isolationGroupId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string IsolationGroupId { get; set; } + + [Newtonsoft.Json.JsonProperty("executionNameSpace", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExecutionNameSpace { get; set; } + + [Newtonsoft.Json.JsonProperty("ownerEmail", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OwnerEmail { get; set; } + + [Newtonsoft.Json.JsonProperty("pollTimeoutSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] + public int PollTimeoutSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("backoffScaleFactor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int BackoffScaleFactor { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class WorkflowDef + { + [Newtonsoft.Json.JsonProperty("ownerApp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OwnerApp { get; set; } + + [Newtonsoft.Json.JsonProperty("createTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long CreateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("updateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long UpdateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("updatedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UpdatedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("accessPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary AccessPolicy { get; set; } + + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("tasks", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Tasks { get; set; } = new System.Collections.ObjectModel.Collection(); + + [Newtonsoft.Json.JsonProperty("inputParameters", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection InputParameters { get; set; } + + [Newtonsoft.Json.JsonProperty("outputParameters", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary OutputParameters { get; set; } + + [Newtonsoft.Json.JsonProperty("failureWorkflow", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FailureWorkflow { get; set; } + + [Newtonsoft.Json.JsonProperty("schemaVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(2, 2)] + public int SchemaVersion { get; set; } + + [Newtonsoft.Json.JsonProperty("restartable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Restartable { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowStatusListenerEnabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool WorkflowStatusListenerEnabled { get; set; } + + [Newtonsoft.Json.JsonProperty("ownerEmail", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OwnerEmail { get; set; } + + [Newtonsoft.Json.JsonProperty("timeoutPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public WorkflowDefTimeoutPolicy TimeoutPolicy { get; set; } + + [Newtonsoft.Json.JsonProperty("timeoutSeconds", Required = Newtonsoft.Json.Required.Always)] + public long TimeoutSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("variables", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Variables { get; set; } + + [Newtonsoft.Json.JsonProperty("inputTemplate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary InputTemplate { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class WorkflowTask + { + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("taskReferenceName", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string TaskReferenceName { get; set; } + + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + [Newtonsoft.Json.JsonProperty("inputParameters", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary InputParameters { get; set; } + + [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Type { get; set; } + + [Newtonsoft.Json.JsonProperty("dynamicTaskNameParam", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DynamicTaskNameParam { get; set; } + + [Newtonsoft.Json.JsonProperty("caseValueParam", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.Obsolete] + public string CaseValueParam { get; set; } + + [Newtonsoft.Json.JsonProperty("caseExpression", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.Obsolete] + public string CaseExpression { get; set; } + + [Newtonsoft.Json.JsonProperty("scriptExpression", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ScriptExpression { get; set; } + + [Newtonsoft.Json.JsonProperty("decisionCases", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary> DecisionCases { get; set; } + + [Newtonsoft.Json.JsonProperty("dynamicForkJoinTasksParam", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.Obsolete] + public string DynamicForkJoinTasksParam { get; set; } + + [Newtonsoft.Json.JsonProperty("dynamicForkTasksParam", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DynamicForkTasksParam { get; set; } + + [Newtonsoft.Json.JsonProperty("dynamicForkTasksInputParamName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DynamicForkTasksInputParamName { get; set; } + + [Newtonsoft.Json.JsonProperty("defaultCase", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection DefaultCase { get; set; } + + [Newtonsoft.Json.JsonProperty("forkTasks", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection> ForkTasks { get; set; } + + [Newtonsoft.Json.JsonProperty("startDelay", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int StartDelay { get; set; } + + [Newtonsoft.Json.JsonProperty("subWorkflowParam", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SubWorkflowParams SubWorkflowParam { get; set; } + + [Newtonsoft.Json.JsonProperty("joinOn", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection JoinOn { get; set; } + + [Newtonsoft.Json.JsonProperty("sink", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Sink { get; set; } + + [Newtonsoft.Json.JsonProperty("optional", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Optional { get; set; } + + [Newtonsoft.Json.JsonProperty("taskDefinition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public TaskDef TaskDefinition { get; set; } + + [Newtonsoft.Json.JsonProperty("rateLimited", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool RateLimited { get; set; } + + [Newtonsoft.Json.JsonProperty("defaultExclusiveJoinTask", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection DefaultExclusiveJoinTask { get; set; } + + [Newtonsoft.Json.JsonProperty("asyncComplete", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AsyncComplete { get; set; } + + [Newtonsoft.Json.JsonProperty("loopCondition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string LoopCondition { get; set; } + + [Newtonsoft.Json.JsonProperty("loopOver", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection LoopOver { get; set; } + + [Newtonsoft.Json.JsonProperty("retryCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RetryCount { get; set; } + + [Newtonsoft.Json.JsonProperty("evaluatorType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EvaluatorType { get; set; } + + [Newtonsoft.Json.JsonProperty("expression", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Expression { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowTaskType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public WorkflowTaskType WorkflowTaskType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Action + { + [Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Action1 Action1 { get; set; } + + [Newtonsoft.Json.JsonProperty("start_workflow", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public StartWorkflow Start_workflow { get; set; } + + [Newtonsoft.Json.JsonProperty("complete_task", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public TaskDetails Complete_task { get; set; } + + [Newtonsoft.Json.JsonProperty("fail_task", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public TaskDetails Fail_task { get; set; } + + [Newtonsoft.Json.JsonProperty("expandInlineJSON", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool ExpandInlineJSON { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EventHandler + { + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("event", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Event { get; set; } + + [Newtonsoft.Json.JsonProperty("condition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Condition { get; set; } + + [Newtonsoft.Json.JsonProperty("actions", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Actions { get; set; } = new System.Collections.ObjectModel.Collection(); + + [Newtonsoft.Json.JsonProperty("active", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Active { get; set; } + + [Newtonsoft.Json.JsonProperty("evaluatorType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EvaluatorType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class StartWorkflow + { + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("input", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Input { get; set; } + + [Newtonsoft.Json.JsonProperty("taskToDomain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskToDomain { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskDetails + { + [Newtonsoft.Json.JsonProperty("workflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("taskRefName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskRefName { get; set; } + + [Newtonsoft.Json.JsonProperty("output", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Output { get; set; } + + [Newtonsoft.Json.JsonProperty("taskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class StartWorkflowRequest + { + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("input", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Input { get; set; } + + [Newtonsoft.Json.JsonProperty("taskToDomain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskToDomain { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowDef", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public WorkflowDef WorkflowDef { get; set; } + + [Newtonsoft.Json.JsonProperty("externalInputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalInputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("priority", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(0, 99)] + public int Priority { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RerunWorkflowRequest + { + [Newtonsoft.Json.JsonProperty("reRunFromWorkflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReRunFromWorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowInput", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary WorkflowInput { get; set; } + + [Newtonsoft.Json.JsonProperty("reRunFromTaskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReRunFromTaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("taskInput", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskInput { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Task + { + [Newtonsoft.Json.JsonProperty("taskType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskType { get; set; } + + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskStatus Status { get; set; } + + [Newtonsoft.Json.JsonProperty("inputData", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary InputData { get; set; } + + [Newtonsoft.Json.JsonProperty("referenceTaskName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReferenceTaskName { get; set; } + + [Newtonsoft.Json.JsonProperty("retryCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RetryCount { get; set; } + + [Newtonsoft.Json.JsonProperty("seq", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Seq { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("pollCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int PollCount { get; set; } + + [Newtonsoft.Json.JsonProperty("taskDefName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskDefName { get; set; } + + [Newtonsoft.Json.JsonProperty("scheduledTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long ScheduledTime { get; set; } + + [Newtonsoft.Json.JsonProperty("startTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long StartTime { get; set; } + + [Newtonsoft.Json.JsonProperty("endTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long EndTime { get; set; } + + [Newtonsoft.Json.JsonProperty("updateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long UpdateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("startDelayInSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int StartDelayInSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("retriedTaskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string RetriedTaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("retried", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Retried { get; set; } + + [Newtonsoft.Json.JsonProperty("executed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Executed { get; set; } + + [Newtonsoft.Json.JsonProperty("callbackFromWorker", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool CallbackFromWorker { get; set; } + + [Newtonsoft.Json.JsonProperty("responseTimeoutSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long ResponseTimeoutSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowInstanceId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowInstanceId { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowType { get; set; } + + [Newtonsoft.Json.JsonProperty("taskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("reasonForIncompletion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReasonForIncompletion { get; set; } + + [Newtonsoft.Json.JsonProperty("callbackAfterSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long CallbackAfterSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("workerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkerId { get; set; } + + [Newtonsoft.Json.JsonProperty("outputData", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary OutputData { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowTask", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public WorkflowTask WorkflowTask { get; set; } + + [Newtonsoft.Json.JsonProperty("domain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Domain { get; set; } + + [Newtonsoft.Json.JsonProperty("rateLimitPerFrequency", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RateLimitPerFrequency { get; set; } + + [Newtonsoft.Json.JsonProperty("rateLimitFrequencyInSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RateLimitFrequencyInSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("externalInputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalInputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("externalOutputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalOutputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowPriority", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int WorkflowPriority { get; set; } + + [Newtonsoft.Json.JsonProperty("executionNameSpace", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExecutionNameSpace { get; set; } + + [Newtonsoft.Json.JsonProperty("isolationGroupId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string IsolationGroupId { get; set; } + + [Newtonsoft.Json.JsonProperty("iteration", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Iteration { get; set; } + + [Newtonsoft.Json.JsonProperty("subWorkflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SubWorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("subworkflowChanged", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool SubworkflowChanged { get; set; } + + [Newtonsoft.Json.JsonProperty("taskDefinition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public TaskDef TaskDefinition { get; set; } + + [Newtonsoft.Json.JsonProperty("queueWaitTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long QueueWaitTime { get; set; } + + [Newtonsoft.Json.JsonProperty("loopOverTask", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool LoopOverTask { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Workflow + { + [Newtonsoft.Json.JsonProperty("ownerApp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OwnerApp { get; set; } + + [Newtonsoft.Json.JsonProperty("createTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long CreateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("updateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long UpdateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("updatedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UpdatedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public WorkflowStatus Status { get; set; } + + [Newtonsoft.Json.JsonProperty("endTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long EndTime { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("parentWorkflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ParentWorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("parentWorkflowTaskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ParentWorkflowTaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("tasks", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Tasks { get; set; } + + [Newtonsoft.Json.JsonProperty("input", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Input { get; set; } + + [Newtonsoft.Json.JsonProperty("output", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Output { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("reRunFromWorkflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReRunFromWorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("reasonForIncompletion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReasonForIncompletion { get; set; } + + [Newtonsoft.Json.JsonProperty("event", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Event { get; set; } + + [Newtonsoft.Json.JsonProperty("taskToDomain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskToDomain { get; set; } + + [Newtonsoft.Json.JsonProperty("failedReferenceTaskNames", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection FailedReferenceTaskNames { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowDefinition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public WorkflowDef WorkflowDefinition { get; set; } + + [Newtonsoft.Json.JsonProperty("externalInputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalInputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("externalOutputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalOutputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("priority", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(0, 99)] + public int Priority { get; set; } + + [Newtonsoft.Json.JsonProperty("variables", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Variables { get; set; } + + [Newtonsoft.Json.JsonProperty("lastRetriedTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long LastRetriedTime { get; set; } + + [Newtonsoft.Json.JsonProperty("failedTaskNames", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection FailedTaskNames { get; set; } + + [Newtonsoft.Json.JsonProperty("startTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long StartTime { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowName { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int WorkflowVersion { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskMock + { + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskMockStatus Status { get; set; } + + [Newtonsoft.Json.JsonProperty("output", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Output { get; set; } + + [Newtonsoft.Json.JsonProperty("executionTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long ExecutionTime { get; set; } + + [Newtonsoft.Json.JsonProperty("queueWaitTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long QueueWaitTime { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class WorkflowTestRequest + { + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("input", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Input { get; set; } + + [Newtonsoft.Json.JsonProperty("taskToDomain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary TaskToDomain { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowDef", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public WorkflowDef WorkflowDef { get; set; } + + [Newtonsoft.Json.JsonProperty("externalInputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalInputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("priority", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [System.ComponentModel.DataAnnotations.Range(0, 99)] + public int Priority { get; set; } + + [Newtonsoft.Json.JsonProperty("taskRefToMockOutput", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary> TaskRefToMockOutput { get; set; } + + [Newtonsoft.Json.JsonProperty("subWorkflowTestRequest", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary SubWorkflowTestRequest { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskExecLog + { + [Newtonsoft.Json.JsonProperty("log", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Log { get; set; } + + [Newtonsoft.Json.JsonProperty("taskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("createdTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long CreatedTime { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskResult + { + [Newtonsoft.Json.JsonProperty("workflowInstanceId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string WorkflowInstanceId { get; set; } + + [Newtonsoft.Json.JsonProperty("taskId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string TaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("reasonForIncompletion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReasonForIncompletion { get; set; } + + [Newtonsoft.Json.JsonProperty("callbackAfterSeconds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long CallbackAfterSeconds { get; set; } + + [Newtonsoft.Json.JsonProperty("workerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkerId { get; set; } + + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskResultStatus Status { get; set; } + + [Newtonsoft.Json.JsonProperty("outputData", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary OutputData { get; set; } + + [Newtonsoft.Json.JsonProperty("logs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Logs { get; set; } + + [Newtonsoft.Json.JsonProperty("externalOutputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalOutputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("subWorkflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SubWorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("extendLease", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool ExtendLease { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Health + { + [Newtonsoft.Json.JsonProperty("details", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Details { get; set; } + + [Newtonsoft.Json.JsonProperty("errorMessage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ErrorMessage { get; set; } + + [Newtonsoft.Json.JsonProperty("healthy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Healthy { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class HealthCheckStatus + { + [Newtonsoft.Json.JsonProperty("healthResults", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection HealthResults { get; set; } + + [Newtonsoft.Json.JsonProperty("suppressedHealthResults", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection SuppressedHealthResults { get; set; } + + [Newtonsoft.Json.JsonProperty("healthy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Healthy { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchResultWorkflowSummary + { + [Newtonsoft.Json.JsonProperty("totalHits", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long TotalHits { get; set; } + + [Newtonsoft.Json.JsonProperty("results", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Results { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class WorkflowSummary + { + [Newtonsoft.Json.JsonProperty("workflowType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowType { get; set; } + + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("startTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string StartTime { get; set; } + + [Newtonsoft.Json.JsonProperty("updateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UpdateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("endTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EndTime { get; set; } + + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public WorkflowSummaryStatus Status { get; set; } + + [Newtonsoft.Json.JsonProperty("input", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Input { get; set; } + + [Newtonsoft.Json.JsonProperty("output", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Output { get; set; } + + [Newtonsoft.Json.JsonProperty("reasonForIncompletion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReasonForIncompletion { get; set; } + + [Newtonsoft.Json.JsonProperty("executionTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long ExecutionTime { get; set; } + + [Newtonsoft.Json.JsonProperty("event", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Event { get; set; } + + [Newtonsoft.Json.JsonProperty("failedReferenceTaskNames", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FailedReferenceTaskNames { get; set; } + + [Newtonsoft.Json.JsonProperty("externalInputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalInputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("externalOutputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalOutputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("priority", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Priority { get; set; } + + [Newtonsoft.Json.JsonProperty("failedTaskNames", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection FailedTaskNames { get; set; } + + [Newtonsoft.Json.JsonProperty("inputSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long InputSize { get; set; } + + [Newtonsoft.Json.JsonProperty("outputSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long OutputSize { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchResultWorkflow + { + [Newtonsoft.Json.JsonProperty("totalHits", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long TotalHits { get; set; } + + [Newtonsoft.Json.JsonProperty("results", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Results { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExternalStorageLocation + { + [Newtonsoft.Json.JsonProperty("uri", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Uri { get; set; } + + [Newtonsoft.Json.JsonProperty("path", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Path { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchResultTaskSummary + { + [Newtonsoft.Json.JsonProperty("totalHits", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long TotalHits { get; set; } + + [Newtonsoft.Json.JsonProperty("results", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Results { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskSummary + { + [Newtonsoft.Json.JsonProperty("workflowId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowId { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkflowType { get; set; } + + [Newtonsoft.Json.JsonProperty("correlationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CorrelationId { get; set; } + + [Newtonsoft.Json.JsonProperty("scheduledTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ScheduledTime { get; set; } + + [Newtonsoft.Json.JsonProperty("startTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string StartTime { get; set; } + + [Newtonsoft.Json.JsonProperty("updateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UpdateTime { get; set; } + + [Newtonsoft.Json.JsonProperty("endTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EndTime { get; set; } + + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskSummaryStatus Status { get; set; } + + [Newtonsoft.Json.JsonProperty("reasonForIncompletion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReasonForIncompletion { get; set; } + + [Newtonsoft.Json.JsonProperty("executionTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long ExecutionTime { get; set; } + + [Newtonsoft.Json.JsonProperty("queueWaitTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long QueueWaitTime { get; set; } + + [Newtonsoft.Json.JsonProperty("taskDefName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskDefName { get; set; } + + [Newtonsoft.Json.JsonProperty("taskType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskType { get; set; } + + [Newtonsoft.Json.JsonProperty("input", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Input { get; set; } + + [Newtonsoft.Json.JsonProperty("output", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Output { get; set; } + + [Newtonsoft.Json.JsonProperty("taskId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskId { get; set; } + + [Newtonsoft.Json.JsonProperty("externalInputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalInputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("externalOutputPayloadStoragePath", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ExternalOutputPayloadStoragePath { get; set; } + + [Newtonsoft.Json.JsonProperty("workflowPriority", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int WorkflowPriority { get; set; } + + [Newtonsoft.Json.JsonProperty("domain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Domain { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchResultTask + { + [Newtonsoft.Json.JsonProperty("totalHits", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long TotalHits { get; set; } + + [Newtonsoft.Json.JsonProperty("results", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Results { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PollData + { + [Newtonsoft.Json.JsonProperty("queueName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string QueueName { get; set; } + + [Newtonsoft.Json.JsonProperty("domain", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Domain { get; set; } + + [Newtonsoft.Json.JsonProperty("workerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WorkerId { get; set; } + + [Newtonsoft.Json.JsonProperty("lastPollTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long LastPollTime { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Status + { + + [System.Runtime.Serialization.EnumMember(Value = @"IN_PROGRESS")] + IN_PROGRESS = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"CANCELED")] + CANCELED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED_WITH_TERMINAL_ERROR")] + FAILED_WITH_TERMINAL_ERROR = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED_WITH_ERRORS")] + COMPLETED_WITH_ERRORS = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"SCHEDULED")] + SCHEDULED = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"TIMED_OUT")] + TIMED_OUT = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"SKIPPED")] + SKIPPED = 8, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Status2 + { + + [System.Runtime.Serialization.EnumMember(Value = @"IN_PROGRESS")] + IN_PROGRESS = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"CANCELED")] + CANCELED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED_WITH_TERMINAL_ERROR")] + FAILED_WITH_TERMINAL_ERROR = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED_WITH_ERRORS")] + COMPLETED_WITH_ERRORS = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"SCHEDULED")] + SCHEDULED = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"TIMED_OUT")] + TIMED_OUT = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"SKIPPED")] + SKIPPED = 8, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskDefTimeoutPolicy + { + + [System.Runtime.Serialization.EnumMember(Value = @"RETRY")] + RETRY = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"TIME_OUT_WF")] + TIME_OUT_WF = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"ALERT_ONLY")] + ALERT_ONLY = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskDefRetryLogic + { + + [System.Runtime.Serialization.EnumMember(Value = @"FIXED")] + FIXED = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"EXPONENTIAL_BACKOFF")] + EXPONENTIAL_BACKOFF = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"LINEAR_BACKOFF")] + LINEAR_BACKOFF = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum WorkflowDefTimeoutPolicy + { + + [System.Runtime.Serialization.EnumMember(Value = @"TIME_OUT_WF")] + TIME_OUT_WF = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"ALERT_ONLY")] + ALERT_ONLY = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum WorkflowTaskType + { + + [System.Runtime.Serialization.EnumMember(Value = @"SIMPLE")] + SIMPLE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"DYNAMIC")] + DYNAMIC = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FORK_JOIN")] + FORK_JOIN = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FORK_JOIN_DYNAMIC")] + FORK_JOIN_DYNAMIC = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"DECISION")] + DECISION = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"SWITCH")] + SWITCH = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"JOIN")] + JOIN = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"DO_WHILE")] + DO_WHILE = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"SUB_WORKFLOW")] + SUB_WORKFLOW = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"START_WORKFLOW")] + START_WORKFLOW = 9, + + [System.Runtime.Serialization.EnumMember(Value = @"EVENT")] + EVENT = 10, + + [System.Runtime.Serialization.EnumMember(Value = @"WAIT")] + WAIT = 11, + + [System.Runtime.Serialization.EnumMember(Value = @"HUMAN")] + HUMAN = 12, + + [System.Runtime.Serialization.EnumMember(Value = @"USER_DEFINED")] + USER_DEFINED = 13, + + [System.Runtime.Serialization.EnumMember(Value = @"HTTP")] + HTTP = 14, + + [System.Runtime.Serialization.EnumMember(Value = @"LAMBDA")] + LAMBDA = 15, + + [System.Runtime.Serialization.EnumMember(Value = @"INLINE")] + INLINE = 16, + + [System.Runtime.Serialization.EnumMember(Value = @"EXCLUSIVE_JOIN")] + EXCLUSIVE_JOIN = 17, + + [System.Runtime.Serialization.EnumMember(Value = @"TERMINATE")] + TERMINATE = 18, + + [System.Runtime.Serialization.EnumMember(Value = @"KAFKA_PUBLISH")] + KAFKA_PUBLISH = 19, + + [System.Runtime.Serialization.EnumMember(Value = @"JSON_JQ_TRANSFORM")] + JSON_JQ_TRANSFORM = 20, + + [System.Runtime.Serialization.EnumMember(Value = @"SET_VARIABLE")] + SET_VARIABLE = 21, + + [System.Runtime.Serialization.EnumMember(Value = @"NOOP")] + NOOP = 22, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Action1 + { + + [System.Runtime.Serialization.EnumMember(Value = @"start_workflow")] + Start_workflow = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"complete_task")] + Complete_task = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"fail_task")] + Fail_task = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"IN_PROGRESS")] + IN_PROGRESS = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"CANCELED")] + CANCELED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED_WITH_TERMINAL_ERROR")] + FAILED_WITH_TERMINAL_ERROR = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED_WITH_ERRORS")] + COMPLETED_WITH_ERRORS = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"SCHEDULED")] + SCHEDULED = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"TIMED_OUT")] + TIMED_OUT = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"SKIPPED")] + SKIPPED = 8, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum WorkflowStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"RUNNING")] + RUNNING = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"TIMED_OUT")] + TIMED_OUT = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"TERMINATED")] + TERMINATED = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"PAUSED")] + PAUSED = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskMockStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"IN_PROGRESS")] + IN_PROGRESS = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED_WITH_TERMINAL_ERROR")] + FAILED_WITH_TERMINAL_ERROR = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskResultStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"IN_PROGRESS")] + IN_PROGRESS = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED_WITH_TERMINAL_ERROR")] + FAILED_WITH_TERMINAL_ERROR = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum WorkflowSummaryStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"RUNNING")] + RUNNING = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"TIMED_OUT")] + TIMED_OUT = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"TERMINATED")] + TERMINATED = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"PAUSED")] + PAUSED = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskSummaryStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"IN_PROGRESS")] + IN_PROGRESS = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"CANCELED")] + CANCELED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED_WITH_TERMINAL_ERROR")] + FAILED_WITH_TERMINAL_ERROR = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED")] + COMPLETED = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"COMPLETED_WITH_ERRORS")] + COMPLETED_WITH_ERRORS = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"SCHEDULED")] + SCHEDULED = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"TIMED_OUT")] + TIMED_OUT = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"SKIPPED")] + SKIPPED = 8, + + } +} + +#pragma warning restore 1591 +#pragma warning restore 1573 +#pragma warning restore 472 +#pragma warning restore 114 +#pragma warning restore 108 +#pragma warning restore 3016 +#pragma warning restore 8603 \ No newline at end of file diff --git a/src/ConductorSharp.Client/Model/Common/EventHandlerDefinition.cs b/src/ConductorSharp.Client/Model/Common/EventHandlerDefinition.cs deleted file mode 100644 index e1671a4f..00000000 --- a/src/ConductorSharp.Client/Model/Common/EventHandlerDefinition.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace ConductorSharp.Client.Model.Common -{ - public class StartWorkflowActionDetails - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("version")] - public int Version { get; set; } - - [JsonProperty("input")] - public JObject Input { get; set; } - } - - public class CompleteTaskAction : Action - { - [JsonProperty("action")] - public string ActionType { get; set; } = "complete_task"; - - [JsonProperty("complete_task")] - public CompleteTaskActionDetails CompleteTask { get; set; } - } - - public class CompleteTaskActionDetails - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("taskRefName")] - public string TaskRefName { get; set; } - - [JsonProperty("output")] - public JObject Output { get; set; } - } - - public class StartWorkflowAction : Action - { - [JsonProperty("action")] - public string ActionType { get; set; } = "start_workflow"; - - [JsonProperty("start_workflow")] - public StartWorkflowActionDetails StartWorkflow { get; set; } - - [JsonProperty("expandInlineJSON")] - public bool ExpandInlineJson { get; set; } = true; - } - - public class FailTaskActionDetails - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("taskRefName")] - public int TaskRefName { get; set; } - - [JsonProperty("output")] - public JObject Output { get; set; } - } - - public class FailTaskAction : Action - { - [JsonProperty("action")] - public string ActionType { get; set; } = "fail_task"; - - [JsonProperty("expandInlineJSON")] - public bool ExpandInlineJson { get; set; } = true; - - [JsonProperty("fail_task")] - public FailTaskActionDetails FailTask { get; set; } - } - - public abstract class Action { } - - public class EventHandlerDefinition - { - [JsonProperty("active")] - public bool Active { get; set; } = true; - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("event")] - public string Event { get; set; } - - [JsonProperty("condition")] - public string Condition { get; set; } - - [JsonProperty("actions")] - public Action[] Actions { get; set; } - - public static bool AreEqual(EventHandlerDefinition d1, EventHandlerDefinition d2) - { - var o1 = JsonConvert.SerializeObject(d1); - var o2 = JsonConvert.SerializeObject(d2); - - return o1.Equals(o2); - } - } -} diff --git a/src/ConductorSharp.Client/Model/Common/TaskDefinition.cs b/src/ConductorSharp.Client/Model/Common/TaskDefinition.cs deleted file mode 100644 index 1fbcaafa..00000000 --- a/src/ConductorSharp.Client/Model/Common/TaskDefinition.cs +++ /dev/null @@ -1,119 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System.Collections.Generic; - -namespace ConductorSharp.Client.Model.Common -{ - public class TaskDefinition - { - [JsonProperty("ownerApp")] - public string OwnerApp { get; set; } = "test@test.local"; - - [JsonProperty("createTime")] - public long CreateTime { get; set; } - - [JsonProperty("updateTime")] - public long UpdateTime { get; set; } - - [JsonProperty("createdBy")] - public string CreatedBy { get; set; } - - [JsonProperty("updatedBy")] - public string UpdatedBy { get; set; } - - /// Task Type. Unique name of the Task that resonates with it's function. - /// Unique - [JsonProperty("name")] - public string Name { get; set; } - - /// Description of the task. - /// Optional - [JsonProperty("description")] - public string Description { get; set; } - - /// No. of retries to attempt when a Task is marked as failure. - /// Defaults to 3 - [JsonProperty("retryCount")] - public int RetryCount { get; set; } - - /// Time in seconds, after which the task is marked as TIMED_OUT if not completed after transitioning to IN_PROGRESS status for the first time. - /// No timeouts if set to 0 - [JsonProperty("timeoutSeconds")] - public int TimeoutSeconds { get; set; } - - /// Array of keys of task's expected input. Used for documenting task's inpu. - /// Optional - [JsonProperty("inputKeys")] - public List InputKeys { get; set; } - - /// Array of keys of task's expected output. Used for documenting task's output. - /// Optional - [JsonProperty("outputKeys")] - public List OutputKeys { get; set; } - - /// Task's timeout policy. - /// Values should be assigned from the TimeoutPolicy constants class - [JsonProperty("timeoutPolicy")] - public string TimeoutPolicy { get; set; } - - /// Mechanism for the retries. - /// Values should be assigned from the RetryLogic constants class - [JsonProperty("retryLogic")] - public string RetryLogic { get; set; } - - /// Time to wait before retries. - /// Defaults to 60 seconds - [JsonProperty("retryDelaySeconds")] - public int RetryDelaySeconds { get; set; } - - /// The task is rescheduled if not updated with a status after this time (heartbeat mechanism). Useful when the worker polls for the task but fails to complete due to errors/network failure. - /// Must be greater than 0 and less than timeoutSeconds, defaults to 3600 - [JsonProperty("responseTimeoutSeconds")] - public int ResponseTimeoutSeconds { get; set; } - - /// Number of tasks that can be executed at any given time. - /// Optional - [JsonProperty("concurrentExecLimit")] - public int ConcurrentExecLimit { get; set; } - - /// Allows to define default values, which can be overridden by values provided in Workflow. - [JsonProperty("inputTemplate")] - public JObject InputTemplate { get; set; } - - /// Defines the number of Tasks that can be given to Workers per given "frequency window". - /// RateLimitFrequencyInSeconds and RateLimitPerFrequency should be used together. - [JsonProperty("rateLimitPerFrequency")] - public int RateLimitPerFrequency { get; set; } - - /// Sets the "frequency window", i.e the duration to be used in events per duration. Eg: 1s, 5s, 60s, 300s etc. - /// RateLimitFrequencyInSeconds and RateLimitPerFrequency should be used together. - [JsonProperty("rateLimitFrequencyInSeconds")] - public int RateLimitFrequencyInSeconds { get; set; } - - /// When we set isolationGroupId, the executor(SystemTaskWorkerCoordinator) will allocate an isolated queue and an isolated thread pool for execution of those tasks. - /// IsolationGroupId is currently supported only in HTTP and kafka Task. - [JsonProperty("isolationGroupId")] - public string IsolationGroupId { get; set; } - - /// To support JVM isolation, and also allow the executors to scale horizontally, we can use executionNameSpace property in taskdef. - /// ExecutionNameSpace can be used along with isolationGroupId - [JsonProperty("executionNameSpace")] - public string ExecutionNameSpace { get; set; } - - [JsonProperty("ownerEmail")] - public string OwnerEmail { get; set; } - - ///Time in seconds, after which the task is marked as TIMED_OUT if not polled by a worker. - ///No timeouts if set to 0 - [JsonProperty("pollTimeoutSeconds")] - public int PollTimeoutSeconds { get; set; } - - public static bool AreEqual(TaskDefinition t1, TaskDefinition t2) - { - var o1 = JsonConvert.SerializeObject(t1); - var o2 = JsonConvert.SerializeObject(t2); - - return o1.Equals(o2); - } - } -} diff --git a/src/ConductorSharp.Client/Model/Common/WorkflowDefinition.cs b/src/ConductorSharp.Client/Model/Common/WorkflowDefinition.cs deleted file mode 100644 index 0221fc28..00000000 --- a/src/ConductorSharp.Client/Model/Common/WorkflowDefinition.cs +++ /dev/null @@ -1,186 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System.Collections.Generic; - -namespace ConductorSharp.Client.Model.Common -{ - public class WorkflowDefinition - { - public class SubWorkflowParam - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("version")] - public int Version { get; set; } - - [JsonProperty("taskToDomain")] - public JObject TaskToDomain { get; set; } - - [JsonProperty("workflowDefinition")] - public WorkflowDefinition WorkflowDefinition { get; set; } - } - - public class Task - { - [JsonProperty("queryExpression")] - public string QueryExpression { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("taskReferenceName")] - public string TaskReferenceName { get; set; } - - [JsonProperty("description")] - public string Description { get; set; } - - [JsonProperty("inputParameters")] - public JObject InputParameters { get; set; } - - /// - /// default: SIMPLE - /// - [JsonProperty("type")] - public string Type { get; set; } = ConductorConstants.SimpleTask; - - [JsonProperty("dynamicTaskNameParam")] - public string DynamicTaskNameParam { get; set; } - - [JsonProperty("caseValueParam")] - public string CaseValueParam { get; set; } - - [JsonProperty("caseExpression")] - public string CaseExpression { get; set; } - - [JsonProperty("expression")] - public string Expression { get; set; } - - [JsonProperty("evaluatorType")] - public string EvaluatorType { get; set; } - - [JsonProperty("scriptExpression")] - public string ScriptExpression { get; set; } - - [JsonProperty("decisionCases")] - public JObject DecisionCases { get; set; } - - [JsonProperty("dynamicForkJoinTasksParam")] - public string DynamicForkJoinTasksParam { get; set; } - - [JsonProperty("dynamicForkTasksParam")] - public string DynamicForkTasksParam { get; set; } - - [JsonProperty("dynamicForkTasksInputParamName")] - public string DynamicForkTasksInputParamName { get; set; } - - [JsonProperty("defaultCase")] - public List DefaultCase { get; set; } - - [JsonProperty("forkTasks")] - public List> ForkTasks { get; set; } - - [JsonProperty("startDelay")] - public int StartDelay { get; set; } - - [JsonProperty("subWorkflowParam")] - public SubWorkflowParam SubWorkflowParam { get; set; } - - [JsonProperty("joinOn")] - public List JoinOn { get; set; } - - [JsonProperty("sink")] - public string Sink { get; set; } - - [JsonProperty("optional")] - public bool Optional { get; set; } - - [JsonProperty("taskDefinition")] - public TaskDefinition TaskDefinition { get; set; } - - [JsonProperty("rateLimited")] - public bool RateLimited { get; set; } - - [JsonProperty("defaultExclusiveJoinTask")] - public List DefaultExclusiveJoinTask { get; set; } - - [JsonProperty("asyncComplete")] - public bool AsyncComplete { get; set; } - - [JsonProperty("loopCondition")] - public string LoopCondition { get; set; } - - [JsonProperty("loopOver")] - public List LoopOver { get; set; } - } - - [JsonProperty("ownerApp")] - public string OwnerApp { get; set; } - - [JsonProperty("createTime")] - public long CreateTime { get; set; } - - [JsonProperty("updateTime")] - public long UpdateTime { get; set; } - - [JsonProperty("createdBy")] - public string CreatedBy { get; set; } - - [JsonProperty("updatedBy")] - public string UpdatedBy { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("description")] - public string Description { get; set; } - - /// - /// default: 1 - /// - [JsonProperty("version")] - public int Version { get; set; } = 1; - - [JsonProperty("tasks")] - public List Tasks { get; set; } - - [JsonProperty("inputParameters")] - public string[] InputParameters { get; set; } - - [JsonProperty("outputParameters")] - public JObject OutputParameters { get; set; } - - [JsonProperty("failureWorkflow")] - public string FailureWorkflow { get; set; } - - /// - /// default: 2 - /// - [JsonProperty("schemaVersion")] - public int SchemaVersion { get; set; } = 2; - - /// - /// default: true - /// - [JsonProperty("restartable")] - public bool Restartable { get; set; } = true; - - /// - /// default: true - /// - [JsonProperty("workflowStatusListenerEnabled")] - public bool WorkflowStatusListenerEnabled { get; set; } = true; - - [JsonProperty("ownerEmail")] - public string OwnerEmail { get; set; } - - [JsonProperty("timeoutPolicy")] - public string TimeoutPolicy { get; set; } - - [JsonProperty("timeoutSeconds")] - public int TimeoutSeconds { get; set; } - - [JsonProperty("variables")] - public JObject Variables { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Request/QueueWorkflowRequest.cs b/src/ConductorSharp.Client/Model/Request/QueueWorkflowRequest.cs deleted file mode 100644 index eedbcbe4..00000000 --- a/src/ConductorSharp.Client/Model/Request/QueueWorkflowRequest.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace ConductorSharp.Client.Model.Request -{ - public class QueueWorkflowRequest - { - [JsonProperty("input")] - public JObject Input { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("version")] - public int Version { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Request/UpdateTaskRequest.cs b/src/ConductorSharp.Client/Model/Request/UpdateTaskRequest.cs deleted file mode 100644 index b623ac3d..00000000 --- a/src/ConductorSharp.Client/Model/Request/UpdateTaskRequest.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; -using System.Collections.Generic; - -namespace ConductorSharp.Client.Model.Request -{ - public class UpdateTaskRequest - { - public class LogData - { - [JsonProperty("log")] - public string Log { get; set; } - - [JsonProperty("createdTime")] - public long CreatedTime { get; set; } - } - - [JsonProperty("workflowInstanceId")] - public string WorkflowInstanceId { get; set; } - - [JsonProperty("taskId")] - public string TaskId { get; set; } - - [JsonProperty("reasonForIncompletion")] - public string ReasonForIncompletion { get; set; } - - [JsonProperty("callbackAfterSeconds")] - public int CallbackAfterSeconds { get; set; } - - [JsonProperty("status")] - public string Status { get; set; } - - [JsonProperty("outputData")] - public JObject OutputData { get; set; } - - [JsonProperty("logs")] - public List Logs { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Request/WorkflowSearchRequest.cs b/src/ConductorSharp.Client/Model/Request/WorkflowSearchRequest.cs deleted file mode 100644 index 9db2cf06..00000000 --- a/src/ConductorSharp.Client/Model/Request/WorkflowSearchRequest.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ConductorSharp.Client.Model.Request -{ - public class WorkflowSearchRequest - { - public int? Start { get; set; } - public int? Size { get; set; } - public string Sort { get; set; } - public bool? SortAscending { get; set; } - public string FreeText { get; set; } - public string Query { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Request/WorkflowTestRequest.cs b/src/ConductorSharp.Client/Model/Request/WorkflowTestRequest.cs deleted file mode 100644 index 33359d97..00000000 --- a/src/ConductorSharp.Client/Model/Request/WorkflowTestRequest.cs +++ /dev/null @@ -1,30 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; - -namespace ConductorSharp.Client.Model.Request -{ - public class WorkflowTestRequest - { - public class TaskMock - { - public string Status { get; set; } - public JObject Output { get; set; } - public long ExecutionTime { get; set; } - public long QueueWaitTime { get; set; } - public JObject AdditionalProperties { get; set; } - } - - public string Name { get; set; } - public int Version { get; set; } - public string CorrelationId { get; set; } - public JObject Input { get; set; } - public Dictionary TaskToDomain { get; set; } - public WorkflowDefinition WorkflowDef { get; set; } - public string ExternalInputPayloadStoragePath { get; set; } - public int Priority { get; set; } - public Dictionary> TaskRefToMockOutput { get; set; } - public Dictionary SubWorkflowTestRequest { get; set; } - public JObject AdditionalProperties { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/ConductorValidationError.cs b/src/ConductorSharp.Client/Model/Response/ConductorValidationError.cs deleted file mode 100644 index 5a844e25..00000000 --- a/src/ConductorSharp.Client/Model/Response/ConductorValidationError.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Newtonsoft.Json; - -namespace ConductorSharp.Client.Model.Response -{ - public class ConductorValidationError - { - [JsonProperty("path")] - public string Path { get; set; } - - [JsonProperty("message")] - public string Message { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/ExternalStorageResponse.cs b/src/ConductorSharp.Client/Model/Response/ExternalStorageResponse.cs deleted file mode 100644 index f49ee353..00000000 --- a/src/ConductorSharp.Client/Model/Response/ExternalStorageResponse.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ConductorSharp.Client.Model.Response -{ - public class ExternalStorageResponse - { - public string Uri { get; set; } - public string Path { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/GetAllTaskDefinitionsResponse.cs b/src/ConductorSharp.Client/Model/Response/GetAllTaskDefinitionsResponse.cs deleted file mode 100644 index cb7389d9..00000000 --- a/src/ConductorSharp.Client/Model/Response/GetAllTaskDefinitionsResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace ConductorSharp.Client.Model.Response -{ - public class GetAllTaskDefinitionsResponse - { - [JsonProperty("result")] - public List Result { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/GetAllWorkflowDefinitionsResponse.cs b/src/ConductorSharp.Client/Model/Response/GetAllWorkflowDefinitionsResponse.cs deleted file mode 100644 index 752ae4ee..00000000 --- a/src/ConductorSharp.Client/Model/Response/GetAllWorkflowDefinitionsResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace ConductorSharp.Client.Model.Response -{ - public class GetAllWorkflowDefinitionsResponse - { - [JsonProperty("result")] - public List Result { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/GetTaskDefinitionResponse.cs b/src/ConductorSharp.Client/Model/Response/GetTaskDefinitionResponse.cs deleted file mode 100644 index 789ba12b..00000000 --- a/src/ConductorSharp.Client/Model/Response/GetTaskDefinitionResponse.cs +++ /dev/null @@ -1,11 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json; - -namespace ConductorSharp.Client.Model.Response -{ - public class GetTaskDefinitionResponse - { - [JsonProperty("result")] - public TaskDefinition Result { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/GetTaskLogsResponse.cs b/src/ConductorSharp.Client/Model/Response/GetTaskLogsResponse.cs deleted file mode 100644 index 97c5f8d1..00000000 --- a/src/ConductorSharp.Client/Model/Response/GetTaskLogsResponse.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Newtonsoft.Json; - -namespace ConductorSharp.Client.Model.Response -{ - public class GetTaskLogsResponse - { - public string Log { get; set; } - public Guid TaskId { get; set; } - - [JsonProperty("createdTime")] - public long CreatedTimeTimestamp { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/GetWorkflowDefinitionResponse.cs b/src/ConductorSharp.Client/Model/Response/GetWorkflowDefinitionResponse.cs deleted file mode 100644 index f7dcfc7d..00000000 --- a/src/ConductorSharp.Client/Model/Response/GetWorkflowDefinitionResponse.cs +++ /dev/null @@ -1,11 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json; - -namespace ConductorSharp.Client.Model.Response -{ - public class GetWorkflowDefinitionResponse - { - [JsonProperty("result")] - public WorkflowDefinition Result { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/HealthResponse.cs b/src/ConductorSharp.Client/Model/Response/HealthResponse.cs deleted file mode 100644 index bce16b95..00000000 --- a/src/ConductorSharp.Client/Model/Response/HealthResponse.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System.Collections.Generic; - -namespace ConductorSharp.Client.Model.Response -{ - public class HealthResponse - { - public class HealthResult - { - [JsonProperty("details")] - public JObject Details { get; set; } - - [JsonProperty("healthy")] - public bool Healthy { get; set; } - - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - } - - public class SuppressedHealthResult - { - [JsonProperty("details")] - public JObject Details { get; set; } - - [JsonProperty("healthy")] - public bool Healthy { get; set; } - - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - } - - [JsonProperty("healthResults")] - public List HealthResults { get; set; } - - [JsonProperty("suppressedHealthResults")] - public List SuppressedHealthResults { get; set; } - - [JsonProperty("healthy")] - public bool Healthy { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/PollDataResponse.cs b/src/ConductorSharp.Client/Model/Response/PollDataResponse.cs deleted file mode 100644 index 7841af1d..00000000 --- a/src/ConductorSharp.Client/Model/Response/PollDataResponse.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; - -namespace ConductorSharp.Client.Model.Response -{ - public class PollDataResponse - { - [JsonProperty("queueName")] - public string QueueName { get; set; } - - [JsonProperty("domain")] - public string Domain { get; set; } - - [JsonProperty("workerId")] - public string WorkerId { get; set; } - - [JsonProperty("lastPollTime")] - public long LastPollTime { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/PollTaskResponse.cs b/src/ConductorSharp.Client/Model/Response/PollTaskResponse.cs deleted file mode 100644 index 5d3b1b0e..00000000 --- a/src/ConductorSharp.Client/Model/Response/PollTaskResponse.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace ConductorSharp.Client.Model.Response -{ - public class PollTaskResponse - { - [JsonProperty("taskType")] - public string TaskType { get; set; } - - [JsonProperty("status")] - public string Status { get; set; } - - [JsonProperty("inputData")] - public JObject InputData { get; set; } - - [JsonProperty("referenceTaskName")] - public string ReferenceTaskName { get; set; } - - [JsonProperty("retryCount")] - public int RetryCount { get; set; } - - [JsonProperty("seq")] - public int Seq { get; set; } - - [JsonProperty("pollCount")] - public int PollCount { get; set; } - - [JsonProperty("taskDefName")] - public string TaskDefName { get; set; } - - [JsonProperty("scheduledTime")] - public long ScheduledTime { get; set; } - - [JsonProperty("startTime")] - public long StartTime { get; set; } - - [JsonProperty("endTime")] - public int EndTime { get; set; } - - [JsonProperty("updateTime")] - public long UpdateTime { get; set; } - - [JsonProperty("startDelayInSeconds")] - public int StartDelayInSeconds { get; set; } - - [JsonProperty("retried")] - public bool Retried { get; set; } - - [JsonProperty("executed")] - public bool Executed { get; set; } - - [JsonProperty("callbackFromWorker")] - public bool CallbackFromWorker { get; set; } - - [JsonProperty("responseTimeoutSeconds")] - public int ResponseTimeoutSeconds { get; set; } - - [JsonProperty("workflowInstanceId")] - public string WorkflowInstanceId { get; set; } - - [JsonProperty("workflowType")] - public string WorkflowType { get; set; } - - [JsonProperty("taskId")] - public string TaskId { get; set; } - - [JsonProperty("callbackAfterSeconds")] - public int CallbackAfterSeconds { get; set; } - - [JsonProperty("outputData")] - public JObject OutputData { get; set; } - - [JsonProperty("workflowTask")] - public JObject WorkflowTask { get; set; } - - [JsonProperty("rateLimitPerFrequency")] - public int RateLimitPerFrequency { get; set; } - - [JsonProperty("rateLimitFrequencyInSeconds")] - public int RateLimitFrequencyInSeconds { get; set; } - - [JsonProperty("workflowPriority")] - public int WorkflowPriority { get; set; } - - [JsonProperty("iteration")] - public int Iteration { get; set; } - - [JsonProperty("loopOverTask")] - public bool LoopOverTask { get; set; } - - [JsonProperty("taskDefinition")] - public JObject TaskDefinition { get; set; } - - [JsonProperty("queueWaitTime")] - public int QueueWaitTime { get; set; } - - [JsonProperty("taskStatus")] - public string TaskStatus { get; set; } - - [JsonProperty("correlationId")] - public string CorrelationId { get; set; } - - [JsonProperty("domain")] - public string Domain { get; set; } - - [JsonProperty("externalInputPayloadStoragePath")] - public string ExternalInputPayloadStorage { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/TaskStatusResponse.cs b/src/ConductorSharp.Client/Model/Response/TaskStatusResponse.cs deleted file mode 100644 index de33a6d1..00000000 --- a/src/ConductorSharp.Client/Model/Response/TaskStatusResponse.cs +++ /dev/null @@ -1,41 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json.Linq; - -namespace ConductorSharp.Client.Model.Response -{ - public class TaskStatusResponse - { - public string TaskType { get; set; } - public string Status { get; set; } - public JObject InputData { get; set; } - public string ReferenceTaskName { get; set; } - public int RetryCount { get; set; } - public int Seq { get; set; } - public int PollCount { get; set; } - public string TaskDefName { get; set; } - public long ScheduledTime { get; set; } - public long StartTime { get; set; } - public long EndTime { get; set; } - public long UpdateTime { get; set; } - public int StartDelayInSeconds { get; set; } - public bool Retried { get; set; } - public bool Executed { get; set; } - public bool CallbackFromWorker { get; set; } - public int ResponseTimeoutSeconds { get; set; } - public string WorkflowInstanceId { get; set; } - public string WorkflowType { get; set; } - public string TaskId { get; set; } - public int CallbackAfterSeconds { get; set; } - public JObject OutputData { get; set; } - public WorkflowDefinition.Task WorkflowTask { get; set; } - public int RateLimitPerFrequency { get; set; } - public int RateLimitFrequencyInSeconds { get; set; } - public int WorkflowPriority { get; set; } - public int Iteration { get; set; } - public bool SubworkflowChanged { get; set; } - public TaskDefinition TaskDefinition { get; set; } - public bool LoopOverTask { get; set; } - public long QueueWaitTime { get; set; } - public string SubWorkflowId { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/ValidateWorkflowResponse.cs b/src/ConductorSharp.Client/Model/Response/ValidateWorkflowResponse.cs deleted file mode 100644 index e2ba14d9..00000000 --- a/src/ConductorSharp.Client/Model/Response/ValidateWorkflowResponse.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; - -namespace ConductorSharp.Client.Model.Response -{ - public class ValidateWorkflowResponse - { - public class ValidationErrors - { - [JsonProperty("path")] - public string Path { get; set; } - - [JsonProperty("message")] - public string Message { get; set; } - } - - [JsonProperty("status")] - public int Status { get; set; } - - [JsonProperty("message")] - public string Message { get; set; } - - [JsonProperty("retryable")] - public bool Retryable { get; set; } - - public ValidationErrors[] ValidationErrorsResponse { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/WorkflowDescriptorResponse.cs b/src/ConductorSharp.Client/Model/Response/WorkflowDescriptorResponse.cs deleted file mode 100644 index 21657d86..00000000 --- a/src/ConductorSharp.Client/Model/Response/WorkflowDescriptorResponse.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ConductorSharp.Client.Model.Response -{ - public class WorkflowDescriptorResponse - { - public string WorkflowId { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/WorkflowSearchResponse.cs b/src/ConductorSharp.Client/Model/Response/WorkflowSearchResponse.cs deleted file mode 100644 index fd89fd33..00000000 --- a/src/ConductorSharp.Client/Model/Response/WorkflowSearchResponse.cs +++ /dev/null @@ -1,42 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Text; - -namespace ConductorSharp.Client.Model.Response -{ - public class WorkflowSearchResponse - { - public class Data - { - public string WorkflowType { get; set; } - public int Version { get; set; } - public string WorkflowId { get; set; } - public string CorrelationId { get; set; } - public DateTimeOffset StartTime { get; set; } - public DateTimeOffset UpdateTime { get; set; } - public DateTimeOffset EndTime { get; set; } - public string Status { get; set; } - public string Input { get; set; } - public string Output { get; set; } - public string ReasonForIncompletion { get; set; } - public long ExecutionTime { get; set; } - public string Event { get; set; } - public string FailedReferenceTaskNames { get; set; } - public string ExternalInputPayloadStoragePath { get; set; } - public string ExternalOutputPayloadStoragePath { get; set; } - public int Priority { get; set; } - public List FailedTaskNames { get; set; } = new List(); - public long OutputSize { get; set; } - public long InputSize { get; set; } - } - - [JsonProperty("totalHits")] - public int TotalHits { get; set; } - - [JsonProperty("results")] - public List Results { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/WorkflowStatusResponse.cs b/src/ConductorSharp.Client/Model/Response/WorkflowStatusResponse.cs deleted file mode 100644 index e01ff508..00000000 --- a/src/ConductorSharp.Client/Model/Response/WorkflowStatusResponse.cs +++ /dev/null @@ -1,30 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Text; - -namespace ConductorSharp.Client.Model.Response -{ - public class WorkflowStatusResponse - { - public string OwnerApp { get; set; } - public long CreateTime { get; set; } - public long UpdateTime { get; set; } - public long StartTime { get; set; } - public long EndTime { get; set; } - public string Status { get; set; } - public string WorkflowName { get; set; } - public List FailedReferenceTaskNames { get; set; } = new List(); - public int WorkflowVersion { get; set; } - public string WorkflowId { get; set; } - public string CorrelationId { get; set; } - public string ReasonForIncompletion { get; set; } - public JObject Input { get; set; } - public JObject Output { get; set; } - public int Priority { get; set; } - public long LastRetriedTime { get; set; } - public WorkflowDefinition WorkflowDefinition { get; set; } - public List Tasks { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Model/Response/WorkflowsNamesAndVersionsResponse.cs b/src/ConductorSharp.Client/Model/Response/WorkflowsNamesAndVersionsResponse.cs deleted file mode 100644 index 072acc59..00000000 --- a/src/ConductorSharp.Client/Model/Response/WorkflowsNamesAndVersionsResponse.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Newtonsoft.Json; - -namespace ConductorSharp.Client.Model.Response -{ - public class NameAndVersion - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("version")] - public int Version { get; set; } - - [JsonProperty("createTime")] - public long CreateTime { get; set; } - } -} diff --git a/src/ConductorSharp.Client/Service/ConductorClient.cs b/src/ConductorSharp.Client/Service/ConductorClient.cs deleted file mode 100644 index 345064a8..00000000 --- a/src/ConductorSharp.Client/Service/ConductorClient.cs +++ /dev/null @@ -1,146 +0,0 @@ -using ConductorSharp.Client.Exceptions; -using ConductorSharp.Client.Model.Response; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Text.Json; -using System.Threading.Tasks; -using Newtonsoft.Json.Serialization; -using JsonSerializer = Newtonsoft.Json.JsonSerializer; - -namespace ConductorSharp.Client.Service -{ - public class ConductorClient : IConductorClient - { - private readonly ILogger _logger; - private readonly HttpClient _httpClient; - private readonly RestConfig _restConfig; - private readonly JsonSerializerSettings _serializerSettings = - new() { ContractResolver = new CamelCasePropertyNamesContractResolver(), NullValueHandling = NullValueHandling.Ignore }; - - public ConductorClient(ILogger logger, HttpClient httpClient, RestConfig restConfig) - { - _logger = logger; - _httpClient = httpClient; - _restConfig = restConfig; - } - - private async void CheckResponse(HttpResponseMessage response) - { - if (!response.IsSuccessStatusCode) - { - var request = await response.RequestMessage.Content.ReadAsStringAsync(); - var responseContent = await response.Content.ReadAsStringAsync(); - ConductorErrorResponse error = default; - - _logger.LogDebug("Received {@response}", response.Content); - - error = DeserializeObject(responseContent); - - if (error == null || string.IsNullOrEmpty(error.Message)) - throw new Exception("Unable to deserialize error"); - - _logger.LogError("{@conductorError}", error); - - if (!_restConfig.IgnoreValidationErrors && error?.Message?.Contains("Validation failed") == true) - throw new Exception(responseContent); - - if (response.StatusCode == HttpStatusCode.InternalServerError) - throw new Exception(responseContent); - - if (response.StatusCode == HttpStatusCode.NotFound) - throw new NotFoundException(error.Message); - } - } - - private string SerializeObject(object body) => JsonConvert.SerializeObject(body, _serializerSettings); - - private T DeserializeObject(string body) => JsonConvert.DeserializeObject(body, _serializerSettings); - - private HttpRequestMessage CreateRequest(Uri relativeUrl, HttpMethod method, object body = null) - { - Uri uri; - - if (relativeUrl.IsAbsoluteUri) - uri = relativeUrl; - else - uri = new Uri($"{_restConfig.BaseUrl}/{_restConfig.ApiPath}/{relativeUrl.OriginalString}"); - - var httpRequestMessage = new HttpRequestMessage(method, uri); - - if (body != null) - httpRequestMessage.Content = new StringContent(SerializeObject(body), Encoding.UTF8, "application/json"); - - return httpRequestMessage; - } - - public async Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource) - { - var request = CreateRequest(relativeUrl, method, resource); - var response = await _httpClient.SendAsync(request); - - CheckResponse(response); - - return DeserializeObject(await response.Content.ReadAsStringAsync()); - } - - public async Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method) - { - var request = CreateRequest(relativeUrl, method); - - var response = await _httpClient.SendAsync(request); - - CheckResponse(response); - - return DeserializeObject(await response.Content.ReadAsStringAsync()); - } - - public async Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource) - { - var request = CreateRequest(relativeUrl, method, resource); - var response = await _httpClient.SendAsync(request); - - CheckResponse(response); - } - - public async Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method) - { - var request = CreateRequest(relativeUrl, method); - var response = await _httpClient.SendAsync(request); - - CheckResponse(response); - } - - public async Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource, Dictionary headers) - { - var request = CreateRequest(relativeUrl, method, resource); - - foreach (var header in headers) - request.Headers.Add(header.Key, header.Value); - - var response = await _httpClient.SendAsync(request); - - CheckResponse(response); - - return DeserializeObject(await response.Content.ReadAsStringAsync()); - } - - public async Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource, Dictionary headers) - { - var request = CreateRequest(relativeUrl, method, resource); - - foreach (var header in headers) - request.Headers.Add(header.Key, header.Value); - - var response = await _httpClient.SendAsync(request); - - CheckResponse(response); - - return await response.Content.ReadAsStringAsync(); - } - } -} diff --git a/src/ConductorSharp.Client/Service/HealthService.cs b/src/ConductorSharp.Client/Service/HealthService.cs index d58151ed..efe8fc0f 100644 --- a/src/ConductorSharp.Client/Service/HealthService.cs +++ b/src/ConductorSharp.Client/Service/HealthService.cs @@ -1,17 +1,14 @@ -using ConductorSharp.Client.Model.Response; -using ConductorSharp.Client.Util; -using System.Net.Http; +using ConductorSharp.Client.Generated; +using System.Threading; using System.Threading.Tasks; namespace ConductorSharp.Client.Service { - public class HealthService : IHealthService + public class HealthService(ConductorClient client) : IHealthService { - private readonly IConductorClient _conductorClient; + private readonly ConductorClient _conductorClient = client; - public HealthService(IConductorClient client) => _conductorClient = client; - - public async Task CheckHealth() => - await _conductorClient.ExecuteRequestAsync(ApiUrls.Health(), HttpMethod.Get); + public async Task CheckHealthAsync(CancellationToken cancellationToken) => + await _conductorClient.DoCheckAsync(cancellationToken); } } diff --git a/src/ConductorSharp.Client/Service/IConductorClient.cs b/src/ConductorSharp.Client/Service/IConductorClient.cs deleted file mode 100644 index 3fe4a35a..00000000 --- a/src/ConductorSharp.Client/Service/IConductorClient.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; - -namespace ConductorSharp.Client.Service -{ - public interface IConductorClient - { - Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource); - Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource, Dictionary headers); - Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method); - Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource); - Task ExecuteRequestAsync(Uri relativeUrlrelativeUrl, HttpMethod method); - Task ExecuteRequestAsync(Uri relativeUrl, HttpMethod method, object resource, Dictionary headers); - } -} diff --git a/src/ConductorSharp.Client/Service/IHealthService.cs b/src/ConductorSharp.Client/Service/IHealthService.cs index 932c7f88..89a31d56 100644 --- a/src/ConductorSharp.Client/Service/IHealthService.cs +++ b/src/ConductorSharp.Client/Service/IHealthService.cs @@ -1,10 +1,11 @@ -using ConductorSharp.Client.Model.Response; +using ConductorSharp.Client.Generated; +using System.Threading; using System.Threading.Tasks; namespace ConductorSharp.Client.Service { public interface IHealthService { - Task CheckHealth(); + Task CheckHealthAsync(CancellationToken cancellationToken); } } diff --git a/src/ConductorSharp.Client/Service/IMetadataService.cs b/src/ConductorSharp.Client/Service/IMetadataService.cs deleted file mode 100644 index f2d32378..00000000 --- a/src/ConductorSharp.Client/Service/IMetadataService.cs +++ /dev/null @@ -1,28 +0,0 @@ -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Client.Model.Response; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace ConductorSharp.Client.Service -{ - public interface IMetadataService - { - Task GetAllTaskDefinitions(); - Task CreateTaskDefinitions(List definitions); - Task GetTaskDefinition(string name); - Task DeleteTaskDefinition(string name); - Task UpdateTaskDefinition(TaskDefinition definition); - Task GetWorkflowDefinition(string name, int version); - Task UpdateWorkflowDefinitions(List workflowDefinition); - Task DeleteWorkflowDefinition(string name, int version); - Task ValidateWorkflowDefinition(WorkflowDefinition workflowDefinition); - Task GetAllWorkflowDefinitions(); - Task>> GetAllWorkflowNamesAndVersions(); - Task GetAllEventHandlerDefinitions(); - Task UpdateEventHandlerDefinition(EventHandlerDefinition definition); - Task DeleteEventHandlerDefinition(string name); - Task CreateEventHandlerDefinition(EventHandlerDefinition definition); - Task GetEventHandlerDefinition(string name); - Task CreateWorkflowDefinitions(List definition); - } -} diff --git a/src/ConductorSharp.Client/Service/ITaskService.cs b/src/ConductorSharp.Client/Service/ITaskService.cs deleted file mode 100644 index 87eadb52..00000000 --- a/src/ConductorSharp.Client/Service/ITaskService.cs +++ /dev/null @@ -1,27 +0,0 @@ -using ConductorSharp.Client.Model.Response; -using Newtonsoft.Json.Linq; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace ConductorSharp.Client.Service -{ - public interface ITaskService - { - Task PollBatch(string name, string workerId, int count, int timeout); - Task PollBatch(string name, string workerId, int count, int timeout, string domain); - Task FetchExternalStorageLocation(string name); - Task FetchExternalStorage(string uri); - Task TaskSearch(int size, string query); - Task> GetQueue(string name); - Task> GetAllQueues(); - Task UpdateTaskCompleted(object outputData, string taskId, string workflowId); - Task UpdateTaskFailed(string taskId, string workflowId, string reasonForIncompletion); - Task UpdateTaskFailed(string taskId, string workflowId, string reasonForIncompletion, string logMessage); - Task UpdateTaskFailed(object outputData, string taskId, string workflowId, string reasonForIncompletion, string logMessage); - Task PollTasks(string name, string workerId); - Task PollTasks(string name, string workerId, string domain); - Task PollTaskQueueData(string taskType); - Task PollAllTasksQueueData(); - Task GetLogsForTask(string taskId); - } -} diff --git a/src/ConductorSharp.Client/Service/IWorkflowService.cs b/src/ConductorSharp.Client/Service/IWorkflowService.cs deleted file mode 100644 index 2d0cb8a7..00000000 --- a/src/ConductorSharp.Client/Service/IWorkflowService.cs +++ /dev/null @@ -1,17 +0,0 @@ -using ConductorSharp.Client.Model.Request; -using ConductorSharp.Client.Model.Response; -using Newtonsoft.Json.Linq; -using System.Threading.Tasks; - -namespace ConductorSharp.Client.Service -{ - public interface IWorkflowService - { - Task QueueWorkflow(string workflowName, int version, JObject input); - Task QueueWorkflow(string workflowName, int version, JObject input); - Task TestWorkflow(WorkflowTestRequest testRequest); - Task QueueWorkflowStringResponse(string workflowName, int version, JObject input); - Task GetWorkflowStatus(string workflowId, bool includeTasks = true); - Task SearchWorkflows(WorkflowSearchRequest request); - } -} diff --git a/src/ConductorSharp.Client/Util/ApiUrls.cs b/src/ConductorSharp.Client/Util/ApiUrls.cs deleted file mode 100644 index 031b5e85..00000000 --- a/src/ConductorSharp.Client/Util/ApiUrls.cs +++ /dev/null @@ -1,127 +0,0 @@ -using ConductorSharp.Client.Model.Request; -using System; - -namespace ConductorSharp.Client.Util -{ - internal static class ApiUrls - { - private readonly static Uri _getAllTaskDefinitions = new("metadata/taskdefs", UriKind.Relative); - private readonly static Uri _createTaskDefinitions = new("metadata/taskdefs", UriKind.Relative); - private readonly static Uri _updateTaskDefinition = new("metadata/taskdefs", UriKind.Relative); - - private readonly static Uri _updateTask = new("tasks", UriKind.Relative); - private readonly static Uri _getAllQueues = new("tasks/queue/all", UriKind.Relative); - - private readonly static Uri _createWorkflowDefinition = new("metadata/workflow", UriKind.Relative); - private readonly static Uri _updateWorkflowDefinitions = new("metadata/workflow", UriKind.Relative); - private readonly static Uri _getAllWorkflowDefinitions = new("metadata/workflow", UriKind.Relative); - private readonly static Uri _createWorkflowDefinitions = new("metadata/workflow", UriKind.Relative); - private readonly static Uri _validateWorkflowDefinition = new("metadata/workflow/validate", UriKind.Relative); - private readonly static Uri _getAllWorkflowNamesAndVersions = new("metadata/workflow/names-and-versions", UriKind.Relative); - - private readonly static Uri _queueWorkflow = new("workflow", UriKind.Relative); - private readonly static Uri _testWorkflow = new("workflow/test", UriKind.Relative); - - private readonly static Uri _getAllEventDefinitions = new("event", UriKind.Relative); - private readonly static Uri _updateEventHandlerDefinition = new("event", UriKind.Relative); - private readonly static Uri _createEventHandlerDefinition = new("event", UriKind.Relative); - - private readonly static Uri _health = new("health", UriKind.Relative); - - // External storage - public static Uri GetExternalStorage(string filename) => "external/postgres/{0}".ToRelativeUri(filename); - - // Tasks - public static Uri GetLogsForTask(string taskId) => new Uri($"tasks/{taskId}/log", UriKind.Relative); - - public static Uri GetAllTaskDefinitions() => _getAllTaskDefinitions; - - public static Uri CreateTaskDefinitions() => _createTaskDefinitions; - - public static Uri GetTaskDefinition(string taskType) => "metadata/taskdefs/{0}".ToRelativeUri(taskType); - - public static Uri DeleteTaskDefinition(string taskType) => "metadata/taskdefs/{0}".ToRelativeUri(taskType); - - public static Uri UpdateTaskDefinition() => _updateTaskDefinition; - - public static Uri BatchPollTasks(string name, string workerId, int count, int timeout) => - "tasks/poll/batch/{0}?workerId={1}&count={2}&timeout={3}".ToRelativeUri(name, workerId, count, timeout); - - public static Uri BatchPollTasks(string name, string workerId, int count, int timeout, string domain) => - "tasks/poll/batch/{0}?workerId={1}&count={2}&timeout={3}&domain={4}".ToRelativeUri(name, workerId, count, timeout, domain); - - public static Uri PollTasks(string name, string workerId) => "tasks/poll/{0}?workerId={1}".ToRelativeUri(name, workerId); - - public static Uri PollTasks(string name, string workerId, string domain) => - "tasks/poll/{0}?workerId={1}&domain={2}".ToRelativeUri(name, workerId, domain); - - public static Uri PollTaskQueueData(string taskType) => "tasks/queue/polldata?taskType={0}".ToRelativeUri(taskType); - - public static Uri PollAllTasksQueueData() => "tasks/queue/polldata/all".ToRelativeUri(); - - public static Uri UpdateTask() => _updateTask; - - public static Uri SearchTask(int size, string query) => "tasks/search?size={0}&query={1}".ToRelativeUri(size, query); - - public static Uri GetTaskQueue(string name) => "tasks/queue/{taskName}".ToRelativeUri(name); - - public static Uri GetAllQueues() => _getAllQueues; - - // External storage - public static Uri FetchExternalStorageLocation(string name) => - "tasks/externalstoragelocation?path={0}&operation=READ&payloadType=TASK_INPUT".ToRelativeUri(name); - - // Workflows - public static Uri SearchWorkflows(WorkflowSearchRequest request) - { - string sortWithDirection = null; - - if (request.Sort != null) - sortWithDirection = request.SortAscending == true ? $"{request.Sort}:ASC" : $"{request.Sort}:DESC"; - - return $"workflow/search?start={request.Start}&size={request.Size}&sort={sortWithDirection}&freeText={request.FreeText}&query={request.Query}".ToRelativeUri(); - } - - public static Uri CreateWorkflowDefinition() => _createWorkflowDefinition; - - public static Uri GetWorkflowDefinition(string name, int version) => "metadata/workflow/{0}?version={1}".ToRelativeUri(name, version); - - public static Uri UpdateWorkflowDefinitions() => _updateWorkflowDefinitions; - - public static Uri DeleteWorkflowDefinition(string name, int version) => "metadata/workflow/{0}/{1}".ToRelativeUri(name, version); - - public static Uri ValidateWorkflowDefinition() => _validateWorkflowDefinition; - - public static Uri GetAlleWorkflowDefinitions() => _getAllWorkflowDefinitions; - - public static Uri GetAllWorkflowNamesAndVersions() => _getAllWorkflowNamesAndVersions; - - public static Uri CreateWorkflowDefinitions() => _createWorkflowDefinitions; - - public static Uri QueueWorkflow() => _queueWorkflow; - - public static Uri TestWorkflow() => _testWorkflow; - - public static Uri GetWorkflowStatus(string workflowId, bool includeTasks) - { - if (includeTasks) - return "workflow/{0}?includeTasks=true".ToRelativeUri(workflowId); - else - return "workflow/{0}?includeTasks=false".ToRelativeUri(workflowId); - } - - // Events - public static Uri GetAllEventDefinitions() => _getAllEventDefinitions; - - public static Uri UpdateEventHandlerDefinition() => _updateEventHandlerDefinition; - - public static Uri DeleteEventHandlerDefinition(string name) => "event/{0}".ToRelativeUri(name); - - public static Uri CreateEventHandlerDefinition() => _createEventHandlerDefinition; - - public static Uri GetEventHandlerDefinition(string name) => "event/{0}".ToRelativeUri(name); - - // Health - public static Uri Health() => _health; - } -} diff --git a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj index 91f9f9bb..af43d1d2 100644 --- a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj +++ b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net6.0 preview Codaxy Codaxy diff --git a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj index a51cb4f9..0492c51d 100644 --- a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj +++ b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net6.0 disable False Codaxy From 00341c9eb20524db0e0fc85730c3efa23a5c4859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:15:16 +0100 Subject: [PATCH 02/33] update services --- .../ConductorSharp.Client.csproj | 2 + .../Service/HealthService.cs | 2 +- .../Service/IHealthService.cs | 2 +- .../Service/IWorkflowService.cs | 195 +++++++++++++++ .../Service/MetadataService.cs | 67 +---- .../Service/TaskService.cs | 124 ---------- .../Service/WorkflowService.cs | 229 +++++++++++++----- src/ConductorSharp.Client/Usings.cs | 1 + src/ConductorSharp.Engine/ExecutionManager.cs | 10 +- 9 files changed, 376 insertions(+), 256 deletions(-) create mode 100644 src/ConductorSharp.Client/Service/IWorkflowService.cs delete mode 100644 src/ConductorSharp.Client/Service/TaskService.cs create mode 100644 src/ConductorSharp.Client/Usings.cs diff --git a/src/ConductorSharp.Client/ConductorSharp.Client.csproj b/src/ConductorSharp.Client/ConductorSharp.Client.csproj index dec97f72..99d04696 100644 --- a/src/ConductorSharp.Client/ConductorSharp.Client.csproj +++ b/src/ConductorSharp.Client/ConductorSharp.Client.csproj @@ -12,6 +12,8 @@ netflix;conductor MIT True + enable + enable diff --git a/src/ConductorSharp.Client/Service/HealthService.cs b/src/ConductorSharp.Client/Service/HealthService.cs index efe8fc0f..1b47fab9 100644 --- a/src/ConductorSharp.Client/Service/HealthService.cs +++ b/src/ConductorSharp.Client/Service/HealthService.cs @@ -8,7 +8,7 @@ public class HealthService(ConductorClient client) : IHealthService { private readonly ConductorClient _conductorClient = client; - public async Task CheckHealthAsync(CancellationToken cancellationToken) => + public async Task CheckHealthAsync(CancellationToken cancellationToken = default) => await _conductorClient.DoCheckAsync(cancellationToken); } } diff --git a/src/ConductorSharp.Client/Service/IHealthService.cs b/src/ConductorSharp.Client/Service/IHealthService.cs index 89a31d56..dab7736c 100644 --- a/src/ConductorSharp.Client/Service/IHealthService.cs +++ b/src/ConductorSharp.Client/Service/IHealthService.cs @@ -6,6 +6,6 @@ namespace ConductorSharp.Client.Service { public interface IHealthService { - Task CheckHealthAsync(CancellationToken cancellationToken); + Task CheckHealthAsync(CancellationToken cancellationToken = default); } } diff --git a/src/ConductorSharp.Client/Service/IWorkflowService.cs b/src/ConductorSharp.Client/Service/IWorkflowService.cs new file mode 100644 index 00000000..aff4df24 --- /dev/null +++ b/src/ConductorSharp.Client/Service/IWorkflowService.cs @@ -0,0 +1,195 @@ +using ConductorSharp.Client.Generated; + +namespace ConductorSharp.Client.Service +{ + public interface IWorkflowService + { + /// + /// Starts the decision task for a workflow + /// + Task DecideAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Removes the workflow from the system + /// + Task DeleteAsync(string workflowId, bool? archiveWorkflow = null, CancellationToken cancellationToken = default); + + /// + /// Lists workflows for the given correlation id list + /// + Task>> GetCorrelatedAsync( + string name, + IEnumerable correlationIds, + bool? includeClosed = false, + bool? includeTasks = false, + CancellationToken cancellationToken = default + ); + + /// + /// Lists workflows for the given correlation id + /// + Task> GetCorrelatedAsync( + string name, + string correlationId, + bool? includeClosed = false, + bool? includeTasks = false, + CancellationToken cancellationToken = default + ); + + /// + /// Gets the workflow by workflow id + /// + Task GetExecutionStatusAsync(string workflowId, bool? includeTasks = false, CancellationToken cancellationToken = default); + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + Task GetExternalStorageLocationAsync(string path, string operation, string payloadType, CancellationToken cancellationToken = default); + + /// + /// Retrieve all the running workflows + /// + Task> ListRunningAsync( + string name, + int? version, + long? startTime = null, + long? endTime = null, + CancellationToken cancellationToken = default + ); + + /// + /// Pauses the workflow + /// + Task PauseAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Reruns the workflow from a specific task + /// + Task RerunAsync(string workflowId, RerunWorkflowRequest rerunWorkflowRequest, CancellationToken cancellationToken = default); + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + Task ResetCallbacksAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Restarts a completed workflow + /// + Task RestartAsync(string workflowId, bool? useLatestDefinitions = null, CancellationToken cancellationToken = default); + + /// + /// Resumes the workflow + /// + Task ResumeAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Retries the last failed task + /// + Task RetryAsync(string workflowId, bool? resumeSubworkflowTasks = null, CancellationToken cancellationToken = default); + + /// + /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchByTasksAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchV2Async( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchV2ByTasksAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Skips a given task from a current running workflow + /// + Task SkipTaskAsync( + string workflowId, + string taskReferenceName, + SkipTaskRequest skipTaskRequest, + CancellationToken cancellationToken = default + ); + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// ConductorShap: There is another Conductor API endpoint with seemingly identical functionality and operation + /// id 'startWorkflow_1'. It seems these two achieve the same task so the second one has been left out. + /// + Task StartAsync(StartWorkflowRequest startWorkflowRequest, CancellationToken cancellationToken = default); + + /// + /// Terminate workflow execution + /// + Task TerminateAsync(string workflowId, string? reason = null, CancellationToken cancellationToken = default); + + /// + /// Test workflow execution using mock data + /// + Task TestAsync(WorkflowTestRequest workflowTestRequest, CancellationToken cancellationToken = default); + } +} diff --git a/src/ConductorSharp.Client/Service/MetadataService.cs b/src/ConductorSharp.Client/Service/MetadataService.cs index 0e4b5351..a6807332 100644 --- a/src/ConductorSharp.Client/Service/MetadataService.cs +++ b/src/ConductorSharp.Client/Service/MetadataService.cs @@ -1,72 +1,15 @@ -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Client.Model.Response; -using ConductorSharp.Client.Util; +using ConductorSharp.Client.Generated; using System.Collections.Generic; using System.Net.Http; +using System.Threading; using System.Threading.Tasks; namespace ConductorSharp.Client.Service { - public class MetadataService : IMetadataService + public class MetadataService { - private readonly IConductorClient _conductorClient; + private readonly ConductorClient _conductorClient; - public MetadataService(IConductorClient client) => _conductorClient = client; - - public async Task GetAllTaskDefinitions() => - (await _conductorClient.ExecuteRequestAsync(ApiUrls.GetAllTaskDefinitions(), HttpMethod.Get)); - - public async Task CreateTaskDefinitions(List definitions) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.CreateTaskDefinitions(), HttpMethod.Post, definitions); - - public async Task GetTaskDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetTaskDefinition(name), HttpMethod.Get); - - public async Task DeleteTaskDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.DeleteTaskDefinition(name), HttpMethod.Delete); - - public async Task UpdateTaskDefinition(TaskDefinition definition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.UpdateTaskDefinition(), HttpMethod.Put, definition); - - public async Task GetWorkflowDefinition(string name, int version) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetWorkflowDefinition(name, version), HttpMethod.Get); - - public async Task UpdateWorkflowDefinitions(List definitions) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.UpdateWorkflowDefinitions(), HttpMethod.Put, definitions); - - public async Task DeleteWorkflowDefinition(string name, int version) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.DeleteWorkflowDefinition(name, version), HttpMethod.Delete); - - public async Task ValidateWorkflowDefinition(WorkflowDefinition workflowDefinition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.ValidateWorkflowDefinition(), HttpMethod.Post, workflowDefinition); - - public async Task CreateWorkflowDefinitions(List workflowDefinition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.CreateWorkflowDefinitions(), HttpMethod.Put, workflowDefinition); - - public async Task GetAllWorkflowDefinitions() => - (await _conductorClient.ExecuteRequestAsync(ApiUrls.GetAlleWorkflowDefinitions(), HttpMethod.Get)); - - public async Task>> GetAllWorkflowNamesAndVersions() => - ( - await _conductorClient.ExecuteRequestAsync>>( - ApiUrls.GetAllWorkflowNamesAndVersions(), - HttpMethod.Get - ) - ); - - public async Task GetAllEventHandlerDefinitions() => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetAllEventDefinitions(), HttpMethod.Get); - - public async Task UpdateEventHandlerDefinition(EventHandlerDefinition definition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.UpdateEventHandlerDefinition(), HttpMethod.Put, definition); - - public async Task DeleteEventHandlerDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.DeleteEventHandlerDefinition(name), HttpMethod.Delete); - - public async Task CreateEventHandlerDefinition(EventHandlerDefinition definition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.CreateEventHandlerDefinition(), HttpMethod.Post, definition); - - public async Task GetEventHandlerDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetEventHandlerDefinition(name), HttpMethod.Get); + public MetadataService(ConductorClient client) => _conductorClient = client; } } diff --git a/src/ConductorSharp.Client/Service/TaskService.cs b/src/ConductorSharp.Client/Service/TaskService.cs deleted file mode 100644 index d1a2556f..00000000 --- a/src/ConductorSharp.Client/Service/TaskService.cs +++ /dev/null @@ -1,124 +0,0 @@ -using ConductorSharp.Client.Model.Request; -using ConductorSharp.Client.Model.Response; -using ConductorSharp.Client.Util; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; -using static ConductorSharp.Client.Model.Request.UpdateTaskRequest; - -namespace ConductorSharp.Client.Service -{ - public class TaskService : ITaskService - { - private readonly IConductorClient _client; - - public TaskService(IConductorClient client) => _client = client; - - public async Task PollBatch(string name, string workerId, int count, int timeout) => - ( - await _client.ExecuteRequestAsync>(ApiUrls.BatchPollTasks(name, workerId, count, timeout), HttpMethod.Get) - ).ToArray(); - - public async Task PollBatch(string name, string workerId, int count, int timeout, string domain) => - ( - await _client.ExecuteRequestAsync>( - ApiUrls.BatchPollTasks(name, workerId, count, timeout, domain), - HttpMethod.Get - ) - ).ToArray(); - - public async Task FetchExternalStorageLocation(string name) => - await _client.ExecuteRequestAsync(ApiUrls.FetchExternalStorageLocation(name), HttpMethod.Get); - - // TODO: Check if this is actually relative url - public async Task FetchExternalStorage(string filename) => - await _client.ExecuteRequestAsync(ApiUrls.GetExternalStorage(filename), HttpMethod.Get); - - private async Task UpdateTask(UpdateTaskRequest data) => await _client.ExecuteRequestAsync(ApiUrls.UpdateTask(), HttpMethod.Post, data); - - public async Task TaskSearch(int size, string query) => - await _client.ExecuteRequestAsync(ApiUrls.SearchTask(size, query), HttpMethod.Get); - - public async Task> GetQueue(string name) => - await _client.ExecuteRequestAsync>(ApiUrls.GetTaskQueue(name), HttpMethod.Get); - - public async Task> GetAllQueues() => - await _client.ExecuteRequestAsync>(ApiUrls.GetAllQueues(), HttpMethod.Get); - - public Task UpdateTaskCompleted(object outputData, string taskId, string workflowId) => - UpdateTask( - new UpdateTaskRequest - { - Status = "COMPLETED", - OutputData = JObject.FromObject(outputData, ConductorConstants.IoJsonSerializer), - TaskId = taskId, - WorkflowInstanceId = workflowId - } - ); - - public Task UpdateTaskFailed(string taskId, string workflowId, string reasonForIncompletion) => - UpdateTask( - new UpdateTaskRequest - { - Status = "FAILED", - TaskId = taskId, - WorkflowInstanceId = workflowId, - ReasonForIncompletion = reasonForIncompletion, - Logs = new List - { - new LogData { Log = reasonForIncompletion, CreatedTime = DateTimeOffset.Now.ToUnixTimeMilliseconds() } - } - } - ); - - public Task UpdateTaskFailed(string taskId, string workflowId, string reasonForIncompletion, string logMessage) => - UpdateTask( - new UpdateTaskRequest - { - Status = "FAILED", - TaskId = taskId, - WorkflowInstanceId = workflowId, - ReasonForIncompletion = reasonForIncompletion, - Logs = new List - { - new LogData { Log = reasonForIncompletion, CreatedTime = DateTimeOffset.Now.ToUnixTimeMilliseconds() }, - new LogData { Log = logMessage, CreatedTime = DateTimeOffset.Now.ToUnixTimeMilliseconds() } - } - } - ); - - public async Task PollTasks(string name, string workerId) => - await _client.ExecuteRequestAsync(ApiUrls.PollTasks(name, workerId), HttpMethod.Get); - - public async Task PollTasks(string name, string workerId, string domain) => - await _client.ExecuteRequestAsync(ApiUrls.PollTasks(name, workerId, domain), HttpMethod.Get); - - public async Task PollTaskQueueData(string taskType) => - await _client.ExecuteRequestAsync(ApiUrls.PollTaskQueueData(taskType), HttpMethod.Get); - - public async Task PollAllTasksQueueData() => - await _client.ExecuteRequestAsync(ApiUrls.PollAllTasksQueueData(), HttpMethod.Get); - - public Task GetLogsForTask(string taskId) => - _client.ExecuteRequestAsync(ApiUrls.GetLogsForTask(taskId), HttpMethod.Get); - - public Task UpdateTaskFailed(object outputData, string taskId, string workflowId, string reasonForIncompletion, string logMessage) => - UpdateTask( - new UpdateTaskRequest - { - Status = "FAILED", - TaskId = taskId, - OutputData = JObject.FromObject(outputData, ConductorConstants.IoJsonSerializer), - WorkflowInstanceId = workflowId, - ReasonForIncompletion = reasonForIncompletion, - Logs = new List - { - new LogData { Log = reasonForIncompletion, CreatedTime = DateTimeOffset.Now.ToUnixTimeMilliseconds() }, - new LogData { Log = logMessage, CreatedTime = DateTimeOffset.Now.ToUnixTimeMilliseconds() } - } - } - ); - } -} diff --git a/src/ConductorSharp.Client/Service/WorkflowService.cs b/src/ConductorSharp.Client/Service/WorkflowService.cs index 0aadd160..bc37ad7b 100644 --- a/src/ConductorSharp.Client/Service/WorkflowService.cs +++ b/src/ConductorSharp.Client/Service/WorkflowService.cs @@ -1,69 +1,172 @@ -using ConductorSharp.Client.Model.Request; -using ConductorSharp.Client.Model.Response; -using ConductorSharp.Client.Util; -using Newtonsoft.Json.Linq; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; +using ConductorSharp.Client.Generated; + namespace ConductorSharp.Client.Service { - public class WorkflowService : IWorkflowService + public class WorkflowService(ConductorClient client) : IWorkflowService { - private readonly IConductorClient _client; - - public WorkflowService(IConductorClient client) => _client = client; - - public async Task QueueWorkflow(string workflowName, int version, JObject input) => - await _client.ExecuteRequestAsync( - ApiUrls.QueueWorkflow(), - HttpMethod.Post, - new QueueWorkflowRequest - { - Input = input, - Name = workflowName, - Version = version - }, - new Dictionary { { "Accept", "*/*" } } - ); - - public async Task GetWorkflowStatus(string workflowId, bool includeTasks = true) - { - return await _client.ExecuteRequestAsync(ApiUrls.GetWorkflowStatus(workflowId, includeTasks), HttpMethod.Get); - } - - public async Task QueueWorkflow(string workflowName, int version, JObject input) => - await _client.ExecuteRequestAsync( - ApiUrls.QueueWorkflow(), - HttpMethod.Post, - new QueueWorkflowRequest - { - Input = input, - Name = workflowName, - Version = version - }, - // Endpoint return 406 Not Acceptable if this header is not set to given value - new Dictionary { { "Accept", "*/*" } } - ); - - public async Task TestWorkflow(WorkflowTestRequest testRequest) => - await _client.ExecuteRequestAsync(ApiUrls.TestWorkflow(), HttpMethod.Post, testRequest); - - public async Task SearchWorkflows(WorkflowSearchRequest request) => - await _client.ExecuteRequestAsync(ApiUrls.SearchWorkflows(request), HttpMethod.Get); - - public async Task QueueWorkflowStringResponse(string workflowName, int version, JObject input) => - await _client.ExecuteRequestAsync( - ApiUrls.QueueWorkflow(), - HttpMethod.Post, - new QueueWorkflowRequest - { - Input = input, - Name = workflowName, - Version = version - }, - // Endpoint return 406 Not Acceptable if this header is not set to given value - new Dictionary { { "Accept", "*/*" } } - ); + private readonly ConductorClient _client = client; + + /// + /// Skips a given task from a current running workflow + /// + public async Task SkipTaskAsync(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest, CancellationToken cancellationToken = default) + => await _client.SkipTaskFromWorkflowAsync(workflowId, taskReferenceName, skipTaskRequest, cancellationToken); + + /// + /// Resumes the workflow + /// + public async Task ResumeAsync(string workflowId, CancellationToken cancellationToken = default) + => await _client.ResumeWorkflowAsync(workflowId, cancellationToken); + + /// + /// Pauses the workflow + /// + public async Task PauseAsync(string workflowId, CancellationToken cancellationToken = default) + => await _client.PauseWorkflowAsync(workflowId, cancellationToken); + + /// + /// Starts the decision task for a workflow + /// + public async Task DecideAsync(string workflowId, CancellationToken cancellationToken = default) + => await _client.DecideAsync(workflowId, cancellationToken); + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// ConductorShap: There is another Conductor API endpoint with seemingly identical functionality and operation + /// id 'startWorkflow_1'. It seems these two achieve the same task so the second one has been left out. + /// + public async Task StartAsync(StartWorkflowRequest startWorkflowRequest, CancellationToken cancellationToken = default) + => await _client.StartWorkflowAsync(startWorkflowRequest, cancellationToken); + + + /// + /// Retries the last failed task + /// + public async Task RetryAsync(string workflowId, bool? resumeSubworkflowTasks = null, CancellationToken cancellationToken = default) + => await _client.RetryAsync(workflowId, resumeSubworkflowTasks, cancellationToken); + + /// + /// Restarts a completed workflow + /// + public async Task RestartAsync(string workflowId, bool? useLatestDefinitions = null, CancellationToken cancellationToken = default) + => await _client.RestartAsync(workflowId, useLatestDefinitions, cancellationToken); + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + public async Task ResetCallbacksAsync(string workflowId, CancellationToken cancellationToken = default) + => await _client.ResetWorkflowAsync(workflowId, cancellationToken); + + /// + /// Reruns the workflow from a specific task + /// + public async Task RerunAsync(string workflowId, RerunWorkflowRequest rerunWorkflowRequest, CancellationToken cancellationToken = default) + => await _client.RerunAsync(workflowId, rerunWorkflowRequest, cancellationToken); + + /// + /// Lists workflows for the given correlation id list + /// + public async Task>> GetCorrelatedAsync(string name, IEnumerable correlationIds, bool? includeClosed = false, bool? includeTasks = false, CancellationToken cancellationToken = default) + => await _client.GetWorkflowsAsync(name, correlationIds, includeClosed, includeTasks, cancellationToken); + + /// + /// Test workflow execution using mock data + /// + public async Task TestAsync(WorkflowTestRequest workflowTestRequest, CancellationToken cancellationToken = default) + => await _client.TestWorkflowAsync(workflowTestRequest, cancellationToken); + + /// + /// Gets the workflow by workflow id + /// + public async Task GetExecutionStatusAsync(string workflowId, bool? includeTasks = false, CancellationToken cancellationToken = default) + => await _client.GetExecutionStatusAsync(workflowId, includeTasks, cancellationToken); + + /// + /// Terminate workflow execution + /// + public async Task TerminateAsync(string workflowId, string? reason = null, CancellationToken cancellationToken = default) + => await _client.Terminate_1Async(workflowId, reason, cancellationToken); + + /// + /// Lists workflows for the given correlation id + /// + public async Task> GetCorrelatedAsync(string name, string correlationId, bool? includeClosed = false, bool? includeTasks = false, CancellationToken cancellationToken = default) + => await _client.GetWorkflows_1Async(name, correlationId, includeClosed, includeTasks, cancellationToken); + + + /// + /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + public async Task SearchAsync(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) + => await _client.SearchAsync(start, size, sort, freeText, query, cancellationToken); + + /// + /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + public async Task SearchV2Async(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) + => await _client.SearchV2Async(start, size, sort, freeText, query, cancellationToken); + + + /// + /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + public async Task SearchByTasksAsync(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) + => await _client.SearchWorkflowsByTasksAsync(start, size, sort, freeText, query, cancellationToken); + + /// + /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + public async Task SearchV2ByTasksAsync(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) + => await _client.SearchWorkflowsByTasksV2Async(start, size, sort, freeText, query, cancellationToken); + + /// + /// Retrieve all the running workflows + /// + public async Task> ListRunningAsync(string name, int? version, long? startTime = null, long? endTime = null, CancellationToken cancellationToken = default) + => await _client.GetRunningWorkflowAsync(name, version, startTime, endTime, cancellationToken); + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + public async Task GetExternalStorageLocationAsync(string path, string operation, string payloadType, CancellationToken cancellationToken = default) + => await _client.GetExternalStorageLocationAsync(path, operation, payloadType, cancellationToken); + + /// + /// Removes the workflow from the system + /// + public async Task DeleteAsync(string workflowId, bool? archiveWorkflow = null, CancellationToken cancellationToken = default) + => await _client.DeleteAsync(workflowId, archiveWorkflow, cancellationToken); + } } diff --git a/src/ConductorSharp.Client/Usings.cs b/src/ConductorSharp.Client/Usings.cs new file mode 100644 index 00000000..06d3dad7 --- /dev/null +++ b/src/ConductorSharp.Client/Usings.cs @@ -0,0 +1 @@ +global using Task = System.Threading.Tasks.Task; diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index f90ba3fd..aeb0d52e 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -1,6 +1,5 @@ using ConductorSharp.Client; -using ConductorSharp.Client.Model.Response; -using ConductorSharp.Client.Service; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Polling; @@ -13,6 +12,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Engine { @@ -21,7 +21,7 @@ internal class ExecutionManager private readonly SemaphoreSlim _semaphore; private readonly WorkerSetConfig _configuration; private readonly ILogger _logger; - private readonly ITaskService _taskManager; + private readonly ConductorClient _taskManager; private readonly IEnumerable _registeredWorkers; private readonly IServiceScopeFactory _lifetimeScopeFactory; private readonly IPollTimingStrategy _pollTimingStrategy; @@ -30,7 +30,7 @@ internal class ExecutionManager public ExecutionManager( WorkerSetConfig options, ILogger logger, - ITaskService taskService, + ConductorClient taskService, IEnumerable workerMappings, IServiceScopeFactory lifetimeScope, IPollTimingStrategy pollTimingStrategy, @@ -53,7 +53,7 @@ public async Task StartAsync(CancellationToken cancellationToken) while (!cancellationToken.IsCancellationRequested) { - var queuedTasks = (await _taskManager.GetAllQueues()) + var queuedTasks = (await _taskManager.all) .Where(a => _registeredWorkers.Any(b => b.TaskName == a.Key) && a.Value > 0) .ToDictionary(a => a.Key, a => a.Value); From be167a0187191cc7256131bf0ec000a4039ae3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:51:51 +0100 Subject: [PATCH 03/33] add task service --- .../Service/ITaskService.cs | 180 ++++++++++++++++++ .../Service/TaskService.cs | 55 ++++++ 2 files changed, 235 insertions(+) create mode 100644 src/ConductorSharp.Client/Service/ITaskService.cs create mode 100644 src/ConductorSharp.Client/Service/TaskService.cs diff --git a/src/ConductorSharp.Client/Service/ITaskService.cs b/src/ConductorSharp.Client/Service/ITaskService.cs new file mode 100644 index 00000000..21ac2702 --- /dev/null +++ b/src/ConductorSharp.Client/Service/ITaskService.cs @@ -0,0 +1,180 @@ +using ConductorSharp.Client.Generated; + +namespace ConductorSharp.Client.Service +{ + public interface ITaskService + { + /// + /// Get task by Id + /// + /// + /// + /// + Task GetAsync(string taskId, CancellationToken cancellationToken = default); + + /// + /// Get queue size for a task type. + /// + /// + /// + /// + /// + /// + /// + Task GetQueueAsync( + string taskType, + string? domain = null, + string? isolationGroupId = null, + string? executionNamespace = null, + CancellationToken cancellationToken = default + ); + + /// + /// Get the external uri where the task payload is to be stored + /// + /// + /// + /// + /// + /// + Task GetExternalStorageLocationAsync( + string path, + string operation, + string payloadType, + CancellationToken cancellationToken = default + ); + + /// + /// Get Task Execution Logs + /// + /// + /// + /// + Task> GetLogsAsync(string taskId, CancellationToken cancellationToken = default); + + /// + /// Get the last poll data for a given task type + /// + /// + /// + /// + Task> GetPollDataAsync(string taskType, CancellationToken cancellationToken = default); + + /// + /// Get the last poll data for all task types + /// + /// + /// + Task> ListPollDataAsync(CancellationToken cancellationToken = default); + + /// + /// Get the details about each queue + /// + /// + /// + Task> ListQueuesAsync(CancellationToken cancellationToken = default); + + /// + /// Get the details about each queue + /// + /// + /// + Task>>> ListQueuesVerboseAsync( + CancellationToken cancellationToken = default + ); + + /// + /// Log Task Execution Details + /// + /// + /// + /// + /// + Task LogAsync(string taskId, string message, CancellationToken cancellationToken = default); + + /// + /// Poll for a task of a certain type + /// + /// + /// + /// + /// + /// + Task PollAsync(string taskType, string? workerId, string? domain, CancellationToken cancellationToken = default); + + /// + /// Batch poll for a task of a certain type + /// + /// + /// + /// + /// + /// + /// + /// + Task> BatchPollAsync( + string taskType, + string? workerId, + string? domain, + int? count = null, + int? timeout = null, + CancellationToken cancellationToken = default + ); + + /// + /// Requeue pending tasks + /// + /// + /// + /// + Task RequeuePendingAsync(string taskType, CancellationToken cancellationToken = default); + + /// + /// Search for tasks based in payload and other parameters. + /// Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for tasks based in payload and other parameters + /// Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchV2Async( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Update a task + /// + /// + /// + /// + Task UpdateAsync(TaskResult updateRequest, CancellationToken cancellationToken = default); + } +} diff --git a/src/ConductorSharp.Client/Service/TaskService.cs b/src/ConductorSharp.Client/Service/TaskService.cs new file mode 100644 index 00000000..6ec6764e --- /dev/null +++ b/src/ConductorSharp.Client/Service/TaskService.cs @@ -0,0 +1,55 @@ +using ConductorSharp.Client.Generated; + +namespace ConductorSharp.Client.Service +{ + public class TaskService(ConductorClient client) : ITaskService + { + private readonly ConductorClient _client = client; + + public async Task UpdateAsync(TaskResult updateRequest, CancellationToken cancellationToken = default) + => await _client.UpdateTaskAsync(updateRequest, cancellationToken); + + public async Task> GetLogsAsync(string taskId, CancellationToken cancellationToken = default) + => await _client.GetTaskLogsAsync(taskId, cancellationToken); + + public async Task LogAsync(string taskId, string message, CancellationToken cancellationToken = default) + => await _client.LogAsync(taskId, message, cancellationToken); + + public async Task RequeuePendingAsync(string taskType, CancellationToken cancellationToken = default) + => await _client.RequeuePendingTaskAsync(taskType, cancellationToken); + + public async Task GetAsync(string taskId, CancellationToken cancellationToken = default) + => await _client.GetTaskAsync(taskId, cancellationToken); + + public async Task SearchAsync(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) + => await _client.Search_1Async(start, size, sort, freeText, query, cancellationToken); + + public async Task SearchV2Async(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) + => await _client.SearchV2_1Async(start, size, sort, freeText, query, cancellationToken); + + public async Task GetQueueAsync(string taskType, string? domain = null, string? isolationGroupId = null, string? executionNamespace = null, CancellationToken cancellationToken = default) + => await _client.TaskDepthAsync(taskType, domain, isolationGroupId, executionNamespace, cancellationToken); + + public async Task> GetPollDataAsync(string taskType, CancellationToken cancellationToken = default) + => await _client.GetPollDataAsync(taskType, cancellationToken); + + public async Task> ListPollDataAsync(CancellationToken cancellationToken = default) + => await _client.GetAllPollDataAsync(cancellationToken); + + public async Task> ListQueuesAsync(CancellationToken cancellationToken = default) + => await _client.AllAsync(cancellationToken); + + public async Task>>> ListQueuesVerboseAsync(CancellationToken cancellationToken = default) + => await _client.AllVerboseAsync(cancellationToken); + + public async Task PollAsync(string taskType, string? workerId, string? domain, CancellationToken cancellationToken = default) + => await _client.PollAsync(taskType, workerId, domain, cancellationToken); + + public async Task> BatchPollAsync(string taskType, string? workerId, string? domain, int? count = null, int? timeout = null, CancellationToken cancellationToken = default) + => await _client.BatchPollAsync(taskType, workerId, domain, count, timeout, cancellationToken); + + public async Task GetExternalStorageLocationAsync(string path, string operation, string payloadType, CancellationToken cancellationToken = default) + => await _client.GetExternalStorageLocation_1Async(path, operation, payloadType, cancellationToken); + + } +} From 3d7656e0e1d670bcb68f78401340efc731eda3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:08:16 +0100 Subject: [PATCH 04/33] tidy up nulls --- src/ConductorSharp.Client/ApiException.cs | 32 +++++++------------ .../ConductorConstants.cs | 2 -- .../ConductorErrorResponse.cs | 13 +++----- src/ConductorSharp.Client/RestConfig.cs | 4 +-- .../Util/JsonNodeConverter.cs | 14 +++++--- .../Util/StringExtensions.cs | 15 --------- 6 files changed, 26 insertions(+), 54 deletions(-) delete mode 100644 src/ConductorSharp.Client/Util/StringExtensions.cs diff --git a/src/ConductorSharp.Client/ApiException.cs b/src/ConductorSharp.Client/ApiException.cs index 6fa8328c..cba8c7d9 100644 --- a/src/ConductorSharp.Client/ApiException.cs +++ b/src/ConductorSharp.Client/ApiException.cs @@ -1,28 +1,18 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; namespace ConductorSharp.Client.Generated { - internal class ApiException : Exception + internal class ApiException( + string message, + int statusCode, + string responseData, + IReadOnlyDictionary> headers, + JsonException exception + ) : Exception(message, exception) { - public ConductorErrorResponse Errors { get; private set; } - public int StatusCode { get; private set; } - public string ResponseData { get; private set; } - public IReadOnlyDictionary> Headers { get; private set; } - - public ApiException( - string message, - int statusCode, - string responseData, - IReadOnlyDictionary> headers, - JsonException exception - ) : base(message, exception) - { - Errors = JsonConvert.DeserializeObject(responseData); - StatusCode = statusCode; - Headers = headers; - ResponseData = responseData; - } + public ConductorErrorResponse? Errors { get; private set; } = JsonConvert.DeserializeObject(responseData); + public int StatusCode { get; private set; } = statusCode; + public string ResponseData { get; private set; } = responseData; + public IReadOnlyDictionary> Headers { get; private set; } = headers; } } diff --git a/src/ConductorSharp.Client/ConductorConstants.cs b/src/ConductorSharp.Client/ConductorConstants.cs index 200b2d7a..32fc6786 100644 --- a/src/ConductorSharp.Client/ConductorConstants.cs +++ b/src/ConductorSharp.Client/ConductorConstants.cs @@ -6,8 +6,6 @@ namespace ConductorSharp.Client { public static class ConductorConstants { - public static string SimpleTask => "SIMPLE"; - public static NamingStrategy IoNamingStrategy { get; } = new SnakeCaseNamingStrategy(); public static JsonSerializer IoJsonSerializer diff --git a/src/ConductorSharp.Client/ConductorErrorResponse.cs b/src/ConductorSharp.Client/ConductorErrorResponse.cs index 3fa28cc3..6bee15c9 100644 --- a/src/ConductorSharp.Client/ConductorErrorResponse.cs +++ b/src/ConductorSharp.Client/ConductorErrorResponse.cs @@ -1,19 +1,14 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ConductorSharp.Client { public class ConductorValidationError { [JsonProperty("path")] - public string Path { get; set; } + public string? Path { get; set; } [JsonProperty("message")] - public string Message { get; set; } + public string? Message { get; set; } } public class ConductorErrorResponse @@ -22,12 +17,12 @@ public class ConductorErrorResponse public int Status { get; set; } [JsonProperty("message")] - public string Message { get; set; } + public string? Message { get; set; } [JsonProperty("retryable")] public bool Retryable { get; set; } [JsonProperty("validationErrors")] - public List ValidationErrors { get; set; } + public List ValidationErrors { get; set; } = []; } } diff --git a/src/ConductorSharp.Client/RestConfig.cs b/src/ConductorSharp.Client/RestConfig.cs index f34ae9bf..223604c4 100644 --- a/src/ConductorSharp.Client/RestConfig.cs +++ b/src/ConductorSharp.Client/RestConfig.cs @@ -2,8 +2,6 @@ { public class RestConfig { - public string BaseUrl { get; set; } - public string ApiPath { get; set; } - public bool IgnoreValidationErrors { get; set; } + public string? BaseUrl { get; set; } } } diff --git a/src/ConductorSharp.Client/Util/JsonNodeConverter.cs b/src/ConductorSharp.Client/Util/JsonNodeConverter.cs index ec8e15f8..ca902e63 100644 --- a/src/ConductorSharp.Client/Util/JsonNodeConverter.cs +++ b/src/ConductorSharp.Client/Util/JsonNodeConverter.cs @@ -1,19 +1,25 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using System; using System.Text.Json.Nodes; namespace ConductorSharp.Client.Util { public class JsonNodeConverter : JsonConverter { - public override void WriteJson(JsonWriter writer, JsonNode value, JsonSerializer serializer) => + public override void WriteJson(JsonWriter writer, JsonNode? value, JsonSerializer serializer) + { + if (value is null) + { + return; + } + serializer.Serialize(writer, JToken.Parse(value.ToJsonString())); + } - public override JsonNode ReadJson( + public override JsonNode? ReadJson( JsonReader reader, Type objectType, - JsonNode existingValue, + JsonNode? existingValue, bool hasExistingValue, JsonSerializer serializer ) => JsonNode.Parse(JToken.Load(reader).ToString(Formatting.None)); diff --git a/src/ConductorSharp.Client/Util/StringExtensions.cs b/src/ConductorSharp.Client/Util/StringExtensions.cs deleted file mode 100644 index d748a231..00000000 --- a/src/ConductorSharp.Client/Util/StringExtensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace ConductorSharp.Client.Util -{ - internal static class StringExtensions - { - public static Uri ToRelativeUri(this string pattern, params object[] args) - { - if (string.IsNullOrEmpty(pattern)) - throw new ArgumentNullException(nameof(pattern)); - - return new Uri(string.Format(pattern, args), UriKind.Relative); - } - } -} From 9ffa5615bb3cb5bdbd78dc2173bbe5cb6d2f4a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:08:51 +0100 Subject: [PATCH 05/33] update dependencies --- src/ConductorSharp.Client/ConductorSharp.Client.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ConductorSharp.Client/ConductorSharp.Client.csproj b/src/ConductorSharp.Client/ConductorSharp.Client.csproj index 99d04696..e8be6c36 100644 --- a/src/ConductorSharp.Client/ConductorSharp.Client.csproj +++ b/src/ConductorSharp.Client/ConductorSharp.Client.csproj @@ -17,9 +17,9 @@ - + - + From 1b21a8be1014272a32485927f2162221abb6df16 Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Mon, 8 Jan 2024 16:20:22 +0100 Subject: [PATCH 06/33] Add wrapper services --- .../Service/AdminService.cs | 29 +++++++ .../Service/EventService.cs | 28 ++++++ .../Service/ExternalPayloadService.cs | 13 +++ .../Service/IAdminService.cs | 34 ++++++++ .../Service/IEventService.cs | 39 +++++++++ .../Service/IExternalPayloadService.cs | 14 +++ .../Service/IMetadataService.cs | 75 ++++++++++++++++ .../Service/IQueueAdminService.cs | 42 +++++++++ .../Service/IWorkflowBulkService.cs | 45 ++++++++++ .../Service/MetadataService.cs | 87 ++++++++----------- .../Service/QueueAdminService.cs | 25 ++++++ .../Service/WorkflowBulkService.cs | 31 +++++++ 12 files changed, 409 insertions(+), 53 deletions(-) create mode 100644 src/ConductorSharp.Client/Service/AdminService.cs create mode 100644 src/ConductorSharp.Client/Service/EventService.cs create mode 100644 src/ConductorSharp.Client/Service/ExternalPayloadService.cs create mode 100644 src/ConductorSharp.Client/Service/IAdminService.cs create mode 100644 src/ConductorSharp.Client/Service/IEventService.cs create mode 100644 src/ConductorSharp.Client/Service/IExternalPayloadService.cs create mode 100644 src/ConductorSharp.Client/Service/IMetadataService.cs create mode 100644 src/ConductorSharp.Client/Service/IQueueAdminService.cs create mode 100644 src/ConductorSharp.Client/Service/IWorkflowBulkService.cs create mode 100644 src/ConductorSharp.Client/Service/QueueAdminService.cs create mode 100644 src/ConductorSharp.Client/Service/WorkflowBulkService.cs diff --git a/src/ConductorSharp.Client/Service/AdminService.cs b/src/ConductorSharp.Client/Service/AdminService.cs new file mode 100644 index 00000000..351b81ae --- /dev/null +++ b/src/ConductorSharp.Client/Service/AdminService.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using ConductorSharp.Client.Generated; +using Task = ConductorSharp.Client.Generated.Task; + +namespace ConductorSharp.Client.Service +{ + public class AdminService(ConductorClient client) : IAdminService + { + public async Task QueueWorkflowsForSweep(string workflowId, CancellationToken cancellationToken = default) + => await client.RequeueSweepAsync(workflowId, cancellationToken); + + public async Task VerifyAndRepairWorkflowConsistency(string workflowId, + CancellationToken cancellationToken = default) + => await client.VerifyAndRepairWorkflowConsistencyAsync(workflowId, cancellationToken); + + public async Task> GetPendingTasks(string taskType, int? start, int? count, + CancellationToken cancellationToken = default) + => await client.ViewAsync(taskType, start, count, cancellationToken); + + public async Task> GetEventQueuesAsync(bool? verbose, + CancellationToken cancellationToken = default) + => await client.GetEventQueuesAsync(verbose, cancellationToken); + + public async Task> GetAllConfigAsync(CancellationToken cancellationToken = default) + => await client.GetAllConfigAsync(cancellationToken); + } +} diff --git a/src/ConductorSharp.Client/Service/EventService.cs b/src/ConductorSharp.Client/Service/EventService.cs new file mode 100644 index 00000000..0e13f692 --- /dev/null +++ b/src/ConductorSharp.Client/Service/EventService.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using ConductorSharp.Client.Generated; +using Task = System.Threading.Tasks.Task; + +namespace ConductorSharp.Client.Service +{ + public class EventService(ConductorClient client) : IEventService + { + public async Task> ListAsync(CancellationToken cancellationToken = default) + => await client.GetEventHandlersAsync(cancellationToken); + + public async Task UpdateAsync(EventHandler eventHandler, CancellationToken cancellationToken = default) + => await client.UpdateEventHandlerAsync(eventHandler, cancellationToken); + + public async Task AddAsync(EventHandler eventHandler, CancellationToken cancellationToken = default) + => await client.AddEventHandlerAsync(eventHandler, cancellationToken); + + public async Task GetEventHandlersForEventAsync(string @event, bool? activeOnly = null, + CancellationToken cancellationToken = default) + => await client.GetEventHandlersForEventAsync(@event, activeOnly, cancellationToken); + + public async Task RemoveEventHandlerStatusAsync(string name, CancellationToken cancellationToken = default) + => await client.RemoveEventHandlerStatusAsync(name, cancellationToken); + + } +} diff --git a/src/ConductorSharp.Client/Service/ExternalPayloadService.cs b/src/ConductorSharp.Client/Service/ExternalPayloadService.cs new file mode 100644 index 00000000..fe110fbf --- /dev/null +++ b/src/ConductorSharp.Client/Service/ExternalPayloadService.cs @@ -0,0 +1,13 @@ +using System.Threading; +using System.Threading.Tasks; +using ConductorSharp.Client.Generated; + +namespace ConductorSharp.Client.Service +{ + public class ExternalPayloadService(ConductorClient client) : IExternalPayloadService + { + public async Task GetExternalStorageData(string externalPayloadPath, + CancellationToken cancellationToken = default) + => await client.GetExternalStorageDataAsync(externalPayloadPath, cancellationToken); + } +} diff --git a/src/ConductorSharp.Client/Service/IAdminService.cs b/src/ConductorSharp.Client/Service/IAdminService.cs new file mode 100644 index 00000000..3a3b2f37 --- /dev/null +++ b/src/ConductorSharp.Client/Service/IAdminService.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace ConductorSharp.Client.Service +{ + public interface IAdminService + { + /// + /// Get all the configuration parameters + /// + Task> GetAllConfigAsync(CancellationToken cancellationToken = default); + + /// + /// Get registered queues + /// + Task> GetEventQueuesAsync(bool? verbose, CancellationToken cancellationToken = default); + + /// + /// Get the list of pending tasks for a given task type + /// + Task> GetPendingTasks(string taskType, int? start, int? count, CancellationToken cancellationToken = default); + + /// + /// Queue up all the running workflows for sweep + /// + Task QueueWorkflowsForSweep(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Verify and repair workflow consistency + /// + Task VerifyAndRepairWorkflowConsistency(string workflowId, CancellationToken cancellationToken = default); + } +} diff --git a/src/ConductorSharp.Client/Service/IEventService.cs b/src/ConductorSharp.Client/Service/IEventService.cs new file mode 100644 index 00000000..d86a8500 --- /dev/null +++ b/src/ConductorSharp.Client/Service/IEventService.cs @@ -0,0 +1,39 @@ +using ConductorSharp.Client.Generated; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace ConductorSharp.Client.Service +{ + public interface IEventService + { + /// + /// Add a new event handler. + /// + System.Threading.Tasks.Task AddAsync(EventHandler eventHandler, CancellationToken cancellationToken = default); + + /// + /// Get event handlers for a given event + /// + System.Threading.Tasks.Task GetEventHandlersForEventAsync( + string @event, + bool? activeOnly = null, + CancellationToken cancellationToken = default + ); + + /// + /// Get all the event handlers + /// + Task> ListAsync(CancellationToken cancellationToken = default); + + /// + /// Remove an event handler + /// + System.Threading.Tasks.Task RemoveEventHandlerStatusAsync(string name, CancellationToken cancellationToken = default); + + /// + /// Update an existing event handler. + /// + System.Threading.Tasks.Task UpdateAsync(EventHandler eventHandler, CancellationToken cancellationToken = default); + } +} diff --git a/src/ConductorSharp.Client/Service/IExternalPayloadService.cs b/src/ConductorSharp.Client/Service/IExternalPayloadService.cs new file mode 100644 index 00000000..74417da5 --- /dev/null +++ b/src/ConductorSharp.Client/Service/IExternalPayloadService.cs @@ -0,0 +1,14 @@ +using ConductorSharp.Client.Generated; +using System.Threading; +using System.Threading.Tasks; + +namespace ConductorSharp.Client.Service +{ + public interface IExternalPayloadService + { + /// + /// Get task or workflow by externalPayloadPath from External PostgreSQL Storage + /// + Task GetExternalStorageData(string externalPayloadPath, CancellationToken cancellationToken = default); + } +} diff --git a/src/ConductorSharp.Client/Service/IMetadataService.cs b/src/ConductorSharp.Client/Service/IMetadataService.cs new file mode 100644 index 00000000..2dea0e18 --- /dev/null +++ b/src/ConductorSharp.Client/Service/IMetadataService.cs @@ -0,0 +1,75 @@ +using ConductorSharp.Client.Generated; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace ConductorSharp.Client.Service +{ + public interface IMetadataService + { + /// + /// Create a new workflow definition + /// + System.Threading.Tasks.Task CreateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); + + /// + /// Remove a task definition + /// + System.Threading.Tasks.Task DeleteTaskDefAsync(string taskType, CancellationToken cancellationToken = default); + + /// + /// Removes workflow definition. It does not remove workflows associated with the definition. + /// + System.Threading.Tasks.Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default); + + /// + /// Retrieves all workflow definition along with blueprint + /// + Task> GetAllWorkflowsAsync(CancellationToken cancellationToken = default); + + /// + /// Returns only the latest version of all workflow definitions + /// + Task> GetAllWorkflowsWithLatestVersionsAsync(CancellationToken cancellationToken = default); + + /// + /// Gets the task definition + /// + Task GetTaskDefAsync(string taskType, CancellationToken cancellationToken = default); + + /// + /// Gets all task definition + /// + Task> GetTaskDefsAsync(CancellationToken cancellationToken = default); + + /// + /// Retrieves workflow definition along with blueprint + /// + Task GetWorkflowAsync(string name, int? version = null, CancellationToken cancellationToken = default); + + /// + /// Returns workflow names and versions only (no definition bodies) + /// + Task> GetWorkflowNamesAndVersionsAsync(CancellationToken cancellationToken = default); + + /// + /// Update an existing task + /// + System.Threading.Tasks.Task RegisterTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default); + + /// + /// Create new task definition(s) + /// + System.Threading.Tasks.Task RegisterTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default); + + /// + /// Create or update workflow definition + /// + Task UpdateWorkflowsAsync(IEnumerable workflows, CancellationToken cancellationToken = default); + + /// + /// Validates a new workflow definition + /// + System.Threading.Tasks.Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); + } +} diff --git a/src/ConductorSharp.Client/Service/IQueueAdminService.cs b/src/ConductorSharp.Client/Service/IQueueAdminService.cs new file mode 100644 index 00000000..cfd563de --- /dev/null +++ b/src/ConductorSharp.Client/Service/IQueueAdminService.cs @@ -0,0 +1,42 @@ +using ConductorSharp.Client.Generated; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace ConductorSharp.Client.Service +{ + public interface IQueueAdminService + { + /// + /// Get the queue length + /// + Task> GetQueueLengthAsync(CancellationToken cancellationToken = default); + + /// + /// Get Queue Names + /// + Task> GetQueueNames(CancellationToken cancellationToken = default); + + /// + /// Publish a message in queue to mark a wait task as completed. + /// + System.Threading.Tasks.Task MarkWaitTaskAsAsync( + string workflowid, + string taskRefName, + Status status, + IDictionary output, + CancellationToken cancellationToken = default + ); + + /// + /// Publish a message in queue to mark a wait task (by taskId) as completed. + /// + System.Threading.Tasks.Task MarkWaitTaskByTaskIdAsAsync( + string workflowId, + string taskId, + Status2 status, + IDictionary output, + CancellationToken cancellationToken = default + ); + } +} diff --git a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs new file mode 100644 index 00000000..7d514e6c --- /dev/null +++ b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs @@ -0,0 +1,45 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using ConductorSharp.Client.Generated; +using Task = ConductorSharp.Client.Generated.Task; + +namespace ConductorSharp.Client.Service +{ + public interface IWorkflowBulkService + { + /// + /// Resume the list of workflows + /// + Task ResumeWorkflowsAsyncAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + + /// + /// Pause the list of workflows + /// + Task PauseWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + + /// + /// Terminate workflows execution + /// + Task TerminateWorkflowsAsync( + IEnumerable worklowIds, + string reason = null, + CancellationToken cancellationToken = default + ); + + /// + /// Retry the last failed task for each workflow from the list + /// + Task RetryWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + + /// + /// Restart the list of completed workflow + /// + Task RestartWorkflowsAsync( + IEnumerable workflowIds, + bool? useLatestDefinitions = null, + CancellationToken cancellationToken = default + ); + } +} diff --git a/src/ConductorSharp.Client/Service/MetadataService.cs b/src/ConductorSharp.Client/Service/MetadataService.cs index 0e4b5351..241d7d91 100644 --- a/src/ConductorSharp.Client/Service/MetadataService.cs +++ b/src/ConductorSharp.Client/Service/MetadataService.cs @@ -1,72 +1,53 @@ -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Client.Model.Response; -using ConductorSharp.Client.Util; -using System.Collections.Generic; -using System.Net.Http; +using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; +using ConductorSharp.Client.Generated; +using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Client.Service { - public class MetadataService : IMetadataService + public class MetadataService(ConductorClient client) : IMetadataService { - private readonly IConductorClient _conductorClient; + public async Task> GetAllWorkflowsAsync(CancellationToken cancellationToken = default) + => await client.GetAllAsync(cancellationToken); - public MetadataService(IConductorClient client) => _conductorClient = client; + public async Task UpdateWorkflowsAsync(IEnumerable workflows, CancellationToken cancellationToken = default) + => await client.UpdateAsync(workflows, cancellationToken); - public async Task GetAllTaskDefinitions() => - (await _conductorClient.ExecuteRequestAsync(ApiUrls.GetAllTaskDefinitions(), HttpMethod.Get)); + public async Task CreateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default) + => await client.CreateAsync(workflowDef, cancellationToken); - public async Task CreateTaskDefinitions(List definitions) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.CreateTaskDefinitions(), HttpMethod.Post, definitions); + public async Task> GetTaskDefsAsync(CancellationToken cancellationToken = default) + => await client.GetTaskDefsAsync(cancellationToken); - public async Task GetTaskDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetTaskDefinition(name), HttpMethod.Get); + public async Task RegisterTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default) + => await client.RegisterTaskDefAsync(taskDef, cancellationToken); - public async Task DeleteTaskDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.DeleteTaskDefinition(name), HttpMethod.Delete); + public async Task RegisterTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default) + => await client.RegisterTaskDef_1Async(taskDefs, cancellationToken); - public async Task UpdateTaskDefinition(TaskDefinition definition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.UpdateTaskDefinition(), HttpMethod.Put, definition); + public async Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default) + => await client.ValidateAsync(workflowDef, cancellationToken); - public async Task GetWorkflowDefinition(string name, int version) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetWorkflowDefinition(name, version), HttpMethod.Get); + public async Task GetWorkflowAsync(string name, int? version = null, + CancellationToken cancellationToken = default) + => await client.GetAsync(name, version, cancellationToken); - public async Task UpdateWorkflowDefinitions(List definitions) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.UpdateWorkflowDefinitions(), HttpMethod.Put, definitions); + public async Task> GetWorkflowNamesAndVersionsAsync( + CancellationToken cancellationToken = default) + => await client.GetWorkflowNamesAndVersionsAsync(cancellationToken); - public async Task DeleteWorkflowDefinition(string name, int version) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.DeleteWorkflowDefinition(name, version), HttpMethod.Delete); + public async Task> GetAllWorkflowsWithLatestVersionsAsync( + CancellationToken cancellationToken = default) + => await client.GetAllWorkflowsWithLatestVersionsAsync(cancellationToken); - public async Task ValidateWorkflowDefinition(WorkflowDefinition workflowDefinition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.ValidateWorkflowDefinition(), HttpMethod.Post, workflowDefinition); + public async Task GetTaskDefAsync(string taskType, CancellationToken cancellationToken = default) + => await client.GetTaskDefAsync(taskType, cancellationToken); - public async Task CreateWorkflowDefinitions(List workflowDefinition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.CreateWorkflowDefinitions(), HttpMethod.Put, workflowDefinition); + public async Task DeleteTaskDefAsync(string taskType, CancellationToken cancellationToken = default) + => await client.UnregisterTaskDefAsync(taskType, cancellationToken); - public async Task GetAllWorkflowDefinitions() => - (await _conductorClient.ExecuteRequestAsync(ApiUrls.GetAlleWorkflowDefinitions(), HttpMethod.Get)); - - public async Task>> GetAllWorkflowNamesAndVersions() => - ( - await _conductorClient.ExecuteRequestAsync>>( - ApiUrls.GetAllWorkflowNamesAndVersions(), - HttpMethod.Get - ) - ); - - public async Task GetAllEventHandlerDefinitions() => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetAllEventDefinitions(), HttpMethod.Get); - - public async Task UpdateEventHandlerDefinition(EventHandlerDefinition definition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.UpdateEventHandlerDefinition(), HttpMethod.Put, definition); - - public async Task DeleteEventHandlerDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.DeleteEventHandlerDefinition(name), HttpMethod.Delete); - - public async Task CreateEventHandlerDefinition(EventHandlerDefinition definition) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.CreateEventHandlerDefinition(), HttpMethod.Post, definition); - - public async Task GetEventHandlerDefinition(string name) => - await _conductorClient.ExecuteRequestAsync(ApiUrls.GetEventHandlerDefinition(name), HttpMethod.Get); + public async Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default) + => await client.UnregisterWorkflowDefAsync(name, version, cancellationToken); } } diff --git a/src/ConductorSharp.Client/Service/QueueAdminService.cs b/src/ConductorSharp.Client/Service/QueueAdminService.cs new file mode 100644 index 00000000..acc23eb7 --- /dev/null +++ b/src/ConductorSharp.Client/Service/QueueAdminService.cs @@ -0,0 +1,25 @@ +using ConductorSharp.Client.Generated; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Task = System.Threading.Tasks.Task; + +namespace ConductorSharp.Client.Service +{ + public class QueueAdminService(ConductorClient client) : IQueueAdminService + { + public async Task MarkWaitTaskAsAsync(string workflowid, string taskRefName, Status status, + IDictionary output, CancellationToken cancellationToken = default) + => await client.Update_1Async(workflowid, taskRefName, status, output, cancellationToken); + + public async Task MarkWaitTaskByTaskIdAsAsync(string workflowId, string taskId, Status2 status, + IDictionary output, CancellationToken cancellationToken = default) + => await client.UpdateByTaskIdAsync(workflowId, taskId, status, output, cancellationToken); + + public async Task> GetQueueLengthAsync(CancellationToken cancellationToken = default) + => await client.Size_1Async(cancellationToken); + + public async Task> GetQueueNames(CancellationToken cancellationToken = default) + => await client.NamesAsync(cancellationToken); + } +} diff --git a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs new file mode 100644 index 00000000..58bcbbe8 --- /dev/null +++ b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using ConductorSharp.Client.Generated; +using Task = ConductorSharp.Client.Generated.Task; + +namespace ConductorSharp.Client.Service; + +public class WorkflowBulkService(ConductorClient client) : IWorkflowBulkService +{ + public async Task ResumeWorkflowsAsyncAsync(IEnumerable workflowIds, + CancellationToken cancellationToken = default) => + await client.ResumeWorkflow_1Async(workflowIds, cancellationToken); + + public async Task PauseWorkflowsAsync(IEnumerable workflowIds, + CancellationToken cancellationToken = default) + => await client.PauseWorkflow_1Async(workflowIds, cancellationToken); + + public async Task TerminateWorkflowsAsync(IEnumerable worklowIds, string reason = null, + CancellationToken cancellationToken = default) + => await client.TerminateAsync(worklowIds, reason, cancellationToken); + + public async Task RetryWorkflowsAsync(IEnumerable workflowIds, + CancellationToken cancellationToken = default) + => await client.Retry_1Async(workflowIds, cancellationToken); + + public async Task RestartWorkflowsAsync(IEnumerable workflowIds, + bool? useLatestDefinition = null, + CancellationToken cancellationToken = default) + => await client.Restart_1Async(workflowIds, useLatestDefinition, cancellationToken); +} \ No newline at end of file From fc2b09b2c36918db600ad2bf235b6ab1fab9f9fc Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Mon, 8 Jan 2024 16:27:13 +0100 Subject: [PATCH 07/33] Fix namespace issues --- .../Service/AdminService.cs | 8 +- .../Service/EventService.cs | 9 +- .../Service/IEventService.cs | 16 +- .../Service/IMetadataService.cs | 111 +++--- .../Service/IQueueAdminService.cs | 4 +- .../Service/IWorkflowBulkService.cs | 66 ++- .../Service/IWorkflowService.cs | 376 +++++++++--------- .../Service/MetadataService.cs | 6 +- .../Service/QueueAdminService.cs | 33 +- .../Service/WorkflowBulkService.cs | 6 +- 10 files changed, 296 insertions(+), 339 deletions(-) diff --git a/src/ConductorSharp.Client/Service/AdminService.cs b/src/ConductorSharp.Client/Service/AdminService.cs index 351b81ae..678cc080 100644 --- a/src/ConductorSharp.Client/Service/AdminService.cs +++ b/src/ConductorSharp.Client/Service/AdminService.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using ConductorSharp.Client.Generated; -using Task = ConductorSharp.Client.Generated.Task; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Client.Service { @@ -15,7 +11,7 @@ public async Task VerifyAndRepairWorkflowConsistency(string workflowId, CancellationToken cancellationToken = default) => await client.VerifyAndRepairWorkflowConsistencyAsync(workflowId, cancellationToken); - public async Task> GetPendingTasks(string taskType, int? start, int? count, + public async Task> GetPendingTasks(string taskType, int? start, int? count, CancellationToken cancellationToken = default) => await client.ViewAsync(taskType, start, count, cancellationToken); diff --git a/src/ConductorSharp.Client/Service/EventService.cs b/src/ConductorSharp.Client/Service/EventService.cs index 0e13f692..101f052e 100644 --- a/src/ConductorSharp.Client/Service/EventService.cs +++ b/src/ConductorSharp.Client/Service/EventService.cs @@ -1,14 +1,11 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using ConductorSharp.Client.Generated; -using Task = System.Threading.Tasks.Task; +using ConductorSharp.Client.Generated; +using EventHandler = ConductorSharp.Client.Generated.EventHandler; namespace ConductorSharp.Client.Service { public class EventService(ConductorClient client) : IEventService { - public async Task> ListAsync(CancellationToken cancellationToken = default) + public async Task> ListAsync(CancellationToken cancellationToken = default) => await client.GetEventHandlersAsync(cancellationToken); public async Task UpdateAsync(EventHandler eventHandler, CancellationToken cancellationToken = default) diff --git a/src/ConductorSharp.Client/Service/IEventService.cs b/src/ConductorSharp.Client/Service/IEventService.cs index d86a8500..c9218a50 100644 --- a/src/ConductorSharp.Client/Service/IEventService.cs +++ b/src/ConductorSharp.Client/Service/IEventService.cs @@ -1,7 +1,5 @@ using ConductorSharp.Client.Generated; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using EventHandler = ConductorSharp.Client.Generated.EventHandler; namespace ConductorSharp.Client.Service { @@ -10,16 +8,12 @@ public interface IEventService /// /// Add a new event handler. /// - System.Threading.Tasks.Task AddAsync(EventHandler eventHandler, CancellationToken cancellationToken = default); + Task AddAsync(EventHandler eventHandler, CancellationToken cancellationToken = default); /// /// Get event handlers for a given event /// - System.Threading.Tasks.Task GetEventHandlersForEventAsync( - string @event, - bool? activeOnly = null, - CancellationToken cancellationToken = default - ); + Task GetEventHandlersForEventAsync(string @event, bool? activeOnly = null, CancellationToken cancellationToken = default); /// /// Get all the event handlers @@ -29,11 +23,11 @@ System.Threading.Tasks.Task GetEventHandlersForEventAsync( /// /// Remove an event handler /// - System.Threading.Tasks.Task RemoveEventHandlerStatusAsync(string name, CancellationToken cancellationToken = default); + Task RemoveEventHandlerStatusAsync(string name, CancellationToken cancellationToken = default); /// /// Update an existing event handler. /// - System.Threading.Tasks.Task UpdateAsync(EventHandler eventHandler, CancellationToken cancellationToken = default); + Task UpdateAsync(EventHandler eventHandler, CancellationToken cancellationToken = default); } } diff --git a/src/ConductorSharp.Client/Service/IMetadataService.cs b/src/ConductorSharp.Client/Service/IMetadataService.cs index 2dea0e18..b064e8a7 100644 --- a/src/ConductorSharp.Client/Service/IMetadataService.cs +++ b/src/ConductorSharp.Client/Service/IMetadataService.cs @@ -3,73 +3,72 @@ using System.Threading; using System.Threading.Tasks; -namespace ConductorSharp.Client.Service +namespace ConductorSharp.Client.Service; + +public interface IMetadataService { - public interface IMetadataService - { - /// - /// Create a new workflow definition - /// - System.Threading.Tasks.Task CreateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); + /// + /// Create a new workflow definition + /// + System.Threading.Tasks.Task CreateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); - /// - /// Remove a task definition - /// - System.Threading.Tasks.Task DeleteTaskDefAsync(string taskType, CancellationToken cancellationToken = default); + /// + /// Remove a task definition + /// + System.Threading.Tasks.Task DeleteTaskDefAsync(string taskType, CancellationToken cancellationToken = default); - /// - /// Removes workflow definition. It does not remove workflows associated with the definition. - /// - System.Threading.Tasks.Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default); + /// + /// Removes workflow definition. It does not remove workflows associated with the definition. + /// + System.Threading.Tasks.Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default); - /// - /// Retrieves all workflow definition along with blueprint - /// - Task> GetAllWorkflowsAsync(CancellationToken cancellationToken = default); + /// + /// Retrieves all workflow definition along with blueprint + /// + Task> GetAllWorkflowsAsync(CancellationToken cancellationToken = default); - /// - /// Returns only the latest version of all workflow definitions - /// - Task> GetAllWorkflowsWithLatestVersionsAsync(CancellationToken cancellationToken = default); + /// + /// Returns only the latest version of all workflow definitions + /// + Task> GetAllWorkflowsWithLatestVersionsAsync(CancellationToken cancellationToken = default); - /// - /// Gets the task definition - /// - Task GetTaskDefAsync(string taskType, CancellationToken cancellationToken = default); + /// + /// Gets the task definition + /// + Task GetTaskDefAsync(string taskType, CancellationToken cancellationToken = default); - /// - /// Gets all task definition - /// - Task> GetTaskDefsAsync(CancellationToken cancellationToken = default); + /// + /// Gets all task definition + /// + Task> GetTaskDefsAsync(CancellationToken cancellationToken = default); - /// - /// Retrieves workflow definition along with blueprint - /// - Task GetWorkflowAsync(string name, int? version = null, CancellationToken cancellationToken = default); + /// + /// Retrieves workflow definition along with blueprint + /// + Task GetWorkflowAsync(string name, int? version = null, CancellationToken cancellationToken = default); - /// - /// Returns workflow names and versions only (no definition bodies) - /// - Task> GetWorkflowNamesAndVersionsAsync(CancellationToken cancellationToken = default); + /// + /// Returns workflow names and versions only (no definition bodies) + /// + Task> GetWorkflowNamesAndVersionsAsync(CancellationToken cancellationToken = default); - /// - /// Update an existing task - /// - System.Threading.Tasks.Task RegisterTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default); + /// + /// Update an existing task + /// + System.Threading.Tasks.Task RegisterTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default); - /// - /// Create new task definition(s) - /// - System.Threading.Tasks.Task RegisterTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default); + /// + /// Create new task definition(s) + /// + System.Threading.Tasks.Task RegisterTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default); - /// - /// Create or update workflow definition - /// - Task UpdateWorkflowsAsync(IEnumerable workflows, CancellationToken cancellationToken = default); + /// + /// Create or update workflow definition + /// + Task UpdateWorkflowsAsync(IEnumerable workflows, CancellationToken cancellationToken = default); - /// - /// Validates a new workflow definition - /// - System.Threading.Tasks.Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); - } + /// + /// Validates a new workflow definition + /// + System.Threading.Tasks.Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); } diff --git a/src/ConductorSharp.Client/Service/IQueueAdminService.cs b/src/ConductorSharp.Client/Service/IQueueAdminService.cs index cfd563de..310e821b 100644 --- a/src/ConductorSharp.Client/Service/IQueueAdminService.cs +++ b/src/ConductorSharp.Client/Service/IQueueAdminService.cs @@ -20,7 +20,7 @@ public interface IQueueAdminService /// /// Publish a message in queue to mark a wait task as completed. /// - System.Threading.Tasks.Task MarkWaitTaskAsAsync( + Task MarkWaitTaskAsAsync( string workflowid, string taskRefName, Status status, @@ -31,7 +31,7 @@ System.Threading.Tasks.Task MarkWaitTaskAsAsync( /// /// Publish a message in queue to mark a wait task (by taskId) as completed. /// - System.Threading.Tasks.Task MarkWaitTaskByTaskIdAsAsync( + Task MarkWaitTaskByTaskIdAsAsync( string workflowId, string taskId, Status2 status, diff --git a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs index 7d514e6c..f7610903 100644 --- a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs +++ b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs @@ -1,45 +1,35 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using ConductorSharp.Client.Generated; -using Task = ConductorSharp.Client.Generated.Task; +using ConductorSharp.Client.Generated; -namespace ConductorSharp.Client.Service +namespace ConductorSharp.Client.Service; + +public interface IWorkflowBulkService { - public interface IWorkflowBulkService - { - /// - /// Resume the list of workflows - /// - Task ResumeWorkflowsAsyncAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + /// + /// Resume the list of workflows + /// + Task ResumeWorkflowsAsyncAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); - /// - /// Pause the list of workflows - /// - Task PauseWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + /// + /// Pause the list of workflows + /// + Task PauseWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); - /// - /// Terminate workflows execution - /// - Task TerminateWorkflowsAsync( - IEnumerable worklowIds, - string reason = null, - CancellationToken cancellationToken = default - ); + /// + /// Terminate workflows execution + /// + Task TerminateWorkflowsAsync(IEnumerable worklowIds, string reason = null, CancellationToken cancellationToken = default); - /// - /// Retry the last failed task for each workflow from the list - /// - Task RetryWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + /// + /// Retry the last failed task for each workflow from the list + /// + Task RetryWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); - /// - /// Restart the list of completed workflow - /// - Task RestartWorkflowsAsync( - IEnumerable workflowIds, - bool? useLatestDefinitions = null, - CancellationToken cancellationToken = default - ); - } + /// + /// Restart the list of completed workflow + /// + Task RestartWorkflowsAsync( + IEnumerable workflowIds, + bool? useLatestDefinitions = null, + CancellationToken cancellationToken = default + ); } diff --git a/src/ConductorSharp.Client/Service/IWorkflowService.cs b/src/ConductorSharp.Client/Service/IWorkflowService.cs index aff4df24..502b6ed2 100644 --- a/src/ConductorSharp.Client/Service/IWorkflowService.cs +++ b/src/ConductorSharp.Client/Service/IWorkflowService.cs @@ -1,195 +1,189 @@ using ConductorSharp.Client.Generated; -namespace ConductorSharp.Client.Service +namespace ConductorSharp.Client.Service; + +public interface IWorkflowService { - public interface IWorkflowService - { - /// - /// Starts the decision task for a workflow - /// - Task DecideAsync(string workflowId, CancellationToken cancellationToken = default); - - /// - /// Removes the workflow from the system - /// - Task DeleteAsync(string workflowId, bool? archiveWorkflow = null, CancellationToken cancellationToken = default); - - /// - /// Lists workflows for the given correlation id list - /// - Task>> GetCorrelatedAsync( - string name, - IEnumerable correlationIds, - bool? includeClosed = false, - bool? includeTasks = false, - CancellationToken cancellationToken = default - ); - - /// - /// Lists workflows for the given correlation id - /// - Task> GetCorrelatedAsync( - string name, - string correlationId, - bool? includeClosed = false, - bool? includeTasks = false, - CancellationToken cancellationToken = default - ); - - /// - /// Gets the workflow by workflow id - /// - Task GetExecutionStatusAsync(string workflowId, bool? includeTasks = false, CancellationToken cancellationToken = default); - - /// - /// Get the uri and path of the external storage where the workflow payload is to be stored - /// - Task GetExternalStorageLocationAsync(string path, string operation, string payloadType, CancellationToken cancellationToken = default); - - /// - /// Retrieve all the running workflows - /// - Task> ListRunningAsync( - string name, - int? version, - long? startTime = null, - long? endTime = null, - CancellationToken cancellationToken = default - ); - - /// - /// Pauses the workflow - /// - Task PauseAsync(string workflowId, CancellationToken cancellationToken = default); - - /// - /// Reruns the workflow from a specific task - /// - Task RerunAsync(string workflowId, RerunWorkflowRequest rerunWorkflowRequest, CancellationToken cancellationToken = default); - - /// - /// Resets callback times of all non-terminal SIMPLE tasks to 0 - /// - Task ResetCallbacksAsync(string workflowId, CancellationToken cancellationToken = default); - - /// - /// Restarts a completed workflow - /// - Task RestartAsync(string workflowId, bool? useLatestDefinitions = null, CancellationToken cancellationToken = default); - - /// - /// Resumes the workflow - /// - Task ResumeAsync(string workflowId, CancellationToken cancellationToken = default); - - /// - /// Retries the last failed task - /// - Task RetryAsync(string workflowId, bool? resumeSubworkflowTasks = null, CancellationToken cancellationToken = default); - - /// - /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// - /// - /// - /// - /// - /// - /// - Task SearchAsync( - int? start = null, - int? size = null, - string? sort = null, - string? freeText = null, - string? query = null, - CancellationToken cancellationToken = default - ); - - /// - /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// - /// - /// - /// - /// - /// - /// - Task SearchByTasksAsync( - int? start = null, - int? size = null, - string? sort = null, - string? freeText = null, - string? query = null, - CancellationToken cancellationToken = default - ); - - /// - /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// - /// - /// - /// - /// - /// - /// - Task SearchV2Async( - int? start = null, - int? size = null, - string? sort = null, - string? freeText = null, - string? query = null, - CancellationToken cancellationToken = default - ); - - /// - /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. - /// - /// - /// - /// - /// - /// - /// - /// - Task SearchV2ByTasksAsync( - int? start = null, - int? size = null, - string? sort = null, - string? freeText = null, - string? query = null, - CancellationToken cancellationToken = default - ); - - /// - /// Skips a given task from a current running workflow - /// - Task SkipTaskAsync( - string workflowId, - string taskReferenceName, - SkipTaskRequest skipTaskRequest, - CancellationToken cancellationToken = default - ); - - /// - /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain - /// - /// - /// ConductorShap: There is another Conductor API endpoint with seemingly identical functionality and operation - /// id 'startWorkflow_1'. It seems these two achieve the same task so the second one has been left out. - /// - Task StartAsync(StartWorkflowRequest startWorkflowRequest, CancellationToken cancellationToken = default); - - /// - /// Terminate workflow execution - /// - Task TerminateAsync(string workflowId, string? reason = null, CancellationToken cancellationToken = default); - - /// - /// Test workflow execution using mock data - /// - Task TestAsync(WorkflowTestRequest workflowTestRequest, CancellationToken cancellationToken = default); - } + /// + /// Starts the decision task for a workflow + /// + Task DecideAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Removes the workflow from the system + /// + Task DeleteAsync(string workflowId, bool? archiveWorkflow = null, CancellationToken cancellationToken = default); + + /// + /// Lists workflows for the given correlation id list + /// + Task>> GetCorrelatedAsync( + string name, + IEnumerable correlationIds, + bool? includeClosed = false, + bool? includeTasks = false, + CancellationToken cancellationToken = default + ); + + /// + /// Lists workflows for the given correlation id + /// + Task> GetCorrelatedAsync( + string name, + string correlationId, + bool? includeClosed = false, + bool? includeTasks = false, + CancellationToken cancellationToken = default + ); + + /// + /// Gets the workflow by workflow id + /// + Task GetExecutionStatusAsync(string workflowId, bool? includeTasks = false, CancellationToken cancellationToken = default); + + /// + /// Get the uri and path of the external storage where the workflow payload is to be stored + /// + Task GetExternalStorageLocationAsync(string path, string operation, string payloadType, CancellationToken cancellationToken = default); + + /// + /// Retrieve all the running workflows + /// + Task> ListRunningAsync( + string name, + int? version, + long? startTime = null, + long? endTime = null, + CancellationToken cancellationToken = default + ); + + /// + /// Pauses the workflow + /// + Task PauseAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Reruns the workflow from a specific task + /// + Task RerunAsync(string workflowId, RerunWorkflowRequest rerunWorkflowRequest, CancellationToken cancellationToken = default); + + /// + /// Resets callback times of all non-terminal SIMPLE tasks to 0 + /// + Task ResetCallbacksAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Restarts a completed workflow + /// + Task RestartAsync(string workflowId, bool? useLatestDefinitions = null, CancellationToken cancellationToken = default); + + /// + /// Resumes the workflow + /// + Task ResumeAsync(string workflowId, CancellationToken cancellationToken = default); + + /// + /// Retries the last failed task + /// + Task RetryAsync(string workflowId, bool? resumeSubworkflowTasks = null, CancellationToken cancellationToken = default); + + /// + /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchByTasksAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for workflows based on payload and other parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchV2Async( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Search for workflows based on task parameters. Use sort options as sort=:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order is not specified, defaults to ASC. + /// + /// + /// + /// + /// + /// + /// + /// + Task SearchV2ByTasksAsync( + int? start = null, + int? size = null, + string? sort = null, + string? freeText = null, + string? query = null, + CancellationToken cancellationToken = default + ); + + /// + /// Skips a given task from a current running workflow + /// + Task SkipTaskAsync(string workflowId, string taskReferenceName, SkipTaskRequest skipTaskRequest, CancellationToken cancellationToken = default); + + /// + /// Start a new workflow with StartWorkflowRequest, which allows task to be executed in a domain + /// + /// + /// ConductorShap: There is another Conductor API endpoint with seemingly identical functionality and operation + /// id 'startWorkflow_1'. It seems these two achieve the same task so the second one has been left out. + /// + Task StartAsync(StartWorkflowRequest startWorkflowRequest, CancellationToken cancellationToken = default); + + /// + /// Terminate workflow execution + /// + Task TerminateAsync(string workflowId, string? reason = null, CancellationToken cancellationToken = default); + + /// + /// Test workflow execution using mock data + /// + Task TestAsync(WorkflowTestRequest workflowTestRequest, CancellationToken cancellationToken = default); } diff --git a/src/ConductorSharp.Client/Service/MetadataService.cs b/src/ConductorSharp.Client/Service/MetadataService.cs index 241d7d91..02c6cc1a 100644 --- a/src/ConductorSharp.Client/Service/MetadataService.cs +++ b/src/ConductorSharp.Client/Service/MetadataService.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using ConductorSharp.Client.Generated; -using Task = System.Threading.Tasks.Task; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Client.Service { diff --git a/src/ConductorSharp.Client/Service/QueueAdminService.cs b/src/ConductorSharp.Client/Service/QueueAdminService.cs index acc23eb7..a8d97e56 100644 --- a/src/ConductorSharp.Client/Service/QueueAdminService.cs +++ b/src/ConductorSharp.Client/Service/QueueAdminService.cs @@ -1,25 +1,20 @@ using ConductorSharp.Client.Generated; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Task = System.Threading.Tasks.Task; -namespace ConductorSharp.Client.Service +namespace ConductorSharp.Client.Service; + +public class QueueAdminService(ConductorClient client) : IQueueAdminService { - public class QueueAdminService(ConductorClient client) : IQueueAdminService - { - public async Task MarkWaitTaskAsAsync(string workflowid, string taskRefName, Status status, - IDictionary output, CancellationToken cancellationToken = default) - => await client.Update_1Async(workflowid, taskRefName, status, output, cancellationToken); + public async Task MarkWaitTaskAsAsync(string workflowid, string taskRefName, Status status, + IDictionary output, CancellationToken cancellationToken = default) + => await client.Update_1Async(workflowid, taskRefName, status, output, cancellationToken); - public async Task MarkWaitTaskByTaskIdAsAsync(string workflowId, string taskId, Status2 status, - IDictionary output, CancellationToken cancellationToken = default) - => await client.UpdateByTaskIdAsync(workflowId, taskId, status, output, cancellationToken); + public async Task MarkWaitTaskByTaskIdAsAsync(string workflowId, string taskId, Status2 status, + IDictionary output, CancellationToken cancellationToken = default) + => await client.UpdateByTaskIdAsync(workflowId, taskId, status, output, cancellationToken); - public async Task> GetQueueLengthAsync(CancellationToken cancellationToken = default) - => await client.Size_1Async(cancellationToken); + public async Task> GetQueueLengthAsync(CancellationToken cancellationToken = default) + => await client.Size_1Async(cancellationToken); - public async Task> GetQueueNames(CancellationToken cancellationToken = default) - => await client.NamesAsync(cancellationToken); - } -} + public async Task> GetQueueNames(CancellationToken cancellationToken = default) + => await client.NamesAsync(cancellationToken); +} \ No newline at end of file diff --git a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs index 58bcbbe8..c65cb4f1 100644 --- a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs +++ b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using ConductorSharp.Client.Generated; -using Task = ConductorSharp.Client.Generated.Task; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Client.Service; From cdd464ce2e12802571d8f852d5c9c6ec251b3e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 18:15:26 +0100 Subject: [PATCH 08/33] refactor partial #1 --- .../ConductorConstants.cs | 13 ++-- .../Util/SerializationHelper.cs | 25 ++++++ .../Builders/BaseTaskBuilder.cs | 6 +- .../Builders/DecisionTaskBuilder.cs | 20 +++-- .../ConductorSharp.Engine.csproj | 1 - src/ConductorSharp.Engine/ExecutionManager.cs | 76 ++++++++++++++----- .../Interface/ITaskBuilder.cs | 5 +- .../Polling/IPollOrderStrategy.cs | 2 +- .../Polling/IPollTimingStrategy.cs | 2 +- .../Polling/InverseExponentialBackoff.cs | 2 +- .../Polling/RandomOrdering.cs | 2 +- 11 files changed, 105 insertions(+), 49 deletions(-) create mode 100644 src/ConductorSharp.Client/Util/SerializationHelper.cs diff --git a/src/ConductorSharp.Client/ConductorConstants.cs b/src/ConductorSharp.Client/ConductorConstants.cs index 32fc6786..076060c9 100644 --- a/src/ConductorSharp.Client/ConductorConstants.cs +++ b/src/ConductorSharp.Client/ConductorConstants.cs @@ -9,20 +9,23 @@ public static class ConductorConstants public static NamingStrategy IoNamingStrategy { get; } = new SnakeCaseNamingStrategy(); public static JsonSerializer IoJsonSerializer + { + get => JsonSerializer.Create(IoJsonSerializerSettings); + } + + public static JsonSerializerSettings IoJsonSerializerSettings { get { - var serializer = new JsonSerializer() + return new JsonSerializerSettings { ContractResolver = new DefaultContractResolver { NamingStrategy = IoNamingStrategy }, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead, - TypeNameHandling = TypeNameHandling.Auto + TypeNameHandling = TypeNameHandling.Auto, + Converters = new List() { new JsonNodeConverter() } }; - - serializer.Converters.Add(new JsonNodeConverter()); - return serializer; } } diff --git a/src/ConductorSharp.Client/Util/SerializationHelper.cs b/src/ConductorSharp.Client/Util/SerializationHelper.cs new file mode 100644 index 00000000..568dca71 --- /dev/null +++ b/src/ConductorSharp.Client/Util/SerializationHelper.cs @@ -0,0 +1,25 @@ +using Newtonsoft.Json; + +namespace ConductorSharp.Client.Util +{ + public static class SerializationHelper + { + public static T? DictonaryToObject(IDictionary dict, JsonSerializerSettings serializerSettings) + { + var json = JsonConvert.SerializeObject(dict, serializerSettings); + return JsonConvert.DeserializeObject(json, serializerSettings); + } + + public static object? DictonaryToObject(Type objectType, IDictionary dict, JsonSerializerSettings serializerSettings) + { + var json = JsonConvert.SerializeObject(dict, serializerSettings); + return JsonConvert.DeserializeObject(json, objectType, serializerSettings); + } + + public static IDictionary? ObjectToDictionary(object obj, JsonSerializerSettings serializerSettings) + { + var json = JsonConvert.SerializeObject(obj, serializerSettings); + return JsonConvert.DeserializeObject>(json, serializerSettings); + } + } +} diff --git a/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs index 65dc5980..9003e3dc 100644 --- a/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs @@ -1,12 +1,10 @@ -using ConductorSharp.Client; -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; using MediatR; using Newtonsoft.Json.Linq; -using System; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -34,6 +32,6 @@ public ITaskOptionsBuilder AsOptional() return this; } - public abstract WorkflowDefinition.Task[] Build(); + public abstract WorkflowTask[] Build(); } } diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index 56dfd49e..52096a32 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -1,10 +1,9 @@ using ConductorSharp.Client; -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; -using MediatR; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -83,29 +82,28 @@ internal DecisionTaskBuilder AddCase(string caseName) return this; } - public override WorkflowDefinition.Task[] Build() + public override WorkflowTask[] Build() { var decisionTaskName = $"DECISION_{_taskRefferenceName}"; - return new WorkflowDefinition.Task[] + return new WorkflowTask[] { - new WorkflowDefinition.Task + new WorkflowTask { Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, - InputParameters = _inputParameters, + InputParameters = _inputParameters.ToObject>(), Type = "DECISION", CaseValueParam = "case_value_param", + ScriptExpression = "case_value_param", + CaseExpression = "case_value_param", DecisionCases = new JObject { _caseDictionary.Select( a => new JProperty(a.Key, JArray.FromObject(a.Value.SelectMany(a => a.Build()), ConductorConstants.DefinitionsSerializer)) ) - }, - DefaultCase = _defaultCase - ?.SelectMany(builder => builder.Build()) - .Select(task => JObject.FromObject(task, ConductorConstants.DefinitionsSerializer)) - .ToList() + }.ToObject>>(), + DefaultCase = _defaultCase?.SelectMany(builder => builder.Build()).ToArray() } }; } diff --git a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj index af43d1d2..7c3a6b6f 100644 --- a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj +++ b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj @@ -20,7 +20,6 @@ - diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index aeb0d52e..a4efa8b5 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -1,5 +1,7 @@ using ConductorSharp.Client; using ConductorSharp.Client.Generated; +using ConductorSharp.Client.Service; +using ConductorSharp.Client.Util; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Polling; @@ -7,11 +9,12 @@ using MediatR; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading; -using System.Threading.Tasks; using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Engine @@ -21,7 +24,8 @@ internal class ExecutionManager private readonly SemaphoreSlim _semaphore; private readonly WorkerSetConfig _configuration; private readonly ILogger _logger; - private readonly ConductorClient _taskManager; + private readonly ITaskService _taskManager; + private readonly IExternalPayloadService _externalPayloadService; private readonly IEnumerable _registeredWorkers; private readonly IServiceScopeFactory _lifetimeScopeFactory; private readonly IPollTimingStrategy _pollTimingStrategy; @@ -30,8 +34,9 @@ internal class ExecutionManager public ExecutionManager( WorkerSetConfig options, ILogger logger, - ConductorClient taskService, + ITaskService taskService, IEnumerable workerMappings, + IExternalPayloadService externalPayloadService, IServiceScopeFactory lifetimeScope, IPollTimingStrategy pollTimingStrategy, IPollOrderStrategy pollOrderStrategy @@ -45,6 +50,7 @@ IPollOrderStrategy pollOrderStrategy _lifetimeScopeFactory = lifetimeScope; _pollTimingStrategy = pollTimingStrategy; _pollOrderStrategy = pollOrderStrategy; + _externalPayloadService = externalPayloadService; } public async Task StartAsync(CancellationToken cancellationToken) @@ -53,7 +59,7 @@ public async Task StartAsync(CancellationToken cancellationToken) while (!cancellationToken.IsCancellationRequested) { - var queuedTasks = (await _taskManager.all) + var queuedTasks = (await _taskManager.ListQueuesAsync(cancellationToken)) .Where(a => _registeredWorkers.Any(b => b.TaskName == a.Key) && a.Value > 0) .ToDictionary(a => a.Key, a => a.Value); @@ -95,27 +101,39 @@ private Type GetInputType(Type workerType) private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken cancellationToken) { var workerId = Guid.NewGuid().ToString(); - PollTaskResponse pollResponse; - if (string.IsNullOrEmpty(_configuration.Domain)) - pollResponse = await _taskManager.PollTasks(scheduledWorker.TaskName, workerId); - else - pollResponse = await _taskManager.PollTasks(scheduledWorker.TaskName, workerId, _configuration.Domain); + var pollResponse = await _taskManager.PollAsync(scheduledWorker.TaskName, workerId, _configuration.Domain, cancellationToken); if (pollResponse == null) return; - if (!string.IsNullOrEmpty(pollResponse.ExternalInputPayloadStorage)) + if (!string.IsNullOrEmpty(pollResponse.ExternalInputPayloadStoragePath)) { - _logger.LogDebug($"Fetching storage location {pollResponse.ExternalInputPayloadStorage}"); - var externalStorageLocation = await _taskManager.FetchExternalStorageLocation(pollResponse.ExternalInputPayloadStorage); - pollResponse.InputData = await _taskManager.FetchExternalStorage(externalStorageLocation.Path); + _logger.LogDebug($"Fetching storage location {pollResponse.ExternalInputPayloadStoragePath}"); + // TODO: Check what the operation and payload type are + var externalStorageLocation = await _taskManager.GetExternalStorageLocationAsync( + pollResponse.ExternalInputPayloadStoragePath, + "", + "", + cancellationToken + ); + + // TODO: iffy + var file = await _externalPayloadService.GetExternalStorageData(externalStorageLocation.Path, cancellationToken); + + using TextReader textReader = new StreamReader(file.Stream); + var json = textReader.ReadToEnd(); + + pollResponse.InputData = JsonConvert.DeserializeObject>( + json, + ConductorConstants.IoJsonSerializerSettings + ); } try { var inputType = GetInputType(scheduledWorker.TaskType); - var inputData = pollResponse.InputData.ToObject(inputType, ConductorConstants.IoJsonSerializer); + var inputData = SerializationHelper.DictonaryToObject(inputType, pollResponse.InputData, ConductorConstants.IoJsonSerializerSettings); using var scope = _lifetimeScopeFactory.CreateScope(); @@ -135,7 +153,16 @@ private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken var response = await mediator.Send(inputData, cancellationToken); - await _taskManager.UpdateTaskCompleted(response, pollResponse.TaskId, pollResponse.WorkflowInstanceId); + await _taskManager.UpdateAsync( + new TaskResult + { + TaskId = pollResponse.TaskId, + Status = TaskResultStatus.COMPLETED, + OutputData = SerializationHelper.ObjectToDictionary(response, ConductorConstants.IoJsonSerializerSettings), + WorkflowInstanceId = pollResponse.WorkflowInstanceId + }, + cancellationToken + ); } catch (Exception exception) { @@ -149,13 +176,20 @@ private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken var errorMessage = new ErrorOutput { ErrorMessage = exception.Message }; - await _taskManager.UpdateTaskFailed( - errorMessage, - pollResponse.TaskId, - pollResponse.WorkflowInstanceId, - exception.Message, - exception.StackTrace + await _taskManager.UpdateAsync( + new TaskResult + { + TaskId = pollResponse.TaskId, + Status = TaskResultStatus.FAILED, + ReasonForIncompletion = exception.Message, + OutputData = SerializationHelper.ObjectToDictionary(errorMessage, ConductorConstants.IoJsonSerializerSettings), + WorkflowInstanceId = pollResponse.WorkflowInstanceId, + }, + cancellationToken ); + + await _taskManager.LogAsync(pollResponse.TaskId, exception.Message, cancellationToken); + await _taskManager.LogAsync(pollResponse.TaskId, exception.StackTrace, cancellationToken); } } } diff --git a/src/ConductorSharp.Engine/Interface/ITaskBuilder.cs b/src/ConductorSharp.Engine/Interface/ITaskBuilder.cs index 7be52d1a..28a7dd31 100644 --- a/src/ConductorSharp.Engine/Interface/ITaskBuilder.cs +++ b/src/ConductorSharp.Engine/Interface/ITaskBuilder.cs @@ -1,10 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Engine.Interface { public interface ITaskBuilder { - //void Build(); - WorkflowDefinition.Task[] Build(); + WorkflowTask[] Build(); } } diff --git a/src/ConductorSharp.Engine/Polling/IPollOrderStrategy.cs b/src/ConductorSharp.Engine/Polling/IPollOrderStrategy.cs index 29c90a54..e3a4f488 100644 --- a/src/ConductorSharp.Engine/Polling/IPollOrderStrategy.cs +++ b/src/ConductorSharp.Engine/Polling/IPollOrderStrategy.cs @@ -7,6 +7,6 @@ namespace ConductorSharp.Engine.Polling { public interface IPollOrderStrategy { - List CalculateOrder(IDictionary taskQueue, List taskToWorkerList, int limit); + List CalculateOrder(IDictionary taskQueue, List taskToWorkerList, int limit); } } diff --git a/src/ConductorSharp.Engine/Polling/IPollTimingStrategy.cs b/src/ConductorSharp.Engine/Polling/IPollTimingStrategy.cs index 995783f1..cfc12906 100644 --- a/src/ConductorSharp.Engine/Polling/IPollTimingStrategy.cs +++ b/src/ConductorSharp.Engine/Polling/IPollTimingStrategy.cs @@ -7,6 +7,6 @@ namespace ConductorSharp.Engine.Polling { public interface IPollTimingStrategy { - int CalculateDelay(IDictionary taskQueue, List taskToWorkerList, int baseSleepInterval, int currentSleepInterval); + int CalculateDelay(IDictionary taskQueue, List taskToWorkerList, int baseSleepInterval, int currentSleepInterval); } } diff --git a/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs b/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs index b572129d..1f4033ad 100644 --- a/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs +++ b/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs @@ -14,7 +14,7 @@ public class InverseExponentialBackoff : IPollTimingStrategy private DateTimeOffset _lastRecoveryTime = DateTimeOffset.UtcNow; public int CalculateDelay( - IDictionary taskQueue, + IDictionary taskQueue, List taskToWorkerList, int baseSleepInterval, int currentSleepInterval diff --git a/src/ConductorSharp.Engine/Polling/RandomOrdering.cs b/src/ConductorSharp.Engine/Polling/RandomOrdering.cs index c311762f..ba5757b1 100644 --- a/src/ConductorSharp.Engine/Polling/RandomOrdering.cs +++ b/src/ConductorSharp.Engine/Polling/RandomOrdering.cs @@ -10,7 +10,7 @@ public class RandomOrdering : IPollOrderStrategy { private readonly Random _random = new Random(); - public List CalculateOrder(IDictionary taskQueue, List taskToWorkerList, int limit) + public List CalculateOrder(IDictionary taskQueue, List taskToWorkerList, int limit) { return taskToWorkerList.OrderBy(a => _random.Next()).Take(limit).ToList(); } From e8c8036cdf09722650e9e184d29b738580f6015c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 20:47:40 +0100 Subject: [PATCH 09/33] refactor partial #2 --- .../Controllers/WorkflowController.cs | 30 ++-- .../Extensions/ServiceCollectionExtensions.cs | 7 +- .../ConductorSharp.Definitions/Program.cs | 6 +- .../Workflows/HandleNotificationFailure.cs | 8 +- .../Workflows/SendCustomerNotification.cs | 4 +- examples/ConductorSharp.NoApi/Program.cs | 7 +- .../Builders/DecisionCases.cs | 1 - .../Builders/DecisionTaskBuilder.cs | 3 +- .../Builders/DynamicForkJoinTaskBuilder.cs | 20 +-- .../Builders/DynamicTaskBuilder.cs | 16 +- .../Builders/HumanTaskBuilder.cs | 16 +- .../Builders/JsonJqTransformTaskBuilder.cs | 15 +- .../Builders/LambdaTaskBuilder.cs | 15 +- .../Builders/PassThroughTaskBuilder.cs | 13 +- .../Builders/SimpleTaskBuilder.cs | 15 +- .../Builders/SubWorkflowTaskBuilder.cs | 19 +-- .../Builders/SwitchTaskBuilder.cs | 24 ++- .../Builders/TaskDefinitionBuilder.cs | 15 +- .../Builders/TerminateTaskBuilder.cs | 15 +- .../Builders/WaitTaskBuilder.cs | 15 +- .../Builders/Workflow.cs | 6 +- .../Builders/WorkflowBuildRegistry.cs | 3 +- .../Builders/WorkflowDefinitionBuilder.cs | 10 +- .../Extensions/ContainerBuilderExtensions.cs | 21 +-- .../WorkflowRegistrationExtensions.cs | 7 +- .../Interface/ITypedWorkflow.cs | 4 +- src/ConductorSharp.Engine/Model/Deployment.cs | 17 +- .../Model/TaskDefinitionOptions.cs | 7 +- .../Service/DeploymentService.cs | 12 +- .../Service/ModuleDeployment.cs | 8 +- .../Builders/CSharpLambdaTaskBuilder.cs | 15 +- .../Builders/TaskNameBuilder.cs | 5 +- .../ConductorSharp.Patterns.csproj | 1 + .../Tasks/ReadWorkflowTasks.cs | 14 +- .../Filters/ITaskFilter.cs | 4 +- .../Filters/IWorkflowFilter.cs | 4 +- .../Filters/NameTaskFilter.cs | 4 +- .../Filters/NameWorkflowFilter.cs | 4 +- .../Filters/OwnerAppTaskFilter.cs | 4 +- .../Filters/OwnerAppWorkflowFilter.cs | 4 +- .../Filters/OwnerEmailTaskFilter.cs | 4 +- .../Filters/OwnerEmailWorkflowFilter.cs | 4 +- src/ConductorSharp.Toolkit/Program.cs | 4 +- .../Service/IScaffoldingService.cs | 5 +- .../Service/ScaffoldingService.cs | 18 +- .../Integration/WorkflowBuilderTests.cs | 5 +- .../Samples/Tasks/CustomerGet.json | 8 +- .../Samples/Workflows/Arrays.json | 65 ++------ .../Workflows/CSharpLambdaWorkflow.json | 75 ++------- .../Samples/Workflows/CastWorkflow.json | 65 ++------ ...ionallySendCustomerNotificationOutput.json | 46 ++--- .../Samples/Workflows/DecisionInDecision.json | 52 ++---- .../Samples/Workflows/DecisionTask.json | 49 ++---- .../Samples/Workflows/DynamicTask.json | 41 +---- .../Workflows/EvaluateExpressionWorkflow.json | 157 ++---------------- .../Samples/Workflows/HumanTask.json | 42 +---- .../Samples/Workflows/IndexerWorkflow.json | 42 +---- .../Workflows/ListInitializationWorkflow.json | 42 +---- .../Samples/Workflows/NestedObjects.json | 42 +---- .../Workflows/OptionalTaskWorkflow.json | 45 +---- .../Workflows/PassthroughTaskWorkflow.cs | 12 +- .../Workflows/PassthroughTaskWorkflow.json | 41 +---- .../Samples/Workflows/PatternTasks.json | 65 ++------ .../Workflows/ScaffoldedWorkflows.json | 71 ++------ .../Workflows/SendCustomerNotification.json | 65 ++------ .../Samples/Workflows/StringAddition.json | 42 +---- .../Workflows/StringInterpolation.json | 40 +---- .../Samples/Workflows/SwitchTask.json | 50 ++---- .../Workflows/TaskPropertiesWorkflow.json | 65 ++------ .../Workflows/TerminateTaskWorkflow.json | 97 +++-------- .../Workflows/VersionAttributeWorkflow.json | 45 +---- .../Samples/Workflows/WaitTask.json | 42 +---- .../Unit/ContainerBuilderTests.cs | 19 ++- .../Unit/TaskDefinitionBuilderTests.cs | 9 +- .../Unit/WorkflowItemRegistryTests.cs | 21 +-- test/ConductorSharp.Engine.Tests/Usings.cs | 9 +- 76 files changed, 505 insertions(+), 1417 deletions(-) diff --git a/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs b/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs index bc5e7628..0c5cb24d 100644 --- a/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs +++ b/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs @@ -1,12 +1,7 @@ using ConductorSharp.ApiEnabled.Models; -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Client.Model.Request; -using ConductorSharp.Client.Model.Response; +using ConductorSharp.Client.Generated; using ConductorSharp.Client.Service; -using ConductorSharp.Engine.Interface; -using ConductorSharp.Engine.Service; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json.Linq; namespace ConductorSharp.ApiEnabled.Controllers; @@ -27,24 +22,27 @@ public WorkflowController(IMetadataService metadataService, IWorkflowService wor } [HttpGet("get-workflows")] - public async Task> GetRegisteredWorkflows() => await metadataService.GetAllWorkflowDefinitions(); + public async Task> GetRegisteredWorkflows() => await metadataService.GetAllWorkflowsAsync(); [HttpGet("get-task-logs")] - public async Task> GetTaskLogs(string taskId) => await taskService.GetLogsForTask(taskId); + public async Task> GetTaskLogs(string taskId) => await taskService.GetLogsAsync(taskId); [HttpGet("get-executions")] - public async Task> SearchWorkflows([FromQuery] WorkflowSearchRequest request) => - await workflowService.SearchWorkflows(request); + public async Task SearchWorkflows([FromQuery] int? start = null, [FromQuery] int? size = null) => + await workflowService.SearchV2Async(start, size); [HttpGet("get-status/{workflowId}")] - public async Task> GetStatus([FromRoute] string workflowId, [FromQuery] bool includeTasks) => - await workflowService.GetWorkflowStatus(workflowId, includeTasks); + public async Task GetStatus([FromRoute] string workflowId, [FromQuery] bool includeTasks) => + await workflowService.GetExecutionStatusAsync(workflowId, includeTasks); [HttpPost("send-notification")] public async Task> QueueWorkflow([FromBody] SendNotificationRequest request) => - await workflowService.QueueWorkflowStringResponse( - NotificationWorfklowName, - 1, - new JObject { new JProperty("task_to_execute", "CUSTOMER_get"), new JProperty("customer_id", request.CustomerId) } + await workflowService.StartAsync( + new StartWorkflowRequest + { + Name = NotificationWorfklowName, + Version = 1, + Input = new Dictionary { { "task_to_execute", "CUSTOMER_get" }, { "customer_id", request.CustomerId } } + } ); } diff --git a/examples/ConductorSharp.ApiEnabled/Extensions/ServiceCollectionExtensions.cs b/examples/ConductorSharp.ApiEnabled/Extensions/ServiceCollectionExtensions.cs index f5b3b8a7..26bd0e93 100644 --- a/examples/ConductorSharp.ApiEnabled/Extensions/ServiceCollectionExtensions.cs +++ b/examples/ConductorSharp.ApiEnabled/Extensions/ServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ using ConductorSharp.ApiEnabled.Services; using ConductorSharp.Engine.Extensions; using ConductorSharp.Engine.Health; -using MediatR; namespace ConductorSharp.ApiEnabled.Extensions; @@ -11,11 +10,7 @@ public static class ServiceCollectionExtensions public static IServiceCollection ConfigureApiEnabled(this IServiceCollection hostBuilder, ConfigurationManager configuration) { hostBuilder - .AddConductorSharp( - baseUrl: configuration.GetValue("Conductor:BaseUrl"), - apiPath: configuration.GetValue("Conductor:ApiUrl"), - preventErrorOnBadRequest: configuration.GetValue("Conductor:PreventErrorOnBadRequest") - ) + .AddConductorSharp(baseUrl: configuration.GetValue("Conductor:BaseUrl")) .AddExecutionManager( maxConcurrentWorkers: configuration.GetValue("Conductor:MaxConcurrentWorkers"), sleepInterval: configuration.GetValue("Conductor:SleepInterval"), diff --git a/examples/ConductorSharp.Definitions/Program.cs b/examples/ConductorSharp.Definitions/Program.cs index 3f38aac8..518c18b1 100644 --- a/examples/ConductorSharp.Definitions/Program.cs +++ b/examples/ConductorSharp.Definitions/Program.cs @@ -21,11 +21,7 @@ { services.AddAutoMapper(typeof(Program)); services - .AddConductorSharp( - baseUrl: configuration.GetValue("Conductor:BaseUrl"), - apiPath: configuration.GetValue("Conductor:ApiUrl"), - preventErrorOnBadRequest: configuration.GetValue("Conductor:PreventErrorOnBadRequest") - ) + .AddConductorSharp(baseUrl: configuration.GetValue("Conductor:BaseUrl")) .AddExecutionManager( maxConcurrentWorkers: configuration.GetValue("Conductor:MaxConcurrentWorkers"), sleepInterval: configuration.GetValue("Conductor:SleepInterval"), diff --git a/examples/ConductorSharp.Definitions/Workflows/HandleNotificationFailure.cs b/examples/ConductorSharp.Definitions/Workflows/HandleNotificationFailure.cs index da4dd25f..901dfe1d 100644 --- a/examples/ConductorSharp.Definitions/Workflows/HandleNotificationFailure.cs +++ b/examples/ConductorSharp.Definitions/Workflows/HandleNotificationFailure.cs @@ -1,13 +1,7 @@ -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Engine.Builders; +using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Util; using ConductorSharp.Patterns.Tasks; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ConductorSharp.Definitions.Workflows { diff --git a/examples/ConductorSharp.Definitions/Workflows/SendCustomerNotification.cs b/examples/ConductorSharp.Definitions/Workflows/SendCustomerNotification.cs index febef7d9..4b14ed66 100644 --- a/examples/ConductorSharp.Definitions/Workflows/SendCustomerNotification.cs +++ b/examples/ConductorSharp.Definitions/Workflows/SendCustomerNotification.cs @@ -1,9 +1,7 @@ -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Definitions.Generated; +using ConductorSharp.Definitions.Generated; using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; -using ConductorSharp.Engine.Util.Builders; using ConductorSharp.Patterns.Tasks; using MediatR; diff --git a/examples/ConductorSharp.NoApi/Program.cs b/examples/ConductorSharp.NoApi/Program.cs index 021f4a66..b0aea14d 100644 --- a/examples/ConductorSharp.NoApi/Program.cs +++ b/examples/ConductorSharp.NoApi/Program.cs @@ -1,7 +1,6 @@ using ConductorSharp.Engine.Extensions; using ConductorSharp.Engine.Health; using ConductorSharp.NoApi.Handlers; -using MediatR; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -21,11 +20,7 @@ { services.AddAutoMapper(typeof(Program)); services - .AddConductorSharp( - baseUrl: configuration.GetValue("Conductor:BaseUrl"), - apiPath: configuration.GetValue("Conductor:ApiUrl"), - preventErrorOnBadRequest: configuration.GetValue("Conductor:PreventErrorOnBadRequest") - ) + .AddConductorSharp(baseUrl: configuration.GetValue("Conductor:BaseUrl")) .AddExecutionManager( maxConcurrentWorkers: configuration.GetValue("Conductor:MaxConcurrentWorkers"), sleepInterval: configuration.GetValue("Conductor:SleepInterval"), diff --git a/src/ConductorSharp.Engine/Builders/DecisionCases.cs b/src/ConductorSharp.Engine/Builders/DecisionCases.cs index f801a8c8..0ac96f55 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionCases.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionCases.cs @@ -1,7 +1,6 @@ using ConductorSharp.Engine.Interface; using System; using System.Collections.Generic; -using System.Text; namespace ConductorSharp.Engine.Builders { diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index 52096a32..5496edf3 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -113,8 +113,7 @@ public void AddTaskBuilderToSequence(ITaskBuilder builder) // Handle default case if (_currentCaseName == null) { - if (_defaultCase == null) - _defaultCase = new(); + _defaultCase ??= []; _defaultCase.Add(builder); return; diff --git a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs index 37619f77..1fb01994 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs @@ -1,9 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -27,29 +27,27 @@ public class DynamicForkJoinTaskBuilder : BaseTaskBuilder>(), }, - new WorkflowDefinition.Task - { + new() { Name = joinTaskName, TaskReferenceName = joinTaskName, Type = "JOIN", } - }; + ]; } } } diff --git a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs index 1f6d94b5..a48a4354 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using System.Linq.Expressions; -using System.Text; namespace ConductorSharp.Engine.Builders { @@ -45,23 +44,22 @@ private class DynamicTaskParameters public string TaskToExecute { get; set; } } - public override WorkflowDefinition.Task[] Build() + public override WorkflowTask[] Build() { var parameters = _inputParameters.ToObject(); parameters.TaskInput.Add(new JProperty(DynamicTasknameParam, parameters.TaskToExecute)); - return new WorkflowDefinition.Task[] - { - new WorkflowDefinition.Task - { + return + [ + new() { Name = _taskRefferenceName, TaskReferenceName = _taskRefferenceName, Type = TaskType, - InputParameters = parameters.TaskInput, + InputParameters = parameters.TaskInput.ToObject>(), DynamicTaskNameParam = DynamicTasknameParam, } - }; + ]; } } } diff --git a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs index 460e055f..aaadcb58 100644 --- a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs @@ -1,9 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -27,16 +27,16 @@ internal class HumanTaskBuilder : BaseTaskBuilder public HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : base(taskExpression, inputExpression, buildConfiguration) { } - public override WorkflowDefinition.Task[] Build() => - new[] - { - new WorkflowDefinition.Task + public override WorkflowTask[] Build() => + + [ + new() { Name = $"HUMAN_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, Type = "HUMAN", - InputParameters = _inputParameters, + InputParameters = _inputParameters.ToObject>(), } - }; + ]; } } diff --git a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs index 7aa71ce4..2277749b 100644 --- a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs @@ -1,9 +1,10 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -38,16 +39,16 @@ public JsonJqTransformTaskBuilder(Expression taskExpression, Expression inputExp _inputParameters.Add("queryExpression", queryExpressionValue); } - public override WorkflowDefinition.Task[] Build() => - new WorkflowDefinition.Task[] - { - new WorkflowDefinition.Task + public override WorkflowTask[] Build() => + + [ + new() { Name = _taskName, TaskReferenceName = _taskRefferenceName, Type = "JSON_JQ_TRANSFORM", - InputParameters = _inputParameters + InputParameters = _inputParameters.ToObject>() } - }; + ]; } } diff --git a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs index 1bf93d1e..96bffd9f 100644 --- a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs @@ -1,10 +1,11 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -34,19 +35,19 @@ public class LambdaTaskBuilder : BaseTaskBuilder where A : IRequest< public LambdaTaskBuilder(string script, Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : base(taskExpression, inputExpression, buildConfiguration) => _script = script; - public override WorkflowDefinition.Task[] Build() + public override WorkflowTask[] Build() { _inputParameters.Add(new JProperty("scriptExpression", _script)); - return new WorkflowDefinition.Task[] - { - new WorkflowDefinition.Task + return + [ + new() { Name = $"LAMBDA_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, Type = "LAMBDA", - InputParameters = _inputParameters + InputParameters = _inputParameters.ToObject>() } - }; + ]; } } } diff --git a/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs index 82a23603..ca38a4de 100644 --- a/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs @@ -1,26 +1,23 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; -using System; -using System.Collections.Generic; -using System.Text; namespace ConductorSharp.Engine.Builders { public static class PassThroughTaskExtensions { - public static void AddTasks(this ITaskSequenceBuilder builder, params WorkflowDefinition.Task[] taskDefinitions) + public static void AddTasks(this ITaskSequenceBuilder builder, params WorkflowTask[] taskDefinitions) where TWorkflow : ITypedWorkflow => builder.AddTaskBuilderToSequence(new PassThroughTaskBuilder(taskDefinitions)); } public class PassThroughTaskBuilder : ITaskBuilder { - private readonly WorkflowDefinition.Task[] _tasks; + private readonly WorkflowTask[] _tasks; - public PassThroughTaskBuilder(WorkflowDefinition.Task[] tasks) + public PassThroughTaskBuilder(WorkflowTask[] tasks) { _tasks = tasks; } - public WorkflowDefinition.Task[] Build() => _tasks; + public WorkflowTask[] Build() => _tasks; } } diff --git a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs index cd8f4ce6..1f423907 100644 --- a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs @@ -1,10 +1,10 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; -using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -30,17 +30,16 @@ public class SimpleTaskBuilder : BaseTaskBuilder where A : IRequest< public SimpleTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : base(taskExpression, inputExpression, buildConfiguration) { } - public override WorkflowDefinition.Task[] Build() => - new WorkflowDefinition.Task[] - { - new WorkflowDefinition.Task + public override WorkflowTask[] Build() => + [ + new() { Name = _taskName, TaskReferenceName = _taskRefferenceName, Type = "SIMPLE", - InputParameters = _inputParameters, + InputParameters = _inputParameters.ToObject>(), Optional = _additionalParameters?.Optional == true, } - }; + ]; } } diff --git a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs index 51af984c..21209d15 100644 --- a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs @@ -1,11 +1,11 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; using MediatR; -using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; @@ -34,21 +34,20 @@ public class SubWorkflowTaskBuilder : BaseTaskBuilder _version = GetVersion(taskExpression); - public override WorkflowDefinition.Task[] Build() => - new WorkflowDefinition.Task[] - { - new WorkflowDefinition.Task + public override WorkflowTask[] Build() => + [ + new() { Name = _taskName, TaskReferenceName = _taskRefferenceName, Type = "SUB_WORKFLOW", - InputParameters = _inputParameters, - SubWorkflowParam = new WorkflowDefinition.SubWorkflowParam { Name = _taskName, Version = _version }, + InputParameters = _inputParameters.ToObject>(), + SubWorkflowParam = new SubWorkflowParams { Name = _taskName, Version = _version }, Optional = _additionalParameters?.Optional == true } - }; + ]; - private int GetVersion(Expression taskExpression) + private static int GetVersion(Expression taskExpression) { var type = ExpressionUtil.ParseToType(taskExpression); return type.GetCustomAttribute()?.Version ?? 1; diff --git a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs index af993cca..9ee097a4 100644 --- a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs @@ -1,10 +1,9 @@ using ConductorSharp.Client; -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; -using MediatR; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -83,17 +82,17 @@ public SwitchTaskBuilder AddCase(string caseName) return this; } - public override WorkflowDefinition.Task[] Build() + public override WorkflowTask[] Build() { var decisionTaskName = $"SWITCH_{_taskRefferenceName}"; - return new WorkflowDefinition.Task[] - { - new WorkflowDefinition.Task + return + [ + new() { Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, - InputParameters = _inputParameters, + InputParameters = _inputParameters.ToObject>(), Type = "SWITCH", Expression = "switch_case_value", EvaluatorType = "value-param", @@ -102,13 +101,11 @@ public override WorkflowDefinition.Task[] Build() _caseDictionary.Select( a => new JProperty(a.Key, JArray.FromObject(a.Value.SelectMany(b => b.Build()), ConductorConstants.DefinitionsSerializer)) ) - }, + }.ToObject>>(), DefaultCase = _defaultCase - ?.SelectMany(builder => builder.Build()) - .Select(task => JObject.FromObject(task, ConductorConstants.DefinitionsSerializer)) - .ToList() + ?.SelectMany(builder => builder.Build()).ToArray() } - }; + ]; } public void AddTaskBuilderToSequence(ITaskBuilder builder) @@ -116,8 +113,7 @@ public void AddTaskBuilderToSequence(ITaskBuilder builder) // Handle default case if (_currentCaseName == null) { - if (_defaultCase == null) - _defaultCase = new(); + _defaultCase ??= []; _defaultCase.Add(builder); return; diff --git a/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs b/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs index 70dc66a2..b17ba85c 100644 --- a/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs @@ -1,16 +1,11 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; -using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; -using ConductorSharp.Client; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; namespace ConductorSharp.Engine.Builders { @@ -25,9 +20,9 @@ public TaskDefinitionBuilder(BuildConfiguration buildConfiguration, ITaskNameBui _taskNameBuilder = taskNameBuilder; } - public TaskDefinition Build(Action updateOptions = null) => Build(typeof(T), updateOptions); + public TaskDef Build(Action updateOptions = null) => Build(typeof(T), updateOptions); - public TaskDefinition Build(Type taskType, Action updateOptions = null) + public TaskDef Build(Type taskType, Action updateOptions = null) { var options = new TaskDefinitionOptions(); @@ -45,7 +40,7 @@ public TaskDefinition Build(Type taskType, Action updateO var originalName = _taskNameBuilder.Build(taskType); - return new TaskDefinition + return new TaskDef { OwnerApp = BuildConfiguration.DefaultOwnerApp ?? options.OwnerApp, Name = originalName, @@ -65,7 +60,7 @@ public TaskDefinition Build(Type taskType, Action updateO PollTimeoutSeconds = options.PollTimeoutSeconds, CreatedBy = options.CreatedBy, UpdatedBy = options.UpdatedBy, - InputTemplate = options.InputTemplate, + InputTemplate = (options.InputTemplate ?? new Newtonsoft.Json.Linq.JObject()).ToObject>(), ExecutionNameSpace = options.ExecutionNameSpace, }; } diff --git a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs index e3711132..0b76d865 100644 --- a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs @@ -1,12 +1,10 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq.Expressions; -using System.Text; namespace ConductorSharp.Engine.Builders { @@ -29,16 +27,15 @@ internal class TerminateTaskBuilder : BaseTaskBuilder - new[] - { - new WorkflowDefinition.Task + public override WorkflowTask[] Build() => + [ + new() { Name = $"TERMINATE_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, Type = "TERMINATE", - InputParameters = _inputParameters, + InputParameters = _inputParameters.ToObject>(), } - }; + ]; } } diff --git a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs index af39ca86..816b5d62 100644 --- a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs @@ -1,9 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders @@ -27,16 +27,15 @@ internal class WaitTaskBuilder : BaseTaskBuilder public WaitTaskBuilder(Expression taskExpression, Expression memberExpression, BuildConfiguration buildConfiguration) : base(taskExpression, memberExpression, buildConfiguration) { } - public override WorkflowDefinition.Task[] Build() => - new[] - { - new WorkflowDefinition.Task + public override WorkflowTask[] Build() => + [ + new() { Name = $"WAIT_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, Type = "WAIT", - InputParameters = _inputParameters + InputParameters = _inputParameters.ToObject>() } - }; + ]; } } diff --git a/src/ConductorSharp.Engine/Builders/Workflow.cs b/src/ConductorSharp.Engine/Builders/Workflow.cs index 7b3e5b80..b54dd9a1 100644 --- a/src/ConductorSharp.Engine/Builders/Workflow.cs +++ b/src/ConductorSharp.Engine/Builders/Workflow.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using MediatR; @@ -19,7 +19,7 @@ public abstract class Workflow : SubWorkflowTaskMode where TOutput : WorkflowOutput { protected WorkflowDefinitionBuilder _builder; - private WorkflowDefinition _workflowDefinition; + private WorkflowDef _workflowDefinition; public TInput WorkflowInput { get; set; } public TOutput WorkflowOutput { get; set; } @@ -32,7 +32,7 @@ public Workflow(WorkflowDefinitionBuilder builder) _builder = builder; } - public virtual WorkflowDefinition GetDefinition() + public virtual WorkflowDef GetDefinition() { if (_workflowDefinition == null) { diff --git a/src/ConductorSharp.Engine/Builders/WorkflowBuildRegistry.cs b/src/ConductorSharp.Engine/Builders/WorkflowBuildRegistry.cs index 2f542cc9..2f372c76 100644 --- a/src/ConductorSharp.Engine/Builders/WorkflowBuildRegistry.cs +++ b/src/ConductorSharp.Engine/Builders/WorkflowBuildRegistry.cs @@ -2,13 +2,12 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace ConductorSharp.Engine.Builders { public class WorkflowBuildItemRegistry { - private readonly Dictionary> _items = new(); + private readonly Dictionary> _items = []; public void Register(string key, object value) where TWorkflow : ITypedWorkflow { diff --git a/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs b/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs index a5c50c3c..f3a352af 100644 --- a/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs @@ -1,11 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; -using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -58,7 +56,7 @@ WorkflowBuildItemRegistry workflowBuildRegistry private void GenerateWorkflowName() => BuildContext.WorkflowName = NamingUtil.DetermineRegistrationName(_workflowType); - public WorkflowDefinition Build() + public WorkflowDef Build() { if (!string.IsNullOrEmpty(BuildConfiguration?.DefaultOwnerApp)) { @@ -83,7 +81,7 @@ public WorkflowDefinition Build() BuildContext.Inputs.Add(propertyName); } - return new WorkflowDefinition + return new WorkflowDef { Name = BuildContext.WorkflowName, Tasks = _taskBuilders.SelectMany(a => a.Build()).ToList(), @@ -93,7 +91,7 @@ public WorkflowDefinition Build() : null, Description = BuildContext.WorkflowOptions.Description, InputParameters = BuildContext.Inputs.ToArray(), - OutputParameters = BuildContext.Outputs, + OutputParameters = (BuildContext.Outputs ?? new Newtonsoft.Json.Linq.JObject()).ToObject>(), OwnerApp = BuildContext.WorkflowOptions.OwnerApp, OwnerEmail = BuildContext.WorkflowOptions.OwnerEmail, Version = BuildContext.WorkflowOptions.Version diff --git a/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs b/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs index 9ce7a0c1..f688223d 100644 --- a/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs +++ b/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs @@ -1,34 +1,21 @@ -using ConductorSharp.Client; +using ConductorSharp.Client.Generated; using ConductorSharp.Client.Service; using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Util.Builders; using Microsoft.Extensions.DependencyInjection; +using System; using System.Net.Http; namespace ConductorSharp.Engine.Extensions { public static class ContainerBuilderExtensions { - public static IConductorSharpBuilder AddConductorSharp( - this IServiceCollection builder, - string baseUrl, - string apiPath, - bool preventErrorOnBadRequest = false - ) + public static IConductorSharpBuilder AddConductorSharp(this IServiceCollection builder, string baseUrl) { - builder.AddSingleton( - new RestConfig - { - ApiPath = apiPath, - BaseUrl = baseUrl, - IgnoreValidationErrors = preventErrorOnBadRequest - } - ); - builder.AddTransient(); - builder.AddSingleton(); + builder.AddSingleton((ctx) => new ConductorClient(new HttpClient { BaseAddress = new Uri(baseUrl) })); builder.AddTransient(); diff --git a/src/ConductorSharp.Engine/Extensions/WorkflowRegistrationExtensions.cs b/src/ConductorSharp.Engine/Extensions/WorkflowRegistrationExtensions.cs index 412321a3..a62de3a1 100644 --- a/src/ConductorSharp.Engine/Extensions/WorkflowRegistrationExtensions.cs +++ b/src/ConductorSharp.Engine/Extensions/WorkflowRegistrationExtensions.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Util.Builders; @@ -12,8 +12,7 @@ namespace ConductorSharp.Engine.Extensions { public static class WorkflowRegistrationExtensions { - public static void RegisterWorkflowDefinition(this IServiceCollection builder, WorkflowDefinition definition) => - builder.AddSingleton(definition); + public static void RegisterWorkflowDefinition(this IServiceCollection builder, WorkflowDef definition) => builder.AddSingleton(definition); public static void RegisterWorkflowDefinition(this IServiceCollection builder, string filename) { @@ -21,7 +20,7 @@ public static void RegisterWorkflowDefinition(this IServiceCollection builder, s throw new ArgumentException($"'{nameof(filename)}' cannot be null or empty.", nameof(filename)); var fileContents = File.ReadAllText(filename); - var definition = JsonConvert.DeserializeObject(fileContents); + var definition = JsonConvert.DeserializeObject(fileContents); builder.AddSingleton(definition); } diff --git a/src/ConductorSharp.Engine/Interface/ITypedWorkflow.cs b/src/ConductorSharp.Engine/Interface/ITypedWorkflow.cs index 31c13bfa..f5cad9cb 100644 --- a/src/ConductorSharp.Engine/Interface/ITypedWorkflow.cs +++ b/src/ConductorSharp.Engine/Interface/ITypedWorkflow.cs @@ -1,9 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Engine.Interface { public interface ITypedWorkflow : INameable { - WorkflowDefinition GetDefinition(); + WorkflowDef GetDefinition(); } } diff --git a/src/ConductorSharp.Engine/Model/Deployment.cs b/src/ConductorSharp.Engine/Model/Deployment.cs index 754c6a8c..85683621 100644 --- a/src/ConductorSharp.Engine/Model/Deployment.cs +++ b/src/ConductorSharp.Engine/Model/Deployment.cs @@ -1,26 +1,27 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using System; using System.Collections.Generic; using System.Linq; +using EventHandler = ConductorSharp.Client.Generated.EventHandler; namespace ConductorSharp.Engine.Model { public class Deployment { - public List TaskDefinitions { get; set; } = new List(); + public List TaskDefinitions { get; set; } = new List(); - public List WorkflowDefinitions { get; set; } = new List(); + public List WorkflowDefinitions { get; set; } = new List(); - public List EventHandlerDefinitions { get; set; } = new List(); + public List EventHandlerDefinitions { get; set; } = new List(); - public TaskDefinition FindTaskByName(string name) => TaskDefinitions.Where(a => a.Name == name).SingleOrDefault(); + public TaskDef FindTaskByName(string name) => TaskDefinitions.Where(a => a.Name == name).SingleOrDefault(); - public TaskDefinition GetTaskByName(string name) => + public TaskDef GetTaskByName(string name) => FindTaskByName(name) ?? throw new Exception($"Task with name {name} not registered in current deployment"); - public WorkflowDefinition FindWorkflowByName(string name) => WorkflowDefinitions.Where(a => name.Equals(a.Name)).SingleOrDefault(); + public WorkflowDef FindWorkflowByName(string name) => WorkflowDefinitions.Where(a => name.Equals(a.Name)).SingleOrDefault(); - public WorkflowDefinition GetWorkflowByName(string name) => + public WorkflowDef GetWorkflowByName(string name) => FindWorkflowByName(name) ?? throw new Exception($"Workflow with name {name} not registered in current deployment"); } } diff --git a/src/ConductorSharp.Engine/Model/TaskDefinitionOptions.cs b/src/ConductorSharp.Engine/Model/TaskDefinitionOptions.cs index 07e8d4d2..c791b184 100644 --- a/src/ConductorSharp.Engine/Model/TaskDefinitionOptions.cs +++ b/src/ConductorSharp.Engine/Model/TaskDefinitionOptions.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using ConductorSharp.Client.Generated; +using Newtonsoft.Json.Linq; namespace ConductorSharp.Engine.Model { @@ -10,8 +11,8 @@ public class TaskDefinitionOptions public string Description { get; set; } public int RetryCount { get; set; } public int TimeoutSeconds { get; set; } = 60; - public string TimeoutPolicy { get; set; } = "TIME_OUT_WF"; - public string RetryLogic { get; set; } = "FIXED"; + public TaskDefTimeoutPolicy TimeoutPolicy { get; set; } = TaskDefTimeoutPolicy.TIME_OUT_WF; + public TaskDefRetryLogic RetryLogic { get; set; } = TaskDefRetryLogic.FIXED; public int RetryDelaySeconds { get; set; } public int ResponseTimeoutSeconds { get; set; } = 60; public int ConcurrentExecLimit { get; set; } diff --git a/src/ConductorSharp.Engine/Service/DeploymentService.cs b/src/ConductorSharp.Engine/Service/DeploymentService.cs index 15601655..3fb99972 100644 --- a/src/ConductorSharp.Engine/Service/DeploymentService.cs +++ b/src/ConductorSharp.Engine/Service/DeploymentService.cs @@ -24,12 +24,12 @@ public async Task Deploy(Deployment deployment) _logger.LogInformation("Deploying conductor definitions"); if (deployment.TaskDefinitions.Count > 0) - await _metadataService.CreateTaskDefinitions(deployment.TaskDefinitions); + await _metadataService.RegisterTasksAsync(deployment.TaskDefinitions); _logger.LogDebug("Registered {registeredTasksCount} tasks", deployment.TaskDefinitions.Count); if (deployment.WorkflowDefinitions.Count > 0) - await _metadataService.CreateWorkflowDefinitions(deployment.WorkflowDefinitions); + await _metadataService.UpdateWorkflowsAsync(deployment.WorkflowDefinitions); _logger.LogDebug("Registered {registeredWorkflowsCount} workflows ", deployment.WorkflowDefinitions.Count); @@ -46,18 +46,18 @@ public async Task Remove(Deployment deployment) { foreach (var definition in deployment.TaskDefinitions) { - var oldDefinition = await _metadataService.GetTaskDefinition(definition.Name); + var oldDefinition = await _metadataService.GetTaskDefAsync(definition.Name); if (oldDefinition?.Name != null) - await _metadataService.DeleteTaskDefinition(definition.Name); + await _metadataService.DeleteTaskDefAsync(definition.Name); } foreach (var definition in deployment.WorkflowDefinitions) { - var oldDefinition = await _metadataService.GetWorkflowDefinition(definition.Name, definition.Version); + var oldDefinition = await _metadataService.GetWorkflowAsync(definition.Name, definition.Version); if (oldDefinition?.Name != null) - await _metadataService.DeleteWorkflowDefinition(definition.Name, definition.Version); + await _metadataService.DeleteWorkflowAsync(definition.Name, definition.Version); } } } diff --git a/src/ConductorSharp.Engine/Service/ModuleDeployment.cs b/src/ConductorSharp.Engine/Service/ModuleDeployment.cs index 7c709522..80bb3f52 100644 --- a/src/ConductorSharp.Engine/Service/ModuleDeployment.cs +++ b/src/ConductorSharp.Engine/Service/ModuleDeployment.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Model; using System.Collections.Generic; @@ -7,9 +7,9 @@ namespace ConductorSharp.Engine.Service public class ModuleDeployment : Deployment { public ModuleDeployment( - IEnumerable taskDefinitions, - IEnumerable workflowDefinitions, - IEnumerable eventHandlerDefinitions + IEnumerable taskDefinitions, + IEnumerable workflowDefinitions, + IEnumerable eventHandlerDefinitions ) { TaskDefinitions.AddRange(taskDefinitions); diff --git a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs index db7fcd30..6adb32ce 100644 --- a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Util; @@ -9,6 +9,7 @@ using MediatR; using Newtonsoft.Json.Linq; using System; +using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; @@ -70,11 +71,11 @@ string workflowName _lambdaTaskNamePrefix = lambdaTaskNamePrefix; } - public override WorkflowDefinition.Task[] Build() + public override WorkflowTask[] Build() { - return new[] - { - new WorkflowDefinition.Task + return + [ + new() { Name = $"{_lambdaTaskNamePrefix}{CSharpLambdaTask.TaskName}", TaskReferenceName = _taskRefferenceName, @@ -82,10 +83,10 @@ public override WorkflowDefinition.Task[] Build() { new JProperty(CSharpLambdaTaskInput.LambdaIdenfitierParamName, LambdaIdentifer), new JProperty(CSharpLambdaTaskInput.TaskInputParamName, _inputParameters) - }, + }.ToObject>(), Optional = _additionalParameters.Optional } - }; + ]; } } } diff --git a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs index 34788803..ae84b3c1 100644 --- a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs @@ -1,12 +1,9 @@ -using ConductorSharp.Client.Model.Common; -using ConductorSharp.Engine.Builders; -using ConductorSharp.Engine.Interface; +using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Util; using ConductorSharp.Patterns.Tasks; using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace ConductorSharp.Patterns.Builders { diff --git a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj index 0492c51d..00bbea8b 100644 --- a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj +++ b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj @@ -2,6 +2,7 @@ net6.0 + preview disable False Codaxy diff --git a/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs b/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs index 8164619e..f7192d41 100644 --- a/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs +++ b/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs @@ -32,7 +32,7 @@ public class ReadWorkflowTasksRequest : IRequest public class ReadWorkflowTasksResponse { - public Dictionary Tasks { get; set; } + public Dictionary Tasks { get; set; } public WorkflowDetails Workflow { get; set; } } @@ -64,24 +64,20 @@ public async override Task Handle(ReadWorkflowTasksRe var tasknames = input.TaskNames.Split(",").Where(a => !string.IsNullOrEmpty(a)).ToList(); - var starterWorkflow = await _workflowService.GetWorkflowStatus(input.WorkflowId); + var starterWorkflow = await _workflowService.GetExecutionStatusAsync(input.WorkflowId, cancellationToken: cancellationToken); if (starterWorkflow == null) throw new Exception($"Could not find starter workflow by id {input.WorkflowId}"); var output = new ReadWorkflowTasksResponse { - Workflow = new WorkflowDetails { InputData = starterWorkflow.Input }, - Tasks = new Dictionary() + Workflow = new WorkflowDetails { InputData = JObject.FromObject(starterWorkflow.Input) }, + Tasks = new Dictionary() }; foreach (var task in tasknames) { - output.Tasks.Add( - task, - starterWorkflow.Tasks.FirstOrDefault(a => a.ReferenceTaskName == task) - ?? new ConductorSharp.Client.Model.Response.TaskStatusResponse() - ); + output.Tasks.Add(task, starterWorkflow.Tasks.FirstOrDefault(a => a.ReferenceTaskName == task) ?? new Client.Generated.Task()); } return output; diff --git a/src/ConductorSharp.Toolkit/Filters/ITaskFilter.cs b/src/ConductorSharp.Toolkit/Filters/ITaskFilter.cs index 6b562495..8ef040a4 100644 --- a/src/ConductorSharp.Toolkit/Filters/ITaskFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/ITaskFilter.cs @@ -1,9 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Toolkit.Filters { public interface ITaskFilter { - bool Test(TaskDefinition taskDefinition); + bool Test(TaskDef taskDefinition); } } diff --git a/src/ConductorSharp.Toolkit/Filters/IWorkflowFilter.cs b/src/ConductorSharp.Toolkit/Filters/IWorkflowFilter.cs index 6afdd7da..5986ed8f 100644 --- a/src/ConductorSharp.Toolkit/Filters/IWorkflowFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/IWorkflowFilter.cs @@ -1,9 +1,9 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Toolkit.Filters { public interface IWorkflowFilter { - bool Test(WorkflowDefinition workflowDefinition); + bool Test(WorkflowDef workflowDefinition); } } diff --git a/src/ConductorSharp.Toolkit/Filters/NameTaskFilter.cs b/src/ConductorSharp.Toolkit/Filters/NameTaskFilter.cs index a04bd415..36659165 100644 --- a/src/ConductorSharp.Toolkit/Filters/NameTaskFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/NameTaskFilter.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Toolkit.Util; using System.Text.RegularExpressions; @@ -10,6 +10,6 @@ public class NameTaskFilter : ITaskFilter public NameTaskFilter(IEnumerable names) => _regexes = names.Select(name => RegexUtil.CreateNameRegex(name)).ToArray(); - public bool Test(TaskDefinition taskDefinition) => _regexes.Any(regex => regex.IsMatch(taskDefinition.Name)); + public bool Test(TaskDef taskDefinition) => _regexes.Any(regex => regex.IsMatch(taskDefinition.Name)); } } diff --git a/src/ConductorSharp.Toolkit/Filters/NameWorkflowFilter.cs b/src/ConductorSharp.Toolkit/Filters/NameWorkflowFilter.cs index fe9189e6..8aa59b6e 100644 --- a/src/ConductorSharp.Toolkit/Filters/NameWorkflowFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/NameWorkflowFilter.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Toolkit.Util; using System.Text.RegularExpressions; @@ -10,6 +10,6 @@ public class NameWorkflowFilter : IWorkflowFilter public NameWorkflowFilter(IEnumerable names) => _regexes = names.Select(name => RegexUtil.CreateNameRegex(name)).ToArray(); - public bool Test(WorkflowDefinition workflowDefinition) => _regexes.Any(regex => regex.IsMatch(workflowDefinition.Name)); + public bool Test(WorkflowDef workflowDefinition) => _regexes.Any(regex => regex.IsMatch(workflowDefinition.Name)); } } diff --git a/src/ConductorSharp.Toolkit/Filters/OwnerAppTaskFilter.cs b/src/ConductorSharp.Toolkit/Filters/OwnerAppTaskFilter.cs index 7096ef30..d056ffa8 100644 --- a/src/ConductorSharp.Toolkit/Filters/OwnerAppTaskFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/OwnerAppTaskFilter.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Toolkit.Filters { @@ -8,6 +8,6 @@ public class OwnerAppTaskFilter : ITaskFilter public OwnerAppTaskFilter(IEnumerable ownerApps) => _ownerApps = ownerApps.ToArray(); - public bool Test(TaskDefinition taskDefinition) => taskDefinition.OwnerApp != null && _ownerApps.Any(app => app == taskDefinition.OwnerApp); + public bool Test(TaskDef taskDefinition) => taskDefinition.OwnerApp != null && _ownerApps.Any(app => app == taskDefinition.OwnerApp); } } diff --git a/src/ConductorSharp.Toolkit/Filters/OwnerAppWorkflowFilter.cs b/src/ConductorSharp.Toolkit/Filters/OwnerAppWorkflowFilter.cs index 84f9adad..c64a635d 100644 --- a/src/ConductorSharp.Toolkit/Filters/OwnerAppWorkflowFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/OwnerAppWorkflowFilter.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Toolkit.Filters { @@ -8,7 +8,7 @@ public class OwnerAppWorkflowFilter : IWorkflowFilter public OwnerAppWorkflowFilter(IEnumerable ownerApps) => _ownerApps = ownerApps.ToArray(); - public bool Test(WorkflowDefinition workflowDefinition) => + public bool Test(WorkflowDef workflowDefinition) => workflowDefinition.OwnerApp != null && _ownerApps.Any(app => app == workflowDefinition.OwnerApp); } } diff --git a/src/ConductorSharp.Toolkit/Filters/OwnerEmailTaskFilter.cs b/src/ConductorSharp.Toolkit/Filters/OwnerEmailTaskFilter.cs index f43f99be..1ba0fb6c 100644 --- a/src/ConductorSharp.Toolkit/Filters/OwnerEmailTaskFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/OwnerEmailTaskFilter.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Toolkit.Filters { @@ -8,7 +8,7 @@ public class OwnerEmailTaskFilter : ITaskFilter public OwnerEmailTaskFilter(IEnumerable ownerEmails) => _ownerEmails = ownerEmails.ToArray(); - public bool Test(TaskDefinition taskDefinition) => + public bool Test(TaskDef taskDefinition) => taskDefinition.OwnerEmail != null && _ownerEmails.Any(email => email == taskDefinition.OwnerEmail); } } diff --git a/src/ConductorSharp.Toolkit/Filters/OwnerEmailWorkflowFilter.cs b/src/ConductorSharp.Toolkit/Filters/OwnerEmailWorkflowFilter.cs index 35c4d153..e00e96d6 100644 --- a/src/ConductorSharp.Toolkit/Filters/OwnerEmailWorkflowFilter.cs +++ b/src/ConductorSharp.Toolkit/Filters/OwnerEmailWorkflowFilter.cs @@ -1,4 +1,4 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Toolkit.Filters { @@ -8,7 +8,7 @@ public class OwnerEmailWorkflowFilter : IWorkflowFilter public OwnerEmailWorkflowFilter(IEnumerable ownerEmails) => _ownerEmails = ownerEmails.ToArray(); - public bool Test(WorkflowDefinition workflowDefinition) => + public bool Test(WorkflowDef workflowDefinition) => workflowDefinition.OwnerEmail != null && _ownerEmails.Any(email => email == workflowDefinition.OwnerEmail); } } diff --git a/src/ConductorSharp.Toolkit/Program.cs b/src/ConductorSharp.Toolkit/Program.cs index 6b4c4d05..4a4753fd 100644 --- a/src/ConductorSharp.Toolkit/Program.cs +++ b/src/ConductorSharp.Toolkit/Program.cs @@ -121,9 +121,7 @@ private static IServiceProvider BuildContainer(Configuration config, ToolkitOpti scaffoldingConfig.DryRun = options.DryRun; }); - builder.AddConductorSharp(config.BaseUrl, config.ApiPath); - builder.AddTransient(); - builder.AddTransient(); + builder.AddConductorSharp(config.BaseUrl); builder.AddTransient(); builder.AddTransient(); builder.AddTransient(); diff --git a/src/ConductorSharp.Toolkit/Service/IScaffoldingService.cs b/src/ConductorSharp.Toolkit/Service/IScaffoldingService.cs index 5dca7b3a..b85bedcb 100644 --- a/src/ConductorSharp.Toolkit/Service/IScaffoldingService.cs +++ b/src/ConductorSharp.Toolkit/Service/IScaffoldingService.cs @@ -1,4 +1,7 @@ -namespace ConductorSharp.Toolkit.Service +using ConductorSharp.Client.Generated; +using Task = System.Threading.Tasks.Task; + +namespace ConductorSharp.Toolkit.Service { public interface IScaffoldingService { diff --git a/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs b/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs index b68a6638..a700bfb8 100644 --- a/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs +++ b/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs @@ -1,13 +1,11 @@ -using ConductorSharp.Client.Model.Common; +using ConductorSharp.Client.Generated; using ConductorSharp.Client.Service; using ConductorSharp.Engine.Util; using ConductorSharp.Toolkit.Filters; using ConductorSharp.Toolkit.Util; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Newtonsoft.Json.Linq; -using System.Text; -using System.Text.RegularExpressions; +using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Toolkit.Service { @@ -32,7 +30,7 @@ public async Task Scaffold() if (!_config.IgnoreWorkflows) { - var workflowDefinitions = await _metadataService.GetAllWorkflowDefinitions(); + var workflowDefinitions = await _metadataService.GetAllWorkflowsAsync(); workflowDefinitions = Filter(workflowDefinitions, workflowFilters).ToArray(); var workflowDirectory = Path.Combine(_config.Destination, "Workflows"); Directory.CreateDirectory(workflowDirectory); @@ -54,7 +52,7 @@ public async Task Scaffold() if (!_config.IgnoreTasks) { - var taskDefinitions = await _metadataService.GetAllTaskDefinitions(); + var taskDefinitions = await _metadataService.GetTaskDefsAsync(); taskDefinitions = Filter(taskDefinitions, taskFilters).ToArray(); var tasksDirectory = Path.Combine(_config.Destination, "Tasks"); Directory.CreateDirectory(tasksDirectory); @@ -75,7 +73,7 @@ public async Task Scaffold() } } - public (string contents, string modelClassName) CreateWorkflowClass(WorkflowDefinition workflowDefinition) + public (string contents, string modelClassName) CreateWorkflowClass(WorkflowDef workflowDefinition) { string name = SnakeCaseUtil.ToPascalCase($"{workflowDefinition.Name}_V{workflowDefinition.Version}").Trim(); string note = null; @@ -115,7 +113,7 @@ private void DefinePropertyParams(TaskModelGenerator.PropertyData propData, stri propData.Type = type; } - public (string contents, string modelClassName) CreateTaskClass(TaskDefinition taskDefinition) + public (string contents, string modelClassName) CreateTaskClass(TaskDef taskDefinition) { string name = SnakeCaseUtil.ToPascalCase(taskDefinition.Name).Trim(); string note = null; @@ -179,10 +177,10 @@ private IWorkflowFilter[] CreateWorkflowFilters() } // If filter list is empty then all workflows/tasks are returned - private IEnumerable Filter(IEnumerable workflows, IWorkflowFilter[] filters) => + private IEnumerable Filter(IEnumerable workflows, IWorkflowFilter[] filters) => workflows.Where(wf => filters.All(filter => filter.Test(wf))); - private IEnumerable Filter(IEnumerable tasks, ITaskFilter[] filters) => + private IEnumerable Filter(IEnumerable tasks, ITaskFilter[] filters) => tasks.Where(task => filters.All(filter => filter.Test(task))); } } diff --git a/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs b/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs index 644cc7a2..0cc268ef 100644 --- a/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs +++ b/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs @@ -1,3 +1,4 @@ +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Exceptions; using ConductorSharp.Engine.Extensions; using ConductorSharp.Engine.Tests.Samples.Workflows; @@ -246,7 +247,7 @@ public void BuilderReturnsCorrectDefinitionNonEvaluatableWorkflow() private string GetDefinitionFromWorkflow() where TWorkflow : IConfigurableWorkflow { var workflow = RegisterWorkflow() - .GetRequiredService>() + .GetRequiredService>() .First(a => a.Name == NamingUtil.NameOf()); return SerializationUtil.SerializeObject(workflow); @@ -257,7 +258,7 @@ private IServiceProvider RegisterWorkflow() where TWorkflow : IConfig var containerBuilder = new ServiceCollection(); containerBuilder - .AddConductorSharp("example.com", "api", false) + .AddConductorSharp("example.com/api") .AddExecutionManager(10, 100, 100, null, typeof(WorkflowBuilderTests).Assembly) .AddPipelines(pipelines => { diff --git a/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json b/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json index 6f3fb728..598949b6 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json @@ -5,7 +5,6 @@ "createdBy": "UNDEFINED", "updatedBy": "UNDEFINED", "name": "CUSTOMER_get", - "description": null, "retryCount": 0, "timeoutSeconds": 60, "inputKeys": [ @@ -20,11 +19,10 @@ "retryDelaySeconds": 0, "responseTimeoutSeconds": 60, "concurrentExecLimit": 0, - "inputTemplate": null, + "inputTemplate": {}, "rateLimitPerFrequency": 0, "rateLimitFrequencyInSeconds": 1, - "isolationGroupId": null, - "executionNameSpace": null, "ownerEmail": "undefined@undefined.local", - "pollTimeoutSeconds": 0 + "pollTimeoutSeconds": 0, + "backoffScaleFactor": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json index 8e792112..f8d01d60 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json @@ -1,18 +1,12 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "arrays", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "array_task", "taskReferenceName": "array_task1", - "description": null, "inputParameters": { "integers": [ 1, @@ -45,76 +39,37 @@ ] }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "array_task", "taskReferenceName": "array_task2", - "description": null, "inputParameters": { "integers": [], "models": [], "objects": [] }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "test_value" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json index d9d957dc..56df2b14 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json @@ -1,64 +1,35 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "c_sharp_lambda_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "TEST.CSHRP_inln_lmbd", "taskReferenceName": "first_lambda_task", - "description": null, "inputParameters": { "lambda_identifier": "c_sharp_lambda_workflow.first_lambda_task", "task_input": { "lambda_input": "${workflow.input.input}" } }, - "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "DECISION_decision_task", "taskReferenceName": "decision_task", - "description": null, "inputParameters": { "case_value_param": "${workflow.input.operation}" }, "type": "DECISION", - "dynamicTaskNameParam": null, "caseValueParam": "case_value_param", - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, + "caseExpression": "case_value_param", + "scriptExpression": "case_value_param", "decisionCases": { "upper": [ { @@ -70,11 +41,12 @@ "lambda_input": "${workflow.input.input}" } }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "lower": [ @@ -87,43 +59,32 @@ "lambda_input": "${workflow.input.input}" } }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "operation", "input" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, "ownerEmail": "test@test.com", - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json index 6b8a78c7..e4a8b83a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json @@ -1,89 +1,44 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "cast_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "get_customer", - "description": null, "inputParameters": { "customer_id": 1 }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "EMAIL_prepare", "taskReferenceName": "prepare_email", - "description": null, "inputParameters": { "customer_name": "${get_customer.output.name.first_name}", "address": "${get_customer.output.address}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json index 86e601b0..ffe77206 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json @@ -1,28 +1,19 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "NOTIFICATION_conditionally_send_to_customer", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "DECISION_send_notification_decision", "taskReferenceName": "send_notification_decision", - "description": null, "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, "type": "DECISION", - "dynamicTaskNameParam": null, "caseValueParam": "case_value_param", - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, + "caseExpression": "case_value_param", + "scriptExpression": "case_value_param", "decisionCases": { "YES": [ { @@ -39,39 +30,28 @@ }, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "should_send_notification", "customer_id" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json index c2610361..7790cdbc 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json @@ -1,28 +1,19 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "TEST_decision_in_decision", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "DECISION_send_notification_decision", "taskReferenceName": "send_notification_decision", - "description": null, "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, "type": "DECISION", - "dynamicTaskNameParam": null, "caseValueParam": "case_value_param", - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, + "caseExpression": "case_value_param", + "scriptExpression": "case_value_param", "decisionCases": { "YES": [ { @@ -33,6 +24,8 @@ }, "type": "DECISION", "caseValueParam": "case_value_param", + "caseExpression": "case_value_param", + "scriptExpression": "case_value_param", "decisionCases": { "YES": [ { @@ -49,46 +42,37 @@ }, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "should_send_notification", "customer_id" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json index ae99aaaa..9d9bc9b6 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json @@ -1,28 +1,19 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "decision_task", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "DECISION_decision", "taskReferenceName": "decision", - "description": null, "inputParameters": { "case_value_param": "test" }, "type": "DECISION", - "dynamicTaskNameParam": null, "caseValueParam": "case_value_param", - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, + "caseExpression": "case_value_param", + "scriptExpression": "case_value_param", "decisionCases": { "test": [ { @@ -35,13 +26,12 @@ "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, "defaultCase": [ { "name": "TERMINATE_terminate", @@ -53,31 +43,24 @@ "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json index a906a257..70e5098b 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json @@ -1,18 +1,12 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "TEST_dynamic_task", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "dynamic_handler", "taskReferenceName": "dynamic_handler", - "description": null, "inputParameters": { "count": "${workflow.input.count}", "should_use_next": "${workflow.input.should_use_next}", @@ -20,28 +14,12 @@ }, "type": "DYNAMIC", "dynamicTaskNameParam": "task_to_execute", - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ @@ -50,13 +28,10 @@ "count", "should_use_next" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json index b5dead3c..6c9677ff 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json @@ -1,223 +1,102 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "evaluate_expression_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "first_customer_get", - "description": null, "inputParameters": { "customer_id": 1 }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "second_customer_get", - "description": null, "inputParameters": { "customer_id": 1 }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "third_customer_get", - "description": null, "inputParameters": { "customer_id": 1 }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "fourth_customer_get", - "description": null, "inputParameters": { "customer_id": 1 }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "fifth_customer_get", - "description": null, "inputParameters": { "customer_id": 34 }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "EMAIL_prepare", "taskReferenceName": "prepare_email", - "description": null, "inputParameters": { "name": "1:1:1:1:1", "address": "${workflow.input.username}@test.com" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "username" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json index 8620da52..15f27de6 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json @@ -1,53 +1,27 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "human_task_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "HUMAN_human_task", "taskReferenceName": "human_task", - "description": null, "inputParameters": {}, "type": "HUMAN", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json index a6f13f68..f32c008e 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json @@ -1,59 +1,33 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "indexer_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "EMAIL_prepare", "taskReferenceName": "prepare_email", - "description": null, "inputParameters": { "customer_name": "${workflow.input.dictionary['test'].customer_name}", "address": "${workflow.input.double_dictionary['test']['address']}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "dictionary", "double_dictionary" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json index 67536603..4c14c896 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json @@ -1,18 +1,12 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "list_initialization_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "list_task", "taskReferenceName": "list_task", - "description": null, "inputParameters": { "list": [ 1, @@ -26,39 +20,19 @@ ] }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json index f941a482..063979bb 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json @@ -1,18 +1,12 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "nested_objects", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "TEST_task_nested_objects", "taskReferenceName": "task_nested_objects", - "description": null, "inputParameters": { "nested_objects": { "integer": 1, @@ -27,39 +21,19 @@ } }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json index 9d906edc..054ec2da 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json @@ -1,62 +1,35 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "TEST_optional_task_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "NOTIFICATION_send_to_customer", "taskReferenceName": "send_notification_subworkflow", - "description": null, "inputParameters": { "id": "${workflow.input.customer_id}" }, "type": "SUB_WORKFLOW", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", - "version": 3, - "taskToDomain": null, - "workflowDefinition": null + "version": 3 }, - "joinOn": null, - "sink": null, "optional": true, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "customer_id" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs index 6f68c331..6eab3050 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs @@ -1,9 +1,5 @@ -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using ConductorSharp.Client.Generated; +using Newtonsoft.Json.Linq; namespace ConductorSharp.Engine.Tests.Samples.Workflows { @@ -20,7 +16,7 @@ WorkflowDefinitionBuilder>() } ); diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json index b9768e32..111fda1e 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json @@ -1,15 +1,10 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "passthrough_task_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "LAMBDA_return_data", "taskReferenceName": "return_data", "description": "Lambda task to return data", @@ -27,39 +22,19 @@ "scriptExpression": "return { hostname : $.hostname,additional_template : $.additional_template,base_template : $.base_template,licence : $.licence,oam_domain : $.oam_domain,platform_codename : $.platform_codename,platform_name : $.platform_name,software_version : $.software_version,upstream_switch : $.upstream_switch,upstream_switch_interface_name : $.upstream_switch_interface_name,}" }, "type": "LAMBDA", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json index 3fd224a9..c1344166 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json @@ -1,92 +1,47 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "pattern_tasks", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "CSH_PATTERNS_read_tasks", "taskReferenceName": "read_workflow_tasks", - "description": null, "inputParameters": { "task_names": "task1,task2", "workflow_id": "${workflow.input.workflow_id}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "CSH_PATTERNS_wait_seconds", "taskReferenceName": "wait_seconds", - "description": null, "inputParameters": { "seconds": "${workflow.input.seconds}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "seconds", "workflow_id" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json index 8273b107..fd45dea8 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json @@ -1,100 +1,53 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "SCAFFOLDED_workflows", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "SCAFFOLDED_one", "taskReferenceName": "scaff_one", - "description": null, "inputParameters": { "input_one": "${workflow.input.customer_id}" }, "type": "SUB_WORKFLOW", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, "subWorkflowParam": { "name": "SCAFFOLDED_one", - "version": 1, - "taskToDomain": null, - "workflowDefinition": null + "version": 1 }, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "SCAFFOLDED_two", "taskReferenceName": "scaff_two", - "description": null, "inputParameters": { "name": "${scaff_one.output.output_one}" }, "type": "SUB_WORKFLOW", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, "subWorkflowParam": { "name": "SCAFFOLDED_two", - "version": 1, - "taskToDomain": null, - "workflowDefinition": null + "version": 1 }, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "customer_id" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json index d2942ec2..66c7e21a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json @@ -1,91 +1,46 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "NOTIFICATION_send_to_customer", - "description": null, "version": 3, "tasks": [ { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "get_customer", - "description": null, "inputParameters": { "id": "${workflow.input.id}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "EMAIL_prepare", "taskReferenceName": "prepare_email", - "description": null, "inputParameters": { "address": "${get_customer.output.address}", "name": "${get_customer.output.name}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "id" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json index 1b3c0e3a..3cd4ee1b 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json @@ -1,58 +1,32 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "string_addition", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "LAMBDA_string_task", "taskReferenceName": "string_task", - "description": null, "inputParameters": { "input": "1Str_2Str_${workflow.input.input}My input: ${workflow.input.input}string_addition1", "scriptExpression": "" }, "type": "LAMBDA", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ "input" ], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json index 2a83270d..40f5fe1f 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json @@ -1,46 +1,23 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "TEST_StringInterpolation", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "EMAIL_prepare", "taskReferenceName": "email_prepare", - "description": null, "inputParameters": { "address": "${workflow.input.first_input},${workflow.input.second_input},Value,0", "name": "Workflow name: TEST_StringInterpolation" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [ @@ -50,12 +27,9 @@ "outputParameters": { "email_body": "${email_prepare.output.email_body}" }, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json index 3fd6f800..4a7e02da 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json @@ -1,28 +1,16 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "switch_task", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "SWITCH_switch", "taskReferenceName": "switch", - "description": null, "inputParameters": { "switch_case_value": "test" }, "type": "SWITCH", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": "switch_case_value", - "evaluatorType": "value-param", - "scriptExpression": null, "decisionCases": { "test": [ { @@ -35,13 +23,12 @@ "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, "defaultCase": [ { "name": "TERMINATE_terminate", @@ -53,31 +40,26 @@ "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "evaluatorType": "value-param", + "expression": "switch_case_value", + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json index 091b8599..fd3e8b80 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json @@ -1,49 +1,24 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "task_properties_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "CUSTOMER_get", "taskReferenceName": "get_customer", - "description": null, "inputParameters": {}, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "task_properties_task", "taskReferenceName": "task_properties", - "description": null, "inputParameters": { "status": "${get_customer.status}", "reference_task_name": "${get_customer.referenceTaskName}", @@ -56,39 +31,19 @@ "correlation_id": "${get_customer.correlationId}" }, "type": "SIMPLE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json index 3a5683fa..d10be02f 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json @@ -1,28 +1,19 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "terminate_task_worfklow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "DECISION_decision_task", "taskReferenceName": "decision_task", - "description": null, "inputParameters": { "case_value_param": "value" }, "type": "DECISION", - "dynamicTaskNameParam": null, "caseValueParam": "case_value_param", - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, + "caseExpression": "case_value_param", + "scriptExpression": "case_value_param", "decisionCases": { "value": [ { @@ -38,42 +29,26 @@ "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "SWITCH_switch_task", "taskReferenceName": "switch_task", - "description": null, "inputParameters": { "switch_case_value": "value" }, "type": "SWITCH", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": "switch_case_value", - "evaluatorType": "value-param", - "scriptExpression": null, "decisionCases": { "value": [ { @@ -89,32 +64,24 @@ "startDelay": 0, "optional": false, "rateLimited": false, - "asyncComplete": false + "asyncComplete": false, + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ] }, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "evaluatorType": "value-param", + "expression": "switch_case_value", + "workflowTaskType": "SIMPLE" }, { - "queryExpression": null, "name": "TERMINATE_terminate", "taskReferenceName": "terminate", - "description": null, "inputParameters": { "terminationStatus": "FAILED", "workflowOutput": { @@ -122,39 +89,19 @@ } }, "type": "TERMINATE", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json index 541a8e32..48a14782 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json @@ -1,58 +1,31 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "version_attribute_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "TEST_subworkflow", "taskReferenceName": "test_subworkflow", - "description": null, "inputParameters": {}, "type": "SUB_WORKFLOW", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, "subWorkflowParam": { "name": "TEST_subworkflow", - "version": 3, - "taskToDomain": null, - "workflowDefinition": null + "version": 3 }, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json index b480a761..9ae1c8a0 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json @@ -1,56 +1,30 @@ { - "ownerApp": null, "createTime": 0, "updateTime": 0, - "createdBy": null, - "updatedBy": null, "name": "wait_task_workflow", - "description": null, "version": 1, "tasks": [ { - "queryExpression": null, "name": "WAIT_wait", "taskReferenceName": "wait", - "description": null, "inputParameters": { "duration": "1s", "until": "2022-12-31 11:59" }, "type": "WAIT", - "dynamicTaskNameParam": null, - "caseValueParam": null, - "caseExpression": null, - "expression": null, - "evaluatorType": null, - "scriptExpression": null, - "decisionCases": null, - "dynamicForkJoinTasksParam": null, - "dynamicForkTasksParam": null, - "dynamicForkTasksInputParamName": null, - "defaultCase": null, - "forkTasks": null, "startDelay": 0, - "subWorkflowParam": null, - "joinOn": null, - "sink": null, "optional": false, - "taskDefinition": null, "rateLimited": false, - "defaultExclusiveJoinTask": null, "asyncComplete": false, - "loopCondition": null, - "loopOver": null + "retryCount": 0, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [], - "outputParameters": null, - "failureWorkflow": null, - "schemaVersion": 2, - "restartable": true, - "workflowStatusListenerEnabled": true, - "ownerEmail": null, - "timeoutPolicy": null, - "timeoutSeconds": 0, - "variables": null + "outputParameters": {}, + "schemaVersion": 0, + "restartable": false, + "workflowStatusListenerEnabled": false, + "timeoutPolicy": "TIME_OUT_WF", + "timeoutSeconds": 0 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Unit/ContainerBuilderTests.cs b/test/ConductorSharp.Engine.Tests/Unit/ContainerBuilderTests.cs index d953930a..bb1d2be0 100644 --- a/test/ConductorSharp.Engine.Tests/Unit/ContainerBuilderTests.cs +++ b/test/ConductorSharp.Engine.Tests/Unit/ContainerBuilderTests.cs @@ -1,4 +1,5 @@ -using ConductorSharp.Engine.Extensions; +using ConductorSharp.Client.Generated; +using ConductorSharp.Engine.Extensions; using ConductorSharp.Engine.Tests.Samples.Workflows; using ConductorSharp.Engine.Tests.Util; using ConductorSharp.Engine.Util.Builders; @@ -14,7 +15,7 @@ public void AppliesBuildConfigurationDefaults() var builder = new ServiceCollection(); builder - .AddConductorSharp(baseUrl: "empty", apiPath: "empty") + .AddConductorSharp(baseUrl: "http://empty/empty") .SetBuildConfiguration(new BuildConfiguration { DefaultOwnerApp = "testApp", DefaultOwnerEmail = "owner@test.app" }) .AddExecutionManager( maxConcurrentWorkers: 1, @@ -27,7 +28,7 @@ public void AppliesBuildConfigurationDefaults() builder.RegisterWorkflow(); var container = builder.BuildServiceProvider(); - var definitions = container.GetRequiredService>().ToList(); + var definitions = container.GetRequiredService>().ToList(); Assert.True(definitions.All(a => a.OwnerApp == "testApp")); } @@ -38,7 +39,7 @@ public void OverridesBuildConfigurationDefaults() var builder = new ServiceCollection(); var overrideValue = "override"; builder - .AddConductorSharp(baseUrl: "empty", apiPath: "empty") + .AddConductorSharp(baseUrl: "http://empty/empty") .SetBuildConfiguration(new BuildConfiguration { DefaultOwnerApp = "testApp", DefaultOwnerEmail = "owner@test.app", }) .AddExecutionManager( maxConcurrentWorkers: 1, @@ -51,7 +52,7 @@ public void OverridesBuildConfigurationDefaults() builder.RegisterWorkflow(new BuildConfiguration { DefaultOwnerApp = overrideValue }); var container = builder.BuildServiceProvider(); - var definitions = container.GetRequiredService>().ToList(); + var definitions = container.GetRequiredService>().ToList(); Assert.True(definitions.All(a => a.OwnerApp == overrideValue)); } @@ -61,7 +62,7 @@ public void ResolveWorkflowDependencies() { var builder = new ServiceCollection(); builder - .AddConductorSharp(baseUrl: "empty", apiPath: "empty") + .AddConductorSharp(baseUrl: "http://empty/empty") .AddExecutionManager( maxConcurrentWorkers: 1, sleepInterval: 1, @@ -73,7 +74,7 @@ public void ResolveWorkflowDependencies() builder.AddTransient(); builder.RegisterWorkflow(); var container = builder.BuildServiceProvider(); - var definitions = container.GetRequiredService>(); + var definitions = container.GetRequiredService>(); Assert.Contains(definitions, def => def.Name == NamingUtil.NameOf()); } @@ -82,7 +83,7 @@ public void FailsToResolveWorkflowDependencies() { var builder = new ServiceCollection(); builder - .AddConductorSharp(baseUrl: "empty", apiPath: "empty") + .AddConductorSharp(baseUrl: "http://empty/empty") .AddExecutionManager( maxConcurrentWorkers: 1, sleepInterval: 1, @@ -93,7 +94,7 @@ public void FailsToResolveWorkflowDependencies() builder.RegisterWorkflow(); var container = builder.BuildServiceProvider(); - Assert.Throws(() => container.GetRequiredService>()); + Assert.Throws(() => container.GetRequiredService>()); } } } diff --git a/test/ConductorSharp.Engine.Tests/Unit/TaskDefinitionBuilderTests.cs b/test/ConductorSharp.Engine.Tests/Unit/TaskDefinitionBuilderTests.cs index 98d8ea8a..c0d5730a 100644 --- a/test/ConductorSharp.Engine.Tests/Unit/TaskDefinitionBuilderTests.cs +++ b/test/ConductorSharp.Engine.Tests/Unit/TaskDefinitionBuilderTests.cs @@ -1,4 +1,5 @@ -using ConductorSharp.Engine.Extensions; +using ConductorSharp.Client.Generated; +using ConductorSharp.Engine.Extensions; using ConductorSharp.Engine.Tests.Samples.Workers; using ConductorSharp.Engine.Tests.Util; using ConductorSharp.Engine.Util.Builders; @@ -15,7 +16,7 @@ public TaskDefinitionBuilderTests() var _containerBuilder = new ServiceCollection(); _containerBuilder - .AddConductorSharp("example.com", "api", false) + .AddConductorSharp("http://example.com/api") .AddExecutionManager(10, 100, 100, null, typeof(TaskDefinitionBuilderTests).Assembly) .AddPipelines(pipelines => { @@ -42,7 +43,7 @@ public void ConfigurableBuilderReturnsCorrectDefinition() { var builder = new ServiceCollection(); - builder.AddConductorSharp(baseUrl: "empty", apiPath: "empty"); + builder.AddConductorSharp(baseUrl: "http://empty/empty"); builder.AddSingleton(new BuildConfiguration { DefaultOwnerApp = "owner" }); @@ -50,7 +51,7 @@ public void ConfigurableBuilderReturnsCorrectDefinition() var container = builder.BuildServiceProvider(); - var definition = container.GetRequiredService(); + var definition = container.GetRequiredService(); Assert.Equal("owner", definition.OwnerApp); } diff --git a/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs b/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs index d150101f..022c6b16 100644 --- a/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs +++ b/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs @@ -1,4 +1,5 @@ -using ConductorSharp.Engine.Extensions; +using ConductorSharp.Client.Generated; +using ConductorSharp.Engine.Extensions; using ConductorSharp.Engine.Tests.Samples.Workflows; using Microsoft.Extensions.DependencyInjection; @@ -12,7 +13,7 @@ public void RegisteredItemsResolve() var builder = new ServiceCollection(); builder - .AddConductorSharp(baseUrl: "empty", apiPath: "empty") + .AddConductorSharp(baseUrl: "http://empty/empty") .AddExecutionManager( maxConcurrentWorkers: 1, sleepInterval: 1, @@ -25,7 +26,7 @@ public void RegisteredItemsResolve() var container = builder.BuildServiceProvider(); // Items are registered when building the workflow definition, so we have to resolve them first - _ = container.GetRequiredService>().ToList(); + _ = container.GetRequiredService>().ToList(); var registry = container.GetRequiredService(); @@ -40,7 +41,7 @@ public void GetAllCorrectlyResolves() var builder = new ServiceCollection(); builder - .AddConductorSharp(baseUrl: "empty", apiPath: "empty") + .AddConductorSharp(baseUrl: "http://empty/empty") .AddExecutionManager( maxConcurrentWorkers: 1, sleepInterval: 1, @@ -53,20 +54,20 @@ public void GetAllCorrectlyResolves() var container = builder.BuildServiceProvider(); // Items are registered when building the workflow definition, so we have to resolve them first - _ = container.GetRequiredService>().ToList(); + _ = container.GetRequiredService>().ToList(); var registry = container.GetRequiredService(); - registry.Register("definition", new TaskDefinition { CreatedBy = "test1test1" }); + registry.Register("definition", new TaskDef { CreatedBy = "test1test1" }); - registry.Register("definition2", new TaskDefinition { CreatedBy = "test1test2" }); + registry.Register("definition2", new TaskDef { CreatedBy = "test1test2" }); - registry.Register("definition3", new WorkflowDefinition { CreatedBy = "test1workflow1" }); + registry.Register("definition3", new WorkflowDef { CreatedBy = "test1workflow1" }); registry.TryGet(out var items); - var taskDefs = registry.GetAll(); - var workflowDefs = registry.GetAll(); + var taskDefs = registry.GetAll(); + var workflowDefs = registry.GetAll(); var ints = registry.GetAll(); Assert.Equal(2, taskDefs.Count); diff --git a/test/ConductorSharp.Engine.Tests/Usings.cs b/test/ConductorSharp.Engine.Tests/Usings.cs index 4de4d40d..eb6fe6a9 100644 --- a/test/ConductorSharp.Engine.Tests/Usings.cs +++ b/test/ConductorSharp.Engine.Tests/Usings.cs @@ -1,9 +1,8 @@ -global using Xunit; +global using ConductorSharp.Engine.Builders; global using ConductorSharp.Engine.Interface; +global using ConductorSharp.Engine.Model; +global using ConductorSharp.Engine.Tests.Samples.Tasks; global using ConductorSharp.Engine.Util; global using MediatR; -global using ConductorSharp.Client.Model.Common; -global using ConductorSharp.Engine.Builders; -global using ConductorSharp.Engine.Tests.Samples.Tasks; -global using ConductorSharp.Engine.Model; global using Newtonsoft.Json; +global using Xunit; From a84c052ef23ce924a5b0f31c549ef0e21180a053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 21:06:44 +0100 Subject: [PATCH 10/33] clear up warnings and messages --- .../Controllers/WorkflowController.cs | 22 ++++----- .../ConductorSharp.Definitions.csproj | 5 +- .../ConductorSharp.Definitions/Program.cs | 2 - .../ConductorSharp.NoApi.csproj | 3 +- .../Service/IWorkflowBulkService.cs | 2 +- .../Service/WorkflowBulkService.cs | 2 +- .../Builders/BaseTaskBuilder.cs | 2 +- .../Builders/DecisionCases.cs | 2 +- .../Builders/DecisionTaskBuilder.cs | 49 +++++++++---------- .../Builders/DynamicForkJoinTaskBuilder.cs | 5 +- .../Builders/DynamicTaskBuilder.cs | 5 +- .../Builders/HumanTaskBuilder.cs | 5 +- .../Builders/JsonJqTransformTaskBuilder.cs | 6 +-- .../Builders/LambdaTaskBuilder.cs | 7 +-- .../Builders/PassThroughTaskBuilder.cs | 9 +--- .../Builders/SimpleTaskBuilder.cs | 5 +- .../Builders/SubWorkflowTaskBuilder.cs | 7 +-- .../Builders/SwitchTaskBuilder.cs | 34 +++++-------- .../Builders/TaskDefinitionBuilder.cs | 14 ++---- .../Builders/TerminateTaskBuilder.cs | 5 +- .../Builders/WaitTaskBuilder.cs | 5 +- .../Builders/Workflow.cs | 9 +--- .../Builders/WorkflowDefinitionBuilder.cs | 6 +-- .../ConductorSharp.Engine.csproj | 9 ++-- src/ConductorSharp.Engine/ExecutionManager.cs | 4 +- src/ConductorSharp.Engine/Model/Deployment.cs | 6 +-- .../Service/DeploymentService.cs | 13 ++--- .../Builders/CSharpLambdaTaskBuilder.cs | 5 +- .../Tasks/ReadWorkflowTasks.cs | 21 ++------ .../ConductorSharp.Toolkit.csproj | 8 +-- .../Service/ScaffoldingService.cs | 9 ++-- .../ConductorSharp.Engine.Tests.csproj | 10 ++-- .../Integration/WorkflowBuilderTests.cs | 4 +- .../Unit/WorkflowItemRegistryTests.cs | 2 +- 34 files changed, 108 insertions(+), 194 deletions(-) diff --git a/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs b/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs index 0c5cb24d..8ddf2521 100644 --- a/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs +++ b/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs @@ -9,35 +9,35 @@ namespace ConductorSharp.ApiEnabled.Controllers; [ApiController] public class WorkflowController : ControllerBase { - private readonly IMetadataService metadataService; - private readonly IWorkflowService workflowService; - private readonly ITaskService taskService; + private readonly IMetadataService _metadataService; + private readonly IWorkflowService _workflowService; + private readonly ITaskService _taskService; private const string NotificationWorfklowName = "NOTIFICATION_send_to_customer"; public WorkflowController(IMetadataService metadataService, IWorkflowService workflowService, ITaskService taskService) { - this.metadataService = metadataService; - this.workflowService = workflowService; - this.taskService = taskService; + _metadataService = metadataService; + _workflowService = workflowService; + _taskService = taskService; } [HttpGet("get-workflows")] - public async Task> GetRegisteredWorkflows() => await metadataService.GetAllWorkflowsAsync(); + public async Task> GetRegisteredWorkflows() => await _metadataService.GetAllWorkflowsAsync(); [HttpGet("get-task-logs")] - public async Task> GetTaskLogs(string taskId) => await taskService.GetLogsAsync(taskId); + public async Task> GetTaskLogs(string taskId) => await _taskService.GetLogsAsync(taskId); [HttpGet("get-executions")] public async Task SearchWorkflows([FromQuery] int? start = null, [FromQuery] int? size = null) => - await workflowService.SearchV2Async(start, size); + await _workflowService.SearchV2Async(start, size); [HttpGet("get-status/{workflowId}")] public async Task GetStatus([FromRoute] string workflowId, [FromQuery] bool includeTasks) => - await workflowService.GetExecutionStatusAsync(workflowId, includeTasks); + await _workflowService.GetExecutionStatusAsync(workflowId, includeTasks); [HttpPost("send-notification")] public async Task> QueueWorkflow([FromBody] SendNotificationRequest request) => - await workflowService.StartAsync( + await _workflowService.StartAsync( new StartWorkflowRequest { Name = NotificationWorfklowName, diff --git a/examples/ConductorSharp.Definitions/ConductorSharp.Definitions.csproj b/examples/ConductorSharp.Definitions/ConductorSharp.Definitions.csproj index 56a38af3..31db3b0e 100644 --- a/examples/ConductorSharp.Definitions/ConductorSharp.Definitions.csproj +++ b/examples/ConductorSharp.Definitions/ConductorSharp.Definitions.csproj @@ -23,10 +23,7 @@ - - - - + diff --git a/examples/ConductorSharp.Definitions/Program.cs b/examples/ConductorSharp.Definitions/Program.cs index 518c18b1..15a42802 100644 --- a/examples/ConductorSharp.Definitions/Program.cs +++ b/examples/ConductorSharp.Definitions/Program.cs @@ -3,7 +3,6 @@ using ConductorSharp.Engine.Health; using ConductorSharp.Patterns.Extensions; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; IConfiguration configuration = null; @@ -19,7 +18,6 @@ .ConfigureServices( (_, services) => { - services.AddAutoMapper(typeof(Program)); services .AddConductorSharp(baseUrl: configuration.GetValue("Conductor:BaseUrl")) .AddExecutionManager( diff --git a/examples/ConductorSharp.NoApi/ConductorSharp.NoApi.csproj b/examples/ConductorSharp.NoApi/ConductorSharp.NoApi.csproj index 79ea8251..b77803a5 100644 --- a/examples/ConductorSharp.NoApi/ConductorSharp.NoApi.csproj +++ b/examples/ConductorSharp.NoApi/ConductorSharp.NoApi.csproj @@ -33,8 +33,7 @@ - - + diff --git a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs index f7610903..e3670458 100644 --- a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs +++ b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs @@ -17,7 +17,7 @@ public interface IWorkflowBulkService /// /// Terminate workflows execution /// - Task TerminateWorkflowsAsync(IEnumerable worklowIds, string reason = null, CancellationToken cancellationToken = default); + Task TerminateWorkflowsAsync(IEnumerable worklowIds, string? reason = null, CancellationToken cancellationToken = default); /// /// Retry the last failed task for each workflow from the list diff --git a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs index c65cb4f1..6f546c0f 100644 --- a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs +++ b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs @@ -12,7 +12,7 @@ public async Task PauseWorkflowsAsync(IEnumerable workflow CancellationToken cancellationToken = default) => await client.PauseWorkflow_1Async(workflowIds, cancellationToken); - public async Task TerminateWorkflowsAsync(IEnumerable worklowIds, string reason = null, + public async Task TerminateWorkflowsAsync(IEnumerable worklowIds, string? reason = null, CancellationToken cancellationToken = default) => await client.TerminateAsync(worklowIds, reason, cancellationToken); diff --git a/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs index 9003e3dc..2d54fd47 100644 --- a/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/BaseTaskBuilder.cs @@ -14,7 +14,7 @@ public abstract class BaseTaskBuilder : ITaskOptionsBuilder, ITaskBuilder protected readonly JObject _inputParameters; protected readonly string _taskRefferenceName; protected readonly string _taskName; - private readonly BuildConfiguration _buildConfiguration; + protected readonly BuildConfiguration _buildConfiguration; protected AdditionalTaskParameters _additionalParameters = new(); public BaseTaskBuilder(Expression taskExpression, Expression memberExpression, BuildConfiguration buildConfiguration) diff --git a/src/ConductorSharp.Engine/Builders/DecisionCases.cs b/src/ConductorSharp.Engine/Builders/DecisionCases.cs index 0ac96f55..47980cc2 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionCases.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionCases.cs @@ -6,7 +6,7 @@ namespace ConductorSharp.Engine.Builders { public class DecisionCases where TWorkflow : ITypedWorkflow { - internal Dictionary>> Cases { get; } = new(); + internal Dictionary>> Cases { get; } = []; public Action> DefaultCase { get; set; } public Action> this[string @case] diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index 5496edf3..f7f3dd06 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -48,32 +48,24 @@ DecisionCases decisionCases } } - public class DecisionTaskBuilder : BaseTaskBuilder, ITaskSequenceBuilder + public class DecisionTaskBuilder( + Expression taskExpression, + Expression inputExpression, + BuildConfiguration buildConfiguration, + WorkflowBuildItemRegistry buildItemRegistry, + IEnumerable configurationProperties, + BuildContext buildContext + ) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration), ITaskSequenceBuilder where TWorkflow : ITypedWorkflow { - private Dictionary> _caseDictionary = new(); + private readonly Dictionary> _caseDictionary = []; private List _defaultCase; private string _currentCaseName; - public BuildContext BuildContext { get; } - public BuildConfiguration BuildConfiguration { get; } - public WorkflowBuildItemRegistry WorkflowBuildRegistry { get; } - public IEnumerable ConfigurationProperties { get; } - - public DecisionTaskBuilder( - Expression taskExpression, - Expression inputExpression, - BuildConfiguration buildConfiguration, - WorkflowBuildItemRegistry buildItemRegistry, - IEnumerable configurationProperties, - BuildContext buildContext - ) : base(taskExpression, inputExpression, buildConfiguration) - { - BuildConfiguration = buildConfiguration; - BuildContext = buildContext; - WorkflowBuildRegistry = buildItemRegistry; - ConfigurationProperties = configurationProperties; - } + public BuildContext BuildContext { get; } = buildContext; + public BuildConfiguration BuildConfiguration { get; } = buildConfiguration; + public WorkflowBuildItemRegistry WorkflowBuildRegistry { get; } = buildItemRegistry; + public IEnumerable ConfigurationProperties { get; } = configurationProperties; internal DecisionTaskBuilder AddCase(string caseName) { @@ -86,9 +78,9 @@ public override WorkflowTask[] Build() { var decisionTaskName = $"DECISION_{_taskRefferenceName}"; - return new WorkflowTask[] - { - new WorkflowTask + return + [ + new() { Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, @@ -105,7 +97,7 @@ public override WorkflowTask[] Build() }.ToObject>>(), DefaultCase = _defaultCase?.SelectMany(builder => builder.Build()).ToArray() } - }; + ]; } public void AddTaskBuilderToSequence(ITaskBuilder builder) @@ -114,13 +106,16 @@ public void AddTaskBuilderToSequence(ITaskBuilder builder) if (_currentCaseName == null) { _defaultCase ??= []; - _defaultCase.Add(builder); + return; } if (!_caseDictionary.ContainsKey(_currentCaseName)) - _caseDictionary.Add(_currentCaseName, new List()); + { + _caseDictionary.Add(_currentCaseName, []); + } + _caseDictionary[_currentCaseName].Add(builder); } } diff --git a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs index 1fb01994..9ad0c8bc 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs @@ -22,11 +22,8 @@ Expression> input } } - public class DynamicForkJoinTaskBuilder : BaseTaskBuilder + public class DynamicForkJoinTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) { - public DynamicForkJoinTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) { } - public override WorkflowTask[] Build() { var dynamicTaskName = $"FORK_JOIN_DYNAMIC_{_taskRefferenceName}"; diff --git a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs index a48a4354..058f8d19 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs @@ -27,14 +27,11 @@ Expression>> input } } - public class DynamicTaskBuilder : BaseTaskBuilder, O> + public class DynamicTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder, O>(taskExpression, inputExpression, buildConfiguration) { private const string TaskType = "DYNAMIC"; private const string DynamicTasknameParam = "task_to_execute"; - public DynamicTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) { } - private class DynamicTaskParameters { [JsonProperty("task_input")] diff --git a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs index aaadcb58..24043e5b 100644 --- a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs @@ -22,11 +22,8 @@ Expression> input } } - internal class HumanTaskBuilder : BaseTaskBuilder + internal class HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) { - public HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) { } - public override WorkflowTask[] Build() => [ diff --git a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs index 2277749b..3b808795 100644 --- a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs @@ -30,11 +30,7 @@ public class JsonJqTransformTaskBuilder : BaseTaskBuilder where A : public JsonJqTransformTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : base(taskExpression, inputExpression, buildConfiguration) { - var queryExpressionValue = _inputParameters.GetValue("query_expression"); - - if (queryExpressionValue == null) - throw new InvalidOperationException("Query expression is a mandatory field"); - + var queryExpressionValue = _inputParameters.GetValue("query_expression") ?? throw new InvalidOperationException("Query expression is a mandatory field"); _inputParameters.Remove("query_expression"); _inputParameters.Add("queryExpression", queryExpressionValue); } diff --git a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs index 96bffd9f..55d58d3b 100644 --- a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs @@ -28,12 +28,9 @@ string script } } - public class LambdaTaskBuilder : BaseTaskBuilder where A : IRequest + public class LambdaTaskBuilder(string script, Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) where A : IRequest { - private readonly string _script; - - public LambdaTaskBuilder(string script, Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) => _script = script; + private readonly string _script = script; public override WorkflowTask[] Build() { diff --git a/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs index ca38a4de..209d1e1b 100644 --- a/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/PassThroughTaskBuilder.cs @@ -9,14 +9,9 @@ public static void AddTasks(this ITaskSequenceBuilder buil where TWorkflow : ITypedWorkflow => builder.AddTaskBuilderToSequence(new PassThroughTaskBuilder(taskDefinitions)); } - public class PassThroughTaskBuilder : ITaskBuilder + public class PassThroughTaskBuilder(WorkflowTask[] tasks) : ITaskBuilder { - private readonly WorkflowTask[] _tasks; - - public PassThroughTaskBuilder(WorkflowTask[] tasks) - { - _tasks = tasks; - } + private readonly WorkflowTask[] _tasks = tasks; public WorkflowTask[] Build() => _tasks; } diff --git a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs index 1f423907..534a425b 100644 --- a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs @@ -25,11 +25,8 @@ Expression> input } } - public class SimpleTaskBuilder : BaseTaskBuilder where A : IRequest + public class SimpleTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) where A : IRequest { - public SimpleTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) { } - public override WorkflowTask[] Build() => [ new() diff --git a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs index 21209d15..481f7696 100644 --- a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs @@ -27,12 +27,9 @@ Expression> input } } - public class SubWorkflowTaskBuilder : BaseTaskBuilder where TInput : IRequest + public class SubWorkflowTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) where TInput : IRequest { - private readonly int _version; - - public SubWorkflowTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) => _version = GetVersion(taskExpression); + private readonly int _version = GetVersion(taskExpression); public override WorkflowTask[] Build() => [ diff --git a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs index 9ee097a4..aa8db81f 100644 --- a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs @@ -48,32 +48,24 @@ DecisionCases decisionCases } } - public class SwitchTaskBuilder : BaseTaskBuilder, ITaskSequenceBuilder + public class SwitchTaskBuilder( + Expression taskExpression, + Expression inputExpression, + BuildConfiguration buildConfiguration, + WorkflowBuildItemRegistry workflowBuildItemRegistry, + IEnumerable configurationProperties, + BuildContext buildContext + ) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration), ITaskSequenceBuilder where TWorkflow : ITypedWorkflow { - private Dictionary> _caseDictionary = new(); + private readonly Dictionary> _caseDictionary = []; private string _currentCaseName; private List _defaultCase; - public BuildContext BuildContext { get; } - public BuildConfiguration BuildConfiguration { get; } - public WorkflowBuildItemRegistry WorkflowBuildRegistry { get; } - public IEnumerable ConfigurationProperties { get; } - - public SwitchTaskBuilder( - Expression taskExpression, - Expression inputExpression, - BuildConfiguration buildConfiguration, - WorkflowBuildItemRegistry workflowBuildItemRegistry, - IEnumerable configurationProperties, - BuildContext buildContext - ) : base(taskExpression, inputExpression, buildConfiguration) - { - BuildConfiguration = buildConfiguration; - WorkflowBuildRegistry = workflowBuildItemRegistry; - ConfigurationProperties = configurationProperties; - BuildContext = buildContext; - } + public BuildContext BuildContext { get; } = buildContext; + public BuildConfiguration BuildConfiguration { get; } = buildConfiguration; + public WorkflowBuildItemRegistry WorkflowBuildRegistry { get; } = workflowBuildItemRegistry; + public IEnumerable ConfigurationProperties { get; } = configurationProperties; public SwitchTaskBuilder AddCase(string caseName) { diff --git a/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs b/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs index b17ba85c..a25d419d 100644 --- a/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs @@ -9,16 +9,10 @@ namespace ConductorSharp.Engine.Builders { - public class TaskDefinitionBuilder + public class TaskDefinitionBuilder(BuildConfiguration buildConfiguration, ITaskNameBuilder taskNameBuilder) { - public BuildConfiguration BuildConfiguration { get; set; } - private readonly ITaskNameBuilder _taskNameBuilder; - - public TaskDefinitionBuilder(BuildConfiguration buildConfiguration, ITaskNameBuilder taskNameBuilder) - { - BuildConfiguration = buildConfiguration; - _taskNameBuilder = taskNameBuilder; - } + public BuildConfiguration BuildConfiguration { get; set; } = buildConfiguration; + private readonly ITaskNameBuilder _taskNameBuilder = taskNameBuilder; public TaskDef Build(Action updateOptions = null) => Build(typeof(T), updateOptions); @@ -60,7 +54,7 @@ public TaskDef Build(Type taskType, Action updateOptions PollTimeoutSeconds = options.PollTimeoutSeconds, CreatedBy = options.CreatedBy, UpdatedBy = options.UpdatedBy, - InputTemplate = (options.InputTemplate ?? new Newtonsoft.Json.Linq.JObject()).ToObject>(), + InputTemplate = (options.InputTemplate ?? []).ToObject>(), ExecutionNameSpace = options.ExecutionNameSpace, }; } diff --git a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs index 0b76d865..36758a49 100644 --- a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs @@ -22,11 +22,8 @@ Expression> input } } - internal class TerminateTaskBuilder : BaseTaskBuilder + internal class TerminateTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) { - public TerminateTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, inputExpression, buildConfiguration) { } - public override WorkflowTask[] Build() => [ new() diff --git a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs index 816b5d62..663ccb66 100644 --- a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs @@ -22,11 +22,8 @@ Expression> input } } - internal class WaitTaskBuilder : BaseTaskBuilder + internal class WaitTaskBuilder(Expression taskExpression, Expression memberExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, memberExpression, buildConfiguration) { - public WaitTaskBuilder(Expression taskExpression, Expression memberExpression, BuildConfiguration buildConfiguration) - : base(taskExpression, memberExpression, buildConfiguration) { } - public override WorkflowTask[] Build() => [ new() diff --git a/src/ConductorSharp.Engine/Builders/Workflow.cs b/src/ConductorSharp.Engine/Builders/Workflow.cs index b54dd9a1..9874b597 100644 --- a/src/ConductorSharp.Engine/Builders/Workflow.cs +++ b/src/ConductorSharp.Engine/Builders/Workflow.cs @@ -13,12 +13,12 @@ public class WorkflowId { } public interface IWorkflowInput { } - public abstract class Workflow : SubWorkflowTaskModel, IConfigurableWorkflow + public abstract class Workflow(WorkflowDefinitionBuilder builder) : SubWorkflowTaskModel, IConfigurableWorkflow where TWorkflow : Workflow where TInput : WorkflowInput where TOutput : WorkflowOutput { - protected WorkflowDefinitionBuilder _builder; + protected WorkflowDefinitionBuilder _builder = builder; private WorkflowDef _workflowDefinition; public TInput WorkflowInput { get; set; } @@ -27,11 +27,6 @@ public abstract class Workflow : SubWorkflowTaskMode public virtual void BuildDefinition() { } - public Workflow(WorkflowDefinitionBuilder builder) - { - _builder = builder; - } - public virtual WorkflowDef GetDefinition() { if (_workflowDefinition == null) diff --git a/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs b/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs index f3a352af..a44fdd49 100644 --- a/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs @@ -35,7 +35,7 @@ public class WorkflowDefinitionBuilder : ITaskSequen where TOutput : WorkflowOutput { private readonly Type _workflowType = typeof(TWorkflow); - private readonly List _taskBuilders = new(); + private readonly List _taskBuilders = []; public BuildContext BuildContext { get; } = new(); public BuildConfiguration BuildConfiguration { get; set; } @@ -70,7 +70,7 @@ public WorkflowDef Build() BuildContext.WorkflowOptions.Version = _workflowType.GetCustomAttribute()?.Version ?? BuildContext.WorkflowOptions.Version; - BuildContext.Inputs = new(); + BuildContext.Inputs = []; var input = _workflowType.BaseType.GenericTypeArguments[1]; var props = input.GetProperties(); @@ -91,7 +91,7 @@ public WorkflowDef Build() : null, Description = BuildContext.WorkflowOptions.Description, InputParameters = BuildContext.Inputs.ToArray(), - OutputParameters = (BuildContext.Outputs ?? new Newtonsoft.Json.Linq.JObject()).ToObject>(), + OutputParameters = (BuildContext.Outputs ?? []).ToObject>(), OwnerApp = BuildContext.WorkflowOptions.OwnerApp, OwnerEmail = BuildContext.WorkflowOptions.OwnerEmail, Version = BuildContext.WorkflowOptions.Version diff --git a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj index 7c3a6b6f..ec31f74a 100644 --- a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj +++ b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj @@ -16,11 +16,10 @@ - - - - - + + + + diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index a4efa8b5..2bc19a33 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -84,7 +84,7 @@ public async Task StartAsync(CancellationToken cancellationToken) } } - private Type GetInputType(Type workerType) + private static Type GetInputType(Type workerType) { var interfaces = workerType .GetInterfaces() @@ -109,7 +109,7 @@ private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken if (!string.IsNullOrEmpty(pollResponse.ExternalInputPayloadStoragePath)) { - _logger.LogDebug($"Fetching storage location {pollResponse.ExternalInputPayloadStoragePath}"); + _logger.LogDebug("Fetching storage {location}", pollResponse.ExternalInputPayloadStoragePath); // TODO: Check what the operation and payload type are var externalStorageLocation = await _taskManager.GetExternalStorageLocationAsync( pollResponse.ExternalInputPayloadStoragePath, diff --git a/src/ConductorSharp.Engine/Model/Deployment.cs b/src/ConductorSharp.Engine/Model/Deployment.cs index 85683621..ea29d982 100644 --- a/src/ConductorSharp.Engine/Model/Deployment.cs +++ b/src/ConductorSharp.Engine/Model/Deployment.cs @@ -8,11 +8,11 @@ namespace ConductorSharp.Engine.Model { public class Deployment { - public List TaskDefinitions { get; set; } = new List(); + public List TaskDefinitions { get; set; } = []; - public List WorkflowDefinitions { get; set; } = new List(); + public List WorkflowDefinitions { get; set; } = []; - public List EventHandlerDefinitions { get; set; } = new List(); + public List EventHandlerDefinitions { get; set; } = []; public TaskDef FindTaskByName(string name) => TaskDefinitions.Where(a => a.Name == name).SingleOrDefault(); diff --git a/src/ConductorSharp.Engine/Service/DeploymentService.cs b/src/ConductorSharp.Engine/Service/DeploymentService.cs index 3fb99972..3b07061d 100644 --- a/src/ConductorSharp.Engine/Service/DeploymentService.cs +++ b/src/ConductorSharp.Engine/Service/DeploymentService.cs @@ -1,5 +1,4 @@ using ConductorSharp.Client.Service; -using ConductorSharp.Engine.Health; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using Microsoft.Extensions.Logging; @@ -7,17 +6,11 @@ namespace ConductorSharp.Engine.Service { - internal class DeploymentService : IDeploymentService + internal class DeploymentService(IMetadataService metadataService, ILogger logger) : IDeploymentService { - private readonly IMetadataService _metadataService; + private readonly IMetadataService _metadataService = metadataService; - private readonly ILogger _logger; - - public DeploymentService(IMetadataService metadataService, ILogger logger) - { - _metadataService = metadataService; - _logger = logger; - } + private readonly ILogger _logger = logger; public async Task Deploy(Deployment deployment) { diff --git a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs index 6adb32ce..2d6393db 100644 --- a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs @@ -28,10 +28,7 @@ Func lambda { var prefixConfigProperty = builder.ConfigurationProperties.FirstOrDefault( prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty - ); - - if (prefixConfigProperty == null) - throw new LambdaTasksNotEnabledException(); + ) ?? throw new LambdaTasksNotEnabledException(); var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(prefixConfigProperty.Value as string); diff --git a/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs b/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs index f7192d41..a383ef71 100644 --- a/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs +++ b/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs @@ -2,7 +2,6 @@ using ConductorSharp.Engine; using ConductorSharp.Engine.Util; using MediatR; -using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -46,16 +45,9 @@ public class WorkflowDetails /// Uses the Conductor API to read the input/output and status of the specified tasks for the specified workflow. /// [OriginalName(Constants.TaskNamePrefix + "_read_tasks")] - public class ReadWorkflowTasks : TaskRequestHandler + public class ReadWorkflowTasks(IWorkflowService workflowService) : TaskRequestHandler { - private readonly ILogger _logger; - private readonly IWorkflowService _workflowService; - - public ReadWorkflowTasks(ILogger logger, IWorkflowService workflowService) - { - _logger = logger; - _workflowService = workflowService; - } + private readonly IWorkflowService _workflowService = workflowService; public async override Task Handle(ReadWorkflowTasksRequest input, CancellationToken cancellationToken) { @@ -64,15 +56,12 @@ public async override Task Handle(ReadWorkflowTasksRe var tasknames = input.TaskNames.Split(",").Where(a => !string.IsNullOrEmpty(a)).ToList(); - var starterWorkflow = await _workflowService.GetExecutionStatusAsync(input.WorkflowId, cancellationToken: cancellationToken); - - if (starterWorkflow == null) - throw new Exception($"Could not find starter workflow by id {input.WorkflowId}"); - + var starterWorkflow = await _workflowService.GetExecutionStatusAsync(input.WorkflowId, cancellationToken: cancellationToken) ?? throw new Exception($"Could not find starter workflow by id {input.WorkflowId}"); + var output = new ReadWorkflowTasksResponse { Workflow = new WorkflowDetails { InputData = JObject.FromObject(starterWorkflow.Input) }, - Tasks = new Dictionary() + Tasks = [] }; foreach (var task in tasknames) diff --git a/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj b/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj index 77511e2b..055c83c7 100644 --- a/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj +++ b/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj @@ -26,10 +26,10 @@ - - - - + + + + diff --git a/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs b/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs index a700bfb8..e9617a08 100644 --- a/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs +++ b/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs @@ -3,7 +3,6 @@ using ConductorSharp.Engine.Util; using ConductorSharp.Toolkit.Filters; using ConductorSharp.Toolkit.Util; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Task = System.Threading.Tasks.Task; @@ -17,7 +16,7 @@ public class ScaffoldingService : IScaffoldingService // Prefix prepended if member name is invalid private const string MemberNamePrefix = "A"; - public ScaffoldingService(IMetadataService metadataService, IOptions options, ILogger logger) + public ScaffoldingService(IMetadataService metadataService, IOptions options) { _metadataService = metadataService; _config = options.Value; @@ -105,7 +104,7 @@ public async Task Scaffold() return (modelGenerator.Build(), name); } - private void DefinePropertyParams(TaskModelGenerator.PropertyData propData, string type, string originalName) + private static void DefinePropertyParams(TaskModelGenerator.PropertyData propData, string type, string originalName) { LangUtils.MakeValidMemberName(SnakeCaseUtil.ToPascalCase(originalName), MemberNamePrefix, out var propertyName); propData.OriginalName = originalName; @@ -177,10 +176,10 @@ private IWorkflowFilter[] CreateWorkflowFilters() } // If filter list is empty then all workflows/tasks are returned - private IEnumerable Filter(IEnumerable workflows, IWorkflowFilter[] filters) => + private static IEnumerable Filter(IEnumerable workflows, IWorkflowFilter[] filters) => workflows.Where(wf => filters.All(filter => filter.Test(wf))); - private IEnumerable Filter(IEnumerable tasks, ITaskFilter[] filters) => + private static IEnumerable Filter(IEnumerable tasks, ITaskFilter[] filters) => tasks.Where(task => filters.All(filter => filter.Test(task))); } } diff --git a/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj b/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj index 6edc4220..79895307 100644 --- a/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj +++ b/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj @@ -69,14 +69,14 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs b/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs index 0cc268ef..8f7aa80a 100644 --- a/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs +++ b/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs @@ -244,7 +244,7 @@ public void BuilderReturnsCorrectDefinitionNonEvaluatableWorkflow() Assert.Throws(GetDefinitionFromWorkflow); } - private string GetDefinitionFromWorkflow() where TWorkflow : IConfigurableWorkflow + private static string GetDefinitionFromWorkflow() where TWorkflow : IConfigurableWorkflow { var workflow = RegisterWorkflow() .GetRequiredService>() @@ -253,7 +253,7 @@ private string GetDefinitionFromWorkflow() where TWorkflow : IConfigu return SerializationUtil.SerializeObject(workflow); } - private IServiceProvider RegisterWorkflow() where TWorkflow : IConfigurableWorkflow + private static IServiceProvider RegisterWorkflow() where TWorkflow : IConfigurableWorkflow { var containerBuilder = new ServiceCollection(); diff --git a/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs b/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs index 022c6b16..26dfaf2d 100644 --- a/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs +++ b/test/ConductorSharp.Engine.Tests/Unit/WorkflowItemRegistryTests.cs @@ -64,7 +64,7 @@ public void GetAllCorrectlyResolves() registry.Register("definition3", new WorkflowDef { CreatedBy = "test1workflow1" }); - registry.TryGet(out var items); + registry.TryGet(out _); var taskDefs = registry.GetAll(); var workflowDefs = registry.GetAll(); From 46924e9a1071c263daf686f922e2cae849115c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 21:13:03 +0100 Subject: [PATCH 11/33] adjust tests --- src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs | 2 -- .../Samples/Workflows/CSharpLambdaWorkflow.json | 2 -- .../ConditionallySendCustomerNotificationOutput.json | 2 -- .../Samples/Workflows/DecisionInDecision.json | 4 ---- .../Samples/Workflows/DecisionTask.json | 2 -- .../Samples/Workflows/TerminateTaskWorkflow.json | 2 -- 6 files changed, 14 deletions(-) diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index f7f3dd06..a6ce16b3 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -86,9 +86,7 @@ public override WorkflowTask[] Build() TaskReferenceName = _taskRefferenceName, InputParameters = _inputParameters.ToObject>(), Type = "DECISION", - CaseValueParam = "case_value_param", ScriptExpression = "case_value_param", - CaseExpression = "case_value_param", DecisionCases = new JObject { _caseDictionary.Select( diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json index 56df2b14..21bd36aa 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json @@ -27,8 +27,6 @@ "case_value_param": "${workflow.input.operation}" }, "type": "DECISION", - "caseValueParam": "case_value_param", - "caseExpression": "case_value_param", "scriptExpression": "case_value_param", "decisionCases": { "upper": [ diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json index ffe77206..238e9828 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json @@ -11,8 +11,6 @@ "case_value_param": "${workflow.input.should_send_notification}" }, "type": "DECISION", - "caseValueParam": "case_value_param", - "caseExpression": "case_value_param", "scriptExpression": "case_value_param", "decisionCases": { "YES": [ diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json index 7790cdbc..c6fb598f 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json @@ -11,8 +11,6 @@ "case_value_param": "${workflow.input.should_send_notification}" }, "type": "DECISION", - "caseValueParam": "case_value_param", - "caseExpression": "case_value_param", "scriptExpression": "case_value_param", "decisionCases": { "YES": [ @@ -23,8 +21,6 @@ "case_value_param": "${workflow.input.should_send_notification}" }, "type": "DECISION", - "caseValueParam": "case_value_param", - "caseExpression": "case_value_param", "scriptExpression": "case_value_param", "decisionCases": { "YES": [ diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json index 9d9bc9b6..8c649f76 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json @@ -11,8 +11,6 @@ "case_value_param": "test" }, "type": "DECISION", - "caseValueParam": "case_value_param", - "caseExpression": "case_value_param", "scriptExpression": "case_value_param", "decisionCases": { "test": [ diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json index d10be02f..2a7d0e53 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json @@ -11,8 +11,6 @@ "case_value_param": "value" }, "type": "DECISION", - "caseValueParam": "case_value_param", - "caseExpression": "case_value_param", "scriptExpression": "case_value_param", "decisionCases": { "value": [ From 1580726d553580e03c1a2ce5882114a4e1af6564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 21:15:52 +0100 Subject: [PATCH 12/33] adjust settings --- examples/ConductorSharp.ApiEnabled/appsettings.json | 4 +--- examples/ConductorSharp.Definitions/appsettings.json | 4 +--- examples/ConductorSharp.NoApi/appsettings.json | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/examples/ConductorSharp.ApiEnabled/appsettings.json b/examples/ConductorSharp.ApiEnabled/appsettings.json index c3c5ffd3..4fc4015a 100644 --- a/examples/ConductorSharp.ApiEnabled/appsettings.json +++ b/examples/ConductorSharp.ApiEnabled/appsettings.json @@ -1,10 +1,8 @@ { "Conductor": { "BaseUrl": "http://host.docker.internal:8080", - "ApiUrl": "api", "LongPollInterval": 100, "MaxConcurrentWorkers": 10, - "SleepInterval": 500, - "PreventErrorOnBadRequest": true + "SleepInterval": 500 } } diff --git a/examples/ConductorSharp.Definitions/appsettings.json b/examples/ConductorSharp.Definitions/appsettings.json index c3c5ffd3..4fc4015a 100644 --- a/examples/ConductorSharp.Definitions/appsettings.json +++ b/examples/ConductorSharp.Definitions/appsettings.json @@ -1,10 +1,8 @@ { "Conductor": { "BaseUrl": "http://host.docker.internal:8080", - "ApiUrl": "api", "LongPollInterval": 100, "MaxConcurrentWorkers": 10, - "SleepInterval": 500, - "PreventErrorOnBadRequest": true + "SleepInterval": 500 } } diff --git a/examples/ConductorSharp.NoApi/appsettings.json b/examples/ConductorSharp.NoApi/appsettings.json index fa169067..4fc4015a 100644 --- a/examples/ConductorSharp.NoApi/appsettings.json +++ b/examples/ConductorSharp.NoApi/appsettings.json @@ -1,10 +1,8 @@ { "Conductor": { "BaseUrl": "http://host.docker.internal:8080", - "ApiUrl": "api", "LongPollInterval": 100, "MaxConcurrentWorkers": 10, - "SleepInterval": 500, - "PreventErrorOnBadRequest": false + "SleepInterval": 500 } } From 87e7c6c505a8e4b46218dd89350af1dce723bfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:43:58 +0100 Subject: [PATCH 13/33] various fixes --- examples/ConductorSharp.ApiEnabled/Program.cs | 1 + .../appsettings.json | 2 +- .../appsettings.json | 2 +- .../ConductorSharp.NoApi/appsettings.json | 2 +- src/ConductorSharp.Client/ApiException.cs | 2 +- .../Builders/DecisionTaskBuilder.cs | 2 +- .../Builders/DynamicForkJoinTaskBuilder.cs | 2 +- .../Builders/DynamicTaskBuilder.cs | 3 +- .../Builders/HumanTaskBuilder.cs | 2 +- .../Builders/JsonJqTransformTaskBuilder.cs | 2 +- .../Builders/LambdaTaskBuilder.cs | 2 +- .../Builders/SimpleTaskBuilder.cs | 4 +- .../Builders/SubWorkflowTaskBuilder.cs | 2 +- .../Builders/SwitchTaskBuilder.cs | 2 +- .../Builders/TaskDefinitionBuilder.cs | 1 + .../Builders/TerminateTaskBuilder.cs | 2 +- .../Builders/WaitTaskBuilder.cs | 2 +- .../Builders/WorkflowDefinitionBuilder.cs | 3 +- .../Extensions/ConductorSharpBuilder.cs | 7 +-- .../Extensions/ContainerBuilderExtensions.cs | 13 ++--- .../WorkflowEngineBackgroundService.cs | 50 +++++++++---------- .../Samples/Tasks/CustomerGet.json | 2 +- .../Samples/Workflows/Arrays.json | 4 +- .../Workflows/CSharpLambdaWorkflow.json | 5 +- .../Samples/Workflows/CastWorkflow.json | 4 +- ...ionallySendCustomerNotificationOutput.json | 8 ++- .../Samples/Workflows/DecisionInDecision.json | 11 ++-- .../Samples/Workflows/DecisionTask.json | 9 ++-- .../Samples/Workflows/DynamicTask.json | 5 +- .../Workflows/EvaluateExpressionWorkflow.json | 8 +-- .../Samples/Workflows/HumanTask.json | 5 +- .../Samples/Workflows/IndexerWorkflow.json | 3 +- .../Workflows/ListInitializationWorkflow.json | 3 +- .../Samples/Workflows/NestedObjects.json | 3 +- .../Workflows/OptionalTaskWorkflow.json | 5 +- .../Workflows/PassthroughTaskWorkflow.json | 2 +- .../Samples/Workflows/PatternTasks.json | 4 +- .../Workflows/ScaffoldedWorkflows.json | 8 ++- .../Workflows/SendCustomerNotification.json | 4 +- .../Samples/Workflows/StringAddition.json | 5 +- .../Workflows/StringInterpolation.json | 3 +- .../Samples/Workflows/SwitchTask.json | 9 ++-- .../Workflows/TaskPropertiesWorkflow.json | 4 +- .../Workflows/TerminateTaskWorkflow.json | 17 +++---- .../Workflows/VersionAttributeWorkflow.json | 5 +- .../Samples/Workflows/WaitTask.json | 5 +- 46 files changed, 99 insertions(+), 150 deletions(-) diff --git a/examples/ConductorSharp.ApiEnabled/Program.cs b/examples/ConductorSharp.ApiEnabled/Program.cs index adca59b3..d61218f0 100644 --- a/examples/ConductorSharp.ApiEnabled/Program.cs +++ b/examples/ConductorSharp.ApiEnabled/Program.cs @@ -1,4 +1,5 @@ using ConductorSharp.ApiEnabled.Extensions; +using ConductorSharp.Client.Service; using ConductorSharp.Engine.Health; using Serilog; diff --git a/examples/ConductorSharp.ApiEnabled/appsettings.json b/examples/ConductorSharp.ApiEnabled/appsettings.json index 4fc4015a..e33134ca 100644 --- a/examples/ConductorSharp.ApiEnabled/appsettings.json +++ b/examples/ConductorSharp.ApiEnabled/appsettings.json @@ -1,6 +1,6 @@ { "Conductor": { - "BaseUrl": "http://host.docker.internal:8080", + "BaseUrl": "http://localhost:8081", "LongPollInterval": 100, "MaxConcurrentWorkers": 10, "SleepInterval": 500 diff --git a/examples/ConductorSharp.Definitions/appsettings.json b/examples/ConductorSharp.Definitions/appsettings.json index 4fc4015a..e33134ca 100644 --- a/examples/ConductorSharp.Definitions/appsettings.json +++ b/examples/ConductorSharp.Definitions/appsettings.json @@ -1,6 +1,6 @@ { "Conductor": { - "BaseUrl": "http://host.docker.internal:8080", + "BaseUrl": "http://localhost:8081", "LongPollInterval": 100, "MaxConcurrentWorkers": 10, "SleepInterval": 500 diff --git a/examples/ConductorSharp.NoApi/appsettings.json b/examples/ConductorSharp.NoApi/appsettings.json index 4fc4015a..e33134ca 100644 --- a/examples/ConductorSharp.NoApi/appsettings.json +++ b/examples/ConductorSharp.NoApi/appsettings.json @@ -1,6 +1,6 @@ { "Conductor": { - "BaseUrl": "http://host.docker.internal:8080", + "BaseUrl": "http://localhost:8081", "LongPollInterval": 100, "MaxConcurrentWorkers": 10, "SleepInterval": 500 diff --git a/src/ConductorSharp.Client/ApiException.cs b/src/ConductorSharp.Client/ApiException.cs index cba8c7d9..e7d0d305 100644 --- a/src/ConductorSharp.Client/ApiException.cs +++ b/src/ConductorSharp.Client/ApiException.cs @@ -2,7 +2,7 @@ namespace ConductorSharp.Client.Generated { - internal class ApiException( + public class ApiException( string message, int statusCode, string responseData, diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index a6ce16b3..3d6dd63c 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -85,7 +85,7 @@ public override WorkflowTask[] Build() Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, InputParameters = _inputParameters.ToObject>(), - Type = "DECISION", + WorkflowTaskType = WorkflowTaskType.DECISION, ScriptExpression = "case_value_param", DecisionCases = new JObject { diff --git a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs index 9ad0c8bc..556ba7ad 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs @@ -34,7 +34,7 @@ public override WorkflowTask[] Build() new() { Name = dynamicTaskName, TaskReferenceName = dynamicTaskName, - Type = "FORK_JOIN_DYNAMIC", + WorkflowTaskType = WorkflowTaskType.FORK_JOIN_DYNAMIC, DynamicForkTasksParam = "dynamic_tasks", DynamicForkTasksInputParamName = "dynamic_tasks_i", InputParameters = _inputParameters.ToObject>(), diff --git a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs index 058f8d19..0ac4ee9b 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs @@ -29,7 +29,6 @@ Expression>> input public class DynamicTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder, O>(taskExpression, inputExpression, buildConfiguration) { - private const string TaskType = "DYNAMIC"; private const string DynamicTasknameParam = "task_to_execute"; private class DynamicTaskParameters @@ -52,7 +51,7 @@ public override WorkflowTask[] Build() new() { Name = _taskRefferenceName, TaskReferenceName = _taskRefferenceName, - Type = TaskType, + WorkflowTaskType = WorkflowTaskType.DYNAMIC, InputParameters = parameters.TaskInput.ToObject>(), DynamicTaskNameParam = DynamicTasknameParam, } diff --git a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs index 24043e5b..0d57f540 100644 --- a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs @@ -31,7 +31,7 @@ public override WorkflowTask[] Build() => { Name = $"HUMAN_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, - Type = "HUMAN", + WorkflowTaskType = WorkflowTaskType.HUMAN, InputParameters = _inputParameters.ToObject>(), } ]; diff --git a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs index 3b808795..2198ed28 100644 --- a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs @@ -42,7 +42,7 @@ public override WorkflowTask[] Build() => { Name = _taskName, TaskReferenceName = _taskRefferenceName, - Type = "JSON_JQ_TRANSFORM", + WorkflowTaskType = WorkflowTaskType.JSON_JQ_TRANSFORM, InputParameters = _inputParameters.ToObject>() } ]; diff --git a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs index 55d58d3b..3c600889 100644 --- a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs @@ -41,7 +41,7 @@ public override WorkflowTask[] Build() { Name = $"LAMBDA_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, - Type = "LAMBDA", + WorkflowTaskType = WorkflowTaskType.LAMBDA, InputParameters = _inputParameters.ToObject>() } ]; diff --git a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs index 534a425b..8bb2a4a4 100644 --- a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs @@ -33,9 +33,9 @@ public override WorkflowTask[] Build() => { Name = _taskName, TaskReferenceName = _taskRefferenceName, - Type = "SIMPLE", + WorkflowTaskType = WorkflowTaskType.SIMPLE, InputParameters = _inputParameters.ToObject>(), - Optional = _additionalParameters?.Optional == true, + Optional = _additionalParameters?.Optional == true } ]; } diff --git a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs index 481f7696..84c1865a 100644 --- a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs @@ -37,7 +37,7 @@ public override WorkflowTask[] Build() => { Name = _taskName, TaskReferenceName = _taskRefferenceName, - Type = "SUB_WORKFLOW", + WorkflowTaskType = WorkflowTaskType.SUB_WORKFLOW, InputParameters = _inputParameters.ToObject>(), SubWorkflowParam = new SubWorkflowParams { Name = _taskName, Version = _version }, Optional = _additionalParameters?.Optional == true diff --git a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs index aa8db81f..298fa91c 100644 --- a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs @@ -85,7 +85,7 @@ public override WorkflowTask[] Build() Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, InputParameters = _inputParameters.ToObject>(), - Type = "SWITCH", + WorkflowTaskType = WorkflowTaskType.SWITCH, Expression = "switch_case_value", EvaluatorType = "value-param", DecisionCases = new JObject diff --git a/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs b/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs index a25d419d..a5e33f9a 100644 --- a/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TaskDefinitionBuilder.cs @@ -56,6 +56,7 @@ public TaskDef Build(Type taskType, Action updateOptions UpdatedBy = options.UpdatedBy, InputTemplate = (options.InputTemplate ?? []).ToObject>(), ExecutionNameSpace = options.ExecutionNameSpace, + BackoffScaleFactor = 1 }; } } diff --git a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs index 36758a49..9f4b7526 100644 --- a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs @@ -30,7 +30,7 @@ public override WorkflowTask[] Build() => { Name = $"TERMINATE_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, - Type = "TERMINATE", + WorkflowTaskType = WorkflowTaskType.TERMINATE, InputParameters = _inputParameters.ToObject>(), } ]; diff --git a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs index 663ccb66..af34ad16 100644 --- a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs @@ -30,7 +30,7 @@ public override WorkflowTask[] Build() => { Name = $"WAIT_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, - Type = "WAIT", + WorkflowTaskType = WorkflowTaskType.WAIT, InputParameters = _inputParameters.ToObject>() } ]; diff --git a/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs b/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs index a44fdd49..62e5df18 100644 --- a/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WorkflowDefinitionBuilder.cs @@ -94,7 +94,8 @@ public WorkflowDef Build() OutputParameters = (BuildContext.Outputs ?? []).ToObject>(), OwnerApp = BuildContext.WorkflowOptions.OwnerApp, OwnerEmail = BuildContext.WorkflowOptions.OwnerEmail, - Version = BuildContext.WorkflowOptions.Version + Version = BuildContext.WorkflowOptions.Version, + SchemaVersion = 2 }; } diff --git a/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs b/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs index fe3e8133..a3f4acae 100644 --- a/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs +++ b/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs @@ -7,18 +7,15 @@ using ConductorSharp.Engine.Util.Builders; using MediatR; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; using System; using System.Reflection; namespace ConductorSharp.Engine.Extensions { - public class ConductorSharpBuilder : IConductorSharpBuilder, IExecutionManagerBuilder, IPipelineBuilder + public class ConductorSharpBuilder(IServiceCollection builder) : IConductorSharpBuilder, IExecutionManagerBuilder, IPipelineBuilder { - public IServiceCollection Builder { get; set; } - - public ConductorSharpBuilder(IServiceCollection builder) => Builder = builder; + public IServiceCollection Builder { get; set; } = builder; public IExecutionManagerBuilder AddExecutionManager( int maxConcurrentWorkers, diff --git a/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs b/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs index f688223d..26a7f2d4 100644 --- a/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs +++ b/src/ConductorSharp.Engine/Extensions/ContainerBuilderExtensions.cs @@ -17,24 +17,21 @@ public static IConductorSharpBuilder AddConductorSharp(this IServiceCollection b builder.AddSingleton((ctx) => new ConductorClient(new HttpClient { BaseAddress = new Uri(baseUrl) })); + builder.AddTransient(); + builder.AddTransient(); + builder.AddTransient(); + builder.AddTransient(); + builder.AddTransient(); builder.AddTransient(); - builder.AddTransient(); - builder.AddTransient(); - builder.AddTransient(); builder.AddSingleton(new BuildConfiguration()); - builder.AddSingleton(); - builder.AddTransient(); - builder.AddTransient(); - builder.AddTransient(typeof(WorkflowDefinitionBuilder<,,>)); - return new ConductorSharpBuilder(builder); } } diff --git a/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs b/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs index 9470f55a..b571f63d 100644 --- a/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs +++ b/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs @@ -1,41 +1,33 @@ -using ConductorSharp.Engine.Health; +using ConductorSharp.Client.Generated; +using ConductorSharp.Engine.Health; using ConductorSharp.Engine.Interface; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System; using System.Threading; using System.Threading.Tasks; +using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Engine.Service { - internal class WorkflowEngineBackgroundService : IHostedService, IDisposable + internal class WorkflowEngineBackgroundService( + IConductorSharpHealthService healthService, + ILogger logger, + IHostApplicationLifetime hostApplicationLifetime, + IDeploymentService deploymentService, + ExecutionManager executionManager, + ModuleDeployment deployment + ) : IHostedService, IDisposable { - private readonly ILogger _logger; - private readonly IHostApplicationLifetime _hostApplicationLifetime; - private readonly IDeploymentService _deploymentService; - private readonly ExecutionManager _executionManager; - private readonly ModuleDeployment _deployment; - private readonly IConductorSharpHealthService _healthService; + private readonly ILogger _logger = logger; + private readonly IHostApplicationLifetime _hostApplicationLifetime = hostApplicationLifetime; + private readonly IDeploymentService _deploymentService = deploymentService; + private readonly ExecutionManager _executionManager = executionManager; + private readonly ModuleDeployment _deployment = deployment; + private readonly IConductorSharpHealthService _healthService = healthService; private Task _executingTask; private readonly CancellationTokenSource _stoppingCts = new(); - public WorkflowEngineBackgroundService( - IConductorSharpHealthService healthService, - ILogger logger, - IHostApplicationLifetime hostApplicationLifetime, - IDeploymentService deploymentService, - ExecutionManager executionManager, - ModuleDeployment deployment - ) - { - _logger = logger; - _hostApplicationLifetime = hostApplicationLifetime; - _deploymentService = deploymentService; - _executionManager = executionManager; - _deployment = deployment; - _healthService = healthService; - } - public Task StartAsync(CancellationToken cancellationToken) { _executingTask = RunAsync(_stoppingCts.Token); @@ -57,9 +49,15 @@ private async Task RunAsync(CancellationToken cancellationToken) await _healthService.SetExecutionManagerRunning(cancellationToken); await _executionManager.StartAsync(cancellationToken); } + catch (ApiException exception) + { + await _healthService.UnsetExecutionManagerRunning(cancellationToken); + _logger.LogCritical(exception, "Workflow Engine Background Service encountered an API error"); + throw; + } catch (Exception exception) { - await _healthService.UnsetExecutionManagerRunning(); + await _healthService.UnsetExecutionManagerRunning(cancellationToken); _logger.LogCritical(exception, "Workflow Engine Background Service encountered an error"); throw; } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json b/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json index 598949b6..8ca9ff8a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Tasks/CustomerGet.json @@ -24,5 +24,5 @@ "rateLimitFrequencyInSeconds": 1, "ownerEmail": "undefined@undefined.local", "pollTimeoutSeconds": 0, - "backoffScaleFactor": 0 + "backoffScaleFactor": 1 } \ No newline at end of file diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json index f8d01d60..4dbc2542 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json @@ -38,7 +38,6 @@ } ] }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -54,7 +53,6 @@ "models": [], "objects": [] }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -67,7 +65,7 @@ "test_value" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json index 21bd36aa..96be2f7c 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json @@ -26,7 +26,6 @@ "inputParameters": { "case_value_param": "${workflow.input.operation}" }, - "type": "DECISION", "scriptExpression": "case_value_param", "decisionCases": { "upper": [ @@ -71,7 +70,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DECISION" } ], "inputParameters": [ @@ -79,7 +78,7 @@ "input" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "ownerEmail": "test@test.com", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json index e4a8b83a..50256ad3 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json @@ -10,7 +10,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -25,7 +24,6 @@ "customer_name": "${get_customer.output.name.first_name}", "address": "${get_customer.output.address}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -36,7 +34,7 @@ ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json index 238e9828..dc9703db 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json @@ -10,7 +10,6 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, - "type": "DECISION", "scriptExpression": "case_value_param", "decisionCases": { "YES": [ @@ -20,7 +19,6 @@ "inputParameters": { "id": "${workflow.input.customer_id}" }, - "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", @@ -30,7 +28,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SUB_WORKFLOW" } ] }, @@ -39,7 +37,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DECISION" } ], "inputParameters": [ @@ -47,7 +45,7 @@ "customer_id" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json index c6fb598f..851130ff 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json @@ -10,7 +10,6 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, - "type": "DECISION", "scriptExpression": "case_value_param", "decisionCases": { "YES": [ @@ -20,7 +19,6 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, - "type": "DECISION", "scriptExpression": "case_value_param", "decisionCases": { "YES": [ @@ -30,7 +28,6 @@ "inputParameters": { "id": "${workflow.input.customer_id}" }, - "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", @@ -40,7 +37,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SUB_WORKFLOW" } ] }, @@ -49,7 +46,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DECISION" } ] }, @@ -58,7 +55,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DECISION" } ], "inputParameters": [ @@ -66,7 +63,7 @@ "customer_id" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json index 8c649f76..35059e77 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json @@ -10,7 +10,6 @@ "inputParameters": { "case_value_param": "test" }, - "type": "DECISION", "scriptExpression": "case_value_param", "decisionCases": { "test": [ @@ -20,7 +19,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -37,13 +35,12 @@ "inputParameters": { "terminationStatus": "FAILED" }, - "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "TERMINATE" } ], "startDelay": 0, @@ -51,12 +48,12 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DECISION" } ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json index 70e5098b..d8137a90 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json @@ -12,14 +12,13 @@ "should_use_next": "${workflow.input.should_use_next}", "task_to_execute": "${workflow.input.task_name}" }, - "type": "DYNAMIC", "dynamicTaskNameParam": "task_to_execute", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DYNAMIC" } ], "inputParameters": [ @@ -29,7 +28,7 @@ "should_use_next" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json index 6c9677ff..0864d7f6 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json @@ -10,7 +10,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -24,7 +23,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -38,7 +36,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -52,7 +49,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -66,7 +62,6 @@ "inputParameters": { "customer_id": 34 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -81,7 +76,6 @@ "name": "1:1:1:1:1", "address": "${workflow.input.username}@test.com" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -94,7 +88,7 @@ "username" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json index 15f27de6..2f1fe4cf 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json @@ -8,18 +8,17 @@ "name": "HUMAN_human_task", "taskReferenceName": "human_task", "inputParameters": {}, - "type": "HUMAN", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "HUMAN" } ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json index f32c008e..b0bfa007 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json @@ -11,7 +11,6 @@ "customer_name": "${workflow.input.dictionary['test'].customer_name}", "address": "${workflow.input.double_dictionary['test']['address']}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -25,7 +24,7 @@ "double_dictionary" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json index 4c14c896..97c39352 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json @@ -19,7 +19,6 @@ } ] }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -30,7 +29,7 @@ ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json index 063979bb..bf066eb8 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json @@ -20,7 +20,6 @@ } } }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -31,7 +30,7 @@ ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json index 054ec2da..468f7b8a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json @@ -10,7 +10,6 @@ "inputParameters": { "id": "${workflow.input.customer_id}" }, - "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", @@ -20,14 +19,14 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SUB_WORKFLOW" } ], "inputParameters": [ "customer_id" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json index 111fda1e..b7cbd75b 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json @@ -32,7 +32,7 @@ ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json index c1344166..9e5a62c9 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json @@ -11,7 +11,6 @@ "task_names": "task1,task2", "workflow_id": "${workflow.input.workflow_id}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -25,7 +24,6 @@ "inputParameters": { "seconds": "${workflow.input.seconds}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -39,7 +37,7 @@ "workflow_id" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json index fd45dea8..7c0c6e0a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json @@ -10,7 +10,6 @@ "inputParameters": { "input_one": "${workflow.input.customer_id}" }, - "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "SCAFFOLDED_one", @@ -20,7 +19,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SUB_WORKFLOW" }, { "name": "SCAFFOLDED_two", @@ -28,7 +27,6 @@ "inputParameters": { "name": "${scaff_one.output.output_one}" }, - "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "SCAFFOLDED_two", @@ -38,14 +36,14 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SUB_WORKFLOW" } ], "inputParameters": [ "customer_id" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json index 66c7e21a..5b8a29fb 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json @@ -10,7 +10,6 @@ "inputParameters": { "id": "${workflow.input.id}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -25,7 +24,6 @@ "address": "${get_customer.output.address}", "name": "${get_customer.output.name}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -38,7 +36,7 @@ "id" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json index 3cd4ee1b..d631014c 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json @@ -11,20 +11,19 @@ "input": "1Str_2Str_${workflow.input.input}My input: ${workflow.input.input}string_addition1", "scriptExpression": "" }, - "type": "LAMBDA", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "LAMBDA" } ], "inputParameters": [ "input" ], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json index 40f5fe1f..e27cd2a8 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json @@ -11,7 +11,6 @@ "address": "${workflow.input.first_input},${workflow.input.second_input},Value,0", "name": "Workflow name: TEST_StringInterpolation" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -27,7 +26,7 @@ "outputParameters": { "email_body": "${email_prepare.output.email_body}" }, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json index 4a7e02da..18273894 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json @@ -10,7 +10,6 @@ "inputParameters": { "switch_case_value": "test" }, - "type": "SWITCH", "decisionCases": { "test": [ { @@ -19,7 +18,6 @@ "inputParameters": { "customer_id": 1 }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -36,13 +34,12 @@ "inputParameters": { "terminationStatus": "FAILED" }, - "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "TERMINATE" } ], "startDelay": 0, @@ -52,12 +49,12 @@ "retryCount": 0, "evaluatorType": "value-param", "expression": "switch_case_value", - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SWITCH" } ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json index fd3e8b80..111db425 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json @@ -8,7 +8,6 @@ "name": "CUSTOMER_get", "taskReferenceName": "get_customer", "inputParameters": {}, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -30,7 +29,6 @@ "task_type": "${get_customer.taskType}", "correlation_id": "${get_customer.correlationId}" }, - "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -41,7 +39,7 @@ ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json index 2a7d0e53..d3f84f00 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json @@ -10,7 +10,6 @@ "inputParameters": { "case_value_param": "value" }, - "type": "DECISION", "scriptExpression": "case_value_param", "decisionCases": { "value": [ @@ -23,13 +22,12 @@ }, "terminationStatus": "COMPLETED" }, - "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "TERMINATE" } ] }, @@ -38,7 +36,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "DECISION" }, { "name": "SWITCH_switch_task", @@ -46,7 +44,6 @@ "inputParameters": { "switch_case_value": "value" }, - "type": "SWITCH", "decisionCases": { "value": [ { @@ -58,13 +55,12 @@ }, "terminationStatus": "FAILED" }, - "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "TERMINATE" } ] }, @@ -75,7 +71,7 @@ "retryCount": 0, "evaluatorType": "value-param", "expression": "switch_case_value", - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SWITCH" }, { "name": "TERMINATE_terminate", @@ -86,18 +82,17 @@ "property": "Test" } }, - "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "TERMINATE" } ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json index 48a14782..a5378cb1 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json @@ -8,7 +8,6 @@ "name": "TEST_subworkflow", "taskReferenceName": "test_subworkflow", "inputParameters": {}, - "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "TEST_subworkflow", @@ -18,12 +17,12 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "SUB_WORKFLOW" } ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json index 9ae1c8a0..8bd7bdb3 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json @@ -11,18 +11,17 @@ "duration": "1s", "until": "2022-12-31 11:59" }, - "type": "WAIT", "startDelay": 0, "optional": false, "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "WAIT" } ], "inputParameters": [], "outputParameters": {}, - "schemaVersion": 0, + "schemaVersion": 2, "restartable": false, "workflowStatusListenerEnabled": false, "timeoutPolicy": "TIME_OUT_WF", From 09d70c95bd6880ad014a1bb9605b87cf64926960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:05:46 +0100 Subject: [PATCH 14/33] various fixes #2 --- src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs | 8 ++++++-- .../Samples/Workflows/CSharpLambdaWorkflow.json | 2 +- .../ConditionallySendCustomerNotificationOutput.json | 2 +- .../Samples/Workflows/DecisionInDecision.json | 4 ++-- .../Samples/Workflows/DecisionTask.json | 2 +- .../Samples/Workflows/TerminateTaskWorkflow.json | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index 3d6dd63c..ab99f070 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -14,6 +14,7 @@ namespace ConductorSharp.Engine.Builders { public static class DecisionTaskExtensions { + [Obsolete("Switch tasks should be used")] public static ITaskOptionsBuilder AddTask( this ITaskSequenceBuilder builder, Expression> taskSelector, @@ -74,19 +75,21 @@ internal DecisionTaskBuilder AddCase(string caseName) return this; } + public override WorkflowTask[] Build() { var decisionTaskName = $"DECISION_{_taskRefferenceName}"; +#pragma warning disable CS0612 // Type or member is obsolete return [ - new() + new WorkflowTask() { Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, InputParameters = _inputParameters.ToObject>(), WorkflowTaskType = WorkflowTaskType.DECISION, - ScriptExpression = "case_value_param", + CaseExpression = "case_value_param", DecisionCases = new JObject { _caseDictionary.Select( @@ -96,6 +99,7 @@ public override WorkflowTask[] Build() DefaultCase = _defaultCase?.SelectMany(builder => builder.Build()).ToArray() } ]; +#pragma warning restore CS0612 // Type or member is obsolete } public void AddTaskBuilderToSequence(ITaskBuilder builder) diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json index 96be2f7c..6401393c 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json @@ -26,7 +26,7 @@ "inputParameters": { "case_value_param": "${workflow.input.operation}" }, - "scriptExpression": "case_value_param", + "caseExpression": "case_value_param", "decisionCases": { "upper": [ { diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json index dc9703db..d44d4cf9 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json @@ -10,7 +10,7 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, - "scriptExpression": "case_value_param", + "caseExpression": "case_value_param", "decisionCases": { "YES": [ { diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json index 851130ff..81e7d963 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json @@ -10,7 +10,7 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, - "scriptExpression": "case_value_param", + "caseExpression": "case_value_param", "decisionCases": { "YES": [ { @@ -19,7 +19,7 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, - "scriptExpression": "case_value_param", + "caseExpression": "case_value_param", "decisionCases": { "YES": [ { diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json index 35059e77..d083c3ed 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json @@ -10,7 +10,7 @@ "inputParameters": { "case_value_param": "test" }, - "scriptExpression": "case_value_param", + "caseExpression": "case_value_param", "decisionCases": { "test": [ { diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json index d3f84f00..e9426f42 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json @@ -10,7 +10,7 @@ "inputParameters": { "case_value_param": "value" }, - "scriptExpression": "case_value_param", + "caseExpression": "case_value_param", "decisionCases": { "value": [ { From 2943447acaa9ca41fd0ad3146fde2972da8986fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:33:45 +0100 Subject: [PATCH 15/33] align names --- .../Controllers/WorkflowController.cs | 4 ++-- .../Service/AdminService.cs | 10 ++++----- .../Service/EventService.cs | 4 ++-- .../Service/ExternalPayloadService.cs | 6 ++---- .../Service/HealthService.cs | 2 -- .../Service/IAdminService.cs | 15 ++++++++----- .../Service/IEventService.cs | 2 +- .../Service/IExternalPayloadService.cs | 2 +- .../Service/IMetadataService.cs | 21 ++++++++----------- .../Service/IQueueAdminService.cs | 8 +++---- .../Service/ITaskService.cs | 2 +- .../Service/IWorkflowBulkService.cs | 10 ++++----- .../Service/IWorkflowService.cs | 2 +- .../Service/MetadataService.cs | 14 ++++++------- .../Service/QueueAdminService.cs | 8 +++---- .../Service/TaskService.cs | 4 ++-- .../Service/WorkflowBulkService.cs | 10 ++++----- .../Service/WorkflowService.cs | 2 +- src/ConductorSharp.Engine/ExecutionManager.cs | 2 +- .../Service/DeploymentService.cs | 6 +++--- .../Service/ScaffoldingService.cs | 4 ++-- 21 files changed, 68 insertions(+), 70 deletions(-) diff --git a/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs b/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs index 8ddf2521..2adf5f95 100644 --- a/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs +++ b/examples/ConductorSharp.ApiEnabled/Controllers/WorkflowController.cs @@ -22,10 +22,10 @@ public WorkflowController(IMetadataService metadataService, IWorkflowService wor } [HttpGet("get-workflows")] - public async Task> GetRegisteredWorkflows() => await _metadataService.GetAllWorkflowsAsync(); + public async Task> GetRegisteredWorkflows() => await _metadataService.ListWorkflowsAsync(); [HttpGet("get-task-logs")] - public async Task> GetTaskLogs(string taskId) => await _taskService.GetLogsAsync(taskId); + public async Task> GetTaskLogs(string taskId) => await _taskService.ListLogsAsync(taskId); [HttpGet("get-executions")] public async Task SearchWorkflows([FromQuery] int? start = null, [FromQuery] int? size = null) => diff --git a/src/ConductorSharp.Client/Service/AdminService.cs b/src/ConductorSharp.Client/Service/AdminService.cs index 678cc080..72853613 100644 --- a/src/ConductorSharp.Client/Service/AdminService.cs +++ b/src/ConductorSharp.Client/Service/AdminService.cs @@ -4,22 +4,22 @@ namespace ConductorSharp.Client.Service { public class AdminService(ConductorClient client) : IAdminService { - public async Task QueueWorkflowsForSweep(string workflowId, CancellationToken cancellationToken = default) + public async Task QueueRunningWorkflowsForSweepAsync(string workflowId, CancellationToken cancellationToken = default) => await client.RequeueSweepAsync(workflowId, cancellationToken); - public async Task VerifyAndRepairWorkflowConsistency(string workflowId, + public async Task VerifyAndRepairWorkflowConsistencyAsync(string workflowId, CancellationToken cancellationToken = default) => await client.VerifyAndRepairWorkflowConsistencyAsync(workflowId, cancellationToken); - public async Task> GetPendingTasks(string taskType, int? start, int? count, + public async Task> ListPendingTasksAsync(string taskType, int? start, int? count, CancellationToken cancellationToken = default) => await client.ViewAsync(taskType, start, count, cancellationToken); - public async Task> GetEventQueuesAsync(bool? verbose, + public async Task> GetEventQueueMapAsync(bool? verbose, CancellationToken cancellationToken = default) => await client.GetEventQueuesAsync(verbose, cancellationToken); - public async Task> GetAllConfigAsync(CancellationToken cancellationToken = default) + public async Task> GetConfigMapAsync(CancellationToken cancellationToken = default) => await client.GetAllConfigAsync(cancellationToken); } } diff --git a/src/ConductorSharp.Client/Service/EventService.cs b/src/ConductorSharp.Client/Service/EventService.cs index 101f052e..d816ba06 100644 --- a/src/ConductorSharp.Client/Service/EventService.cs +++ b/src/ConductorSharp.Client/Service/EventService.cs @@ -5,7 +5,7 @@ namespace ConductorSharp.Client.Service { public class EventService(ConductorClient client) : IEventService { - public async Task> ListAsync(CancellationToken cancellationToken = default) + public async Task> ListAsync(CancellationToken cancellationToken = default) => await client.GetEventHandlersAsync(cancellationToken); public async Task UpdateAsync(EventHandler eventHandler, CancellationToken cancellationToken = default) @@ -14,7 +14,7 @@ public async Task UpdateAsync(EventHandler eventHandler, CancellationToken cance public async Task AddAsync(EventHandler eventHandler, CancellationToken cancellationToken = default) => await client.AddEventHandlerAsync(eventHandler, cancellationToken); - public async Task GetEventHandlersForEventAsync(string @event, bool? activeOnly = null, + public async Task> ListForEventAsync(string @event, bool? activeOnly = null, CancellationToken cancellationToken = default) => await client.GetEventHandlersForEventAsync(@event, activeOnly, cancellationToken); diff --git a/src/ConductorSharp.Client/Service/ExternalPayloadService.cs b/src/ConductorSharp.Client/Service/ExternalPayloadService.cs index fe110fbf..a8938b47 100644 --- a/src/ConductorSharp.Client/Service/ExternalPayloadService.cs +++ b/src/ConductorSharp.Client/Service/ExternalPayloadService.cs @@ -1,12 +1,10 @@ -using System.Threading; -using System.Threading.Tasks; -using ConductorSharp.Client.Generated; +using ConductorSharp.Client.Generated; namespace ConductorSharp.Client.Service { public class ExternalPayloadService(ConductorClient client) : IExternalPayloadService { - public async Task GetExternalStorageData(string externalPayloadPath, + public async Task GetExternalStorageDataAsync(string externalPayloadPath, CancellationToken cancellationToken = default) => await client.GetExternalStorageDataAsync(externalPayloadPath, cancellationToken); } diff --git a/src/ConductorSharp.Client/Service/HealthService.cs b/src/ConductorSharp.Client/Service/HealthService.cs index 1b47fab9..48d8cec9 100644 --- a/src/ConductorSharp.Client/Service/HealthService.cs +++ b/src/ConductorSharp.Client/Service/HealthService.cs @@ -1,6 +1,4 @@ using ConductorSharp.Client.Generated; -using System.Threading; -using System.Threading.Tasks; namespace ConductorSharp.Client.Service { diff --git a/src/ConductorSharp.Client/Service/IAdminService.cs b/src/ConductorSharp.Client/Service/IAdminService.cs index 3a3b2f37..c8641a9d 100644 --- a/src/ConductorSharp.Client/Service/IAdminService.cs +++ b/src/ConductorSharp.Client/Service/IAdminService.cs @@ -9,26 +9,31 @@ public interface IAdminService /// /// Get all the configuration parameters /// - Task> GetAllConfigAsync(CancellationToken cancellationToken = default); + Task> GetConfigMapAsync(CancellationToken cancellationToken = default); /// /// Get registered queues /// - Task> GetEventQueuesAsync(bool? verbose, CancellationToken cancellationToken = default); + Task> GetEventQueueMapAsync(bool? verbose, CancellationToken cancellationToken = default); /// /// Get the list of pending tasks for a given task type /// - Task> GetPendingTasks(string taskType, int? start, int? count, CancellationToken cancellationToken = default); + Task> ListPendingTasksAsync( + string taskType, + int? start, + int? count, + CancellationToken cancellationToken = default + ); /// /// Queue up all the running workflows for sweep /// - Task QueueWorkflowsForSweep(string workflowId, CancellationToken cancellationToken = default); + Task QueueRunningWorkflowsForSweepAsync(string workflowId, CancellationToken cancellationToken = default); /// /// Verify and repair workflow consistency /// - Task VerifyAndRepairWorkflowConsistency(string workflowId, CancellationToken cancellationToken = default); + Task VerifyAndRepairWorkflowConsistencyAsync(string workflowId, CancellationToken cancellationToken = default); } } diff --git a/src/ConductorSharp.Client/Service/IEventService.cs b/src/ConductorSharp.Client/Service/IEventService.cs index c9218a50..9029f203 100644 --- a/src/ConductorSharp.Client/Service/IEventService.cs +++ b/src/ConductorSharp.Client/Service/IEventService.cs @@ -13,7 +13,7 @@ public interface IEventService /// /// Get event handlers for a given event /// - Task GetEventHandlersForEventAsync(string @event, bool? activeOnly = null, CancellationToken cancellationToken = default); + Task> ListForEventAsync(string @event, bool? activeOnly = null, CancellationToken cancellationToken = default); /// /// Get all the event handlers diff --git a/src/ConductorSharp.Client/Service/IExternalPayloadService.cs b/src/ConductorSharp.Client/Service/IExternalPayloadService.cs index 74417da5..ebfcc38f 100644 --- a/src/ConductorSharp.Client/Service/IExternalPayloadService.cs +++ b/src/ConductorSharp.Client/Service/IExternalPayloadService.cs @@ -9,6 +9,6 @@ public interface IExternalPayloadService /// /// Get task or workflow by externalPayloadPath from External PostgreSQL Storage /// - Task GetExternalStorageData(string externalPayloadPath, CancellationToken cancellationToken = default); + Task GetExternalStorageDataAsync(string externalPayloadPath, CancellationToken cancellationToken = default); } } diff --git a/src/ConductorSharp.Client/Service/IMetadataService.cs b/src/ConductorSharp.Client/Service/IMetadataService.cs index b064e8a7..fd790964 100644 --- a/src/ConductorSharp.Client/Service/IMetadataService.cs +++ b/src/ConductorSharp.Client/Service/IMetadataService.cs @@ -1,7 +1,4 @@ using ConductorSharp.Client.Generated; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; namespace ConductorSharp.Client.Service; @@ -10,22 +7,22 @@ public interface IMetadataService /// /// Create a new workflow definition /// - System.Threading.Tasks.Task CreateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); + Task AddWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); /// /// Remove a task definition /// - System.Threading.Tasks.Task DeleteTaskDefAsync(string taskType, CancellationToken cancellationToken = default); + Task DeleteTaskAsync(string taskType, CancellationToken cancellationToken = default); /// /// Removes workflow definition. It does not remove workflows associated with the definition. /// - System.Threading.Tasks.Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default); + Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default); /// /// Retrieves all workflow definition along with blueprint /// - Task> GetAllWorkflowsAsync(CancellationToken cancellationToken = default); + Task> ListWorkflowsAsync(CancellationToken cancellationToken = default); /// /// Returns only the latest version of all workflow definitions @@ -35,12 +32,12 @@ public interface IMetadataService /// /// Gets the task definition /// - Task GetTaskDefAsync(string taskType, CancellationToken cancellationToken = default); + Task GetTaskAsync(string taskType, CancellationToken cancellationToken = default); /// /// Gets all task definition /// - Task> GetTaskDefsAsync(CancellationToken cancellationToken = default); + Task> ListTasksAsync(CancellationToken cancellationToken = default); /// /// Retrieves workflow definition along with blueprint @@ -55,12 +52,12 @@ public interface IMetadataService /// /// Update an existing task /// - System.Threading.Tasks.Task RegisterTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default); + Task AddTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default); /// /// Create new task definition(s) /// - System.Threading.Tasks.Task RegisterTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default); + Task AddTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default); /// /// Create or update workflow definition @@ -70,5 +67,5 @@ public interface IMetadataService /// /// Validates a new workflow definition /// - System.Threading.Tasks.Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); + Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default); } diff --git a/src/ConductorSharp.Client/Service/IQueueAdminService.cs b/src/ConductorSharp.Client/Service/IQueueAdminService.cs index 310e821b..d1872c8d 100644 --- a/src/ConductorSharp.Client/Service/IQueueAdminService.cs +++ b/src/ConductorSharp.Client/Service/IQueueAdminService.cs @@ -15,13 +15,13 @@ public interface IQueueAdminService /// /// Get Queue Names /// - Task> GetQueueNames(CancellationToken cancellationToken = default); + Task> GetQueueNamesAsync(CancellationToken cancellationToken = default); /// /// Publish a message in queue to mark a wait task as completed. /// - Task MarkWaitTaskAsAsync( - string workflowid, + Task MarkWaitTaskCompletedAsync( + string workflowId, string taskRefName, Status status, IDictionary output, @@ -31,7 +31,7 @@ Task MarkWaitTaskAsAsync( /// /// Publish a message in queue to mark a wait task (by taskId) as completed. /// - Task MarkWaitTaskByTaskIdAsAsync( + Task MarkWaitTaskCompletedAsync( string workflowId, string taskId, Status2 status, diff --git a/src/ConductorSharp.Client/Service/ITaskService.cs b/src/ConductorSharp.Client/Service/ITaskService.cs index 21ac2702..81923538 100644 --- a/src/ConductorSharp.Client/Service/ITaskService.cs +++ b/src/ConductorSharp.Client/Service/ITaskService.cs @@ -50,7 +50,7 @@ Task GetExternalStorageLocationAsync( /// /// /// - Task> GetLogsAsync(string taskId, CancellationToken cancellationToken = default); + Task> ListLogsAsync(string taskId, CancellationToken cancellationToken = default); /// /// Get the last poll data for a given task type diff --git a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs index e3670458..b910afb6 100644 --- a/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs +++ b/src/ConductorSharp.Client/Service/IWorkflowBulkService.cs @@ -7,27 +7,27 @@ public interface IWorkflowBulkService /// /// Resume the list of workflows /// - Task ResumeWorkflowsAsyncAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + Task ResumeAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); /// /// Pause the list of workflows /// - Task PauseWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + Task PauseAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); /// /// Terminate workflows execution /// - Task TerminateWorkflowsAsync(IEnumerable worklowIds, string? reason = null, CancellationToken cancellationToken = default); + Task TerminateAsync(IEnumerable worklowIds, string? reason = null, CancellationToken cancellationToken = default); /// /// Retry the last failed task for each workflow from the list /// - Task RetryWorkflowsAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); + Task RetryAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default); /// /// Restart the list of completed workflow /// - Task RestartWorkflowsAsync( + Task RestartAsync( IEnumerable workflowIds, bool? useLatestDefinitions = null, CancellationToken cancellationToken = default diff --git a/src/ConductorSharp.Client/Service/IWorkflowService.cs b/src/ConductorSharp.Client/Service/IWorkflowService.cs index 502b6ed2..d9140868 100644 --- a/src/ConductorSharp.Client/Service/IWorkflowService.cs +++ b/src/ConductorSharp.Client/Service/IWorkflowService.cs @@ -28,7 +28,7 @@ Task>> GetCorrelatedAsync( /// /// Lists workflows for the given correlation id /// - Task> GetCorrelatedAsync( + Task> ListCorrelatedAsync( string name, string correlationId, bool? includeClosed = false, diff --git a/src/ConductorSharp.Client/Service/MetadataService.cs b/src/ConductorSharp.Client/Service/MetadataService.cs index 02c6cc1a..08ed0980 100644 --- a/src/ConductorSharp.Client/Service/MetadataService.cs +++ b/src/ConductorSharp.Client/Service/MetadataService.cs @@ -4,22 +4,22 @@ namespace ConductorSharp.Client.Service { public class MetadataService(ConductorClient client) : IMetadataService { - public async Task> GetAllWorkflowsAsync(CancellationToken cancellationToken = default) + public async Task> ListWorkflowsAsync(CancellationToken cancellationToken = default) => await client.GetAllAsync(cancellationToken); public async Task UpdateWorkflowsAsync(IEnumerable workflows, CancellationToken cancellationToken = default) => await client.UpdateAsync(workflows, cancellationToken); - public async Task CreateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default) + public async Task AddWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default) => await client.CreateAsync(workflowDef, cancellationToken); - public async Task> GetTaskDefsAsync(CancellationToken cancellationToken = default) + public async Task> ListTasksAsync(CancellationToken cancellationToken = default) => await client.GetTaskDefsAsync(cancellationToken); - public async Task RegisterTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default) + public async Task AddTaskAsync(TaskDef taskDef, CancellationToken cancellationToken = default) => await client.RegisterTaskDefAsync(taskDef, cancellationToken); - public async Task RegisterTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default) + public async Task AddTasksAsync(IEnumerable taskDefs, CancellationToken cancellationToken = default) => await client.RegisterTaskDef_1Async(taskDefs, cancellationToken); public async Task ValidateWorkflowAsync(WorkflowDef workflowDef, CancellationToken cancellationToken = default) @@ -37,10 +37,10 @@ public async Task> GetAllWorkflowsWithLatestVersionsAsy CancellationToken cancellationToken = default) => await client.GetAllWorkflowsWithLatestVersionsAsync(cancellationToken); - public async Task GetTaskDefAsync(string taskType, CancellationToken cancellationToken = default) + public async Task GetTaskAsync(string taskType, CancellationToken cancellationToken = default) => await client.GetTaskDefAsync(taskType, cancellationToken); - public async Task DeleteTaskDefAsync(string taskType, CancellationToken cancellationToken = default) + public async Task DeleteTaskAsync(string taskType, CancellationToken cancellationToken = default) => await client.UnregisterTaskDefAsync(taskType, cancellationToken); public async Task DeleteWorkflowAsync(string name, int version, CancellationToken cancellationToken = default) diff --git a/src/ConductorSharp.Client/Service/QueueAdminService.cs b/src/ConductorSharp.Client/Service/QueueAdminService.cs index a8d97e56..99a722ec 100644 --- a/src/ConductorSharp.Client/Service/QueueAdminService.cs +++ b/src/ConductorSharp.Client/Service/QueueAdminService.cs @@ -4,17 +4,17 @@ namespace ConductorSharp.Client.Service; public class QueueAdminService(ConductorClient client) : IQueueAdminService { - public async Task MarkWaitTaskAsAsync(string workflowid, string taskRefName, Status status, + public async Task MarkWaitTaskCompletedAsync(string workflowId, string taskRefName, Status status, IDictionary output, CancellationToken cancellationToken = default) - => await client.Update_1Async(workflowid, taskRefName, status, output, cancellationToken); + => await client.Update_1Async(workflowId, taskRefName, status, output, cancellationToken); - public async Task MarkWaitTaskByTaskIdAsAsync(string workflowId, string taskId, Status2 status, + public async Task MarkWaitTaskCompletedAsync(string workflowId, string taskId, Status2 status, IDictionary output, CancellationToken cancellationToken = default) => await client.UpdateByTaskIdAsync(workflowId, taskId, status, output, cancellationToken); public async Task> GetQueueLengthAsync(CancellationToken cancellationToken = default) => await client.Size_1Async(cancellationToken); - public async Task> GetQueueNames(CancellationToken cancellationToken = default) + public async Task> GetQueueNamesAsync(CancellationToken cancellationToken = default) => await client.NamesAsync(cancellationToken); } \ No newline at end of file diff --git a/src/ConductorSharp.Client/Service/TaskService.cs b/src/ConductorSharp.Client/Service/TaskService.cs index 6ec6764e..79081fa6 100644 --- a/src/ConductorSharp.Client/Service/TaskService.cs +++ b/src/ConductorSharp.Client/Service/TaskService.cs @@ -9,7 +9,7 @@ public class TaskService(ConductorClient client) : ITaskService public async Task UpdateAsync(TaskResult updateRequest, CancellationToken cancellationToken = default) => await _client.UpdateTaskAsync(updateRequest, cancellationToken); - public async Task> GetLogsAsync(string taskId, CancellationToken cancellationToken = default) + public async Task> ListLogsAsync(string taskId, CancellationToken cancellationToken = default) => await _client.GetTaskLogsAsync(taskId, cancellationToken); public async Task LogAsync(string taskId, string message, CancellationToken cancellationToken = default) @@ -18,7 +18,7 @@ public async Task LogAsync(string taskId, string message, CancellationToken canc public async Task RequeuePendingAsync(string taskType, CancellationToken cancellationToken = default) => await _client.RequeuePendingTaskAsync(taskType, cancellationToken); - public async Task GetAsync(string taskId, CancellationToken cancellationToken = default) + public async Task GetAsync(string taskId, CancellationToken cancellationToken = default) => await _client.GetTaskAsync(taskId, cancellationToken); public async Task SearchAsync(int? start = null, int? size = null, string? sort = null, string? freeText = null, string? query = null, CancellationToken cancellationToken = default) diff --git a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs index 6f546c0f..564d0d85 100644 --- a/src/ConductorSharp.Client/Service/WorkflowBulkService.cs +++ b/src/ConductorSharp.Client/Service/WorkflowBulkService.cs @@ -4,23 +4,23 @@ namespace ConductorSharp.Client.Service; public class WorkflowBulkService(ConductorClient client) : IWorkflowBulkService { - public async Task ResumeWorkflowsAsyncAsync(IEnumerable workflowIds, + public async Task ResumeAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default) => await client.ResumeWorkflow_1Async(workflowIds, cancellationToken); - public async Task PauseWorkflowsAsync(IEnumerable workflowIds, + public async Task PauseAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default) => await client.PauseWorkflow_1Async(workflowIds, cancellationToken); - public async Task TerminateWorkflowsAsync(IEnumerable worklowIds, string? reason = null, + public async Task TerminateAsync(IEnumerable worklowIds, string? reason = null, CancellationToken cancellationToken = default) => await client.TerminateAsync(worklowIds, reason, cancellationToken); - public async Task RetryWorkflowsAsync(IEnumerable workflowIds, + public async Task RetryAsync(IEnumerable workflowIds, CancellationToken cancellationToken = default) => await client.Retry_1Async(workflowIds, cancellationToken); - public async Task RestartWorkflowsAsync(IEnumerable workflowIds, + public async Task RestartAsync(IEnumerable workflowIds, bool? useLatestDefinition = null, CancellationToken cancellationToken = default) => await client.Restart_1Async(workflowIds, useLatestDefinition, cancellationToken); diff --git a/src/ConductorSharp.Client/Service/WorkflowService.cs b/src/ConductorSharp.Client/Service/WorkflowService.cs index bc37ad7b..dc771dc0 100644 --- a/src/ConductorSharp.Client/Service/WorkflowService.cs +++ b/src/ConductorSharp.Client/Service/WorkflowService.cs @@ -93,7 +93,7 @@ public async Task TerminateAsync(string workflowId, string? reason = null, Cance /// /// Lists workflows for the given correlation id /// - public async Task> GetCorrelatedAsync(string name, string correlationId, bool? includeClosed = false, bool? includeTasks = false, CancellationToken cancellationToken = default) + public async Task> ListCorrelatedAsync(string name, string correlationId, bool? includeClosed = false, bool? includeTasks = false, CancellationToken cancellationToken = default) => await _client.GetWorkflows_1Async(name, correlationId, includeClosed, includeTasks, cancellationToken); diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index 2bc19a33..45d438aa 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -119,7 +119,7 @@ private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken ); // TODO: iffy - var file = await _externalPayloadService.GetExternalStorageData(externalStorageLocation.Path, cancellationToken); + var file = await _externalPayloadService.GetExternalStorageDataAsync(externalStorageLocation.Path, cancellationToken); using TextReader textReader = new StreamReader(file.Stream); var json = textReader.ReadToEnd(); diff --git a/src/ConductorSharp.Engine/Service/DeploymentService.cs b/src/ConductorSharp.Engine/Service/DeploymentService.cs index 3b07061d..8ee5282f 100644 --- a/src/ConductorSharp.Engine/Service/DeploymentService.cs +++ b/src/ConductorSharp.Engine/Service/DeploymentService.cs @@ -17,7 +17,7 @@ public async Task Deploy(Deployment deployment) _logger.LogInformation("Deploying conductor definitions"); if (deployment.TaskDefinitions.Count > 0) - await _metadataService.RegisterTasksAsync(deployment.TaskDefinitions); + await _metadataService.AddTasksAsync(deployment.TaskDefinitions); _logger.LogDebug("Registered {registeredTasksCount} tasks", deployment.TaskDefinitions.Count); @@ -39,10 +39,10 @@ public async Task Remove(Deployment deployment) { foreach (var definition in deployment.TaskDefinitions) { - var oldDefinition = await _metadataService.GetTaskDefAsync(definition.Name); + var oldDefinition = await _metadataService.GetTaskAsync(definition.Name); if (oldDefinition?.Name != null) - await _metadataService.DeleteTaskDefAsync(definition.Name); + await _metadataService.DeleteTaskAsync(definition.Name); } foreach (var definition in deployment.WorkflowDefinitions) diff --git a/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs b/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs index e9617a08..54b28bcc 100644 --- a/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs +++ b/src/ConductorSharp.Toolkit/Service/ScaffoldingService.cs @@ -29,7 +29,7 @@ public async Task Scaffold() if (!_config.IgnoreWorkflows) { - var workflowDefinitions = await _metadataService.GetAllWorkflowsAsync(); + var workflowDefinitions = await _metadataService.ListWorkflowsAsync(); workflowDefinitions = Filter(workflowDefinitions, workflowFilters).ToArray(); var workflowDirectory = Path.Combine(_config.Destination, "Workflows"); Directory.CreateDirectory(workflowDirectory); @@ -51,7 +51,7 @@ public async Task Scaffold() if (!_config.IgnoreTasks) { - var taskDefinitions = await _metadataService.GetTaskDefsAsync(); + var taskDefinitions = await _metadataService.ListTasksAsync(); taskDefinitions = Filter(taskDefinitions, taskFilters).ToArray(); var tasksDirectory = Path.Combine(_config.Destination, "Tasks"); Directory.CreateDirectory(tasksDirectory); From 20f45e8fef3f4ad9c599fdcce723e2b32f3fad61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:41:03 +0100 Subject: [PATCH 16/33] tidy up --- .../Workflows/CSharpLambdaWorkflow.cs | 2 ++ .../Extensions/ConductorSharpBuilder.cs | 2 +- .../Service/WorkflowEngineBackgroundService.cs | 3 --- .../Util/ConfigurationProperty.cs | 12 +++--------- .../Util/EmbeddedFileHelper.cs | 6 +----- .../Util/EnumValueAttribute.cs | 6 ++---- src/ConductorSharp.Engine/Util/ExpressionUtil.cs | 14 +++++++------- src/ConductorSharp.Patterns/Tasks/WaitSeconds.cs | 9 +-------- .../Samples/Workflows/CSharpLambdaWorkflow.cs | 2 ++ .../ConditionallySendCustomerNotificationOutput.cs | 2 ++ .../Samples/Workflows/DecisionInDecision.cs | 2 ++ .../Samples/Workflows/DecisionTask.cs | 11 +++-------- .../Samples/Workflows/TerminateTaskWorfklow.cs | 10 +++------- 13 files changed, 29 insertions(+), 52 deletions(-) diff --git a/examples/ConductorSharp.Definitions/Workflows/CSharpLambdaWorkflow.cs b/examples/ConductorSharp.Definitions/Workflows/CSharpLambdaWorkflow.cs index 7acc8a7a..00c71853 100644 --- a/examples/ConductorSharp.Definitions/Workflows/CSharpLambdaWorkflow.cs +++ b/examples/ConductorSharp.Definitions/Workflows/CSharpLambdaWorkflow.cs @@ -50,6 +50,7 @@ public override void BuildDefinition() } ); +#pragma warning disable CS0618 // Type or member is obsolete _builder.AddTask( wf => wf.DecisionTask, wf => new DecisionTaskInput() { CaseValueParam = wf.WorkflowInput.Operation }, @@ -79,6 +80,7 @@ public override void BuildDefinition() } } ); +#pragma warning restore CS0618 // Type or member is obsolete _builder.SetOptions(options => options.OwnerEmail = "test@test.com"); } diff --git a/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs b/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs index a3f4acae..fb91c4c9 100644 --- a/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs +++ b/src/ConductorSharp.Engine/Extensions/ConductorSharpBuilder.cs @@ -80,7 +80,7 @@ public IConductorSharpBuilder SetBuildConfiguration(BuildConfiguration buildConf { if (buildConfiguration is null) { - throw new ArgumentNullException("Build configuration cannot be null"); + throw new ArgumentNullException(nameof(buildConfiguration)); } Builder.AddSingleton(buildConfiguration); diff --git a/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs b/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs index b571f63d..c8768da5 100644 --- a/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs +++ b/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.Logging; using System; using System.Threading; -using System.Threading.Tasks; using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Engine.Service @@ -13,14 +12,12 @@ namespace ConductorSharp.Engine.Service internal class WorkflowEngineBackgroundService( IConductorSharpHealthService healthService, ILogger logger, - IHostApplicationLifetime hostApplicationLifetime, IDeploymentService deploymentService, ExecutionManager executionManager, ModuleDeployment deployment ) : IHostedService, IDisposable { private readonly ILogger _logger = logger; - private readonly IHostApplicationLifetime _hostApplicationLifetime = hostApplicationLifetime; private readonly IDeploymentService _deploymentService = deploymentService; private readonly ExecutionManager _executionManager = executionManager; private readonly ModuleDeployment _deployment = deployment; diff --git a/src/ConductorSharp.Engine/Util/ConfigurationProperty.cs b/src/ConductorSharp.Engine/Util/ConfigurationProperty.cs index 34ba9509..d3f24c39 100644 --- a/src/ConductorSharp.Engine/Util/ConfigurationProperty.cs +++ b/src/ConductorSharp.Engine/Util/ConfigurationProperty.cs @@ -1,14 +1,8 @@ namespace ConductorSharp.Engine.Util { - public class ConfigurationProperty + public class ConfigurationProperty(string key, object value) { - public ConfigurationProperty(string key, object value) - { - Key = key; - Value = value; - } - - public string Key { get; } - public object Value { get; } + public string Key { get; } = key; + public object Value { get; } = value; } } diff --git a/src/ConductorSharp.Engine/Util/EmbeddedFileHelper.cs b/src/ConductorSharp.Engine/Util/EmbeddedFileHelper.cs index 61fe665a..5ac59da1 100644 --- a/src/ConductorSharp.Engine/Util/EmbeddedFileHelper.cs +++ b/src/ConductorSharp.Engine/Util/EmbeddedFileHelper.cs @@ -11,11 +11,7 @@ internal static class EmbeddedFileHelper { private static string ReadAssemblyFile(Assembly assembly, string name) { - var stream = assembly.GetManifestResourceStream(name); - - if (stream == null) - throw new InvalidOperationException($"Resource {name} does not exist."); - + var stream = assembly.GetManifestResourceStream(name) ?? throw new InvalidOperationException($"Resource {name} does not exist."); using var reader = new StreamReader(stream, Encoding.UTF8); return reader.ReadToEnd(); diff --git a/src/ConductorSharp.Engine/Util/EnumValueAttribute.cs b/src/ConductorSharp.Engine/Util/EnumValueAttribute.cs index 9e06add1..2a8c3278 100644 --- a/src/ConductorSharp.Engine/Util/EnumValueAttribute.cs +++ b/src/ConductorSharp.Engine/Util/EnumValueAttribute.cs @@ -3,10 +3,8 @@ namespace ConductorSharp.Engine.Util { [AttributeUsage(AttributeTargets.Field)] - public class EnumValueAttribute : Attribute + public class EnumValueAttribute(object value) : Attribute { - internal object Value { get; } - - public EnumValueAttribute(object value) => Value = value; + internal object Value { get; } = value; } } diff --git a/src/ConductorSharp.Engine/Util/ExpressionUtil.cs b/src/ConductorSharp.Engine/Util/ExpressionUtil.cs index 84005a56..2db9dcfb 100644 --- a/src/ConductorSharp.Engine/Util/ExpressionUtil.cs +++ b/src/ConductorSharp.Engine/Util/ExpressionUtil.cs @@ -1,4 +1,5 @@ using ConductorSharp.Engine.Builders; +using ConductorSharp.Engine.Exceptions; using ConductorSharp.Engine.Interface; using Newtonsoft.Json.Linq; using System; @@ -6,7 +7,6 @@ using System.Linq; using System.Linq.Expressions; using System.Reflection; -using ConductorSharp.Engine.Exceptions; namespace ConductorSharp.Engine.Util { @@ -14,7 +14,7 @@ public static class ExpressionUtil { public static string ParseToReferenceName(Expression expression) { - if (!(expression is MemberExpression taskSelectExpression)) + if (expression is not MemberExpression taskSelectExpression) throw new NotSupportedException($"Only {nameof(MemberExpression)} expression allowed"); return SnakeCaseUtil.ToSnakeCase(taskSelectExpression.Member.Name); @@ -22,7 +22,7 @@ public static string ParseToReferenceName(Expression expression) public static Type ParseToType(Expression expression) { - if (!(expression is MemberExpression taskSelectExpression)) + if (expression is not MemberExpression taskSelectExpression) throw new NotSupportedException($"Only {nameof(MemberExpression)} expression allowed"); return ((PropertyInfo)taskSelectExpression.Member).PropertyType; @@ -99,9 +99,9 @@ private static object CompileStringInterpolationExpression(MethodCallExpression { var interpolationArguments = GetInterpolationArguments(methodExpression); var expressionStrings = interpolationArguments.Select(CompileInterpolatedStringArgument).ToArray(); - var formatExpr = methodExpression.Arguments[0] as ConstantExpression; - if (formatExpr == null) - throw new NotSupportedException("string.Format with non constant format string is not supported"); + var formatExpr = + methodExpression.Arguments[0] as ConstantExpression + ?? throw new NotSupportedException("string.Format with non constant format string is not supported"); var formatString = (string)formatExpr.Value; return string.Format(formatString, expressionStrings); } @@ -219,7 +219,7 @@ expression is NewExpression newExpression { foreach ( var member in newExpression.Arguments.Zip( - newExpression.Members ?? (IEnumerable)new List(), + newExpression.Members ?? (IEnumerable)[], (expression, memberInfo) => (expression, memberInfo) ) ) diff --git a/src/ConductorSharp.Patterns/Tasks/WaitSeconds.cs b/src/ConductorSharp.Patterns/Tasks/WaitSeconds.cs index e4b8cb20..665ff567 100644 --- a/src/ConductorSharp.Patterns/Tasks/WaitSeconds.cs +++ b/src/ConductorSharp.Patterns/Tasks/WaitSeconds.cs @@ -2,11 +2,8 @@ using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using MediatR; -using Microsoft.Extensions.Logging; using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; using System.Threading; using System.Threading.Tasks; @@ -28,13 +25,9 @@ public class WaitSecondsRequest : IRequest [OriginalName(Constants.TaskNamePrefix + "_wait_seconds")] public class WaitSeconds : TaskRequestHandler { - private readonly ILogger _logger; - - public WaitSeconds(ILogger logger) => _logger = logger; - public async override Task Handle(WaitSecondsRequest input, CancellationToken cancellationToken) { - await Task.Delay(input.Seconds * 1000); + await Task.Delay(input.Seconds * 1000, cancellationToken); return new NoOutput(); } } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.cs index 11b78d88..d5bee19e 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.cs @@ -47,6 +47,7 @@ public override void BuildDefinition() } ); +#pragma warning disable CS0618 // Type or member is obsolete _builder.AddTask( wf => wf.DecisionTask, wf => new() { CaseValueParam = wf.WorkflowInput.Operation }, @@ -76,6 +77,7 @@ public override void BuildDefinition() } } ); +#pragma warning restore CS0618 // Type or member is obsolete _builder.SetOptions(options => options.OwnerEmail = "test@test.com"); } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.cs index 08dbc32f..6bb27540 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.cs @@ -26,6 +26,7 @@ public ConditionallySendCustomerNotification( public override void BuildDefinition() { +#pragma warning disable CS0618 // Type or member is obsolete _builder.AddTask( wf => wf.SendNotificationDecision, wf => new() { CaseValueParam = wf.WorkflowInput.ShouldSendNotification }, @@ -34,5 +35,6 @@ public override void BuildDefinition() ["YES"] = builder => builder.AddTask(c => c.SendNotificationSubworkflow, wf => new() { CustomerId = wf.WorkflowInput.CustomerId }) } ); +#pragma warning restore CS0618 // Type or member is obsolete } } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.cs index 45328b01..69fb57da 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.cs @@ -26,6 +26,7 @@ public DecisionInDecision(WorkflowDefinitionBuilder wf.SendNotificationDecision, wf => new() { CaseValueParam = wf.WorkflowInput.ShouldSendNotification }, @@ -43,6 +44,7 @@ public override void BuildDefinition() ) } ); +#pragma warning restore CS0618 // Type or member is obsolete } } } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.cs index 9552b5a0..4e79383a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.cs @@ -1,11 +1,4 @@ -using ConductorSharp.Engine.Builders; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ConductorSharp.Engine.Tests.Samples.Workflows +namespace ConductorSharp.Engine.Tests.Samples.Workflows { public class DecisionTaskInput : WorkflowInput { } @@ -21,6 +14,7 @@ public DecisionTask(WorkflowDefinitionBuilder wf.Decision, wf => new() { CaseValueParam = "test" }, @@ -33,6 +27,7 @@ public override void BuildDefinition() DefaultCase = builder => builder.AddTask(wf => wf.Terminate, wf => new() { TerminationStatus = TerminationStatus.Failed }) } ); +#pragma warning restore CS0618 // Type or member is obsolete } } } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorfklow.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorfklow.cs index 068e129d..e41621a9 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorfklow.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorfklow.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ConductorSharp.Engine.Tests.Samples.Workflows +namespace ConductorSharp.Engine.Tests.Samples.Workflows { public class TerminateTaskWorfklowInput : WorkflowInput { } @@ -24,6 +18,7 @@ WorkflowDefinitionBuilder wf.DecisionTask, wf => new() { CaseValueParam = "value" }, @@ -36,6 +31,7 @@ public override void BuildDefinition() ) } ); +#pragma warning restore CS0618 // Type or member is obsolete _builder.AddTask( wf => wf.SwitchTask, From 64fa25f464102a6a660f940b3ae37b1dc9c56137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:47:49 +0100 Subject: [PATCH 17/33] tidy up patterns --- .../Builders/TaskNameBuilder.cs | 6 ++---- src/ConductorSharp.Patterns/Constants.cs | 6 +----- .../Exceptions/NoLambdaException.cs | 3 +-- .../Tasks/CSharpLambdaTask.cs | 15 +++------------ .../Util/CSharpLambdaHandler.cs | 15 ++++----------- 5 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs index ae84b3c1..42e598aa 100644 --- a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs @@ -7,11 +7,9 @@ namespace ConductorSharp.Patterns.Builders { - internal class TaskNameBuilder : DefaultTaskNameBuilder + internal class TaskNameBuilder(IEnumerable configurationProperties) : DefaultTaskNameBuilder { - private readonly IEnumerable _configurationProperties; - - public TaskNameBuilder(IEnumerable configurationProperties) => _configurationProperties = configurationProperties; + private readonly IEnumerable _configurationProperties = configurationProperties; public override string Build(Type taskType) => taskType == typeof(CSharpLambdaTask) ? $"{GetLambdaTaskPrefix()}{base.Build(taskType)}" : base.Build(taskType); diff --git a/src/ConductorSharp.Patterns/Constants.cs b/src/ConductorSharp.Patterns/Constants.cs index 3924daf2..af243b16 100644 --- a/src/ConductorSharp.Patterns/Constants.cs +++ b/src/ConductorSharp.Patterns/Constants.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ConductorSharp.Patterns +namespace ConductorSharp.Patterns { public static class Constants { diff --git a/src/ConductorSharp.Patterns/Exceptions/NoLambdaException.cs b/src/ConductorSharp.Patterns/Exceptions/NoLambdaException.cs index 8ff563bb..d8fd23a8 100644 --- a/src/ConductorSharp.Patterns/Exceptions/NoLambdaException.cs +++ b/src/ConductorSharp.Patterns/Exceptions/NoLambdaException.cs @@ -2,8 +2,7 @@ namespace ConductorSharp.Patterns.Exceptions { - public class NoLambdaException : Exception + public class NoLambdaException(string lambdaName) : Exception($"ConductorSharp: Lambda with corresponding identifier\"{lambdaName}\" ") { - public NoLambdaException(string lambdaName) : base($"ConductorSharp: Lambda with corresponding identifier\"{lambdaName}\" ") { } } } diff --git a/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs b/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs index fc8b710d..c25181f8 100644 --- a/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs +++ b/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs @@ -1,18 +1,14 @@ using ConductorSharp.Client; using ConductorSharp.Engine.Builders; -using ConductorSharp.Engine.Exceptions; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Util; using ConductorSharp.Patterns.Exceptions; using MediatR; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; -using System.Text; using System.Threading; using System.Threading.Tasks; @@ -33,21 +29,16 @@ internal class CSharpLambdaTaskInput : IRequest } [OriginalName(TaskName)] - internal class CSharpLambdaTask : ITaskRequestHandler + internal class CSharpLambdaTask(WorkflowBuildItemRegistry itemRegistry) : ITaskRequestHandler { public const string TaskName = "CSHRP_inln_lmbd"; public const string LambdaTaskNameConfigurationProperty = nameof(LambdaTaskNameConfigurationProperty); - private readonly WorkflowBuildItemRegistry _itemRegistry; - - public CSharpLambdaTask(WorkflowBuildItemRegistry itemRegistry) => _itemRegistry = itemRegistry; + private readonly WorkflowBuildItemRegistry _itemRegistry = itemRegistry; public Task Handle(CSharpLambdaTaskInput request, CancellationToken cancellationToken) { - var lambda = _itemRegistry.GetAll().FirstOrDefault(lambda => lambda.LambdaIdentifier == request.LambdaIdentifier); - if (lambda == null) - throw new NoLambdaException(request.LambdaIdentifier); - + var lambda = _itemRegistry.GetAll().FirstOrDefault(lambda => lambda.LambdaIdentifier == request.LambdaIdentifier) ?? throw new NoLambdaException(request.LambdaIdentifier); try { return Task.FromResult( diff --git a/src/ConductorSharp.Patterns/Util/CSharpLambdaHandler.cs b/src/ConductorSharp.Patterns/Util/CSharpLambdaHandler.cs index 74b51a7f..0af1416f 100644 --- a/src/ConductorSharp.Patterns/Util/CSharpLambdaHandler.cs +++ b/src/ConductorSharp.Patterns/Util/CSharpLambdaHandler.cs @@ -2,17 +2,10 @@ namespace ConductorSharp.Engine.Util { - internal class CSharpLambdaHandler + internal class CSharpLambdaHandler(string lambdaIdentifier, Type taskInputType, Delegate handler) { - public string LambdaIdentifier { get; } - public Type TaskInputType { get; } - public Delegate Handler { get; } - - public CSharpLambdaHandler(string lambdaIdentifier, Type taskInputType, Delegate handler) - { - LambdaIdentifier = lambdaIdentifier; - TaskInputType = taskInputType; - Handler = handler; - } + public string LambdaIdentifier { get; } = lambdaIdentifier; + public Type TaskInputType { get; } = taskInputType; + public Delegate Handler { get; } = handler; } } From f5c298e60c07d9f07392c457b75e0867390d895b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:20:23 +0100 Subject: [PATCH 18/33] slight tweaks and version bump --- .../ConductorSharp.Client.csproj | 2 +- .../ConductorSharp.Engine.csproj | 2 +- .../Builders/CSharpLambdaTaskBuilder.cs | 6 ++-- .../ConductorSharp.Patterns.csproj | 4 +-- .../Extensions/ContainerBuilderExtensions.cs | 3 +- .../Tasks/CSharpLambdaTask.cs | 14 +++++--- .../Tasks/ReadWorkflowTasks.cs | 35 +++++++------------ .../ConductorSharp.Toolkit.csproj | 2 +- 8 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/ConductorSharp.Client/ConductorSharp.Client.csproj b/src/ConductorSharp.Client/ConductorSharp.Client.csproj index e8be6c36..480f8f5b 100644 --- a/src/ConductorSharp.Client/ConductorSharp.Client.csproj +++ b/src/ConductorSharp.Client/ConductorSharp.Client.csproj @@ -6,7 +6,7 @@ Codaxy Codaxy ConductorSharp.Client - 2.3.2 + 3.0.0-beta Client library for Netflix Conductor, with some additional quality of life features. https://github.com/codaxy/conductor-sharp netflix;conductor diff --git a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj index ec31f74a..cfe3fd71 100644 --- a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj +++ b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj @@ -6,7 +6,7 @@ Codaxy Codaxy ConductorSharp.Engine - 2.3.2 + 3.0.0-beta Client library for Netflix Conductor, with some additional quality of life features. https://github.com/codaxy/conductor-sharp netflix;conductor diff --git a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs index 2d6393db..11c4ec18 100644 --- a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs @@ -26,11 +26,11 @@ Func lambda where TWorkflow : ITypedWorkflow where TInput : IRequest { - var prefixConfigProperty = builder.ConfigurationProperties.FirstOrDefault( + var prefixString = builder.ConfigurationProperties.FirstOrDefault( prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty - ) ?? throw new LambdaTasksNotEnabledException(); + )?.Value as string ?? throw new LambdaTasksNotEnabledException(); - var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(prefixConfigProperty.Value as string); + var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(prefixString); var taskBuilder = new CSharpLambdaTaskBuilder( task.Body, diff --git a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj index 00bbea8b..3c880cf0 100644 --- a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj +++ b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj @@ -3,11 +3,11 @@ net6.0 preview - disable + enable False Codaxy Codaxy - 2.3.2 + 3.0.0-beta diff --git a/src/ConductorSharp.Patterns/Extensions/ContainerBuilderExtensions.cs b/src/ConductorSharp.Patterns/Extensions/ContainerBuilderExtensions.cs index 2b59b7cf..8aecc193 100644 --- a/src/ConductorSharp.Patterns/Extensions/ContainerBuilderExtensions.cs +++ b/src/ConductorSharp.Patterns/Extensions/ContainerBuilderExtensions.cs @@ -3,7 +3,6 @@ using ConductorSharp.Engine.Util; using ConductorSharp.Patterns.Builders; using ConductorSharp.Patterns.Tasks; -using MediatR; using Microsoft.Extensions.DependencyInjection; namespace ConductorSharp.Patterns.Extensions @@ -21,7 +20,7 @@ public static IExecutionManagerBuilder AddConductorSharpPatterns(this IExecution public static IExecutionManagerBuilder AddCSharpLambdaTasks( this IExecutionManagerBuilder executionManagerBuilder, - string csharpLambdaTaskNamePrefix = null + string? csharpLambdaTaskNamePrefix = null ) { executionManagerBuilder.Builder.RegisterWorkerTask(options => diff --git a/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs b/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs index c25181f8..c0b2904b 100644 --- a/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs +++ b/src/ConductorSharp.Patterns/Tasks/CSharpLambdaTask.cs @@ -6,6 +6,7 @@ using MediatR; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; @@ -21,11 +22,11 @@ internal class CSharpLambdaTaskInput : IRequest [JsonProperty(LambdaIdenfitierParamName)] [Required] - public string LambdaIdentifier { get; set; } + public string? LambdaIdentifier { get; set; } [JsonProperty(TaskInputParamName)] [Required] - public JObject TaskInput { get; set; } + public JObject TaskInput { get; set; } = []; } [OriginalName(TaskName)] @@ -37,12 +38,17 @@ internal class CSharpLambdaTask(WorkflowBuildItemRegistry itemRegistry) : ITaskR private readonly WorkflowBuildItemRegistry _itemRegistry = itemRegistry; public Task Handle(CSharpLambdaTaskInput request, CancellationToken cancellationToken) - { + { + if (string.IsNullOrEmpty(request.LambdaIdentifier)) + { + throw new ArgumentException($"Request parameter {request.LambdaIdentifier} cannot be empty"); + } + var lambda = _itemRegistry.GetAll().FirstOrDefault(lambda => lambda.LambdaIdentifier == request.LambdaIdentifier) ?? throw new NoLambdaException(request.LambdaIdentifier); try { return Task.FromResult( - lambda.Handler.DynamicInvoke(request.TaskInput.ToObject(lambda.TaskInputType, ConductorConstants.IoJsonSerializer)) + lambda.Handler.DynamicInvoke(request.TaskInput.ToObject(lambda.TaskInputType, ConductorConstants.IoJsonSerializer))! ); } catch (TargetInvocationException ex) diff --git a/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs b/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs index a383ef71..f437b88a 100644 --- a/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs +++ b/src/ConductorSharp.Patterns/Tasks/ReadWorkflowTasks.cs @@ -2,11 +2,9 @@ using ConductorSharp.Engine; using ConductorSharp.Engine.Util; using MediatR; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -19,26 +17,16 @@ public class ReadWorkflowTasksRequest : IRequest /// /// Comma separated list of task reference names to be read from specified workflow /// - [Required] - public string TaskNames { get; set; } + public string? TaskNames { get; set; } /// /// Id of the workflow to read tasks from /// - [Required] - public string WorkflowId { get; set; } + public string? WorkflowId { get; set; } } - public class ReadWorkflowTasksResponse - { - public Dictionary Tasks { get; set; } - public WorkflowDetails Workflow { get; set; } - } - - public class WorkflowDetails - { - public JObject InputData { get; set; } - } + public record ReadWorkflowTasksResponse(Dictionary Tasks, WorkflowDetails Workflow); + public record WorkflowDetails(JObject InputData); #endregion /// @@ -52,17 +40,20 @@ public class ReadWorkflowTasks(IWorkflowService workflowService) : TaskRequestHa public async override Task Handle(ReadWorkflowTasksRequest input, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(input.TaskNames)) + { throw new Exception("No task names provided. Comma separated list of reference names expected"); + } + + if (string.IsNullOrEmpty(input.WorkflowId)) + { + throw new Exception("No workflowId provided"); + } var tasknames = input.TaskNames.Split(",").Where(a => !string.IsNullOrEmpty(a)).ToList(); var starterWorkflow = await _workflowService.GetExecutionStatusAsync(input.WorkflowId, cancellationToken: cancellationToken) ?? throw new Exception($"Could not find starter workflow by id {input.WorkflowId}"); - - var output = new ReadWorkflowTasksResponse - { - Workflow = new WorkflowDetails { InputData = JObject.FromObject(starterWorkflow.Input) }, - Tasks = [] - }; + + var output = new ReadWorkflowTasksResponse([],new WorkflowDetails(JObject.FromObject(starterWorkflow.Input))); foreach (var task in tasknames) { diff --git a/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj b/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj index 055c83c7..c2b64552 100644 --- a/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj +++ b/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj @@ -7,7 +7,7 @@ disable true dotnet-conductorsharp - 3.0.0-alpha1 + 3.0.0-beta From 4ddda787ca53f0f536fb581f7876dbbcbca7ba60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:28:53 +0100 Subject: [PATCH 19/33] handle null prefix --- .../Builders/CSharpLambdaTaskBuilder.cs | 6 +++--- src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs index 11c4ec18..2b576de4 100644 --- a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs @@ -26,11 +26,11 @@ Func lambda where TWorkflow : ITypedWorkflow where TInput : IRequest { - var prefixString = builder.ConfigurationProperties.FirstOrDefault( + var configurationProp = builder.ConfigurationProperties.FirstOrDefault( prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty - )?.Value as string ?? throw new LambdaTasksNotEnabledException(); + ) ?? throw new LambdaTasksNotEnabledException(); ; - var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(prefixString); + var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(configurationProp?.Value as string); var taskBuilder = new CSharpLambdaTaskBuilder( task.Body, diff --git a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs index 42e598aa..57d429ea 100644 --- a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs @@ -20,6 +20,6 @@ private string GetLambdaTaskPrefix() return MakeTaskNamePrefix(prefix); } - public static string MakeTaskNamePrefix(string prefix) => prefix == null ? string.Empty : $"{prefix}."; + public static string MakeTaskNamePrefix(string? prefix) => prefix == null ? string.Empty : $"{prefix}."; } } From 959216c0aaf1711e35745170fc2b88c4e4d254e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 22:13:17 +0100 Subject: [PATCH 20/33] update dotnet version --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index be2a1235..99779bf6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore ConductorSharp.sln - name: Build From 9d498bc63e11808b5b1ea3b4e95a33242fc44e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 22:16:53 +0100 Subject: [PATCH 21/33] update tools --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 402c7b79..1fc85138 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,13 +3,13 @@ "isRoot": true, "tools": { "csharpier": { - "version": "0.18.0", + "version": "0.26.7", "commands": [ "dotnet-csharpier" ] }, "husky": { - "version": "0.4.4", + "version": "0.6.4", "commands": [ "husky" ] From 10150f0e38294332ce08d309d6b686eac205fedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 22:33:21 +0100 Subject: [PATCH 22/33] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 99779bf6..6ec7037c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 8.0.x + dotnet-version: 8.0.100 - name: Restore dependencies run: dotnet restore ConductorSharp.sln - name: Build From 2e11ed4e08a9a787233480fad9648915d6cd68a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 22:34:52 +0100 Subject: [PATCH 23/33] Revert "Update dotnet.yml" This reverts commit 10150f0e38294332ce08d309d6b686eac205fedd. --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 6ec7037c..99779bf6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 8.0.100 + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore ConductorSharp.sln - name: Build From df40efe83fae8d52982324fbaab95903402a8e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:32:08 +0100 Subject: [PATCH 24/33] update lang version --- .../ConductorSharp.Engine.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj b/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj index 79895307..0707d91e 100644 --- a/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj +++ b/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj @@ -2,6 +2,7 @@ net6.0 + preview enable false From 2febfbe6f273a5b1323829ac948721ac422644ca Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Thu, 11 Jan 2024 12:36:08 +0100 Subject: [PATCH 25/33] Change dotnet version --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 99779bf6..be2a1235 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 8.0.x + dotnet-version: 6.0.x - name: Restore dependencies run: dotnet restore ConductorSharp.sln - name: Build From 708895a9d2f8d65ef6e58855df6795dd520cab75 Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Thu, 11 Jan 2024 14:43:18 +0100 Subject: [PATCH 26/33] Restore dotnet version --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index be2a1235..99779bf6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore ConductorSharp.sln - name: Build From 19df150a3430a9a0e4e4c2d266e738212839596d Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Thu, 11 Jan 2024 15:03:02 +0100 Subject: [PATCH 27/33] Try to specify multiple versions --- .github/workflows/dotnet.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 99779bf6..02c33541 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -14,9 +14,11 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: | + 6.x + 8.x - name: Restore dependencies run: dotnet restore ConductorSharp.sln - name: Build From 8912ad2cba20dfdd51a0d83fcf7497024290ad26 Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Thu, 11 Jan 2024 15:57:13 +0100 Subject: [PATCH 28/33] Specify 8.x dotnet version --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6815b013..3c76e42a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,9 @@ jobs: - name: Install .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: | + 6.x + 8.x - name: Restore dependencies run: dotnet restore ConductorSharp.sln From ecb65aaeec0aea8ff6cfbe56ab23351a77a8f3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:00:18 +0100 Subject: [PATCH 29/33] remove unused package --- src/ConductorSharp.Client/ConductorSharp.Client.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ConductorSharp.Client/ConductorSharp.Client.csproj b/src/ConductorSharp.Client/ConductorSharp.Client.csproj index 480f8f5b..d5b2a3d2 100644 --- a/src/ConductorSharp.Client/ConductorSharp.Client.csproj +++ b/src/ConductorSharp.Client/ConductorSharp.Client.csproj @@ -19,7 +19,6 @@ - From 416b8007f70f7583161cead8900a305dee0410c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:07:07 +0100 Subject: [PATCH 30/33] execute task updates in paralel --- src/ConductorSharp.Engine/ExecutionManager.cs | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index 45d438aa..c8815910 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -1,4 +1,9 @@ -using ConductorSharp.Client; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using ConductorSharp.Client; using ConductorSharp.Client.Generated; using ConductorSharp.Client.Service; using ConductorSharp.Client.Util; @@ -10,11 +15,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; using Task = System.Threading.Tasks.Task; namespace ConductorSharp.Engine @@ -176,20 +176,23 @@ await _taskManager.UpdateAsync( var errorMessage = new ErrorOutput { ErrorMessage = exception.Message }; - await _taskManager.UpdateAsync( - new TaskResult - { - TaskId = pollResponse.TaskId, - Status = TaskResultStatus.FAILED, - ReasonForIncompletion = exception.Message, - OutputData = SerializationHelper.ObjectToDictionary(errorMessage, ConductorConstants.IoJsonSerializerSettings), - WorkflowInstanceId = pollResponse.WorkflowInstanceId, - }, - cancellationToken + await Task.WhenAll( + [ + _taskManager.UpdateAsync( + new TaskResult + { + TaskId = pollResponse.TaskId, + Status = TaskResultStatus.FAILED, + ReasonForIncompletion = exception.Message, + OutputData = SerializationHelper.ObjectToDictionary(errorMessage, ConductorConstants.IoJsonSerializerSettings), + WorkflowInstanceId = pollResponse.WorkflowInstanceId + }, + cancellationToken + ), + _taskManager.LogAsync(pollResponse.TaskId, exception.Message, cancellationToken), + _taskManager.LogAsync(pollResponse.TaskId, exception.StackTrace, cancellationToken) + ] ); - - await _taskManager.LogAsync(pollResponse.TaskId, exception.Message, cancellationToken); - await _taskManager.LogAsync(pollResponse.TaskId, exception.StackTrace, cancellationToken); } } } From 58bbb4a0a5320e4032014da7fe134b4174441a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:13:41 +0100 Subject: [PATCH 31/33] add comment for concurrent task updates --- src/ConductorSharp.Engine/ExecutionManager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index c8815910..fe475082 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -176,6 +176,10 @@ await _taskManager.UpdateAsync( var errorMessage = new ErrorOutput { ErrorMessage = exception.Message }; + // TODO: We should verify that this is alright, it is possible that when executed concurrently, + // the updates caused by LogAsync will be discarded because the call of UpdateAsync(TaskResult...) + // sets the logs to null. Not sure how this is implemented in the backend, also, would have expected this to be a + // PUT or PATCH request, but by specs it is POST await Task.WhenAll( [ _taskManager.UpdateAsync( From 9039b3f0529d4b29772e780838addac911763fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Sun, 21 Jan 2024 22:14:02 +0100 Subject: [PATCH 32/33] fix usage of Type instead of WorkflowTaskType --- .../Builders/DynamicForkJoinTaskBuilder.cs | 24 +++++++++++-------- .../Builders/SubWorkflowTaskBuilder.cs | 16 +++++++------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs index 556ba7ad..2a2d5f8c 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs @@ -1,10 +1,10 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -14,7 +14,8 @@ public static ITaskOptionsBuilder AddTask( this ITaskSequenceBuilder builder, Expression> refference, Expression> input - ) where TWorkflow : ITypedWorkflow + ) + where TWorkflow : ITypedWorkflow { var taskBuilder = new DynamicForkJoinTaskBuilder(refference.Body, input.Body, builder.BuildConfiguration); builder.AddTaskBuilderToSequence(taskBuilder); @@ -22,7 +23,8 @@ Expression> input } } - public class DynamicForkJoinTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + public class DynamicForkJoinTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) { public override WorkflowTask[] Build() { @@ -31,18 +33,20 @@ public override WorkflowTask[] Build() return [ - new() { + new() + { Name = dynamicTaskName, TaskReferenceName = dynamicTaskName, WorkflowTaskType = WorkflowTaskType.FORK_JOIN_DYNAMIC, DynamicForkTasksParam = "dynamic_tasks", DynamicForkTasksInputParamName = "dynamic_tasks_i", - InputParameters = _inputParameters.ToObject>(), + InputParameters = _inputParameters.ToObject>(), }, - new() { + new() + { Name = joinTaskName, TaskReferenceName = joinTaskName, - Type = "JOIN", + WorkflowTaskType = WorkflowTaskType.JOIN } ]; } diff --git a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs index 84c1865a..9706246d 100644 --- a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs @@ -1,13 +1,13 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; using MediatR; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; namespace ConductorSharp.Engine.Builders { @@ -27,7 +27,9 @@ Expression> input } } - public class SubWorkflowTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) where TInput : IRequest + public class SubWorkflowTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + where TInput : IRequest { private readonly int _version = GetVersion(taskExpression); @@ -38,7 +40,7 @@ public override WorkflowTask[] Build() => Name = _taskName, TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.SUB_WORKFLOW, - InputParameters = _inputParameters.ToObject>(), + InputParameters = _inputParameters.ToObject>(), SubWorkflowParam = new SubWorkflowParams { Name = _taskName, Version = _version }, Optional = _additionalParameters?.Optional == true } From 314a87e7ae085d9348525e78ae8b2ec43d8b0769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Kati=C4=87?= <44910579+ognjenkatic@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:02:08 +0100 Subject: [PATCH 33/33] use type as both string and enum and adjust tests --- .../Builders/DecisionTaskBuilder.cs | 17 +++++----- .../Builders/DynamicForkJoinTaskBuilder.cs | 4 ++- .../Builders/DynamicTaskBuilder.cs | 17 +++++----- .../Builders/HumanTaskBuilder.cs | 18 ++++++----- .../Builders/JsonJqTransformTaskBuilder.cs | 18 ++++++----- .../Builders/LambdaTaskBuilder.cs | 15 +++++---- .../Builders/SimpleTaskBuilder.cs | 15 +++++---- .../Builders/SubWorkflowTaskBuilder.cs | 1 + .../Builders/SwitchTaskBuilder.cs | 21 +++++++------ .../Builders/TerminateTaskBuilder.cs | 15 +++++---- .../Builders/WaitTaskBuilder.cs | 15 +++++---- .../Builders/CSharpLambdaTaskBuilder.cs | 31 +++++++++++-------- .../Samples/Workflows/Arrays.json | 2 ++ .../Workflows/CSharpLambdaWorkflow.json | 4 +++ .../Samples/Workflows/CastWorkflow.json | 2 ++ ...ionallySendCustomerNotificationOutput.json | 2 ++ .../Samples/Workflows/DecisionInDecision.json | 3 ++ .../Samples/Workflows/DecisionTask.json | 3 ++ .../Samples/Workflows/DynamicTask.json | 1 + .../Workflows/EvaluateExpressionWorkflow.json | 6 ++++ .../Samples/Workflows/HumanTask.json | 1 + .../Samples/Workflows/IndexerWorkflow.json | 1 + .../Workflows/ListInitializationWorkflow.json | 1 + .../Samples/Workflows/NestedObjects.json | 1 + .../Workflows/OptionalTaskWorkflow.json | 1 + .../Workflows/PassthroughTaskWorkflow.cs | 6 ++-- .../Workflows/PassthroughTaskWorkflow.json | 2 +- .../Samples/Workflows/PatternTasks.json | 2 ++ .../Workflows/ScaffoldedWorkflows.json | 2 ++ .../Workflows/SendCustomerNotification.json | 2 ++ .../Samples/Workflows/StringAddition.json | 1 + .../Workflows/StringInterpolation.json | 1 + .../Samples/Workflows/SwitchTask.json | 3 ++ .../Workflows/TaskPropertiesWorkflow.json | 2 ++ .../Workflows/TerminateTaskWorkflow.json | 5 +++ .../Workflows/VersionAttributeWorkflow.json | 1 + .../Samples/Workflows/WaitTask.json | 1 + 37 files changed, 161 insertions(+), 82 deletions(-) diff --git a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs index ab99f070..ebf39287 100644 --- a/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DecisionTaskBuilder.cs @@ -1,14 +1,14 @@ -using ConductorSharp.Client; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using ConductorSharp.Client; using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -20,7 +20,8 @@ public static ITaskOptionsBuilder AddTask( Expression> taskSelector, Expression> expression, DecisionCases decisionCases - ) where TWorkflow : ITypedWorkflow + ) + where TWorkflow : ITypedWorkflow { var taskBuilder = new DecisionTaskBuilder( taskSelector.Body, @@ -56,7 +57,7 @@ public class DecisionTaskBuilder( WorkflowBuildItemRegistry buildItemRegistry, IEnumerable configurationProperties, BuildContext buildContext - ) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration), ITaskSequenceBuilder + ) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration), ITaskSequenceBuilder where TWorkflow : ITypedWorkflow { private readonly Dictionary> _caseDictionary = []; @@ -75,7 +76,6 @@ internal DecisionTaskBuilder AddCase(string caseName) return this; } - public override WorkflowTask[] Build() { var decisionTaskName = $"DECISION_{_taskRefferenceName}"; @@ -89,6 +89,7 @@ public override WorkflowTask[] Build() TaskReferenceName = _taskRefferenceName, InputParameters = _inputParameters.ToObject>(), WorkflowTaskType = WorkflowTaskType.DECISION, + Type = WorkflowTaskType.DECISION.ToString(), CaseExpression = "case_value_param", DecisionCases = new JObject { diff --git a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs index 2a2d5f8c..ca981ea4 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicForkJoinTaskBuilder.cs @@ -38,6 +38,7 @@ public override WorkflowTask[] Build() Name = dynamicTaskName, TaskReferenceName = dynamicTaskName, WorkflowTaskType = WorkflowTaskType.FORK_JOIN_DYNAMIC, + Type = WorkflowTaskType.FORK_JOIN_DYNAMIC.ToString(), DynamicForkTasksParam = "dynamic_tasks", DynamicForkTasksInputParamName = "dynamic_tasks_i", InputParameters = _inputParameters.ToObject>(), @@ -46,7 +47,8 @@ public override WorkflowTask[] Build() { Name = joinTaskName, TaskReferenceName = joinTaskName, - WorkflowTaskType = WorkflowTaskType.JOIN + WorkflowTaskType = WorkflowTaskType.JOIN, + Type = WorkflowTaskType.JOIN.ToString() } ]; } diff --git a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs index 0ac4ee9b..4616820a 100644 --- a/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/DynamicTaskBuilder.cs @@ -1,13 +1,13 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -27,7 +27,8 @@ Expression>> input } } - public class DynamicTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder, O>(taskExpression, inputExpression, buildConfiguration) + public class DynamicTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder, O>(taskExpression, inputExpression, buildConfiguration) { private const string DynamicTasknameParam = "task_to_execute"; @@ -48,11 +49,13 @@ public override WorkflowTask[] Build() return [ - new() { + new() + { Name = _taskRefferenceName, TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.DYNAMIC, - InputParameters = parameters.TaskInput.ToObject>(), + Type = WorkflowTaskType.DYNAMIC.ToString(), + InputParameters = parameters.TaskInput.ToObject>(), DynamicTaskNameParam = DynamicTasknameParam, } ]; diff --git a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs index 0d57f540..eb9c69da 100644 --- a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs @@ -1,10 +1,10 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -14,7 +14,8 @@ public static ITaskOptionsBuilder AddTask( this ITaskSequenceBuilder builder, Expression> reference, Expression> input - ) where TWorkflow : ITypedWorkflow + ) + where TWorkflow : ITypedWorkflow { var taskBuilder = new HumanTaskBuilder(reference.Body, input.Body, builder.BuildConfiguration); builder.AddTaskBuilderToSequence(taskBuilder); @@ -22,17 +23,18 @@ Expression> input } } - internal class HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + internal class HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) { public override WorkflowTask[] Build() => - [ new() { Name = $"HUMAN_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.HUMAN, - InputParameters = _inputParameters.ToObject>(), + Type = WorkflowTaskType.HUMAN.ToString(), + InputParameters = _inputParameters.ToObject>(), } ]; } diff --git a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs index 2198ed28..64bebbf6 100644 --- a/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/JsonJqTransformTaskBuilder.cs @@ -1,11 +1,11 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -25,25 +25,27 @@ Expression> input } } - public class JsonJqTransformTaskBuilder : BaseTaskBuilder where A : IRequest + public class JsonJqTransformTaskBuilder : BaseTaskBuilder + where A : IRequest { public JsonJqTransformTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : base(taskExpression, inputExpression, buildConfiguration) { - var queryExpressionValue = _inputParameters.GetValue("query_expression") ?? throw new InvalidOperationException("Query expression is a mandatory field"); + var queryExpressionValue = + _inputParameters.GetValue("query_expression") ?? throw new InvalidOperationException("Query expression is a mandatory field"); _inputParameters.Remove("query_expression"); _inputParameters.Add("queryExpression", queryExpressionValue); } public override WorkflowTask[] Build() => - [ new() { Name = _taskName, TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.JSON_JQ_TRANSFORM, - InputParameters = _inputParameters.ToObject>() + Type = WorkflowTaskType.JSON_JQ_TRANSFORM.ToString(), + InputParameters = _inputParameters.ToObject>() } ]; } diff --git a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs index 3c600889..f38b0915 100644 --- a/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/LambdaTaskBuilder.cs @@ -1,12 +1,12 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -28,7 +28,9 @@ string script } } - public class LambdaTaskBuilder(string script, Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) where A : IRequest + public class LambdaTaskBuilder(string script, Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + where A : IRequest { private readonly string _script = script; @@ -36,12 +38,13 @@ public override WorkflowTask[] Build() { _inputParameters.Add(new JProperty("scriptExpression", _script)); return - [ + [ new() { Name = $"LAMBDA_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.LAMBDA, + Type = WorkflowTaskType.LAMBDA.ToString(), InputParameters = _inputParameters.ToObject>() } ]; diff --git a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs index 8bb2a4a4..de685ed4 100644 --- a/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SimpleTaskBuilder.cs @@ -1,11 +1,11 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using MediatR; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -25,7 +25,9 @@ Expression> input } } - public class SimpleTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) where A : IRequest + public class SimpleTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + where A : IRequest { public override WorkflowTask[] Build() => [ @@ -34,7 +36,8 @@ public override WorkflowTask[] Build() => Name = _taskName, TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.SIMPLE, - InputParameters = _inputParameters.ToObject>(), + Type = WorkflowTaskType.SIMPLE.ToString(), + InputParameters = _inputParameters.ToObject>(), Optional = _additionalParameters?.Optional == true } ]; diff --git a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs index 9706246d..f27256cf 100644 --- a/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SubWorkflowTaskBuilder.cs @@ -40,6 +40,7 @@ public override WorkflowTask[] Build() => Name = _taskName, TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.SUB_WORKFLOW, + Type = WorkflowTaskType.SUB_WORKFLOW.ToString(), InputParameters = _inputParameters.ToObject>(), SubWorkflowParam = new SubWorkflowParams { Name = _taskName, Version = _version }, Optional = _additionalParameters?.Optional == true diff --git a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs index 298fa91c..67cc7890 100644 --- a/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/SwitchTaskBuilder.cs @@ -1,14 +1,14 @@ -using ConductorSharp.Client; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using ConductorSharp.Client; using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util; using ConductorSharp.Engine.Util.Builders; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -19,7 +19,8 @@ public static ITaskOptionsBuilder AddTask( Expression> taskSelector, Expression> expression, DecisionCases decisionCases - ) where TWorkflow : ITypedWorkflow + ) + where TWorkflow : ITypedWorkflow { var taskBuilder = new SwitchTaskBuilder( taskSelector.Body, @@ -55,7 +56,7 @@ public class SwitchTaskBuilder( WorkflowBuildItemRegistry workflowBuildItemRegistry, IEnumerable configurationProperties, BuildContext buildContext - ) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration), ITaskSequenceBuilder + ) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration), ITaskSequenceBuilder where TWorkflow : ITypedWorkflow { private readonly Dictionary> _caseDictionary = []; @@ -84,8 +85,9 @@ public override WorkflowTask[] Build() { Name = decisionTaskName, TaskReferenceName = _taskRefferenceName, - InputParameters = _inputParameters.ToObject>(), + InputParameters = _inputParameters.ToObject>(), WorkflowTaskType = WorkflowTaskType.SWITCH, + Type = WorkflowTaskType.SWITCH.ToString(), Expression = "switch_case_value", EvaluatorType = "value-param", DecisionCases = new JObject @@ -94,8 +96,7 @@ public override WorkflowTask[] Build() a => new JProperty(a.Key, JArray.FromObject(a.Value.SelectMany(b => b.Build()), ConductorConstants.DefinitionsSerializer)) ) }.ToObject>>(), - DefaultCase = _defaultCase - ?.SelectMany(builder => builder.Build()).ToArray() + DefaultCase = _defaultCase?.SelectMany(builder => builder.Build()).ToArray() } ]; } diff --git a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs index 9f4b7526..599fdc54 100644 --- a/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/TerminateTaskBuilder.cs @@ -1,10 +1,10 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -14,7 +14,8 @@ public static ITaskOptionsBuilder AddTask( this ITaskSequenceBuilder builder, Expression> reference, Expression> input - ) where TWorkflow : ITypedWorkflow + ) + where TWorkflow : ITypedWorkflow { var taskBuilder = new TerminateTaskBuilder(reference.Body, input.Body, builder.BuildConfiguration); builder.AddTaskBuilderToSequence(taskBuilder); @@ -22,7 +23,8 @@ Expression> input } } - internal class TerminateTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + internal class TerminateTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) { public override WorkflowTask[] Build() => [ @@ -31,6 +33,7 @@ public override WorkflowTask[] Build() => Name = $"TERMINATE_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.TERMINATE, + Type = WorkflowTaskType.TERMINATE.ToString(), InputParameters = _inputParameters.ToObject>(), } ]; diff --git a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs index af34ad16..d4e69ddd 100644 --- a/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/WaitTaskBuilder.cs @@ -1,10 +1,10 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; namespace ConductorSharp.Engine.Builders { @@ -14,7 +14,8 @@ public static ITaskOptionsBuilder AddTask( this ITaskSequenceBuilder builder, Expression> reference, Expression> input - ) where TWorkflow : ITypedWorkflow + ) + where TWorkflow : ITypedWorkflow { var taskBuilder = new WaitTaskBuilder(reference.Body, input.Body, builder.BuildConfiguration); builder.AddTaskBuilderToSequence(taskBuilder); @@ -22,7 +23,8 @@ Expression> input } } - internal class WaitTaskBuilder(Expression taskExpression, Expression memberExpression, BuildConfiguration buildConfiguration) : BaseTaskBuilder(taskExpression, memberExpression, buildConfiguration) + internal class WaitTaskBuilder(Expression taskExpression, Expression memberExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder(taskExpression, memberExpression, buildConfiguration) { public override WorkflowTask[] Build() => [ @@ -31,6 +33,7 @@ public override WorkflowTask[] Build() => Name = $"WAIT_{_taskRefferenceName}", TaskReferenceName = _taskRefferenceName, WorkflowTaskType = WorkflowTaskType.WAIT, + Type = WorkflowTaskType.WAIT.ToString(), InputParameters = _inputParameters.ToObject>() } ]; diff --git a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs index 2b576de4..bbe60fc8 100644 --- a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs @@ -1,4 +1,8 @@ -using ConductorSharp.Client.Generated; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Util; @@ -8,10 +12,6 @@ using ConductorSharp.Patterns.Tasks; using MediatR; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; namespace ConductorSharp.Patterns.Builders { @@ -26,9 +26,10 @@ Func lambda where TWorkflow : ITypedWorkflow where TInput : IRequest { - var configurationProp = builder.ConfigurationProperties.FirstOrDefault( - prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty - ) ?? throw new LambdaTasksNotEnabledException(); ; + var configurationProp = + builder.ConfigurationProperties.FirstOrDefault(prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty) + ?? throw new LambdaTasksNotEnabledException(); + ; var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(configurationProp?.Value as string); @@ -48,7 +49,8 @@ Func lambda } } - internal class CSharpLambdaTaskBuilder : BaseTaskBuilder where TInput : IRequest + internal class CSharpLambdaTaskBuilder : BaseTaskBuilder + where TInput : IRequest { public const string LambdaIdStorageKey = "ConductorSharp.Engine.CSharpLambdaTaskBuilder.LambdaId"; @@ -62,7 +64,8 @@ public CSharpLambdaTaskBuilder( BuildConfiguration buildConfiguration, string lambdaTaskNamePrefix, string workflowName - ) : base(taskExpression, memberExpression, buildConfiguration) + ) + : base(taskExpression, memberExpression, buildConfiguration) { LambdaIdentifer = $"{workflowName}.{_taskRefferenceName}"; _lambdaTaskNamePrefix = lambdaTaskNamePrefix; @@ -70,7 +73,7 @@ string workflowName public override WorkflowTask[] Build() { - return + return [ new() { @@ -80,8 +83,10 @@ public override WorkflowTask[] Build() { new JProperty(CSharpLambdaTaskInput.LambdaIdenfitierParamName, LambdaIdentifer), new JProperty(CSharpLambdaTaskInput.TaskInputParamName, _inputParameters) - }.ToObject>(), - Optional = _additionalParameters.Optional + }.ToObject>(), + Optional = _additionalParameters.Optional, + WorkflowTaskType = WorkflowTaskType.SIMPLE, + Type = WorkflowTaskType.SIMPLE.ToString() } ]; } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json index 4dbc2542..11811237 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/Arrays.json @@ -38,6 +38,7 @@ } ] }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -53,6 +54,7 @@ "models": [], "objects": [] }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json index 6401393c..26e3e20c 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CSharpLambdaWorkflow.json @@ -13,6 +13,7 @@ "lambda_input": "${workflow.input.input}" } }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -26,6 +27,7 @@ "inputParameters": { "case_value_param": "${workflow.input.operation}" }, + "type": "DECISION", "caseExpression": "case_value_param", "decisionCases": { "upper": [ @@ -38,6 +40,7 @@ "lambda_input": "${workflow.input.input}" } }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -56,6 +59,7 @@ "lambda_input": "${workflow.input.input}" } }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json index 50256ad3..2d9ac9bd 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/CastWorkflow.json @@ -10,6 +10,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -24,6 +25,7 @@ "customer_name": "${get_customer.output.name.first_name}", "address": "${get_customer.output.address}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json index d44d4cf9..76a5eed4 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ConditionallySendCustomerNotificationOutput.json @@ -10,6 +10,7 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, + "type": "DECISION", "caseExpression": "case_value_param", "decisionCases": { "YES": [ @@ -19,6 +20,7 @@ "inputParameters": { "id": "${workflow.input.customer_id}" }, + "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json index 81e7d963..159acc09 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionInDecision.json @@ -10,6 +10,7 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, + "type": "DECISION", "caseExpression": "case_value_param", "decisionCases": { "YES": [ @@ -19,6 +20,7 @@ "inputParameters": { "case_value_param": "${workflow.input.should_send_notification}" }, + "type": "DECISION", "caseExpression": "case_value_param", "decisionCases": { "YES": [ @@ -28,6 +30,7 @@ "inputParameters": { "id": "${workflow.input.customer_id}" }, + "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json index d083c3ed..e8aae57d 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DecisionTask.json @@ -10,6 +10,7 @@ "inputParameters": { "case_value_param": "test" }, + "type": "DECISION", "caseExpression": "case_value_param", "decisionCases": { "test": [ @@ -19,6 +20,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -35,6 +37,7 @@ "inputParameters": { "terminationStatus": "FAILED" }, + "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json index d8137a90..75e1d1ae 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/DynamicTask.json @@ -12,6 +12,7 @@ "should_use_next": "${workflow.input.should_use_next}", "task_to_execute": "${workflow.input.task_name}" }, + "type": "DYNAMIC", "dynamicTaskNameParam": "task_to_execute", "startDelay": 0, "optional": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json index 0864d7f6..e4ad0e02 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/EvaluateExpressionWorkflow.json @@ -10,6 +10,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -23,6 +24,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -36,6 +38,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -49,6 +52,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -62,6 +66,7 @@ "inputParameters": { "customer_id": 34 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -76,6 +81,7 @@ "name": "1:1:1:1:1", "address": "${workflow.input.username}@test.com" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json index 2f1fe4cf..02b9718a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json @@ -8,6 +8,7 @@ "name": "HUMAN_human_task", "taskReferenceName": "human_task", "inputParameters": {}, + "type": "HUMAN", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json index b0bfa007..65f2ad65 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/IndexerWorkflow.json @@ -11,6 +11,7 @@ "customer_name": "${workflow.input.dictionary['test'].customer_name}", "address": "${workflow.input.double_dictionary['test']['address']}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json index 97c39352..436c5021 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ListInitializationWorkflow.json @@ -19,6 +19,7 @@ } ] }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json index bf066eb8..36d79d4f 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/NestedObjects.json @@ -20,6 +20,7 @@ } } }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json index 468f7b8a..b85f01b1 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/OptionalTaskWorkflow.json @@ -10,6 +10,7 @@ "inputParameters": { "id": "${workflow.input.customer_id}" }, + "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "NOTIFICATION_send_to_customer", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs index 6eab3050..82f43df1 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.cs @@ -11,7 +11,8 @@ public class PassthroughTaskWorkflow : Workflow builder - ) : base(builder) { } + ) + : base(builder) { } public override void BuildDefinition() { @@ -20,7 +21,8 @@ public override void BuildDefinition() { Name = "LAMBDA_return_data", TaskReferenceName = "return_data", - Type = "LAMBDA", + WorkflowTaskType = WorkflowTaskType.LAMBDA, + Type = WorkflowTaskType.LAMBDA.ToString(), Description = "Lambda task to return data", InputParameters = new JObject { diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json index b7cbd75b..ddfa427a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PassthroughTaskWorkflow.json @@ -27,7 +27,7 @@ "rateLimited": false, "asyncComplete": false, "retryCount": 0, - "workflowTaskType": "SIMPLE" + "workflowTaskType": "LAMBDA" } ], "inputParameters": [], diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json index 9e5a62c9..e998c866 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/PatternTasks.json @@ -11,6 +11,7 @@ "task_names": "task1,task2", "workflow_id": "${workflow.input.workflow_id}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -24,6 +25,7 @@ "inputParameters": { "seconds": "${workflow.input.seconds}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json index 7c0c6e0a..07db3a02 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/ScaffoldedWorkflows.json @@ -10,6 +10,7 @@ "inputParameters": { "input_one": "${workflow.input.customer_id}" }, + "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "SCAFFOLDED_one", @@ -27,6 +28,7 @@ "inputParameters": { "name": "${scaff_one.output.output_one}" }, + "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "SCAFFOLDED_two", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json index 5b8a29fb..d3662603 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SendCustomerNotification.json @@ -10,6 +10,7 @@ "inputParameters": { "id": "${workflow.input.id}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -24,6 +25,7 @@ "address": "${get_customer.output.address}", "name": "${get_customer.output.name}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json index d631014c..95293130 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringAddition.json @@ -11,6 +11,7 @@ "input": "1Str_2Str_${workflow.input.input}My input: ${workflow.input.input}string_addition1", "scriptExpression": "" }, + "type": "LAMBDA", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json index e27cd2a8..f1ec608a 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/StringInterpolation.json @@ -11,6 +11,7 @@ "address": "${workflow.input.first_input},${workflow.input.second_input},Value,0", "name": "Workflow name: TEST_StringInterpolation" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json index 18273894..dea5e929 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/SwitchTask.json @@ -10,6 +10,7 @@ "inputParameters": { "switch_case_value": "test" }, + "type": "SWITCH", "decisionCases": { "test": [ { @@ -18,6 +19,7 @@ "inputParameters": { "customer_id": 1 }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -34,6 +36,7 @@ "inputParameters": { "terminationStatus": "FAILED" }, + "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json index 111db425..da2506ba 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TaskPropertiesWorkflow.json @@ -8,6 +8,7 @@ "name": "CUSTOMER_get", "taskReferenceName": "get_customer", "inputParameters": {}, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -29,6 +30,7 @@ "task_type": "${get_customer.taskType}", "correlation_id": "${get_customer.correlationId}" }, + "type": "SIMPLE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json index e9426f42..043ee35f 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/TerminateTaskWorkflow.json @@ -10,6 +10,7 @@ "inputParameters": { "case_value_param": "value" }, + "type": "DECISION", "caseExpression": "case_value_param", "decisionCases": { "value": [ @@ -22,6 +23,7 @@ }, "terminationStatus": "COMPLETED" }, + "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -44,6 +46,7 @@ "inputParameters": { "switch_case_value": "value" }, + "type": "SWITCH", "decisionCases": { "value": [ { @@ -55,6 +58,7 @@ }, "terminationStatus": "FAILED" }, + "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, @@ -82,6 +86,7 @@ "property": "Test" } }, + "type": "TERMINATE", "startDelay": 0, "optional": false, "rateLimited": false, diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json index a5378cb1..4dd8a4f2 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/VersionAttributeWorkflow.json @@ -8,6 +8,7 @@ "name": "TEST_subworkflow", "taskReferenceName": "test_subworkflow", "inputParameters": {}, + "type": "SUB_WORKFLOW", "startDelay": 0, "subWorkflowParam": { "name": "TEST_subworkflow", diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json index 8bd7bdb3..8ecfb373 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/WaitTask.json @@ -11,6 +11,7 @@ "duration": "1s", "until": "2022-12-31 11:59" }, + "type": "WAIT", "startDelay": 0, "optional": false, "rateLimited": false,