Skip to main content

Class: JinEitherFrame<TPASS, TFAIL>

Definition HTTP Request

Type parameters

NameTypeDescription
TPASSunknownAxiosResponse type argument case of valid status. eg. AxiosResponse<TPASS>
TFAILTPASSAxiosResponse type argument case of invalid status. eg. AxiosResponse<TFAIL>

Hierarchy

Implements

Constructors

constructor

new JinEitherFrame<TPASS, TFAIL>(args)

Type parameters

NameType
TPASSunknown
TFAILTPASS

Parameters

NameType
argsObject
args.contentType?string
args.customBody?Object
args.host?string
args.methodMethod
args.path?string

Overrides

AbstractJinFrame.constructor

Defined in

jin-frame/src/frames/JinEitherFrame.ts:41

Properties

contentType

Readonly contentType: string

content-type of API Request endpoint

Inherited from

AbstractJinFrame.contentType

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:87


customBody

Optional Readonly customBody: Object

custom object of POST Request body data

Index signature

[key: string]: any

Inherited from

AbstractJinFrame.customBody

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:90


host

Optional Readonly host: string

host of API Request endpoint

Inherited from

AbstractJinFrame.host

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:78


method

Readonly method: Method

method of API Request endpoint

Inherited from

AbstractJinFrame.method

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:84


path

Optional Readonly path: string

pathname of API Request endpoint

Inherited from

AbstractJinFrame.path

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:81


startAt

Protected startAt: Date

Inherited from

AbstractJinFrame.startAt

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:95


transformRequest

Optional Readonly transformRequest: AxiosRequestTransformer | AxiosRequestTransformer[]

transformRequest function of POST Request

Inherited from

AbstractJinFrame.transformRequest

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:93


BodySymbolBox

Static BodySymbolBox: symbol

Inherited from

AbstractJinFrame.BodySymbolBox

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:36


HeaderSymbolBox

Static HeaderSymbolBox: symbol

Inherited from

AbstractJinFrame.HeaderSymbolBox

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:40


ObjectBodySymbolBox

Static ObjectBodySymbolBox: symbol

Inherited from

AbstractJinFrame.ObjectBodySymbolBox

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:38


ParamSymbolBox

Static ParamSymbolBox: symbol

Inherited from

AbstractJinFrame.ParamSymbolBox

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:32


QuerySymbolBox

Static QuerySymbolBox: symbol

Inherited from

AbstractJinFrame.QuerySymbolBox

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:34

Methods

create

create(option?): () => Promise<PassFailEither<IFailReplyJinEitherFrame<TFAIL> | IFailExceptionJinEitherFrame<TFAIL>, TPassJinEitherFrame<TPASS>>>

Generate an AxiosRequestConfig value and use it to return a functions that invoke HTTP APIs

Parameters

NameTypeDescription
option?IJinFrameRequestConfig & IJinFrameCreateConfigsame with AxiosRequestConfig, bug exclude some filed ignored

Returns

fn

Functions that invoke HTTP APIs

▸ (): Promise<PassFailEither<IFailReplyJinEitherFrame<TFAIL> | IFailExceptionJinEitherFrame<TFAIL>, TPassJinEitherFrame<TPASS>>>

Generate an AxiosRequestConfig value and use it to return a functions that invoke HTTP APIs

Returns

Promise<PassFailEither<IFailReplyJinEitherFrame<TFAIL> | IFailExceptionJinEitherFrame<TFAIL>, TPassJinEitherFrame<TPASS>>>

Functions that invoke HTTP APIs

Implementation of

IJinFrameFunction.create

Defined in

jin-frame/src/frames/JinEitherFrame.ts:84


execute

execute(option?): Promise<PassFailEither<IFailReplyJinEitherFrame<TFAIL> | IFailExceptionJinEitherFrame<TFAIL>, TPassJinEitherFrame<TPASS>>>

Generate an AxiosRequestConfig value and invoke HTTP APIs

Parameters

NameTypeDescription
option?IJinFrameRequestConfig & IJinFrameCreateConfigsame with AxiosRequestConfig, bug exclude some filed ignored

Returns

Promise<PassFailEither<IFailReplyJinEitherFrame<TFAIL> | IFailExceptionJinEitherFrame<TFAIL>, TPassJinEitherFrame<TPASS>>>

