Table of Contents

Class UciResponse<T>

Namespace
adas_core.Authentication.Models
Assembly
adas-core.Authentication.dll

Represents a generic response in the Universal Chess Interface (UCI) protocol, encapsulating a payload of type T.

public class UciResponse<T>

Type Parameters

T

The type of the response payload.

Inheritance
UciResponse<T>
Inherited Members
Extension Methods

Constructors

UciResponse()

protected UciResponse()

UciResponse(T)

protected UciResponse(T entity)

Parameters

entity T

Properties

Data

public T? Data { get; protected set; }

Property Value

T

Date

public DateTime Date { get; set; }

Property Value

DateTime

Error

public string? Error { get; set; }

Property Value

string

Message

public string? Message { get; protected set; }

Property Value

string

Success

public bool Success { get; protected set; }

Property Value

bool

Methods

FromError(Exception)

Creates a UciResponse<T> representing an error state derived from the supplied exception, using the exception's type name (with the "Exception" suffix stripped) as the error code and its message as the error description.

public static UciResponse<T> FromError(Exception ex)

Parameters

ex Exception

The exception whose type name and message are used to populate the error response.

Returns

UciResponse<T>

A UciResponse<T> containing the cleaned exception type name and the exception message as the error details.

FromError(string, string?)

Creates a UciResponse<T> instance representing a failed operation, populating the error information and an optional descriptive message.

public static UciResponse<T> FromError(string error, string? message = null)

Parameters

error string

The error code or identifier describing the failure.

message string

An optional human-readable message providing additional context about the error.

Returns

UciResponse<T>

A UciResponse<T> with Success set to false, the specified error, and the optional message.

FromSuccess(T)

Creates a successful UciResponse<T> wrapping the specified entity.

public static UciResponse<T> FromSuccess(T entity)

Parameters

entity T

The entity to include in the response payload.

Returns

UciResponse<T>

A UciResponse<T> containing the provided entity.