Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseServiceClient

Class to be used as the base class for the generated service clients.

Hierarchy

Index

Constructors

Protected constructor

  • Creates new instance of the BaseServiceClient

    Parameters

    • apiConfiguration: ApiConfiguration

      configuration parameter to provide dependencies to service client instance

    Returns BaseServiceClient

Properties

Protected apiConfiguration

apiConfiguration: ApiConfiguration

ApiConfiguration instance to provide dependencies for this service client

Private requestInterceptors

requestInterceptors: Array<function> = []

Private responseInterceptors

responseInterceptors: Array<function> = []

Methods

Protected invoke

  • invoke(method: string, endpoint: string, path: string, pathParams: Map<string, string>, queryParams: Array<object>, headerParams: Array<object>, bodyParam: any, errors: Map<number, string>, nonJsonBody?: boolean): Promise<any>
  • Invocation wrapper to implement service operations in generated classes

    Parameters

    • method: string

      HTTP method, such as 'POST', 'GET', 'DELETE', etc.

    • endpoint: string

      base API url

    • path: string

      the path pattern with possible placeholders for path parameters in form {paramName}

    • pathParams: Map<string, string>

      path parameters collection

    • queryParams: Array<object>

      query parameters collection

    • headerParams: Array<object>

      headers collection

    • bodyParam: any

      if body parameter is present it is provided here, otherwise null or undefined

    • errors: Map<number, string>

      maps recognized status codes to messages

    • Optional nonJsonBody: boolean

      if the body is in JSON format

    Returns Promise<any>

withRequestInterceptors

  • withRequestInterceptors(...requestInterceptors: Array<function>): BaseServiceClient
  • Sets array of functions that is going to be executed before the request is send

    Parameters

    • Rest ...requestInterceptors: Array<function>

    Returns BaseServiceClient

withResponseInterceptors

  • withResponseInterceptors(...responseInterceptors: Array<function>): BaseServiceClient
  • Sets array of functions that is going to be executed after the request is send

    Parameters

    • Rest ...responseInterceptors: Array<function>

    Returns BaseServiceClient

Static Private buildQueryString

  • buildQueryString(params: Array<object>, isQueryStart: boolean): string
  • Parameters

    • params: Array<object>
    • isQueryStart: boolean

    Returns string

Static Private buildUrl

  • buildUrl(endpoint: string, path: string, queryParameters: Array<object>, pathParameters: Map<string, string>): string
  • Parameters

    • endpoint: string
    • path: string
    • queryParameters: Array<object>
    • pathParameters: Map<string, string>

    Returns string

Static Private interpolateParams

  • interpolateParams(path: string, params: Map<string, string>): string
  • Parameters

    • path: string
    • params: Map<string, string>

    Returns string

Static Private isCodeSuccessful

  • isCodeSuccessful(responseCode: number): boolean
  • Parameters

    • responseCode: number

    Returns boolean