Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.DelmiaNotifier/IRecipeSender.cs
T
2026-06-26 05:13:58 -04:00

22 lines
1.1 KiB
C#

namespace ZB.MOM.WW.ScadaBridge.DelmiaNotifier;
/// <summary>Whether a single POST attempt reached the server (<see cref="Connected"/>) or never did (<see cref="ConnectFailed"/>).</summary>
internal enum AttemptKind
{
Connected,
ConnectFailed,
}
/// <summary>Result of one POST attempt against a single base URL.</summary>
/// <param name="Kind">Did the attempt reach the server?</param>
/// <param name="StatusCode">HTTP status when <see cref="AttemptKind.Connected"/>; 0 otherwise.</param>
/// <param name="Body">Parsed response body on a 2xx; null otherwise.</param>
/// <param name="Error">Connection/exception detail when <see cref="AttemptKind.ConnectFailed"/>; null otherwise.</param>
internal sealed record AttemptOutcome(AttemptKind Kind, int StatusCode, RecipeDownloadResult? Body, string? Error);
/// <summary>Seam over a single recipe-download POST attempt, so the failover loop is testable without real HTTP.</summary>
internal interface IRecipeSender
{
Task<AttemptOutcome> SendAsync(string baseUrl, RecipeDownload payload, CancellationToken ct);
}