SMS služba: prostředník nad SMS-Služba.cz (API XML 3.0)
- JSON API /v1: odeslání SMS, doručenka, události, potvrzení událostí, kredit - vlastní API klíč pro každou aplikaci (X-Api-Key, API_KEYS) - po chybě přihlášení k bráně se volání zastaví, aby se účet nezablokoval - heslo maskované v logu, odeslání se nikdy neopakuje automaticky - /health, /docs a OpenAPI s prefixem z ROOT_PATH - .NET 10, šablona .NET 8 nahrazena projektem v src/, testy v tests/ - dokumentace: návrh, stav a návod pro napojení aplikací
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using SmsSluzba.Api.Contracts;
|
||||
using SmsSluzba.Api.Gateway;
|
||||
|
||||
namespace SmsSluzba.Api.Endpoints;
|
||||
|
||||
internal static class SystemEndpoints
|
||||
{
|
||||
private const string GatewayOk = "ok";
|
||||
private const string GatewayBlocked = "blocked";
|
||||
|
||||
public static IEndpointRouteBuilder MapSystemEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapGet("/", () => Results.Json(new
|
||||
{
|
||||
name = "SMS Služba",
|
||||
service = "sms-sluzba",
|
||||
status = "ok",
|
||||
}))
|
||||
.ExcludeFromDescription();
|
||||
|
||||
// Stays 200 even when the gateway login is blocked: a failing health check would make AppFactory
|
||||
// restart the container, and every restart would try the wrong password again.
|
||||
app.MapGet("/health", (GatewayAuthGuard authGuard) =>
|
||||
Results.Ok(new HealthResponse("ok", authGuard.IsBlocked ? GatewayBlocked : GatewayOk)))
|
||||
.WithName("Health")
|
||||
.WithTags("Služba")
|
||||
.WithSummary("Stav služby, nevolá SMS bránu")
|
||||
.Produces<HealthResponse>();
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user