Table of Contents

Class ProblemDetailsExtensions

Namespace
Arc4u.AspNetCore.Results
Assembly
Arc4u.AspNetCore.Results.dll

Fluent helpers to fill the members and extensions of a ProblemDetails.

public static class ProblemDetailsExtensions
Inheritance
ProblemDetailsExtensions
Inherited Members

Methods

WithCode(ProblemDetails, string)

Adds or replaces the Code entry of Extensions when code is not null or white space.

public static ProblemDetails WithCode(this ProblemDetails problemDetails, string code)

Parameters

problemDetails ProblemDetails

The problem details to complete.

code string

The code to expose.

Returns

ProblemDetails

The same problemDetails, to chain calls.

Exceptions

ArgumentNullException

problemDetails is null.

WithDetail(ProblemDetails, string)

Sets Detail.

public static ProblemDetails WithDetail(this ProblemDetails problemDetails, string detail)

Parameters

problemDetails ProblemDetails

The problem details to complete.

detail string

The human readable explanation.

Returns

ProblemDetails

The same problemDetails, to chain calls.

WithInstance(ProblemDetails, string?)

Sets Instance when instance is not null or white space.

public static ProblemDetails WithInstance(this ProblemDetails problemDetails, string? instance)

Parameters

problemDetails ProblemDetails

The problem details to complete.

instance string

The instance URI reference.

Returns

ProblemDetails

The same problemDetails, to chain calls.

Exceptions

ArgumentNullException

problemDetails is null.

WithMetadata(ProblemDetails, string, object)

Adds or replaces an entry of Extensions when key is not null or white space and value is not null.

public static ProblemDetails WithMetadata(this ProblemDetails problemDetails, string key, object value)

Parameters

problemDetails ProblemDetails

The problem details to complete.

key string

The extension name.

value object

The extension value.

Returns

ProblemDetails

The same problemDetails, to chain calls.

Exceptions

ArgumentNullException

problemDetails is null.

WithSeverity(ProblemDetails, string)

Adds or replaces the Severity entry of Extensions when severity is not null or white space.

public static ProblemDetails WithSeverity(this ProblemDetails problemDetails, string severity)

Parameters

problemDetails ProblemDetails

The problem details to complete.

severity string

The severity to expose.

Returns

ProblemDetails

The same problemDetails, to chain calls.

Exceptions

ArgumentNullException

problemDetails is null.

WithStatusCode(ProblemDetails, int)

Sets Status.

public static ProblemDetails WithStatusCode(this ProblemDetails problemDetails, int statusCode)

Parameters

problemDetails ProblemDetails

The problem details to complete.

statusCode int

The HTTP status code.

Returns

ProblemDetails

The same problemDetails, to chain calls.

WithTitle(ProblemDetails, string)

Sets Title.

public static ProblemDetails WithTitle(this ProblemDetails problemDetails, string title)

Parameters

problemDetails ProblemDetails

The problem details to complete.

title string

The title.

Returns

ProblemDetails

The same problemDetails, to chain calls.

WithType(ProblemDetails, Uri)

Sets Type from a URI.

public static ProblemDetails WithType(this ProblemDetails problemDetails, Uri type)

Parameters

problemDetails ProblemDetails

The problem details to complete.

type Uri

The problem type URI.

Returns

ProblemDetails

The same problemDetails, to chain calls.