import LoginResult from './models/LoginResult'; import { AuthHeaders } from './models/AuthHeaders'; export declare enum METHODS { GET = "GET", POST = "POST" } export interface BaseResponse { /** Api status message */ status: 'success' | 'error'; /** Timestamp from server */ generatedAt: number; /** API response object */ response: ApiResponseType; /** API Error details object */ errorResponse?: { errorCode: string; description: string; displayMessage: string; }[]; } export interface BaseClientOptions { /** Custom host for Applozic APIs */ host?: string; /** Enable S3 mechanism for file attachment upload and download */ enableS3?: boolean; } export default class BaseClient { /** Applozic Application ID */ applicationId: string; /** Auth headers to use for requests on behalf of logged in user */ authHeaders: AuthHeaders; /** Result from successful login for a user */ loginResult: LoginResult | null; /** Override the default API host */ host?: string; /** Indicate whether to use S3 upload mechanism */ isS3Enabled: boolean; /** * Create a new Applozic client * @param applicationId Applozic Application ID * @param options Options to initialize the client */ constructor(applicationId: string, options?: BaseClientOptions); private getAgent; /** Initialize the client. This is left as a an empty function to be overridden by inherited classes, if required */ init(): Promise; /** * Post login kickback so enable all layers to initialize for the logged in user. * For example, in storage later in {@link BaseClientWithStore}, its used to persist login data across sessions. * @param loginRes */ postLogin(loginRes: LoginResult): Promise; /** * Perform logout from client */ logout(): Promise; refreshToken(loginResult: LoginResult): Promise; makeApiCall: (method: METHODS, endpoint: string, options?: { /** Override host from API call. Do not remove. Required for upload endpoint */ apiHost?: string; data?: object; query?: { [key: string]: string | number; }; /** Whether or not to use authentication headers from login result or not. Default is `false` */ useAuth?: boolean; /** Whether to add `Accept: application/json` in header. Default is `true` */ json?: boolean; }) => Promise; uploadFile: (endpoint: string, keyName: string, file: File, options?: { /** Override the default API host */ apiHost?: string; query?: { [key: string]: string | number; }; useAuth?: boolean; }) => Promise; }