Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseClient

Hierarchy

Index

Constructors

constructor

  • new BaseClient(baseURL: string, config?: AxiosRequestConfig): BaseClient
  • Parameters

    • baseURL: string
    • Default value config: AxiosRequestConfig = {}

    Returns BaseClient

Properties

axios

axios: AxiosInstance

config

config: AxiosRequestConfig

Accessors

hostname

  • get hostname(): string
  • set hostname(value: string): void

Methods

bindMethodsToPath

  • bindMethodsToPath(relativePath: string): object
  • Parameters

    • relativePath: string

    Returns object

delete

  • delete<T>(path: string, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

detail

  • Client.prototype.detail() and Client.prototype.list() are the primary purpose of defining these here. Simply runs a GET on the detail route path (eg. /users/123) and negotiates the content

    Type parameters

    Parameters

    • ResourceClass: T
    • id: string
    • Default value options: RequestConfig = {}

    Returns Promise<ResourceResponse<InstanceType<T>, any>>

get

  • get<T>(path: string, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

head

  • head<T>(path: string, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

list

  • Client.prototype.list() and Client.prototype.detail() are the primary purpose of defining these here. Simply runs a GET on the list route path (eg. /users) and negotiates the content

    Type parameters

    Parameters

    Returns ListResponse<T>

negotiateContent

onError

  • onError(exception: Error | AxiosError): any
  • Parameters

    • exception: Error | AxiosError

    Returns any

options

  • options<T>(path: string, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

patch

  • patch<T>(path: string, body?: any, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value body: any = {}
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

post

  • post<T>(path: string, body?: any, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value body: any = {}
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

put

  • put<T>(path: string, body?: any, options?: AxiosRequestConfig): AxiosPromise<T>
  • Type parameters

    • T

    Parameters

    • path: string
    • Default value body: any = {}
    • Default value options: AxiosRequestConfig = {}

    Returns AxiosPromise<T>

Static extend

  • extend<T, U>(this: U, classProps: T): U & T
  • Type parameters

    • T

    • U

    Parameters

    • this: U
    • classProps: T

    Returns U & T

Generated using TypeDoc