using StellaOps.TaskRunner.Client.Models;
namespace StellaOps.TaskRunner.Client;
///
/// Client interface for the TaskRunner WebService API.
///
public interface ITaskRunnerClient
{
#region Pack Runs
///
/// Creates a new pack run.
///
/// Run creation request.
/// Cancellation token.
/// Created run response.
Task CreateRunAsync(
CreatePackRunRequest request,
CancellationToken cancellationToken = default);
///
/// Gets the current state of a pack run.
///
/// Run identifier.
/// Cancellation token.
/// Pack run state or null if not found.
Task GetRunAsync(
string runId,
CancellationToken cancellationToken = default);
///
/// Cancels a running pack run.
///
/// Run identifier.
/// Cancellation token.
/// Cancel response.
Task CancelRunAsync(
string runId,
CancellationToken cancellationToken = default);
#endregion
#region Approvals
///
/// Applies an approval decision to a pending approval gate.
///
/// Run identifier.
/// Approval gate identifier.
/// Decision request.
/// Cancellation token.
/// Approval decision response.
Task ApplyApprovalDecisionAsync(
string runId,
string approvalId,
ApprovalDecisionRequest request,
CancellationToken cancellationToken = default);
#endregion
#region Logs
///
/// Streams log entries for a pack run as NDJSON.
///
/// Run identifier.
/// Cancellation token.
/// Async enumerable of log entries.
IAsyncEnumerable StreamLogsAsync(
string runId,
CancellationToken cancellationToken = default);
#endregion
#region Artifacts
///
/// Lists artifacts produced by a pack run.
///
/// Run identifier.
/// Cancellation token.
/// Artifact list response.
Task ListArtifactsAsync(
string runId,
CancellationToken cancellationToken = default);
#endregion
#region Simulation
///
/// Simulates a task pack execution without running it.
///
/// Simulation request.
/// Cancellation token.
/// Simulation result.
Task SimulateAsync(
SimulatePackRequest request,
CancellationToken cancellationToken = default);
#endregion
#region Metadata
///
/// Gets OpenAPI metadata including spec URL, version, and signature.
///
/// Cancellation token.
/// OpenAPI metadata.
Task GetOpenApiMetadataAsync(CancellationToken cancellationToken = default);
#endregion
}
///
/// OpenAPI metadata from /.well-known/openapi endpoint.
///
public sealed record OpenApiMetadata(
[property: System.Text.Json.Serialization.JsonPropertyName("specUrl")] string SpecUrl,
[property: System.Text.Json.Serialization.JsonPropertyName("version")] string Version,
[property: System.Text.Json.Serialization.JsonPropertyName("buildVersion")] string BuildVersion,
[property: System.Text.Json.Serialization.JsonPropertyName("eTag")] string ETag,
[property: System.Text.Json.Serialization.JsonPropertyName("signature")] string Signature);