Skip to main content

Class: ApiResponse<Request>

Since

1.0.0

Extends

  • ServerResponse<Request>

Type Parameters

Type ParameterDefault type
Request extends IncomingMessageIncomingMessage

Constructors

new ApiResponse()

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

Parameters

ParameterType
reqRequest

Returns

ApiResponse<Request>

Inherited from

ServerResponse<Request>.constructor

Defined in

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

Properties

cookies

cookies: CookieStore

Since

1.0.0

Defined in

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

Defined in

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

Defined in

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


created()

created(data: unknown): void

Parameters

ParameterType
dataunknown

Returns

void

Since

1.0.0

Defined in

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

Defined in

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


forbidden()

forbidden(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Defined in

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

Defined in

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


image()

image(type: "image/svg+xml" | "image/aces" | "image/apng" | "image/avci" | "image/avcs" | "image/avif" | "image/bmp" | "image/cgm" | "image/dicom-rle" | "image/dpx" | "image/emf" | "image/example" | "image/fits" | "image/g3fax" | "image/gif" | "image/heic" | "image/heic-sequence" | "image/heif" | "image/heif-sequence" | "image/hej2k" | "image/hsj2" | "image/ief" | "image/j2c" | "image/jls" | "image/jp2" | "image/jpeg" | "image/jph" | "image/jphc" | "image/jpm" | "image/jpx" | "image/jxl" | "image/jxr" | "image/jxrA" | "image/jxrS" | "image/jxs" | "image/jxsc" | "image/jxsi" | "image/jxss" | "image/ktx" | "image/ktx2" | "image/naplps" | "image/png" | "image/prs.btif" | "image/prs.pti" | "image/pwg-raster" | "image/t38" | "image/tiff" | "image/tiff-fx" | "image/vnd.adobe.photoshop" | "image/vnd.airzip.accelerator.azv" | "image/vnd.cns.inf2" | "image/vnd.dece.graphic" | "image/vnd.djvu" | "image/vnd.dwg" | "image/vnd.dxf" | "image/vnd.dvb.subtitle" | "image/vnd.fastbidsheet" | "image/vnd.fpx" | "image/vnd.fst" | "image/vnd.fujixerox.edmics-mmr" | "image/vnd.fujixerox.edmics-rlc" | "image/vnd.globalgraphics.pgb" | "image/vnd.microsoft.icon" | "image/vnd.mix" | "image/vnd.ms-modi" | "image/vnd.mozilla.apng" | "image/vnd.net-fpx" | "image/vnd.pco.b16" | "image/vnd.radiance" | "image/vnd.sealed.png" | "image/vnd.sealedmedia.softseal.gif" | "image/vnd.sealedmedia.softseal.jpg" | "image/vnd.svf" | "image/vnd.tencent.tap" | "image/vnd.valve.source.texture" | "image/vnd.wap.wbmp" | "image/vnd.xiff" | "image/vnd.zbrush.pcx" | "image/webp" | "image/wmf", data: string | Uint8Array | Readable | Buffer): void

Parameters

ParameterTypeDescription
type"image/svg+xml" | "image/aces" | "image/apng" | "image/avci" | "image/avcs" | "image/avif" | "image/bmp" | "image/cgm" | "image/dicom-rle" | "image/dpx" | "image/emf" | "image/example" | "image/fits" | "image/g3fax" | "image/gif" | "image/heic" | "image/heic-sequence" | "image/heif" | "image/heif-sequence" | "image/hej2k" | "image/hsj2" | "image/ief" | "image/j2c" | "image/jls" | "image/jp2" | "image/jpeg" | "image/jph" | "image/jphc" | "image/jpm" | "image/jpx" | "image/jxl" | "image/jxr" | "image/jxrA" | "image/jxrS" | "image/jxs" | "image/jxsc" | "image/jxsi" | "image/jxss" | "image/ktx" | "image/ktx2" | "image/naplps" | "image/png" | "image/prs.btif" | "image/prs.pti" | "image/pwg-raster" | "image/t38" | "image/tiff" | "image/tiff-fx" | "image/vnd.adobe.photoshop" | "image/vnd.airzip.accelerator.azv" | "image/vnd.cns.inf2" | "image/vnd.dece.graphic" | "image/vnd.djvu" | "image/vnd.dwg" | "image/vnd.dxf" | "image/vnd.dvb.subtitle" | "image/vnd.fastbidsheet" | "image/vnd.fpx" | "image/vnd.fst" | "image/vnd.fujixerox.edmics-mmr" | "image/vnd.fujixerox.edmics-rlc" | "image/vnd.globalgraphics.pgb" | "image/vnd.microsoft.icon" | "image/vnd.mix" | "image/vnd.ms-modi" | "image/vnd.mozilla.apng" | "image/vnd.net-fpx" | "image/vnd.pco.b16" | "image/vnd.radiance" | "image/vnd.sealed.png" | "image/vnd.sealedmedia.softseal.gif" | "image/vnd.sealedmedia.softseal.jpg" | "image/vnd.svf" | "image/vnd.tencent.tap" | "image/vnd.valve.source.texture" | "image/vnd.wap.wbmp" | "image/vnd.xiff" | "image/vnd.zbrush.pcx" | "image/webp" | "image/wmf"The MIME type of the image (e.g., 'image/png').
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.

Defined in

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


json()

json(data: any): void

Parameters

ParameterType
dataany

Returns

void

Since

1.0.0

Defined in

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


methodNotAllowed()

methodNotAllowed(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

7.0.0

Defined in

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


noContent()

noContent(data: unknown): void

Parameters

ParameterType
dataunknown

Returns

void

Since

1.0.0

Defined in

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

Defined in

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

Defined in

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

Defined in

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


setContentType()

setContentType(contentType: MimeType): this

Parameters

ParameterType
contentTypeMimeType

Returns

this

Since

1.0.0

Defined in

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


status()

status(code: number): this

Parameters

ParameterType
codenumber

Returns

this

Since

1.0.0

Defined in

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


text()

text(data: string): void

Parameters

ParameterType
datastring

Returns

void

Since

1.0.0

Defined in

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


unauthorized()

unauthorized(data?: unknown): void

Parameters

ParameterType
data?unknown

Returns

void

Since

1.0.0

Defined in

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