Options
All
  • Public
  • Public/Protected
  • All
Menu

Http Interface class for making api calls to backend

Hierarchy

  • HttpClient

Index

Constructors

Properties

apiNetworkPerformance: ApiNetworkPerformance
circuitBreaker: CircuitBreakerPolicy = ...
logger: Logger = ...

Methods

  • Parameters

    • url: string

      url for the delete api

    • request: HttpRequestInit

      request object associated with the api

    Returns Promise<HttpResponse>

    returns http response from the delete api

    @example
    delete('https://nice.dev.cxone.com/getUsers', {body: 'api_request_body'})
  • Parameters

    • url: string

      url for the api

    • request: HttpRequestInit

      request object associated with the api

    • Optional includeForMeasuringLatency: boolean

      boolean to enable measuring api latency

    Returns Promise<HttpResponse>

    returns http response from the get api

    @example
    get('https://nice.dev.cxone.com/getUsers', {body: 'api_request_body'}, true)
  • Gets blob data from given url

    example
    getBlob(attachment.securedPermanentUrl, reqInit)
    

    Parameters

    • url: string

      url for the api

    • request: HttpRequestInit

      request object associated with the api

    Returns Promise<HttpResponse>

    returns response from the get api

  • handleRequestWithCircuitBreaker(url: string, httpRequest: HttpRequest, includeForMeasuringLatency?: boolean): Promise<any>
  • Used to handle the request via circuit breaker

    example
    this.handleRequestWithCircuitBreaker(url, httpRequest, true);
    

    Parameters

    • url: string

      url for the api

    • httpRequest: HttpRequest
    • includeForMeasuringLatency: boolean = false

      boolean to enable measuring api latency

    Returns Promise<any>

  • handleResponse(response$: Observable<Response>, retryOptions?: RetryOptions): Observable<any>
  • Parameters

    • response$: Observable<Response>

      Http response object

    • Optional retryOptions: RetryOptions

      retry mechanism for failure scenarios

    Returns Observable<any>

    • handled response after api processing
    @example
    const resp = this.handleResponse({status: 200, statusText: 'OK'}, {maxRetryAttempts: 3, retryInterval: 1000});
  • Parameters

    • url: string

      url for the patch api

    • request: HttpRequestInit

      request object associated with the api

    Returns Promise<HttpResponse>

    returns http response from the patch api to update data

    @example
    patch('https://nice.dev.cxone.com/getUsers', {body: 'api_request_body'})
  • Parameters

    • url: string

      url for the post api

    • request: HttpRequestInit

      request object associated with the api

    Returns Promise<HttpResponse>

    returns http response from the post api

    @example
    get('https://nice.dev.cxone.com/getUsers', {body: 'api_request_body'})
  • Parameters

    • url: string

      url for the put api

    • request: HttpRequestInit

      request object associated with the api

    Returns Promise<HttpResponse>

    returns http response from the put api

    @example
    put('https://nice.dev.cxone.com/getUsers', {body: 'api_request_body'})

Generated using TypeDoc