UNPKG

@juzi/wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

53 lines 1.64 kB
import * as PUPPET from '@juzi/wechaty-puppet'; import { log } from '../config.js'; import { validationMixin } from '../user-mixins/validation.js'; import { wechatifyMixinBase, } from '../user-mixins/wechatify.js'; class CallRecordMixin extends wechatifyMixinBase() { payload; static async create() { log.verbose('CallRecord', 'create()'); const payload = { starter: 'todo', participants: ['todo'], length: 0, type: 0, status: 0, }; return new this(payload); } /* * @hideconstructor */ constructor(payload) { super(); this.payload = payload; log.verbose('CallRecord', 'constructor()'); } async starter() { const starterId = this.payload.starter; if (!starterId) { return undefined; } const starter = this.wechaty.Contact.find({ id: starterId }); return starter; } async participants() { const participantIds = this.payload.participants; const contactPromises = participantIds.map(this.wechaty.Contact.find.bind(this.wechaty.Contact)); const contacts = await Promise.all(contactPromises); return contacts.filter(item => !!item); } length() { return this.payload.length; } type() { return this.payload.type || PUPPET.types.Call.UNKNOWN; } status() { return this.payload.status || PUPPET.types.CallStatus.UNKNOWN; } } class CallRecordImpl extends validationMixin(CallRecordMixin)() { } export { CallRecordImpl, }; //# sourceMappingURL=call.js.map