Table of Contents

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

T

The 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

data T

Data returned by the API call

error ApiException

Error that occurred during the API call

responseCode ApiResponseCode

Response code returned by the API.

statusCode int

HTTP 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

ApiException

ErrorMessage

Gets the error message from the Error, or null if no error occurred.

public string? ErrorMessage { get; }

Property Value

string

IsSuccess

Gets a value indicating whether the API call was successful (no error occurred).

public bool IsSuccess { get; }

Property Value

bool

ResponseCode

Gets the response code returned by the API.

public ApiResponseCode ResponseCode { get; }

Property Value

ApiResponseCode

StatusCode

Gets the HTTP status code of the response.

public int StatusCode { get; init; }

Property Value

int