import type { AxiosInstance } from 'axios'; import type { AppInterceptor } from './app-interceptor.token'; import type { FSNetworkPromise, FSNetworkRequestConfig, FSNetworkRequestData } from './types'; /** * Manages network requests, optionally adding a set of default configuration to each request. */ export declare class FSNetwork { static addAppInterceptor(interceptor: AppInterceptor): void; /** * Gets the full url that will be requested from a given config. baseUrl may contain more than * just the hostname and url may contain an absolute url, so those config attributes cannot be used directly. * * @param config Configuration for the request. * @return url that will be requested */ static getUriFromConfig(config: FSNetworkRequestConfig): string; /** * Creates a new instance of FSNetwork. * * @param config Default configuration to apply to every request. */ constructor(config?: FSNetworkRequestConfig); instance: AxiosInstance; private readonly appInterceptorManager; private readonly defaultContext; interceptor?: number; removeInterceptor(): void; setInterceptor(config?: FSNetworkRequestConfig): void; /** * Performs a generic request. * * @param config Configuration for the request. * @return A promise of the network response. */ request(config: FSNetworkRequestConfig): FSNetworkPromise; /** * Performs a GET request. * * @template T The response data type. * @param uri A URI or path to request. * @param config Configuration for the request. * @return A promise of the network response. */ get(uri: string, config?: FSNetworkRequestConfig): FSNetworkPromise; /** * Performs a DELETE request. * * @param uri A URI or path to request. * @param config Configuration for the request. * @return A promise of the network response. */ delete(uri: string, config?: FSNetworkRequestConfig): FSNetworkPromise; /** * Performs a HEAD request. * * @param uri A URI or path to request. * @param config Configuration for the request. * @return A promise of the network response. */ head(uri: string, config?: FSNetworkRequestConfig): FSNetworkPromise; /** * Performs a POST request. * * @template T The response data type. * @param uri A URI or path to request. * @param data The body of the request. * @param config Configuration for the request. * @return A promise of the network response. */ post(uri: string, data?: FSNetworkRequestData, config?: FSNetworkRequestConfig): FSNetworkPromise; /** * Performs a PUT request. * * @template T The response data type. * @param uri A URI or path to request. * @param data The body of the request. * @param config Configuration for the request. * @return A promise of the network response. */ put(uri: string, data?: FSNetworkRequestData, config?: FSNetworkRequestConfig): FSNetworkPromise; /** * Performs a PATCH request. * * @template T The response data type. * @param uri A URI or path to request. * @param data The body of the request. * @param config Configuration for the request. * @return A promise of the network response. */ patch(uri: string, data?: FSNetworkRequestData, config?: FSNetworkRequestConfig): FSNetworkPromise; }