UNPKG

jade-integration-utils

Version:

A tool made for any type of http requisitions and to manage localstorage. This package works into Angular and Ionic projects (maybe you can run this in ReactNative, MAYBE!).

83 lines (82 loc) 3.15 kB
import { IDataService } from '../interfaces/IDataService'; import { XHRManager } from '../services/xhr-manager.service'; export declare class DataService<T> implements IDataService { static user_session: string; element_list: Array<T>; page_array: Array<number>; page: number; fetch: number; itemsCount: number; args: any; results: any; loading: boolean; xMan: XHRManager; private _endpoint; private target; constructor(api_url: string, endpoint: string); private remove_e_query; getById(id: number, callbackHandler?: any): void; private bind_results; get(filter?: T, callbackHandler?: any, pagination?: boolean): void; getAll(callbackHandler?: any, pagination?: boolean): void; next(filter?: T): void; previous(filter?: T): void; /** * calls a http get to not configured endpoint * * @param endpoint another endpoint */ get_by_endpoint(endpoint: string, callbackHandler?: any, query_params?: any, pagination?: boolean): void; /** * this function calls a http post from before configured api * * @param body parameter that send's a different custom body * @param callbackHandler @optional function to call when requests finish * @param message @optional string to show after requests finish */ post(body: any, callbackHandler?: any): void; /** * this function calls a http post from before configured api * * @param body parameter that send's a custom body * @param callbackHandler @optional function to call when requests finish * @param message @optional string to show after requests finish */ create(body: T, callbackHandler?: any): void; /** * call's a Put method to the url before configured * @param body of requisition of request * @param callbackHandler function that call's on request's finished * @param message @optional string to show after requests finish */ update(body: T, callbackHandler?: any): void; /** * call's a Put method to the url before configured * @param body of requisition of request * @param callbackHandler function that call's on request's finished * @param message @optional string to show after requests finish */ put(body: any, callbackHandler?: any): void; /** * calls http DELETE to configured endpoint * * @param id Id to delete * @param callbackHandler a function to run after delete function as done */ delete(id: number, callbackHandler?: any): void; /** * Set's Authentication bearer * @param auth strings containing authentication bearer */ set_auth(auth: string): void; get_auth(): string; get_pages_array(): void; get_pagination_query(): string; show_success(msg?: string): void; showError(error: any): void; logout(): void; serialize_query(obj: any): string; auto_bind(result: any, target: any): void; remove_resource(target: any): any; static normalizeString(text: any): any; }