/** * Copyright Linkurious SAS 2012 - 2019 * * - Created on 2019-10-01. */ import { User } from '../api/user'; import { DataSourceUserInfo } from '../api/dataSource'; import { ErrorListener } from '../errorListener'; import { LkErrorKey } from './response'; /** * Interfaces for Request class */ export interface RawFetchConfig = Record> { errors?: E[]; url: string; method: 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH'; params?: P; } export interface SendBeaconConfig = Record> extends RawFetchConfig { method: 'POST'; } export interface FetchConfig { url: URL; method: 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH'; contentType?: string; body?: string | File; } export interface ClientState { user?: User; currentSource?: DataSourceUserInfo; guestMode?: boolean; sources?: DataSourceUserInfo[]; } export interface ModuleProps { readonly baseUrl: string; readonly fetchMethod: typeof fetch; readonly customHeaders: Record; readonly clientState: ClientState; readonly dispatchError: ErrorListener['dispatchError']; }