Skip to content

Latest commit

 

History

History
221 lines (125 loc) · 4.12 KB

baseapi.md

File metadata and controls

221 lines (125 loc) · 4.12 KB

fikenBaseAPI

Class: BaseAPI

This is the base class for all generated API classes.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new BaseAPI(configuration: Configuration‹›): BaseAPI

Parameters:

Name Type Default
configuration Configuration‹› new Configuration()

Returns: BaseAPI

Properties

Protected configuration

configuration: Configuration‹›


Private middleware

middleware: Middleware[]

Methods

Private clone

cloneT›(this: T): T

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

Type parameters:

T: BaseAPI

Parameters:

Name Type
this T

Returns: T


Private createFetchParams

createFetchParams(context: RequestOpts): object

Parameters:

Name Type
context RequestOpts

Returns: object

  • init(): object

    • body: any

    • credentials: RequestCredentials = this.configuration.credentials

    • headers: HTTPHeaders = headers

    • method: HTTPMethod = context.method

  • url: string


Private fetchApi

fetchApi(url: string, init: RequestInit): Promise‹Response›

Parameters:

Name Type
url string
init RequestInit

Returns: Promise‹Response›


Protected request

request(context: RequestOpts): Promise‹Response›

Parameters:

Name Type
context RequestOpts

Returns: Promise‹Response›


withMiddleware

withMiddlewareT›(this: T, ...middlewares: Middleware[]): T

Type parameters:

T: BaseAPI

Parameters:

Name Type
this T
...middlewares Middleware[]

Returns: T


withPostMiddleware

withPostMiddlewareT›(this: T, ...postMiddlewares: Array‹Middleware["post"]›): T

Type parameters:

T: BaseAPI

Parameters:

Name Type
this T
...postMiddlewares Array‹Middleware["post"]›

Returns: T


withPreMiddleware

withPreMiddlewareT›(this: T, ...preMiddlewares: Array‹Middleware["pre"]›): T

Type parameters:

T: BaseAPI

Parameters:

Name Type
this T
...preMiddlewares Array‹Middleware["pre"]›

Returns: T