Class ProblemDetailsExtensions
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
problemDetailsProblemDetailsThe problem details to complete.
codestringThe code to expose.
Returns
- ProblemDetails
The same
problemDetails, to chain calls.
Exceptions
- ArgumentNullException
problemDetailsis null.
WithDetail(ProblemDetails, string)
Sets Detail.
public static ProblemDetails WithDetail(this ProblemDetails problemDetails, string detail)
Parameters
problemDetailsProblemDetailsThe problem details to complete.
detailstringThe 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
problemDetailsProblemDetailsThe problem details to complete.
instancestringThe instance URI reference.
Returns
- ProblemDetails
The same
problemDetails, to chain calls.
Exceptions
- ArgumentNullException
problemDetailsis 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
problemDetailsProblemDetailsThe problem details to complete.
keystringThe extension name.
valueobjectThe extension value.
Returns
- ProblemDetails
The same
problemDetails, to chain calls.
Exceptions
- ArgumentNullException
problemDetailsis 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
problemDetailsProblemDetailsThe problem details to complete.
severitystringThe severity to expose.
Returns
- ProblemDetails
The same
problemDetails, to chain calls.
Exceptions
- ArgumentNullException
problemDetailsis null.
WithStatusCode(ProblemDetails, int)
Sets Status.
public static ProblemDetails WithStatusCode(this ProblemDetails problemDetails, int statusCode)
Parameters
problemDetailsProblemDetailsThe problem details to complete.
statusCodeintThe 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
problemDetailsProblemDetailsThe problem details to complete.
titlestringThe 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
problemDetailsProblemDetailsThe problem details to complete.
typeUriThe problem type URI.
Returns
- ProblemDetails
The same
problemDetails, to chain calls.