const CORE_ENDPOINT = '/complains'; const commandError = require('./error'); const coreapi = require('../coreapi'); function help(keyword) { return `Untuk melihat keluhan yg telah dibuat,\nketik perintah dengan format: ${ keyword.toUpperCase() }.<PIN>`; } function execute(tokens, params, cb) { if (!tokens || tokens.length < 2) { const responseParams = { body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }` } cb(null, null, responseParams); return; } const coreParams = { asker_terminal_name: params.from, asker_terminal_password: tokens[1], origin: params.origin, report_ip: params.report_ip, report_port: params.report_port, }; coreapi(CORE_ENDPOINT, coreParams, 'GET', cb); } module.exports = execute;