@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
61 lines (60 loc) • 1.97 kB
TypeScript
import { LoopBackFilter } from '../../models';
export declare abstract class XompassBaseApi {
protected static model: any;
/**
* This is a core method, every HTTP Call will be done from here, every API Service will
* extend this class and use this method to get RESTful communication.
*/
static request(method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH' | 'HEAD' | 'OPTIONS', url: string, routeParams?: any, urlParams?: any, postBody?: any, retry?: boolean): Promise<any>;
/**
* This method will try to authenticate using either an access_token or basic http auth
*/
static authenticate<T>(url: string, headers: {
[key: string]: string | number;
}): object;
/**
* Generic create method
*/
static create<T>(data: T, retry?: boolean): Promise<T>;
/**
* Generic findById method
*/
static findById<T>(id: any, _filter?: LoopBackFilter, retry?: boolean): Promise<T>;
/**
* Generic find method
*/
static find<T>(_filter?: LoopBackFilter, retry?: boolean): Promise<T[]>;
/**
* Generic exists method
*/
static exists<T>(id: any, retry?: boolean): Promise<{
exist: boolean;
}>;
/**
* Generic findOne method
*/
static findOne<T>(_filter?: LoopBackFilter, retry?: boolean): Promise<T>;
/**
* Generic deleteById method
*/
static deleteById<T>(id: any, retry?: boolean): Promise<T>;
/**
* Generic count method
*/
static count(where?: any, retry?: boolean): Promise<{
count: number;
}>;
/**
* Generic updateAttributes method
*/
static updateAttributes<T>(id: any, data: T, retry?: boolean): Promise<T>;
/**
* Generic patchAttributes method
*/
static patchAttributes<T>(id: any, data: T, retry?: boolean): Promise<T>;
/**
* Abstract getModelName method
*/
abstract getModelName(): string;
static getBasePath(): string;
}