tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
AuthorityResponse{TResult}.cs
Go to the documentation of this file.
1using System;
2using System.Diagnostics.CodeAnalysis;
3
4using Microsoft.AspNetCore.Mvc;
6
8{
13 public sealed class AuthorityResponse<TResult> : AuthorityResponse
14 {
16 [MemberNotNullWhen(true, nameof(IsNoContent))]
17 public override bool Success => base.Success;
18
22 [MemberNotNullWhen(false, nameof(Result))]
23 [MemberNotNullWhen(false, nameof(Result))]
24 public bool? IsNoContent => Success ? Result == null : null;
25
29 public TResult? Result { get; }
30
35
42 : base(errorMessage, httpResponse)
43 {
44 }
45
51 public AuthorityResponse(TResult result, HttpSuccessResponse httpResponse = HttpSuccessResponse.Ok)
52 {
53 Result = result ?? throw new ArgumentNullException(nameof(result));
54 SuccessResponse = httpResponse;
55 }
56
62 {
63 }
64 }
65}
Represents an error message returned by the server.
virtual bool Success
Checks if the AuthorityResponse was successful.
AuthorityResponse(ErrorMessageResponse errorMessage, HttpFailureResponse httpResponse)
Initializes a new instance of the AuthorityResponse<TResult> class.
AuthorityResponse(TResult result, HttpSuccessResponse httpResponse=HttpSuccessResponse.Ok)
Initializes a new instance of the AuthorityResponse<TResult> class.
HttpSuccessResponse? SuccessResponse
The HttpSuccessResponse for generating the IActionResults.
bool? IsNoContent
Checks if a the AuthorityResponse<TResult> is a no content result. Only set on Success.
AuthorityResponse()
Initializes a new instance of the AuthorityResponse<TResult> class.
HttpFailureResponse
Indicates the type of HTTP status code an failing AuthorityResponse should generate.
HttpSuccessResponse
Indicates the type of HTTP status code a successful AuthorityResponse<TResult> should generate.