UNPKG

@opendatasoft/api-client

Version:
31 lines (30 loc) 1.05 kB
import { Query } from '../odsql'; export type RequestInterceptor = (request: Request) => Promise<Request>; export type ResponseInterceptor = (response: Response) => Promise<any>; export interface ApiClientOptions { domain?: string; apiKey?: string; fetch?: WindowOrWorkerGlobalScope['fetch']; headers?: HeadersInit; interceptRequest?: RequestInterceptor; interceptResponse?: ResponseInterceptor; hideDeprecatedWarning?: boolean; } export interface ApiClientConfiguration { baseUrl: string; apiKey?: string; fetch: WindowOrWorkerGlobalScope['fetch']; headers?: Headers; interceptRequest?: RequestInterceptor; interceptResponse?: ResponseInterceptor; hideDeprecatedWarning?: boolean; } export declare class ApiClient { readonly defaultConfig: ApiClientConfiguration; deprecatedWarningShown: string[]; /** * Constructs an instance of {@link ApiClient} */ constructor(options?: ApiClientOptions); get<T>(query: string | Query, options?: ApiClientOptions): Promise<T>; }