UNPKG

@juzi/wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

55 lines 1.65 kB
import { log } from '../config.js'; import { validationMixin } from '../user-mixins/validation.js'; import { wechatifyMixinBase, } from '../user-mixins/wechatify.js'; class LocationMixin extends wechatifyMixinBase() { payload; /** * * Create * @param poi string A point of interest (POI) is a specific point location that someone may find useful or interesting. * See: https://en.wikipedia.org/wiki/Point_of_interest */ static async create(poi) { log.verbose('Location', 'create(%s)', poi); const payload = { accuracy: 15, address: '北京市北京市海淀区45 Chengfu Rd', latitude: 39.995120999999997, longitude: 116.334154, name: poi, // Huan(202109): FIXME: generate payload by poi }; return new this(payload); } /* * @hideconstructor */ constructor(payload) { super(); this.payload = payload; log.verbose('Location', 'constructor()'); // Huan(202110): it is ok to create a raw one without wechaty instance // guardWechatifyClass.call(this, Location) } toString() { return `Location<${this.payload.name}>`; } address() { return this.payload.address; } latitude() { return this.payload.latitude; } longitude() { return this.payload.longitude; } name() { return this.payload.name; } accuracy() { return this.payload.accuracy; } } class LocationImpl extends validationMixin(LocationMixin)() { } export { LocationImpl, }; //# sourceMappingURL=location.js.map