import { METHODS } from "lambda-api"; import { ApiRequest } from "../model/ApiRequest"; import { IDictionary } from "./IDictionary"; /** * Builds `ApiRequest` instances using the builder * pattern. Used for testing. */ export declare class RequestBuilder { private readonly method; private readonly path; private readonly httpHeaders; private readonly httpQueryParams; private httpBody; private isBase64Encoded; /** * Start building a HTTP GET request. * * @param path URL path to request. */ static get(path: string): RequestBuilder; /** * Start building a HTTP POST request. * * @param path URL path to request. */ static post(path: string): RequestBuilder; /** * Start building a HTTP PUT request. * * @param path URL path to request. */ static put(path: string): RequestBuilder; /** * Start building a HTTP PATCH request. * * @param path URL path to request. */ static patch(path: string): RequestBuilder; /** * Start building a HTTP DELETE request. * * @param path URL path to request. */ static delete(path: string): RequestBuilder; /** * Start building a HTTP request. * * @param method HTTP method to use. * @param path URL path to request. */ static do(method: METHODS, path: string): RequestBuilder; private constructor(); /** * Add a HTTP header to the request. * * @param name Name of the header. * @param value Value to set. * @returns This builder instance. */ header(name: string, value: string): this; /** * Add multiple HTTP headers to the request. * * @param httpHeaders Map of HTTP headers to add. * @returns This builder instance. */ headers(httpHeaders: IDictionary): this; /** * Add a HTTP query parameter to the request. * * @param key Name of the query param. * @param value Value to set. * @returns This builder instance. */ query(key: string, value: string): this; /** * Add multiple HTTP query parameters to the request. * * @param params Map of HTTP query params to add. * @returns This builder instance. */ queryParams(params: IDictionary): this; /** * Add a HTTP body to the request. * * @param value The body as a raw string. * @returns This builder instance. */ body(value: string): this; /** * Add a base64 encoded HTTP body to the request. * * @param value The body as a base64 string. * @returns This builder instance. */ base64EncodedBody(value: string): this; /** * Add a binary HTTP body to the request. * * @param value The binary body as a Buffer. * @returns This builder instance. */ binaryBody(value: Buffer): this; /** * Add basic authentication to the request. * * @param username Username to send. * @param password Password to send. * @returns This builder instance. */ basicAuth(username: string, password: string): this; private mapToObject; /** * Build a request object using the current builder config. */ build(): ApiRequest; }