import { inject, injectable } from "inversify"; import BaseService from "../../service"; import { IHttpClient, IService, IResourceMapper, IOpenIdUserInfoResponse, IFindParams } from "../../interfaces"; import Poi, { IPoi, IPoiResource, IPoiResponse, poiType } from "./"; import Mapper from "./mapper"; import * as TYPES from "../../types"; export interface IPoiService extends IService { nearby(id: string, options: IFindParams): Promise; } @injectable() export default class PoiService extends BaseService implements IPoiService { resource: string = poiType; mapper: IResourceMapper = new Mapper(); public url() { return `${this.host}/pois`; } public async nearby(id: string, options: IFindParams = { include: ["image-associations.from"] }) { const response = await this.http.fetch( `${this.url()}/${id}/nearby${this.qs(options)}` ); return this.mapper.map(response); } }