Class: BaseAPI
This is the base class for all generated API classes.
Hierarchy
-
BaseAPI
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new BaseAPI(configuration?
)
Parameters
Name | Type |
---|---|
configuration | Configuration |
Properties
configuration
• Protected
configuration: Configuration
middleware
• Private
middleware: Middleware
[]
Methods
clone
▸ Private
clone<T
>(this
): T
Create a shallow clone of this
by constructing a new instance and then shallow cloning data members.
Type parameters
Name | Type |
---|---|
T | extends BaseAPI <T > |
Parameters
Name | Type |
---|---|
this | T |
Returns
T
createFetchParams
▸ Private
createFetchParams(context
, initOverrides?
): Object
Parameters
Name | Type |
---|---|
context | RequestOpts |
initOverrides? | RequestInit |
Returns
Object
Name | Type |
---|---|
init | { body : any ; cache? : RequestCache ; credentials : RequestCredentials ; headers : HTTPHeaders |
init.body | any |
init.cache? | RequestCache |
init.credentials | RequestCredentials |
init.headers | HTTPHeaders |
init.integrity? | string |
init.keepalive? | boolean |
init.method | string |
init.mode? | RequestMode |
init.redirect? | RequestRedirect |
init.referrer? | string |
init.referrerPolicy? | ReferrerPolicy |
init.signal? | AbortSignal |
init.window? | any |
url | string |
fetchApi
▸ Private
fetchApi(url
, init
): Promise
<Response
>
Parameters
Name | Type |
---|---|
url | string |
init | RequestInit |
Returns
Promise
<Response
>
request
▸ Protected
request(context
, initOverrides?
): Promise
<Response
>
Parameters
Name | Type |
---|---|
context | RequestOpts |
initOverrides? | RequestInit |
Returns
Promise
<Response
>
withMiddleware
▸ withMiddleware<T
>(this
, ...middlewares
): T
Type parameters
Name | Type |
---|---|
T | extends BaseAPI <T > |
Parameters
Name | Type |
---|---|
this | T |
...middlewares | Middleware [] |
Returns
T
withPostMiddleware
▸ withPostMiddleware<T
>(this
, ...postMiddlewares
): T
Type parameters
Name | Type |
---|---|
T | extends BaseAPI <T > |
Parameters
Name | Type |
---|---|
this | T |
...postMiddlewares | (context : ResponseContext ) => Promise <void |
Returns
T
withPreMiddleware
▸ withPreMiddleware<T
>(this
, ...preMiddlewares
): T
Type parameters
Name | Type |
---|---|
T | extends BaseAPI <T > |
Parameters
Name | Type |
---|---|
this | T |
...preMiddlewares | (context : RequestContext ) => Promise <void |
Returns
T