Skip to main content

Class: ApiResponse<Request>

Since

1.0.0

Extends

  • ServerResponse<Request>

Type parameters

Type parameterValue
Request extends IncomingMessageIncomingMessage

Constructors

new ApiResponse()

new ApiResponse<Request>(req: Request): ApiResponse<Request>

Parameters

ParameterType
reqRequest

Returns

ApiResponse<Request>

Inherited from

ServerResponse<Request>.constructor

Source

node_modules/@types/node/http.d.ts:741

Properties

cookies

cookies: CookieStore

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:15

Methods

badRequest()

badRequest(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:44


conflict()

conflict(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:72


created()

created(data: unknown): void

Parameters

ParameterType
dataunknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:28


error()

error(error: string | number, data?: unknown): void

Parameters

ParameterType
errorstring | number
data?unknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:79


forbidden()

forbidden(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:58


html()

html(code: number, data: string): void

Parameters

ParameterType
codenumber
datastring

Returns

void

Since

5.1.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:139


image()

image(type: ImageGif | ImageJpg | ImagePng | ImageWebp | ImageXIcon, data: string | Uint8Array | Readable | Buffer): void

Parameters

ParameterTypeDescription
typeImageGif | ImageJpg | ImagePng | ImageWebp | ImageXIconThe MIME type of the image (e.g., MimeTypes.ImagePng).
datastring | Uint8Array | Readable | BufferThe image data as a string, Buffer, Uint8Array, or ReadableStream.

Returns

void

Since

6.1.0

Sets the image content type and sends the image data in the response.

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:124


json()

json(data: any): void

Parameters

ParameterType
dataany

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:105


noContent()

noContent(data: unknown): void

Parameters

ParameterType
dataunknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:36


notFound()

notFound(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:65


ok()

ok(data: unknown): void

Parameters

ParameterType
dataunknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:20


respond()

respond(data: unknown): void

Parameters

ParameterType
dataunknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:90


setContentType()

setContentType(contentType: MimeTypes): this

Parameters

ParameterType
contentTypeMimeTypes

Returns

this

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:146


status()

status(code: number): this

Parameters

ParameterType
codenumber

Returns

this

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:97


text()

text(data: string): void

Parameters

ParameterType
datastring

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:112


unauthorized()

unauthorized(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Source

projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:51