Class: ApiResponse<Request>
Since
1.0.0
Extends
ServerResponse
<Request
>
Type Parameters
Type Parameter | Default type |
---|---|
Request extends IncomingMessage | IncomingMessage |
Constructors
new ApiResponse()
new ApiResponse<
Request
>(req
:Request
):ApiResponse
<Request
>
Parameters
Parameter | Type |
---|---|
req | Request |
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
data | unknown |
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
Parameter | Type |
---|---|
error | string | 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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
code | number |
data | string |
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/avif"
|"image/bmp"
|"image/gif"
|"image/jpeg"
|"image/png"
|"image/tiff"
|"image/webp"
|"image/aces"
|"image/apng"
|"image/avci"
|"image/avcs"
|"image/cgm"
|"image/dicom-rle"
|"image/dpx"
|"image/emf"
|"image/example"
|"image/fits"
|"image/g3fax"
|"image/heic"
|"image/heic-sequence"
|"image/heif"
|"image/heif-sequence"
|"image/hej2k"
|"image/hsj2"
|"image/ief"
|"image/j2c"
|"image/jls"
|"image/jp2"
|"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/prs.btif"
|"image/prs.pti"
|"image/pwg-raster"
|"image/t38"
|"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/wmf"
,data
:string
|Uint8Array
|Readable
|Buffer
):void
Parameters
Parameter | Type | Description |
---|---|---|
type | "image/svg+xml" | "image/avif" | "image/bmp" | "image/gif" | "image/jpeg" | "image/png" | "image/tiff" | "image/webp" | "image/aces" | "image/apng" | "image/avci" | "image/avcs" | "image/cgm" | "image/dicom-rle" | "image/dpx" | "image/emf" | "image/example" | "image/fits" | "image/g3fax" | "image/heic" | "image/heic-sequence" | "image/heif" | "image/heif-sequence" | "image/hej2k" | "image/hsj2" | "image/ief" | "image/j2c" | "image/jls" | "image/jp2" | "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/prs.btif" | "image/prs.pti" | "image/pwg-raster" | "image/t38" | "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/wmf" | The MIME type of the image (e.g., 'image/png'). |
data | string | Uint8Array | Readable | Buffer | The 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
Parameter | Type |
---|---|
data | any |
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
data | unknown |
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
data | unknown |
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
Parameter | Type |
---|---|
data | unknown |
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
Parameter | Type |
---|---|
contentType | MimeType |
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
Parameter | Type |
---|---|
code | number |
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
Parameter | Type |
---|---|
data | string |
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
Parameter | Type |
---|---|
data ? | unknown |
Returns
void
Since
1.0.0
Defined in
projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:51