Interface MakeHttpRequestProps<TPathParams, TQueryParams, TRequestBody, TResponseBody>

Interface representing the properties for making an HTTP request.

interface MakeHttpRequestProps<TPathParams, TQueryParams, TRequestBody, TResponseBody> {
    headers?: Headers;
    logger?: Logger;
    method: string;
    pathParams?: ParamWithOptionalSchema<TPathParams>;
    queryParams?: ParamWithOptionalSchema<TQueryParams>;
    requestBody?: ParamWithOptionalSchema<TRequestBody>;
    responseBodySchema?: ZodType<TResponseBody, ZodTypeDef, TResponseBody>;
    responseType?: ResponseType;
    retryOptions?: {
        backoffMultiplier?: number;
        initialDelay?: number;
        retries?: number;
    };
    timeout?: number;
    urlTemplate: string;
}

Type Parameters

  • TPathParams = PathParams

    Type of the path parameters.

  • TQueryParams = QueryParams

    Type of the query parameters.

  • TRequestBody = any

    Type of the request body.

  • TResponseBody = any

    Type of the response body.

Properties

headers?: Headers

Optional headers to include in the request.

logger?: Logger

Optional logger function to log request details.

method: string

The HTTP method for the request (e.g., GET, POST, PUT).

pathParams?: ParamWithOptionalSchema<TPathParams>

Optional path parameters for the request.

queryParams?: ParamWithOptionalSchema<TQueryParams>

Optional query parameters for the request.

requestBody?: ParamWithOptionalSchema<TRequestBody>

Optional request body for the request.

responseBodySchema?: ZodType<TResponseBody, ZodTypeDef, TResponseBody>

Optional schema to validate the response body.

responseType?: ResponseType

Optional response type for the request (e.g., json, blob).

retryOptions?: {
    backoffMultiplier?: number;
    initialDelay?: number;
    retries?: number;
}

Optional retry options for the request.

Type declaration

  • OptionalbackoffMultiplier?: number

    The multiplier to apply to the delay between subsequent retries. Optional and must be between 1 and 2.

  • OptionalinitialDelay?: number

    The initial delay before the first retry attempt in milliseconds. Optional and must be between 100 and 5000 ms.

  • Optionalretries?: number

    The number of retry attempts. Optional and must be between 0 and 5.

timeout?: number

Optional timeout for the request in milliseconds.

urlTemplate: string

The URL template for the request.