@anglr/rest
Version:
Angular module representing rest services
54 lines • 1.96 kB
TypeScript
import { Injector } from '@angular/core';
import { HttpClient, HttpEvent, HttpRequest } from '@angular/common/http';
import { Observable } from 'rxjs';
import { RestMiddlewareOrderType, RestMiddlewareType } from '../types';
import { RestMiddleware } from '../../interfaces';
import * as i0 from "@angular/core";
/**
* Base class for RESTClient class
*/
export declare abstract class RESTClientBase {
/**
* Instance of http client
*/
protected http: HttpClient;
/**
* Instance of injector used for obtaining DI
*/
protected injector: Injector;
/**
* Array of rest middlewares in specific order in which will be middlewares executed
*/
protected middlewaresOrder: RestMiddlewareOrderType<string>[];
/**
* Array of middlewares that are executed for each http method
*/
protected methodMiddlewares: RestMiddlewareType<RestMiddleware>[];
/**
* Base path that is prepended to request URL
*/
protected baseUrl: string;
/**
* Returns the base url of RESTClient
*/
protected abstract getBaseUrl(): string;
/**
* Returns the default headers of RESTClient in a key-value
*/
protected abstract getDefaultHeaders(): string | {
[]: string | string[];
};
/**
* Request interceptor for all methods, must return new HttpRequest since object is immutable
* @param req - request object
*/
protected abstract requestInterceptor(req: HttpRequest<unknown>): HttpRequest<unknown>;
/**
* Allows to intercept all responses for all methods in class
* @param res - response object
*/
protected abstract responseInterceptor<TBody = unknown>(res: Observable<HttpEvent<TBody>>): Observable<HttpEvent<unknown>>;
static ɵfac: i0.ɵɵFactoryDeclaration<RESTClientBase, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RESTClientBase>;
}
//# sourceMappingURL=restClientBase.d.ts.map