Restructure solution layout by module
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace StellaOps.Policy.Gateway.Clients;
|
||||
|
||||
internal sealed class PolicyEngineResponse<TSuccess>
|
||||
{
|
||||
private PolicyEngineResponse(HttpStatusCode statusCode, TSuccess? value, ProblemDetails? problem, string? location)
|
||||
{
|
||||
StatusCode = statusCode;
|
||||
Value = value;
|
||||
Problem = problem;
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public HttpStatusCode StatusCode { get; }
|
||||
|
||||
public TSuccess? Value { get; }
|
||||
|
||||
public ProblemDetails? Problem { get; }
|
||||
|
||||
public string? Location { get; }
|
||||
|
||||
public bool IsSuccess => Problem is null && StatusCode is >= HttpStatusCode.OK and < HttpStatusCode.MultipleChoices;
|
||||
|
||||
public static PolicyEngineResponse<TSuccess> Success(HttpStatusCode statusCode, TSuccess? value, string? location)
|
||||
=> new(statusCode, value, problem: null, location);
|
||||
|
||||
public static PolicyEngineResponse<TSuccess> Failure(HttpStatusCode statusCode, ProblemDetails? problem)
|
||||
=> new(statusCode, value: default, problem, location: null);
|
||||
}
|
||||
Reference in New Issue
Block a user