Interface representing an HTTP client.

The HttpClient interface provides methods for making HTTP requests

interface HttpClient {
    baseURL: string;
    get: ((path: string, params?: HttpParams) => Promise<unknown>);
    http: ((method: HttpMethod, path: string, params?: HttpParams) => Promise<unknown>);
    post: ((path: string, params?: HttpParams) => Promise<unknown>);
}

Implemented by

Properties

Properties

baseURL: string

The base URL for the API requests. This endpoint serves as the root URL for constructing all subsequent API calls.

get: ((path: string, params?: HttpParams) => Promise<unknown>)

Makes an HTTP GET request to the specified path with optional query parameters.

Type declaration

    • (path, params?): Promise<unknown>
    • Parameters

      • path: string

        The endpoint path for the GET request.

      • Optionalparams: HttpParams

        Optional query parameters to include in the request.

      Returns Promise<unknown>

      A promise that resolves to the response of the GET request.

http: ((method: HttpMethod, path: string, params?: HttpParams) => Promise<unknown>)

Sends an HTTP request using the specified method, path, and optional parameters.

Type declaration

    • (method, path, params?): Promise<unknown>
    • Parameters

      • method: HttpMethod

        The HTTP method to be used for the request (e.g., 'GET', 'POST').

      • path: string

        The endpoint path for the HTTP request.

      • Optionalparams: HttpParams

        Optional parameters to include in the HTTP request.

      Returns Promise<unknown>

      A promise that resolves with the response of the HTTP request.

post: ((path: string, params?: HttpParams) => Promise<unknown>)

Sends a POST request to the specified path with the given parameters.

Type declaration

    • (path, params?): Promise<unknown>
    • Parameters

      • path: string

        The endpoint to which the POST request is sent.

      • Optionalparams: HttpParams

        Optional parameters to be included in the POST request body.

      Returns Promise<unknown>

      • A promise that resolves to the response of the POST request.