UNPKG

mnubo-sdk

Version:
60 lines (58 loc) 1.88 kB
import { RequestOptions } from './http/request'; import { Owners } from './ingestion/owners'; import { Objects } from './ingestion/objects'; import { Events } from './ingestion/events'; import { Search } from './restitution/search'; import { Bigdata } from './bigdata/bigdata'; import { Model } from './model/model'; export declare enum OAuth2Scopes { ALL = 0, LIMITED = 1, READ = 2, WRITE = 3 } export interface ClientCompression { requests: boolean; responses: boolean; } export interface ExponentialBackoff { numberOfAttempts?: number; initialDelayInMillis?: number; onRetry?: (attempt: number) => any; } export interface ClientOptions { id?: string; secret?: string; env?: string; token?: string; httpOptions?: RequestOptions; compression?: boolean | ClientCompression; exponentialBackoff?: ExponentialBackoff; } export declare class Client { options: ClientOptions; private defaultNumberOfAttempts; private defaultInitialDelay; owners: Owners; objects: Objects; events: Events; search: Search; bigdata: Bigdata; model: Model; private token; constructor(options: ClientOptions); hostname(): string; getAccessToken(scope?: OAuth2Scopes): Promise<any>; /** * Is the access token still valid? * @return {boolean} false if there is no access token or if it has expired. */ isAccessTokenValid(): boolean; authenticate(): Promise<any>; buildHttpOptions(path: string, contentType?: string): RequestOptions; possiblyRetry(f: () => Promise<any>): Promise<any>; get(path: string, contentType?: string): Promise<any>; post(path: string, payload: any, contentType?: string): Promise<any>; put(path: string, payload: any, contentType?: string): Promise<any>; delete(path: string, contentType?: string): Promise<any>; }