Class: BaseAPI

This is the base class for all generated API classes.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new BaseAPI(configuration?)

Parameters

NameType
configurationConfiguration

Properties

configuration

Protected configuration: Configuration


middleware

Private middleware: Middleware[]

Methods

clone

Private clone<T>(): T

Create a shallow clone of this by constructing a new instance and then shallow cloning data members.

Type parameters

NameType
Textends BaseAPI<T>

Returns

T


createFetchParams

Private createFetchParams(context, initOverrides?): Object

Parameters

NameType
contextRequestOpts
initOverrides?RequestInit

Returns

Object

NameType
initObject
init.bodyany
init.cache?RequestCache
init.credentialsRequestCredentials
init.headersHTTPHeaders
init.integrity?string
init.keepalive?boolean
init.methodstring
init.mode?RequestMode
init.redirect?RequestRedirect
init.referrer?string
init.referrerPolicy?ReferrerPolicy
init.signal?AbortSignal
init.window?any
urlstring

fetchApi

Private fetchApi(url, init): Promise<Response>

Parameters

NameType
urlstring
initRequestInit

Returns

Promise<Response>


request

Protected request(context, initOverrides?): Promise<Response>

Parameters

NameType
contextRequestOpts
initOverrides?RequestInit

Returns

Promise<Response>


withMiddleware

withMiddleware<T>(…middlewares): T

Type parameters

NameType
Textends BaseAPI<T>

Parameters

NameType
...middlewaresMiddleware[]

Returns

T


withPostMiddleware

withPostMiddleware<T>(…postMiddlewares): T

Type parameters

NameType
Textends BaseAPI<T>

Parameters

NameType
...postMiddlewares(context: ResponseContext) => Promise<void

Returns

T


withPreMiddleware

withPreMiddleware<T>(…preMiddlewares): T

Type parameters

NameType
Textends BaseAPI<T>

Parameters

NameType
...preMiddlewares(context: RequestContext) => Promise<void

Returns

T