Table of Contents

Class Result<T>

Namespace
RustMapsApi.Results
Assembly
RustMapsApi.dll

The outcome of a RustMaps API call.

public sealed class Result<T>

Type Parameters

T

The 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

RustMapsError

IsSuccess

Whether the call succeeded.

public bool IsSuccess { get; }

Property Value

bool

StatusCode

The HTTP status code of the response.

public int StatusCode { get; }

Property Value

int

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

error RustMapsError

The error describing the failure.

statusCode int

The HTTP status code of the response.

Returns

Result<T>

A failed Result<T>.

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

data T

The payload to carry.

statusCode int

The HTTP status code of the response.

Returns

Result<T>

A successful Result<T>.