/** * Api class to handle requests to a server */ export default class Api { /** * get or set the api address */ addr: string; /** * Creates a new Api instance */ constructor(addr: string); /** * Prepares a json object to be sent as a header */ static jsonHeader(data: object): string; /** * Send a request to the server * * @param method - The method of the request * @param path - The path of the request * @param data - The data to be sent if the method is get the data will * be sent as query params * @param headers - The headers to be sent * @param opts - The additional options to be sent to fetch * * @returns The response of the request * * @throws - If the request fails */ request(method: string, path: string, data?: object | null, headers?: object, opts?: any): Promise; /** * Send a request to the server with a file * * @param method - The method of the request * @param path - The path of the request * @param file - The file to be sent * @param progress - The progress callback * @param headers - The headers to be sent * * @throws {ApiError} - If the request fails */ requestWithFile(method: string, path: string, file: File, progress?: ((percent: number) => void) | null, headers?: Record): Promise; /** * Send a request to the server with a timeout * * @param method - The method of the request * @param path - The path of the request * @param data - The data to be sent * @param headers - The headers to be sent * @param timeout - The timeout of the request if the value is 0 there is no timeout */ requestTimeout(method: string, path: string, data?: object | null, headers?: object, timeout?: number): Promise; } //# sourceMappingURL=Api.d.ts.map