SuccessfulResponse
Class SuccessfulResponse
Hierarchy
↳ SuccessfulResponse
Index
Constructors
Properties
Methods
- addHeaders
- appendHeader
- apply
- applyBody
- applyHeaders
- applyStatusCode
- file
- format
- getStatusCode
- html
- json
- patchContext
- removeHeader
- sendFile
- setHeader
- setHeaders
- setStatusCode
- accepted
- alreadyReported
- create
- created
- imUsed
- multiStatus
- noContent
- nonAuthoritativeInformation
- ok
- partialContent
- resetContent
Constructors
Protected constructor
new SuccessfulResponse(__namedParameters: object): SuccessfulResponse
Inherited from Response.constructor
Defined in Library/Response/Response.ts:20
Parameters:
__namedParameters: object
| Name | Type |
|---|---|
| data | any |
| message | string |
| meta | any |
| statusCode | HttpStatusCodes |
Returns: SuccessfulResponse
Properties
Protected ctx
ctx: ContextInterface
Defined in Library/Response/Response.ts:8
Protected data
data: any
Defined in Library/Response/Response.ts:18
Protected headers
headers: object
Inherited from Response.headers
Defined in Library/Response/Response.ts:10
Type declaration
[header: string]: string | Array<string>
Protected message
message: string
Inherited from Response.message
Defined in Library/Response/Response.ts:20
Protected meta
meta: any
Defined in Library/Response/Response.ts:16
Protected statusCode
statusCode: HttpStatusCodes
Inherited from Response.statusCode
Defined in Library/Response/Response.ts:14
Protected strategy
strategy: string = ResponseStrategies.Json
Inherited from Response.strategy
Defined in Library/Response/Response.ts:12
Methods
addHeaders
addHeaders(headers: object): this
Inherited from Response.addHeaders
Defined in Library/Response/Response.ts:93
Parameters:
| Name | Type |
|---|---|
| headers | object |
Returns: this
appendHeader
appendHeader(header: string, value: * string | Array<string>*): void
Inherited from Response.appendHeader
Defined in Library/Response/Response.ts:105
Parameters:
| Name | Type |
|---|---|
| header | string |
| value | string | Array<string> |
Returns: void
Protected apply
apply(): void
Defined in Library/Response/Response.ts:142
Returns: void
Protected applyBody
applyBody(body: any): this
Inherited from Response.applyBody
Defined in Library/Response/Response.ts:79
Parameters:
| Name | Type |
|---|---|
| body | any |
Returns: this
applyHeaders
applyHeaders(): this
Inherited from Response.applyHeaders
Defined in Library/Response/Response.ts:115
Returns: this
applyStatusCode
applyStatusCode(statusCode: HttpStatusCodes): this
Inherited from Response.applyStatusCode
Defined in Library/Response/Response.ts:63
Parameters:
| Name | Type |
|---|---|
| statusCode | HttpStatusCodes |
Returns: this
file
file(location: string, options?: SendOptions): this
Defined in Library/Response/Response.ts:121
Parameters:
| Name | Type |
|---|---|
| location | string |
Optional options | SendOptions |
Returns: this
format
format(): any
Defined in Library/Response/SuccessfulResponse.ts:49
Returns: any
getStatusCode
getStatusCode(): HttpStatusCodes
Inherited from Response.getStatusCode
Defined in Library/Response/Response.ts:75
Returns: HttpStatusCodes
html
html(data: any): this
Defined in Library/Response/Response.ts:135
Parameters:
| Name | Type |
|---|---|
| data | any |
Returns: this
json
json(data: any): this
Defined in Library/Response/Response.ts:128
Parameters:
| Name | Type |
|---|---|
| data | any |
Returns: this
patchContext
patchContext(ctx: ContextInterface): Promise<void>
Inherited from Response.patchContext
Defined in Library/Response/Response.ts:29
Parameters:
| Name | Type |
|---|---|
| ctx | ContextInterface |
Returns: Promise<void>
removeHeader
removeHeader(header: string): this
Inherited from Response.removeHeader
Defined in Library/Response/Response.ts:109
Parameters:
| Name | Type |
|---|---|
| header | string |
Returns: this
Protected sendFile
sendFile(): Promise<string>
Inherited from Response.sendFile
Defined in Library/Response/Response.ts:52
Returns: Promise<string>
setHeader
setHeader(header: string, value: * string | Array<string>*): this
Inherited from Response.setHeader
Defined in Library/Response/Response.ts:99
Parameters:
| Name | Type |
|---|---|
| header | string |
| value | string | Array<string> |
Returns: this
setHeaders
setHeaders(headers: object): this
Inherited from Response.setHeaders
Defined in Library/Response/Response.ts:87
Parameters:
| Name | Type |
|---|---|
| headers | object |
Returns: this
setStatusCode
setStatusCode(statusCode: HttpStatusCodes): this
Inherited from Response.setStatusCode
Defined in Library/Response/Response.ts:69
Parameters:
| Name | Type |
|---|---|
| statusCode | HttpStatusCodes |
Returns: this
Static accepted
accepted(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:17
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static alreadyReported
alreadyReported(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:41
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static create
create(statusCode: HttpStatusCodes, data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:5
Parameters:
| Name | Type |
|---|---|
| statusCode | HttpStatusCodes |
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static created
created(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:13
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static imUsed
imUsed(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:45
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static multiStatus
multiStatus(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:37
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static noContent
noContent(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:25
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static nonAuthoritativeInformation
nonAuthoritativeInformation(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:21
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static ok
ok(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:9
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static partialContent
partialContent(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:33
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse
Static resetContent
resetContent(data?: any, meta?: any): SuccessfulResponse
Defined in Library/Response/SuccessfulResponse.ts:29
Parameters:
| Name | Type |
|---|---|
Optional data | any |
Optional meta | any |
Returns: SuccessfulResponse