From de45c3b1750b70c26babe0acc676cc3f27076c3d Mon Sep 17 00:00:00 2001 From: Gabriel Kalani Date: Thu, 4 Feb 2021 21:37:20 -0300 Subject: [PATCH] format: lib/api.js --- lib/api.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/api.js b/lib/api.js index 657a704..67e050f 100644 --- a/lib/api.js +++ b/lib/api.js @@ -1,6 +1,5 @@ #!/usr/bin/env node - /** * Zenvia SMS API * @@ -20,7 +19,6 @@ const unirest = require('unirest'); module.exports = { - ZENVIA_API: { apiHostName: 'https://api-rest.zenvia.com', postSmsPath: '/services/send-sms', @@ -31,7 +29,10 @@ module.exports = { cancelScheduledSms: '/services/cancel-sms', }, - DEFAULT_HEADER: { Accept: 'application/json', 'Content-Type': 'application/json' }, + DEFAULT_HEADER: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, CREDENTIALS: { account: null, @@ -42,7 +43,10 @@ module.exports = { return new Promise((resolve, reject) => { unirest .get(url) - .headers({ Accept: 'application/octet-stream', 'Content-Type': 'application/octet-stream' }) + .headers({ + Accept: 'application/octet-stream', + 'Content-Type': 'application/octet-stream', + }) .auth({ user: this.CREDENTIALS.account, pass: this.CREDENTIALS.password, @@ -94,8 +98,9 @@ module.exports = { sendSMS(payload) { return new Promise((resolve, reject) => { - const path = payload.sendSmsMultiRequest ? - this.ZENVIA_API.postSmsMultiple : this.ZENVIA_API.postSmsPath; + const path = payload.sendSmsMultiRequest + ? this.ZENVIA_API.postSmsMultiple + : this.ZENVIA_API.postSmsPath; const url = this.ZENVIA_API.apiHostName + path; @@ -127,7 +132,8 @@ module.exports = { // TODO: Not working getSMSReceivedList() { return new Promise((resolve, reject) => { - const url = this.ZENVIA_API.apiHostName + this.ZENVIA_API.getSmsReceivedList; + const url = + this.ZENVIA_API.apiHostName + this.ZENVIA_API.getSmsReceivedList; this.makePost(url) .then((res) => { @@ -167,5 +173,4 @@ module.exports = { }); }); }, - };