import { Injector } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Connection, ConnectionBackend, Request, Response, ResponseOptions } from '@angular/http'; import { IAngularApiHandlerConfig } from './angular-api-handler.config'; import { AngularApiHandlerRequestHandler } from './angular-api-handler.request-handler'; export declare abstract class AngularApiHandlerService { abstract getHandlers(): AngularApiHandlerRequestHandler[]; } /** * Service for handling api requests * * Manages a list of request handlers for responding to api calls */ export declare class AngularApiHandlerBackendService { private injector; private service; /** * Global handler module configuration * * @type {AngularApiHandlerConfig} */ protected config: IAngularApiHandlerConfig; /** * List of request handlers for processing requests */ protected requestHandlers: AngularApiHandlerRequestHandler[]; /** * Real http backend for passing through api requests */ protected httpBackend: ConnectionBackend; constructor(injector: Injector, service: AngularApiHandlerService, config: IAngularApiHandlerConfig); createConnection(req: Request): Connection; /** * Handle the api request * * If a handler is implemented for the request, allow it to handle the request * * Otherwise, either return an error or allow the request to pass through to the * http api endpoint * * @param req * @returns {Observable} */ protected handleRequest(req: Request): Observable; /** * Handle the request based on the request type * * @param req * @param requestHandler * @param index * @returns {Observable} */ protected requestTypeHandler(req: Request, requestHandler: AngularApiHandlerRequestHandler, index: number): Observable; /** * Create an observable for the response provided * * @param resOptions * @returns {Observable|"../../../Observable".Observable|"../../Observable".Observable} */ protected createObservableResponse(resOptions: ResponseOptions): Observable; /** * error response helper * * @param status * @param message * @returns {ResponseOptions} */ protected createErrorResponse(status: number, message: string): ResponseOptions; /** * is the status code a success code * * @param status * @returns {boolean} */ protected isSuccess(status: number): boolean; protected setStatusText(options: ResponseOptions): ResponseOptions; /** * initialise the request handlers */ protected initHandlers(): void; /** * initialise the http backend for passing requests through to */ protected initHttpBackend(): void; }