Skip to main content

IQEvent

@quik/http


@quik/http / IQEvent

Interface: IQEvent<TPathParameters, TQueryParameters, TBody, TUser>

Defined in: http/src/router/endpoint/QEvent.ts:15

Endpoint event contract exposed to endpoint handlers.

Type Parameters

TPathParameters

TPathParameters = ObjectLiteral

TQueryParameters

TQueryParameters = ObjectLiteral

TBody

TBody = ObjectLiteral

TUser

TUser extends IQUser = IQUser

Properties

body

readonly body: TBody

Defined in: http/src/router/endpoint/QEvent.ts:24

Validated request body entity or object.


ip?

readonly optional ip?: string

Defined in: http/src/router/endpoint/QEvent.ts:64

Client IP address for the current request.


language

readonly language: string

Defined in: http/src/router/endpoint/QEvent.ts:49

Active request language.


path

readonly path: TPathParameters

Defined in: http/src/router/endpoint/QEvent.ts:29

Validated path parameter entity or object.


query

readonly query: TQueryParameters

Defined in: http/src/router/endpoint/QEvent.ts:19

Validated query parameter entity or object.


requestId

readonly requestId: string

Defined in: http/src/router/endpoint/QEvent.ts:54

Request identifier used for tracing.


scheme

readonly scheme: string

Defined in: http/src/router/endpoint/QEvent.ts:39

Authorization scheme extracted from the request.


token

readonly token: string

Defined in: http/src/router/endpoint/QEvent.ts:34

Authorization token extracted from the request.


user

readonly user: TUser

Defined in: http/src/router/endpoint/QEvent.ts:44

Authenticated user associated with the request.


userAgent?

readonly optional userAgent?: string

Defined in: http/src/router/endpoint/QEvent.ts:59

User agent header value for the current request.

Methods

clearCookie()

clearCookie(cookieName, options?): void

Defined in: http/src/router/endpoint/QEvent.ts:133

Remove a cookie from the current response.

Parameters

cookieName

string

Cookie name to remove

options?

IQCookieOptions

Cookie options applied by the HTTP adapter

Returns

void


freeze()

freeze(): void

Defined in: http/src/router/endpoint/QEvent.ts:91

Freeze the event instance.

Returns

void


getCookie()

getCookie(cookieName): string

Defined in: http/src/router/endpoint/QEvent.ts:116

Read a cookie value from the current request.

Parameters

cookieName

string

Cookie name to read

Returns

string


getObject()

getObject<T>(key): T

Defined in: http/src/router/endpoint/QEvent.ts:78

Retrieve a custom object stored on the request context.

Type Parameters

T

T = any

Parameters

key

string

Object key to read

Returns

T


header(headerName): string

Defined in: http/src/router/endpoint/QEvent.ts:71

Read a request header value.

Parameters

headerName

string

Header name to read

Returns

string


init()

init(): Promise<void>

Defined in: http/src/router/endpoint/QEvent.ts:96

Initialize configured endpoint parameters from the request context.

Returns

Promise<void>


logout()

logout(): void

Defined in: http/src/router/endpoint/QEvent.ts:101

Log out the current user through the request context.

Returns

void


setCookie()

setCookie(cookieName, cookieValue, options?): void

Defined in: http/src/router/endpoint/QEvent.ts:125

Add a cookie to the current response.

Parameters

cookieName

string

Cookie name to write

cookieValue

string

Cookie value to write

options?

IQCookieOptions

Cookie options applied by the HTTP adapter

Returns

void


setObject()

setObject<T>(key, value): void

Defined in: http/src/router/endpoint/QEvent.ts:86

Store a custom object on the request context.

Type Parameters

T

T = any

Parameters

key

string

Object key to write

value

T

Object value to store

Returns

void


translate()

translate(key, parameters?): string

Defined in: http/src/router/endpoint/QEvent.ts:109

Translate a key using the request context.

Parameters

key

string

Translation key to resolve

parameters?

ObjectLiteral

Translation interpolation parameters

Returns

string