/** * @module browser */ /** End Typedoc Module Declaration */ import { Injector } from '@angular/core'; import { Http } from '@angular/http'; import { AbstractStore } from '../../common/stores/store'; import { identifier, ModelStatic, AbstractModel } from '../../common/models/model'; import { Logger } from '../../common/services/logger.service'; import { Collection } from '../../common/models/collection'; import 'rxjs/add/operator/toPromise'; /** * HttpStore store should be extended with a specific implementation for a model. Interacts with * the backend over the REST API using Angular's Http service */ export declare abstract class HttpStore extends AbstractStore { protected http: Http; protected logger: Logger; constructor(modelStatic: ModelStatic, injector: Injector, http: Http, loggerBase: Logger); /** * Get the rest endpoint for the model * @param id * @returns {string} */ protected endpoint(id?: identifier): string; /** * @inheritdoc */ findOne(id: identifier): Promise; /** * @inheritdoc */ findMany(query?: any): Promise>; /** * @inheritdoc */ saveOne(model: T): Promise; /** * @inheritdoc */ deleteOne(model: T): Promise; /** * @inheritdoc */ hasOne(model: T): Promise; /** * Extract model from the payload * @param res * @returns {T} */ private extractModel(res); /** * Extract collection of models from the payload * @param res * @returns {Collection} */ private extractCollection(res); /** * Handle any exceptions * @param error * @returns {Promise|Promise} */ private handleError(error); /** * Check the status is ok. * This only seems to be required for unit testing @todo resolve why there is a discrepancy * @param res * @returns {any} */ private checkStatus(res); }