Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

132 - Add support for name and version fetch endpoint #141

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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; }
}
}
2 changes: 2 additions & 0 deletions src/ConductorSharp.Client/Service/IMetadataService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ConductorSharp.Client.Model.Common;
using ConductorSharp.Client.Model.Response;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand All @@ -15,6 +16,7 @@ public interface IMetadataService
Task UpdateWorkflowDefinition(WorkflowDefinition workflowDefinition);
Task DeleteWorkflowDefinition(string name, int version);
Task<WorkflowDefinition[]> GetAllWorkflowDefinitions();
Task<Dictionary<string, List<NameAndVersion>>> GetAllWorkflowNamesAndVersions();
Task<EventHandlerDefinition[]> GetAllEventHandlerDefinitions();
Task UpdateEventHandlerDefinition(EventHandlerDefinition definition);
Task DeleteEventHandlerDefinition(string name);
Expand Down
9 changes: 9 additions & 0 deletions src/ConductorSharp.Client/Service/MetadataService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ConductorSharp.Client.Model.Common;
using ConductorSharp.Client.Model.Response;
using ConductorSharp.Client.Util;
using System.Collections.Generic;
using System.Net.Http;
Expand Down Expand Up @@ -42,6 +43,14 @@ public async Task CreateWorkflowDefinitions(List<WorkflowDefinition> workflowDef
public async Task<WorkflowDefinition[]> GetAllWorkflowDefinitions() =>
(await _conductorClient.ExecuteRequestAsync<WorkflowDefinition[]>(ApiUrls.GetAlleWorkflowDefinitions(), HttpMethod.Get));

public async Task<Dictionary<string, List<NameAndVersion>>> GetAllWorkflowNamesAndVersions() =>
(
await _conductorClient.ExecuteRequestAsync<Dictionary<string, List<NameAndVersion>>>(
ApiUrls.GetAllWorkflowNamesAndVersions(),
HttpMethod.Get
)
);

public async Task<EventHandlerDefinition[]> GetAllEventHandlerDefinitions() =>
await _conductorClient.ExecuteRequestAsync<EventHandlerDefinition[]>(ApiUrls.GetAllEventDefinitions(), HttpMethod.Get);

Expand Down
3 changes: 3 additions & 0 deletions src/ConductorSharp.Client/Util/ApiUrls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal static class ApiUrls
private readonly static Uri _updateWorkflowDefinition = 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 _getAllWorkflowNamesAndVersions = new("metadata/workflow/names-and-versions", UriKind.Relative);

private readonly static Uri _queueWorkflow = new("workflow", UriKind.Relative);

Expand Down Expand Up @@ -85,6 +86,8 @@ public static Uri SearchWorkflows(WorkflowSearchRequest request)

public static Uri GetAlleWorkflowDefinitions() => _getAllWorkflowDefinitions;

public static Uri GetAllWorkflowNamesAndVersions() => _getAllWorkflowNamesAndVersions;

public static Uri CreateWorkflowDefinitions() => _createWorkflowDefinitions;

public static Uri QueueWorkflow() => _queueWorkflow;
Expand Down
Loading