Class APIService

class: APIService

  • use internal http-proxy service due to restriction internet-face in VPC lambda.

Hierarchy

  • APIService

Implements

Constructors

  • create API service.

    // basic
    const api = new API('web', 'http://localhost:8081', {});
    api.doGet('');

    // via python
    const api = new API('residents', 'http://localhost:8113', {});
    api.doGet('123'); // http GET :8113/residents/123

    // proxy server
    const api = new API('web', 'http://localhost:8081', {}, null, proxy);
    api.doGet('');

    Parameters

    • type: string

      type in endpoint

    • endpoint: string

      base endpoint (support ONLY http, https)

    • Optional headers: APIHeaders

      common headers.

    • Optional client: APIServiceClient

      real api-client to use (or use proxy, or create default)

    • Optional proxy: ApiHttpProxy

      proxy-service to use if there is no client (or use backbone server)

    Returns APIService

Properties

endpoint: string
headers: APIHeaders
type: string
APIServiceClientRecorder: typeof __class = ...

recorder of api-service client.

ApiHttpProxyRecorder: typeof __class = ...

recorder of api-http-proxy client.

ProxyServiceClient: typeof __class = ...

class: TypedEndpoint

  • by using common proxy, extends endpoint by type.
  • endpoint := base+'/'+type.
SubTypeClient: typeof __class = ...

use sub-typed endpoint.

  • extends as endpoint := parent.endpoint + '/' + type

Methods

  • DELETE HOST/PATH?$param

    Type Parameters

    • T = any

    Parameters

    • id: string
    • Optional cmd: string
    • Optional $param: any
    • Optional $body: any
    • Optional hash: string

    Returns Promise<T>

  • GET HOST/PATH?$param

    Type Parameters

    • T = any

    Parameters

    • id: string
    • Optional cmd: string
    • Optional $param: any
    • Optional $body: any
    • Optional hash: string

    Returns Promise<T>

  • PATCH HOST/PATH?$param

    Type Parameters

    • T = any

    Parameters

    • id: string
    • Optional cmd: string
    • Optional $param: any
    • Optional $body: any
    • Optional hash: string

    Returns Promise<T>

  • POST HOST/PATH?$param

    Type Parameters

    • T = any

    Parameters

    • id: string
    • Optional cmd: string
    • Optional $param: any
    • Optional $body: any
    • Optional hash: string

    Returns Promise<T>

  • PUT HOST/PATH?$param

    Type Parameters

    • T = any

    Parameters

    • id: string
    • Optional cmd: string
    • Optional $param: any
    • Optional $body: any
    • Optional hash: string

    Returns Promise<T>

Generated using TypeDoc