Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ApiCallConfig<TResult, TInput, TRawData, TInput>

Type parameters

  • TResult

  • TInput

  • TRawData

  • TInput

Hierarchy

Index

Properties

Optional baseUrl

The domain to use for all calls for this Entity/ApiCall. Used as a prefix for all HTTP requests. Set to an empty string to avoid this altogether (in case the data arrives from an external URL, for example). If not set and not an empty string, Paris will use config.apiRoot instead.

Optional cache

cache: boolean | DataCacheSettings<TResult>

If cache is specified, entities will be cached according to the cache settings. Note: cache refers to individual items (such as received from getItemById or with an ApiCall), not queries.

Optional customHeaders

customHeaders: function | Record<string, string>

Custom headers for API call. It can be either a dictionary of string, with header names as the keys, or a function (which be applied by Paris) which receives data and config, and returns the headers for the API call.

param
param

Optional endpoint

The URL to use for HTTP requests.

Optional fixedData

fixedData: object

Query params to always send when requesting data.

Type declaration

  • [index: string]: any

Optional method

name

name: string

Optional parse

parse: function

Type declaration

    • (data?: any, input?: TInput): TResult
    • Parameters

      • Optional data: any
      • Optional input: TInput

      Returns TResult

Optional parseData

parseData: function

A function that if specifies, parses whatever is received from the API call, before Paris starts handling it.

param
param
param

Type declaration

Optional parseQuery

parseQuery: function

Type declaration

Optional responseType

responseType: "json" | "blob" | "text"

Optional separateArrayParams

separateArrayParams: boolean

If true, a value that's specified in DataQuery.params and is an array will result in multiple params in the HTTP request

example

Using separateArrayParams

@Entity({
    singularName: 'My entity',
    pluralName: 'My entities',
    endpoint: 'myentity',
    separateArrayParams: true
})
export class MyEntity extends EntityModelBase{}

paris.query(MyEntity, { where: { foo: ['bar', 'lish'] }})
    .subscribe((dataSet:DataSet<MyEntity>) => console.log(dataSet));

In this example, the API call will be to (config.apiRoot)/myentity?foo=bar&foo=lish. If separateArrayParams wasn't specified as true, the api call would have been to: (config.apiRoot)/myentity?foo=bar,lish

Optional timeout

timeout: number

Optional type

type: object

Type declaration

Generated using TypeDoc