Class ApiResponse<T>
- Namespace
- Tudormobile.OpenTrivia
- Assembly
- Tudormobile.OpenTrivia.dll
Represents the response from an Open Trivia API call.
public class ApiResponse<T>
Type Parameters
TThe type of data returned by the API call.
- Inheritance
-
ApiResponse<T>
- Inherited Members
Constructors
ApiResponse(T?, ApiException?, ApiResponseCode, int)
Initializes a new instance of the ApiResponse<T> class.
public ApiResponse(T? data = default, ApiException? error = null, ApiResponseCode responseCode = ApiResponseCode.Unknown, int statusCode = 0)
Parameters
dataTData returned by the API call
errorApiExceptionError that occurred during the API call
responseCodeApiResponseCodeResponse code returned by the API.
statusCodeintHTTP status code of the response.
Properties
Data
Gets the data returned by the API call, or null if the request failed.
public T? Data { get; }
Property Value
- T
Error
Gets the error that occurred during the API call, or null if the request was successful.
public ApiException? Error { get; }
Property Value
ErrorMessage
Gets the error message from the Error, or null if no error occurred.
public string? ErrorMessage { get; }
Property Value
IsSuccess
Gets a value indicating whether the API call was successful (no error occurred).
public bool IsSuccess { get; }
Property Value
ResponseCode
Gets the response code returned by the API.
public ApiResponseCode ResponseCode { get; }
Property Value
StatusCode
Gets the HTTP status code of the response.
public int StatusCode { get; init; }