Class to build and execute HTTP requests with AWS signing

Example

const response: HttpResponse<OAuthResponse> = await new AWSHttpRequestBuilder({
method: 'GET',
baseURL: `https://api.lemoncloud.io/v1/oauth`,
})
.addHeaders({ Cookie: this.cookie })
.setParams({ page: 0 })
.execute();

Constructors

Properties

axiosInstance: AxiosInstance
config: AxiosRequestConfig<any> = ...
tokenStorage: AWSStorageService

The AWS storage service for token management.

Methods

  • Adds x-lemon-identity to the header.

    Parameters

    • header: any

      The header to be added

    Returns Promise<AxiosHeaders>

    The header with x-lemon-identity added

  • Private

    Extracts the hostname from a URL.

    Parameters

    • url: string

      The URL to extract the hostname from.

    Returns any

    • The extracted hostname.
  • Private

    Gets the signed AWS client.

    Parameters

    • endpoint: string

      The endpoint for the client.

    Returns Promise<any>

    • The signed AWS client.

    Throws

    If endpoint is not provided or signed client is not available.

  • Private

    Gets the signed headers for the request.

    Parameters

    • signedClient: any

      The signed AWS client.

    • data: HttpRequestData

      The request data.

    Returns Promise<any>

    • The signed headers.