Interface IHttpClient

interface IHttpClient {
    DefaultRequestHeaders: Record<string, string>;
    OnRequestReceived?: ((request) => Promise<Request | Response>);
    OnResponseResolved?: ((response) => void);
    Delete<T>(uri, additionalHeaders?): Promise<RestResponse<T>>;
    Get<T>(uri, additionalHeaders?): Promise<RestResponse<T>>;
    Patch<T>(uri, body?, additionalHeaders?): Promise<RestResponse<T>>;
    Post<T>(uri, body?, additionalHeaders?): Promise<RestResponse<T>>;
    Put<T>(uri, body?, additionalHeaders?): Promise<RestResponse<T>>;
    Request(uri, method, body?, additionalHeaders?): Promise<Response>;
}

Implemented by

Properties

DefaultRequestHeaders: Record<string, string>

Gets the headers which should be sent with each request.

OnRequestReceived?: ((request) => Promise<Request | Response>)

An operation used to modify a request prior to submission OR override the normal request process and return a response.

Type declaration

    • (request): Promise<Request | Response>
    • An operation used to modify a request prior to submission OR override the normal request process and return a response.

      Parameters

      • request: Request

        the original request

      Returns Promise<Request | Response>

      a modified request or a response

Param: request

the original request

Returns

a modified request or a response

OnResponseResolved?: ((response) => void)

An operation to be performed just after a response is resolved from a request, but prior to the response being returned.

Type declaration

    • (response): void
    • An operation to be performed just after a response is resolved from a request, but prior to the response being returned.

      Parameters

      • response: Response

      Returns void

Methods

  • Send a DELETE request to the specified Uri as an asynchronous operation.

    Type Parameters

    • T

    Parameters

    • uri: string
    • Optional additionalHeaders: Record<string, string>

    Returns Promise<RestResponse<T>>

  • Send a GET request to the specified Uri as an asynchronous operation.

    Type Parameters

    • T

    Parameters

    • uri: string
    • Optional additionalHeaders: Record<string, string>

    Returns Promise<RestResponse<T>>

  • Send a PATCH request to the specified Uri as an asynchronous operation.

    Type Parameters

    • T

    Parameters

    • uri: string
    • Optional body: string
    • Optional additionalHeaders: Record<string, string>

    Returns Promise<RestResponse<T>>

  • Send a POST request to the specified Uri as an asynchronous operation.

    Type Parameters

    • T

    Parameters

    • uri: string
    • Optional body: string
    • Optional additionalHeaders: Record<string, string>

    Returns Promise<RestResponse<T>>

  • Send a PUT request to the specified Uri as an asynchronous operation.

    Type Parameters

    • T

    Parameters

    • uri: string
    • Optional body: string
    • Optional additionalHeaders: Record<string, string>

    Returns Promise<RestResponse<T>>

  • Parameters

    • uri: string
    • method: HttpMethod
    • Optional body: string
    • Optional additionalHeaders: Record<string, string>

    Returns Promise<Response>

Generated using TypeDoc