Table of Contents

Class IResultResponse

Namespace
Biwen.QuickApi
Assembly
Biwen.QuickApi.dll

IResult输出. 针对IResultResponse 请自行重写BaseQuickApi.HandlerBuilder方法的OpenApi实现

[Obsolete("请直接使用IResult返回")]
public sealed class IResultResponse
Inheritance
IResultResponse
Inherited Members
Extension Methods

Constructors

IResultResponse(IResult)

IResult输出. 针对IResultResponse 请自行重写BaseQuickApi.HandlerBuilder方法的OpenApi实现

public IResultResponse(IResult result)

Parameters

result IResult

Properties

Empty

Empty

public static IResultResponse Empty { get; }

Property Value

IResultResponse

NotFound

NotFound

public static IResultResponse NotFound { get; }

Property Value

IResultResponse

Result

public IResult Result { get; set; }

Property Value

IResult

Unauthorized

Unauthorized

public static IResultResponse Unauthorized { get; }

Property Value

IResultResponse

Methods

BadRequest(object?)

BadRequest

public static IResultResponse BadRequest(object? error = null)

Parameters

error object

Returns

IResultResponse

Content(string?, string?, Encoding?, int?)

Content

public static IResultResponse Content(string? content, string? contentType = null, Encoding? encoding = null, int? statusCode = null)

Parameters

content string
contentType string
encoding Encoding
statusCode int?

Returns

IResultResponse

File(string, string?, string?, bool)

File

public static IResultResponse File(string path, string? contentType = null, string? fileDownloadName = null, bool enableRangeProcessing = false)

Parameters

path string
contentType string
fileDownloadName string
enableRangeProcessing bool

Returns

IResultResponse

Json<T>(T, JsonSerializerOptions?, string?, int?)

Json

public static IResultResponse Json<T>(T value, JsonSerializerOptions? serializerOptions = null, string? contentType = null, int? statusCode = null)

Parameters

value T
serializerOptions JsonSerializerOptions
contentType string
statusCode int?

Returns

IResultResponse

Type Parameters

T

OK(object?)

直接返回OK

public static IResultResponse OK(object? value = null)

Parameters

value object

Returns

IResultResponse

Problem(ProblemDetails)

Problem

public static IResultResponse Problem(ProblemDetails problemDetails)

Parameters

problemDetails ProblemDetails

Returns

IResultResponse

Problem(string?, string?, int?, string?, string?, IDictionary<string, object?>?)

Problem

public static IResultResponse Problem(string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, IDictionary<string, object?>? extensions = null)

Parameters

detail string
instance string
statusCode int?
title string
type string
extensions IDictionary<string, object>

Returns

IResultResponse

Redirect(string, bool, bool)

Redirect

public static IResultResponse Redirect(string url, bool permanent = false, bool preserveMethod = false)

Parameters

url string
permanent bool
preserveMethod bool

Returns

IResultResponse

StatusCode(int)

StatusCode

public static IResultResponse StatusCode(int statusCode)

Parameters

statusCode int

Returns

IResultResponse

Stream(Stream, string?, string?, bool)

Stream

public static IResultResponse Stream(Stream stream, string? contentType = null, string? fileDownloadName = null, bool enableRangeProcessing = false)

Parameters

stream Stream
contentType string
fileDownloadName string
enableRangeProcessing bool

Returns

IResultResponse

Text(string, string?, Encoding?, int?)

Text

public static IResultResponse Text(string text, string? contentType = null, Encoding? encoding = null, int? statusCode = null)

Parameters

text string
contentType string
encoding Encoding
statusCode int?

Returns

IResultResponse