import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { ToastService } from '../../toast/toast.service'; export declare abstract class BaseModel { private _http; private _toastService; constructor(_http: HttpClient, _toastService: ToastService); url: string; path: string; timeout: number; buildResource(resource_params: ResourceParams): Resource; getPath(resource_params: ResourceParams): ResourcePath; parseResourcePath(resource_path: ResourcePath, request_params: RequestParams): string; headerInterceptor(headers: any, resource_params: ResourceParams, request_params: RequestParams): string | { [key: string]: any; }; clearSession(): void; private getOptions; private _getHeaders; private _getLogoutOnUnauthorized; private _getParams; private _hasBody; private _setParams; private _findParamsKey; private _setResourceParamsDefaults; private _handleSuccess; private _handleError; } export declare enum RequestMethod { Post = "POST", Put = "PUT", Path = "PATH", Get = "GET", Delete = "DELETE", Head = "HEAD", Options = "OPTIONS", Jsonp = "JSONP" } export declare type RequestMethodWithBody = 'DELETE' | 'GET' | 'HEAD' | 'JSONP' | 'OPTIONS'; export declare type RequestMethodWithoutBody = 'POST' | 'PUT' | 'PATH'; export interface RequestOptions { headers?: HttpHeaders; reportProgress?: boolean; params?: HttpParams; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; } export declare type Resource = (request_params?: RequestParams, ...args: any[]) => ResourcePromise; export interface ResourcePromise { then: (on_success: ResourceResponsePromise, on_error?: ResourceResponsePromise) => ResourcePromise; catch: (on_error: ResourceResponsePromise) => ResourcePromise; finally: (on_finally: () => void) => ResourcePromise; abort: () => void; } export declare type ResourceResponsePromise = (response: ResourceResponse) => void; export interface ResourceParams { method?: RequestMethod; path?: string; requestInterceptor?: RequestInterceptor; responseInterceptor?: ResponseInterceptor; withCredentials?: boolean; logoutOnUnauthorized?: boolean; timeout?: number; cache?: CacheSettings; } export interface CacheSettings { name: string; ignore_params?: boolean; } export interface ResourcePath { template: string; keys: Array; } export interface CacheInfo { enabled: boolean; replace: boolean; name: string; params: Object; } export interface RequestParams { logoutOnUnauthorized?: boolean; [key: string]: any; } export declare type RequestInterceptor = (requestData: RequestOptions) => RequestOptions; export declare type ResponseInterceptor = (response: ResourceResponse) => ResourceResponse; export interface ResourceResponse { data: any; cached: boolean; status: number; statusText: string; } export interface DefaultRequestData { [key: string]: any; } export interface DefaultResponseData { error?: string; success?: string; id?: number; }