UNPKG

domrobot-client

Version:
59 lines (58 loc) 2.34 kB
export declare class ApiClient { static readonly CLIENT_VERSION = "3.0.2"; static readonly API_URL_LIVE = "https://api.domrobot.com/jsonrpc/"; static readonly API_URL_OTE = "https://api.ote.domrobot.com/jsonrpc/"; static generateClientTransactionId(): string; private readonly apiUrl; private language; private debugMode; private cookie; private headers; /** * @param apiUrl url of the API. * @param language default language for future API requests. * @param debugMode whether requests and responses should be printed out. * @param headers Optional HTTP headers to be included in all API requests. */ constructor(apiUrl?: string, language?: string, debugMode?: boolean, headers?: Record<string, any>); /** * Makes an API call. * * @param apiMethod The name of the method called in the API. * @param methodParams An object of parameters added to the request. * @param clientTransactionId Id sent with every request to distinguish your api requests in case you need support. * @param language Language for the API request. Default is value of field language. * @param cacheOption HTTP cache options * @param nextjsOptions Next.js options */ callApi(apiMethod: string, methodParams?: any, clientTransactionId?: string, language?: string, cacheOption?: 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' | 'default', nextjsOptions?: object): Promise<any>; /** * Performs a login at the API and saves the session for following API calls. * * @param username your username. * @param password your password. * @param sharedSecret */ login(username: string, password: string, sharedSecret?: string): Promise<any>; /** * Performs a logout at the API and destroys the current session. */ logout(): Promise<any>; getApiUrl(): string; getLanguage(): string; setLanguage(value: string): void; isDebugMode(): boolean; setDebugMode(value: boolean): void; getCookie(): string; setCookie(cookie: string): void; setHeaders(headers: Record<string, any>): void; getHeaders(): Record<string, any>; } /** * The API response-message language. */ export declare enum Language { EN = "en", DE = "de", ES = "es" }