Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • JsonApi

Index

Constructors

constructor

Properties

Protected _axios

_axios: AxiosInstance

Holds the axios instance we use for our requests

Protected _guid

_guid: any

A unique id for this api instance

Accessors

axios

  • get axios(): AxiosInstance
  • Returns the axios instance we use internally

    Returns AxiosInstance

Methods

Protected deserializeResponse

  • deserializeResponse(response: PlainObject<any>): Promise<JsonApiResponse>
  • Internal helper which receives the raw result from axios and de-serializes the json api structure into a more speaking javascript object

    Parameters

    • response: PlainObject<any>

    Returns Promise<JsonApiResponse>

Protected formatQuery

  • formatQuery(query?: PlainObject<any> | JsonApiGetQuery, prefix?: string): string
  • Internal helper which formats the get query object into the correct query string

    Parameters

    • Optional query: PlainObject<any> | JsonApiGetQuery
    • Optional prefix: string

    Returns string

get

  • Requests a resource collection from the server

    deprecated

    will be removed in v4.0 - use getCollection() instead.

    Parameters

    • resourceType: string

      The resource type to request from the server

    • Optional query: JsonApiGetQuery

      An optional query to use when requesting the resources

    • Optional debounceLimit: number

      Can be used to debounce multiple, subsequent requests for a certain number of milli-seconds, before they should be actually submitted to the server. Can be used to avoid multiple request for text inputs or similar occurrences.

    Returns Promise<JsonApiStateList>

getCollection

  • Requests a resource collection from the server

    Parameters

    • resourceType: string

      The resource type to request from the server

    • Optional query: JsonApiGetQuery

      An optional query to use when requesting the resources

    • Optional debounceLimit: number

      Can be used to debounce multiple, subsequent requests for a certain number of milli-seconds, before they should be actually submitted to the server. Can be used to avoid multiple request for text inputs or similar occurrences.

    Returns Promise<Collection>

getResource

  • getResource(resourceType: string, id: string | number, query?: JsonApiGetQuery, debounceLimit?: number): Promise<Resource>
  • Requests a single resource item from the server

    Parameters

    • resourceType: string

      The resource type to request from the server

    • id: string | number

      The id of the entity to request from the server. Set this to NULL if your endpoint does not require a unique id for requesting a single entity

    • Optional query: JsonApiGetQuery

      An optional query to use when requesting the resource

    • Optional debounceLimit: number

      Can be used to debounce multiple, subsequent requests for a certain number of milli-seconds, before they should be actually submitted to the server. Can be used to avoid multiple request for text inputs or similar occurrences.

    Returns Promise<Resource>

getSingle

  • Requests a single resource entity from the server

    deprecated

    will be removed in v4.0 - use getResource() instead.

    Parameters

    • resourceType: string

      The resource type to request from the server

    • id: string | number

      The id of the entity to request from the server. Set this to NULL if your endpoint does not require a unique id for requesting a single entity

    • Optional query: JsonApiGetQuery

      An optional query to use when requesting the resource

    • Optional debounceLimit: number

      Can be used to debounce multiple, subsequent requests for a certain number of milli-seconds, before they should be actually submitted to the server. Can be used to avoid multiple request for text inputs or similar occurrences

    Returns Promise<JsonApiState>

Protected handleAxiosResponse

makeQueryString

makeResourceOrCollection

makeStateOrStateList

  • Receives a raw json api response (presumably from an ajax request) and converts it either into a json api state, or a state list object, depending on the content

    deprecated

    Will be removed in v4.0 use makeResourceOrCollection() instead!

    Parameters

    Returns Promise<JsonApiState | JsonApiStateList>

Generated using TypeDoc