import { HttpResponse } from '../models/http-response'; /** * Utility to make strongly typed HTTP requests. * Uses the Fetch API. */ export declare class HttpUtil { /** * Utility function to make a fully typed * http request with the fetch API. * * @example * const response = await HttpUtil.request( * "https://jsonplaceholder.typicode.com/todos" * ); * * @param req This Fetch API interface represents a resource request. * @returns a typed async http reponse */ static request(req: RequestInfo): Promise>; /** * Make a strongly typed http GET request. * * @example * const response = await HttpUtil.get<{ id: number }>( * "https://jsonplaceholder.typicode.com/posts" * ); * * @param path url for the request * @param args fetch API args, defaults to `{ method: 'get' }` * @returns a typed async http reponse */ static get(path: string, args?: RequestInit): Promise>; /** * Make a strongly typed http POST request. * * @example * const response = await HttpUtil.post<{ id: number }>( * "https://jsonplaceholder.typicode.com/posts", * { title: "my post", body: "some content" } * ); * * @param path url for the request * @param body request's body * @param args fetch API args, defaults to `{ method: 'post', body: JSON.stringify(body) }` * @returns a typed async http reponse */ static post(path: string, body: any, args?: RequestInit): Promise>; /** * Make a strongly typed http PUT request. * * @example * const response = await HttpUtil.put<{ id: number }>( * "https://jsonplaceholder.typicode.com/posts", * { title: "my post", body: "some content" } * ); * * @param path url for the request * @param body request's body * @param args fetch API args, defaults to `{ method: 'put', body: JSON.stringify(body) }` * @returns a typed async http reponse */ static put(path: string, body: any, args?: RequestInit): Promise>; }