UNPKG

@juzi/wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

79 lines 2.88 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CallRecordImpl = void 0; const PUPPET = __importStar(require("@juzi/wechaty-puppet")); const config_js_1 = require("../config.js"); const validation_js_1 = require("../user-mixins/validation.js"); const wechatify_js_1 = require("../user-mixins/wechatify.js"); class CallRecordMixin extends (0, wechatify_js_1.wechatifyMixinBase)() { payload; static async create() { config_js_1.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; config_js_1.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 (0, validation_js_1.validationMixin)(CallRecordMixin)() { } exports.CallRecordImpl = CallRecordImpl; //# sourceMappingURL=call.js.map