Class Result<T>
- Namespace
- RustMapsApi.Results
- Assembly
- RustMapsApi.dll
The outcome of a RustMaps API call.
public sealed class Result<T>
Type Parameters
TThe payload type on success.
- Inheritance
-
Result<T>
- Inherited Members
Properties
Data
The payload, populated when IsSuccess is true.
public T? Data { get; }
Property Value
- T
Error
The error, populated when IsSuccess is false.
public RustMapsError? Error { get; }
Property Value
IsSuccess
Whether the call succeeded.
public bool IsSuccess { get; }
Property Value
StatusCode
The HTTP status code of the response.
public int StatusCode { get; }
Property Value
Methods
Failure(RustMapsError, int)
Creates a failed result.
[SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "Factory methods are the intended construction API for this result type.")]
public static Result<T> Failure(RustMapsError error, int statusCode)
Parameters
errorRustMapsErrorThe error describing the failure.
statusCodeintThe HTTP status code of the response.
Returns
Success(T, int)
Creates a successful result.
[SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "Factory methods are the intended construction API for this result type.")]
public static Result<T> Success(T data, int statusCode)
Parameters
dataTThe payload to carry.
statusCodeintThe HTTP status code of the response.