AxiosResponse With PassFailEither

Implementation of

IJinFrameFunction.execute

Defined in

jin-frame/src/frames/JinEitherFrame.ts:175


getFormData

getFormData(bodies): Record<string, any> | FormData

Parameters

NameType
bodiesRecord<string, any>

Returns

Record<string, any> | FormData

Inherited from

AbstractJinFrame.getFormData

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:143


getTransformRequest

getTransformRequest(): undefined | AxiosRequestTransformer | AxiosRequestTransformer[]

Returns

undefined | AxiosRequestTransformer | AxiosRequestTransformer[]

Inherited from

AbstractJinFrame.getTransformRequest

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:125


request

request(option?): AxiosRequestConfig<any>

AxiosRequestConfig create using by class member variable.

Parameters

NameTypeDescription
option?IJinFrameRequestConfig & IJinFrameCreateConfigsame with AxiosRequestConfig, bug exclude some filed ignored

Returns

AxiosRequestConfig<any>

created AxiosRequestConfig

Inherited from

AbstractJinFrame.request

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:186


requestWrap

requestWrap(option?): PassFailEither<JinCreateError<JinEitherFrame<TPASS, TFAIL>, TPASS, TFAIL>, AxiosRequestConfig<any>>

Parameters

NameType
option?IJinFrameRequestConfig & IJinFrameCreateConfig

Returns

PassFailEither<JinCreateError<JinEitherFrame<TPASS, TFAIL>, TPASS, TFAIL>, AxiosRequestConfig<any>>

Defined in

jin-frame/src/frames/JinEitherFrame.ts:51


body

Static body(option?): (target: Function) => void(target: Object, propertyKey: string | symbol) => void

decorator to set class variable to HTTP API body parameter

Parameters

NameTypeDescription
option?Partial<Except<IBodyFieldOption, "type">>body parameter option

Returns

fn

▸ (target): void

Parameters
NameType
targetFunction
Returns

void

▸ (target, propertyKey): void

Parameters
NameType
targetObject
propertyKeystring | symbol
Returns

void

Inherited from

AbstractJinFrame.body

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:60


Static header(option?): (target: Function) => void(target: Object, propertyKey: string | symbol) => void

decorator to set class variable to HTTP API header parameter

Parameters

NameTypeDescription
option?Partial<Except<IHeaderFieldOption, "type">>header parameter option

Returns

fn

▸ (target): void

Parameters
NameType
targetFunction
Returns

void

▸ (target, propertyKey): void

Parameters
NameType
targetObject
propertyKeystring | symbol
Returns

void

Inherited from

AbstractJinFrame.header

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:74


objectBody

Static objectBody(option?): (target: Function) => void(target: Object, propertyKey: string | symbol) => void

decorator to set class variable to HTTP API body parameter

Parameters

NameTypeDescription
option?Partial<Except<IObjectBodyFieldOption, "type">>body parameter option

Returns

fn

▸ (target): void

Parameters
NameType
targetFunction
Returns

void

▸ (target, propertyKey): void

Parameters
NameType
targetObject
propertyKeystring | symbol
Returns

void

Inherited from

AbstractJinFrame.objectBody

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:67


param

Static param(option?): (target: Function) => void(target: Object, propertyKey: string | symbol) => void

decorator to set class variable to HTTP API path parameter

Parameters

NameTypeDescription
option?Partial<Omit<IParamFieldOption, "type">>path parameter option

Returns

fn

▸ (target): void

Parameters
NameType
targetFunction
Returns

void

▸ (target, propertyKey): void

Parameters
NameType
targetObject
propertyKeystring | symbol
Returns

void

Inherited from

AbstractJinFrame.param

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:46


query

Static query(option?): (target: Function) => void(target: Object, propertyKey: string | symbol) => void

decorator to set class variable to HTTP API query parameter

Parameters

NameTypeDescription
option?Partial<Omit<IQueryFieldOption, "type">>query parameter option

Returns

fn

▸ (target): void

Parameters
NameType
targetFunction
Returns

void

▸ (target, propertyKey): void

Parameters
NameType
targetObject
propertyKeystring | symbol
Returns

void

Inherited from

AbstractJinFrame.query

Defined in

jin-frame/src/frames/AbstractJinFrame.ts:53