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
TThe type of the response payload.
- Inheritance
-
UciResponse<T>
- Inherited Members
- Extension Methods
Constructors
UciResponse()
protected UciResponse()
UciResponse(T)
protected UciResponse(T entity)
Parameters
entityT
Properties
Data
public T? Data { get; protected set; }
Property Value
- T
Date
public DateTime Date { get; set; }
Property Value
Error
public string? Error { get; set; }
Property Value
Message
public string? Message { get; protected set; }
Property Value
Success
public bool Success { get; protected set; }
Property Value
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
exExceptionThe 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
errorstringThe error code or identifier describing the failure.
messagestringAn optional human-readable message providing additional context about the error.
Returns
- UciResponse<T>
A UciResponse<T> with
Successset tofalse, the specifiederror, and the optionalmessage.
FromSuccess(T)
Creates a successful UciResponse<T> wrapping the specified entity.
public static UciResponse<T> FromSuccess(T entity)
Parameters
entityTThe entity to include in the response payload.
Returns
- UciResponse<T>
A UciResponse<T> containing the provided entity.