From 8f116d1ff9851e6b505358f6cad89d26d7e7d2d5 Mon Sep 17 00:00:00 2001 From: caioagiani Date: Sun, 21 Feb 2021 21:31:55 -0300 Subject: [PATCH] feat: upgrade es6 --- .eslintrc.js | 8 +-- README.md | 15 +++-- __tests__/balance.test.js | 2 +- __tests__/config/index.js | 4 +- __tests__/shortlink.test.js | 32 ++++++----- __tests__/sms.test.js | 8 ++- dist/environment.js | 21 +++++++ dist/index.js | 23 ++++++++ dist/services/mobizon.js | 44 ++++++++++++++ dist/structures/balance.js | 5 ++ dist/structures/shortlink.js | 10 ++++ dist/structures/sms.js | 7 +++ example.js | 108 +++++++++++++++++++++++------------ jest.config.js | 1 + package.json | 29 +++++++--- src/environment.js | 12 +--- src/index.js | 52 ++++++----------- src/services/mobizon.js | 70 +++++++++++++---------- src/structures/balance.js | 8 +-- src/structures/shortlink.js | 37 +++--------- src/structures/sms.js | 21 ++----- src/utils/url.js | 9 --- 22 files changed, 317 insertions(+), 209 deletions(-) create mode 100644 dist/environment.js create mode 100644 dist/index.js create mode 100644 dist/services/mobizon.js create mode 100644 dist/structures/balance.js create mode 100644 dist/structures/shortlink.js create mode 100644 dist/structures/sms.js delete mode 100644 src/utils/url.js diff --git a/.eslintrc.js b/.eslintrc.js index ca1d392..dc64dca 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,13 +21,7 @@ module.exports = { 'no-console': 0, 'linebreak-style': ['error', 'unix'], 'no-unused-vars': ['error', { argsIgnorePattern: 'next' }], - 'no-restricted-syntax': [ - 'warn', - { - selector: 'ForOfStatement', - message: 'frowned upon using For...Of', - }, - ], + 'import/no-extraneous-dependencies': ['error', { devDependencies: true }], 'import-helpers/order-imports': [ 'warn', { diff --git a/README.md b/README.md index cd29231..99d6b47 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ GitHub language count GitHub top language GitHub repo size + NPM downloads GitHub license

@@ -50,14 +51,16 @@ Confira em [docs](https://github.com/caioagiani/mobizon-node/blob/master/docs) t console.log(getBalance); /** Encurtar URL */ - const short = await mobizon.shortCreate({ - fullLink: 'https://mobizon.com.br', - status: 1, - expirationDate: '', - comment: 'Shortened link.', + const createShort = await mobizon.createShort({ + data: { + fullLink: 'https://mobizon.com.br', + status: 1, + expirationDate: '', + comment: 'Shortened link.', + }, }); - console.log(short); + console.log(createShort); /** Enviar SMS */ const sendSms = await mobizon.sendSms({ diff --git a/__tests__/balance.test.js b/__tests__/balance.test.js index 31c6ad6..f4cedce 100644 --- a/__tests__/balance.test.js +++ b/__tests__/balance.test.js @@ -1,4 +1,4 @@ -const mobizon = require('./config'); +import mobizon from './config'; describe('Mobizon balance', () => { it('should receive the account balance', async () => { diff --git a/__tests__/config/index.js b/__tests__/config/index.js index d6c091e..2583457 100644 --- a/__tests__/config/index.js +++ b/__tests__/config/index.js @@ -1,4 +1,4 @@ -const mobizon = require('../../src/index'); +import mobizon from '../../src'; mobizon.setConfig({ apiServer: 'https://api.mobizon.com.br', @@ -6,4 +6,4 @@ mobizon.setConfig({ format: 'json', }); -module.exports = mobizon; +export default mobizon; diff --git a/__tests__/shortlink.test.js b/__tests__/shortlink.test.js index c11af5a..306d2d9 100644 --- a/__tests__/shortlink.test.js +++ b/__tests__/shortlink.test.js @@ -1,14 +1,16 @@ -const mobizon = require('./config'); +import mobizon from './config'; describe('Mobizon short methods', () => { const responseValues = []; it('should create short link', async () => { - const response = await mobizon.shortCreate({ - fullLink: 'https://mobizon.com.br', - status: 1, - expirationDate: '', - comment: 'Created short link.', + const response = await mobizon.createShort({ + data: { + fullLink: 'https://mobizon.com.br', + status: 1, + expirationDate: '', + comment: 'Created short link.', + }, }); responseValues.push(response.data); @@ -17,25 +19,27 @@ describe('Mobizon short methods', () => { }); it('should throw error when creating short link', async () => { - const response = await mobizon.shortCreate({}); + const response = await mobizon.createShort({}); expect(response.code).not.toBe(0); }); it('should get short link', async () => { - const response = await mobizon.shortGet([responseValues[0].code]); + const response = await mobizon.getShort({ + code: responseValues[0].code, + }); expect(response.code).toBe(0); }); it('should throw error when getting short link', async () => { - const response = await mobizon.shortGet([]); + const response = await mobizon.getShort({}); expect(response.code).not.toBe(0); }); it('should update short link', async () => { - const response = await mobizon.shortUpdate({ + const response = await mobizon.updateShort({ id: responseValues[0].id, data: { status: 0, @@ -48,19 +52,21 @@ describe('Mobizon short methods', () => { }); it('should throw an error when updating a short link', async () => { - const response = await mobizon.shortUpdate({}); + const response = await mobizon.updateShort({}); expect(response.code).not.toBe(0); }); it('should delete short link', async () => { - const response = await mobizon.shortDelete([responseValues[0].id]); + const response = await mobizon.deleteShort({ + ids: [responseValues[0].id], + }); expect(response.code).toBe(0); }); it('should throw an error when deleting a short link', async () => { - const response = await mobizon.shortDelete(); + const response = await mobizon.deleteShort(); expect(response.code).not.toBe(0); }); diff --git a/__tests__/sms.test.js b/__tests__/sms.test.js index 5ea4b8b..e19f82b 100644 --- a/__tests__/sms.test.js +++ b/__tests__/sms.test.js @@ -1,4 +1,4 @@ -const mobizon = require('./config'); +import mobizon from './config'; describe('Mobizon sms methods', () => { const recipient = process.env.NUMBER; @@ -23,13 +23,15 @@ describe('Mobizon sms methods', () => { }); it('should list the sms sent by id', async () => { - const response = await mobizon.getSms(responseValues[0].messageId); + const response = await mobizon.getSms({ + ids: [responseValues[0].messageId], + }); expect(response.code).toBe(0); }); it('should throw error when listing sms by id', async () => { - const response = await mobizon.getSms([]); + const response = await mobizon.getSms({}); expect(response.code).not.toBe(0); }); diff --git a/dist/environment.js b/dist/environment.js new file mode 100644 index 0000000..60b3c89 --- /dev/null +++ b/dist/environment.js @@ -0,0 +1,21 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});exports. default = { + /** + * User API key. + * Each user has their key, it represents their access and allows access to API routes. + */ + apiKey: '', + /** + * User API server depends on user initial registration site. + * Correct API domain could be found in API quick start guide here: https://help.mobizon.com/help/api-docs/sms-api + */ + apiServer: '', + /** + * API response format - possible formats see in allowedFormats + */ + format: '', + /** + * API version. + * Default: v1. + */ + apiVersion: 'v1', +}; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..059e991 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,23 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _environment = require('./environment'); var _environment2 = _interopRequireDefault(_environment); +var _balance = require('./structures/balance'); var _balance2 = _interopRequireDefault(_balance); +var _shortlink = require('./structures/shortlink'); var _shortlink2 = _interopRequireDefault(_shortlink); +var _sms = require('./structures/sms'); var _sms2 = _interopRequireDefault(_sms); + +exports. default = { + environment: _environment2.default, + setConfig({ apiServer, apiKey, format }) { + _environment2.default.apiKey = apiKey; + _environment2.default.format = format || 'json'; + _environment2.default.apiServer = apiServer; + }, + getBalance: () => _balance2.default.get(), + getSms: (data) => _sms2.default.get(data), + sendSms: (data) => _sms2.default.send(data), + listSms: (data) => _sms2.default.list(data), + getShort: (data) => _shortlink2.default.get(data), + listShort: (data) => _shortlink2.default.list(data), + createShort: (data) => _shortlink2.default.create(data), + deleteShort: (data) => _shortlink2.default.delete(data), + updateShort: (data) => _shortlink2.default.update(data), + getStatsShort: (data) => _shortlink2.default.getstats(data), +}; diff --git a/dist/services/mobizon.js b/dist/services/mobizon.js new file mode 100644 index 0000000..133801f --- /dev/null +++ b/dist/services/mobizon.js @@ -0,0 +1,44 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _axios = require('axios'); +var _https = require('https'); +var _qs = require('qs'); + +var _environment = require('../environment'); var _environment2 = _interopRequireDefault(_environment); + +exports. default = async (provider, method, postParams, queryParams) => { + const { format, apiVersion, apiKey, apiServer } = _environment2.default; + + const request = _axios.create.call(void 0, { + baseURL: `${apiServer}/service`, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + httpsAgent: new (0, _https.Agent)({ + rejectUnauthorized: false, + }), + }); + + const queryDefault = _qs.stringify.call(void 0, { + output: format, + api: apiVersion, + apiKey, + }); + + if (postParams) { + const body = _qs.stringify.call(void 0, postParams); + + const { data } = await request.post( + `${provider}/${method}?${queryDefault}`, + body + ); + + return data; + } + + const query = queryParams + ? `${_qs.stringify.call(void 0, queryParams)}&${queryDefault}` + : queryDefault; + + const { data } = await request.get(`${provider}/${method}?${query}`); + + return data; +}; diff --git a/dist/structures/balance.js b/dist/structures/balance.js new file mode 100644 index 0000000..5408196 --- /dev/null +++ b/dist/structures/balance.js @@ -0,0 +1,5 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _mobizon = require('../services/mobizon'); var _mobizon2 = _interopRequireDefault(_mobizon); + +exports. default = { + get: () => _mobizon2.default.call(void 0, 'user', 'getownbalance'), +}; diff --git a/dist/structures/shortlink.js b/dist/structures/shortlink.js new file mode 100644 index 0000000..cdadca6 --- /dev/null +++ b/dist/structures/shortlink.js @@ -0,0 +1,10 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _mobizon = require('../services/mobizon'); var _mobizon2 = _interopRequireDefault(_mobizon); + +exports. default = { + get: (body) => _mobizon2.default.call(void 0, 'link', 'get', body), + list: (body) => _mobizon2.default.call(void 0, 'link', 'list', body), + create: (body) => _mobizon2.default.call(void 0, 'link', 'create', body), + delete: (body) => _mobizon2.default.call(void 0, 'link', 'delete', body), + update: (body) => _mobizon2.default.call(void 0, 'link', 'update', body), + getstats: (body) => _mobizon2.default.call(void 0, 'link', 'getstats', body), +}; diff --git a/dist/structures/sms.js b/dist/structures/sms.js new file mode 100644 index 0000000..00ab305 --- /dev/null +++ b/dist/structures/sms.js @@ -0,0 +1,7 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _mobizon = require('../services/mobizon'); var _mobizon2 = _interopRequireDefault(_mobizon); + +exports. default = { + get: (body) => _mobizon2.default.call(void 0, 'message', 'getsmsstatus', body), + list: (body) => _mobizon2.default.call(void 0, 'message', 'list', body), + send: (query) => _mobizon2.default.call(void 0, 'message', 'sendsmsmessage', null, query), +}; diff --git a/example.js b/example.js index 9df4dd1..7ae1582 100644 --- a/example.js +++ b/example.js @@ -1,4 +1,6 @@ -const mobizon = require('mobizon-node'); +import 'dotenv/config'; + +import mobizon from 'mobizon-node'; mobizon.setConfig({ /** Endpoint do serviço. */ @@ -15,37 +17,12 @@ mobizon.setConfig({ console.log(getBalance); - /** Encurtar URL */ - const short = await mobizon.shortCreate({ - fullLink: 'https://mobizon.com.br', - status: 1, - expirationDate: '', - comment: 'Shortened link.', - }); - - console.log(short); - - /** Listar link curto */ - const shortGet = await mobizon.shortGet('05xxi'); - - console.log(shortGet); - - /** Atualizar link curto */ - const shortUpdate = await mobizon.shortUpdate({ - id: '626', - data: { - status: 0, - expirationDate: '', - comment: 'Updated link.', - }, + /** Listar SMS por ID */ + const getSms = await mobizon.getSms({ + ids: ['49567', '49566'], }); - console.log(shortUpdate); - - /** Deletar link encurtado by ID */ - const shortDelete = await mobizon.shortDelete(['532']); - - console.log(shortDelete); + console.log(getSms); /** Enviar SMS */ const sendSms = await mobizon.sendSms({ @@ -56,11 +33,6 @@ mobizon.setConfig({ console.log(sendSms); - /** Listar SMS por ID */ - const getSms = await mobizon.getSms(['49567', '49566']); - - console.log(getSms); - /** Listar todos os SMS enviados */ const listSms = await mobizon.listSms({ criteria: { @@ -76,4 +48,70 @@ mobizon.setConfig({ }); console.dir(listSms, { depth: null }); + + /** Listar link curto by ID */ + const getShort = await mobizon.getShort({ + code: '92qe4', + }); + + console.log(getShort); + + /** Listar Links encurtados */ + const listShort = await mobizon.listShort({ + criteria: { + status: '1', + moderatorStatus: '1', + }, + pagination: { + currentPage: '2', + pageSize: '50', + }, + sort: { + clickCnt: 'ASC', + }, + }); + + console.dir(listShort, { depth: null }); + + /** Encurtar URL */ + const createShort = await mobizon.createShort({ + data: { + fullLink: 'https://mobizon.com.br', + status: 1, + expirationDate: '', + comment: 'Shortened link.', + }, + }); + + console.log(createShort); + + /** Deletar link encurtado by ID */ + const deleteShort = await mobizon.deleteShort({ + ids: ['718', '697', '689'], + }); + + console.log(deleteShort); + + /** Atualizar link encurtado */ + const updateShort = await mobizon.updateShort({ + id: '723', + data: { + status: 1, + expirationDate: '', + comment: 'Updated link.', + }, + }); + + console.log(updateShort); + + /** Listar status dos links encurtados by ID */ + const getStatsShort = await mobizon.getStatsShort({ + ids: ['723', '722'], + type: 'monthly', + criteria: { + dateFrom: '2021-01-01 13:30:00', + }, + }); + + console.dir(getStatsShort, { depth: null }); })(); diff --git a/jest.config.js b/jest.config.js index 55a2928..1470969 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,5 +3,6 @@ module.exports = { coverageDirectory: 'coverage', coverageProvider: 'v8', testEnvironment: 'node', + transform: { '.(js|jsx|tx|tsx)': '@sucrase/jest-plugin' }, testMatch: ['**/__tests__/**/*.test.js?(x)'], }; diff --git a/package.json b/package.json index 6b681eb..dfc9a10 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "mobizon-node", - "version": "0.2.3", - "description": "Mobizon é um poderoso gateway de SMS e ferramentas de marketing online.", + "version": "0.3.0", + "description": "Biblioteca NodeJS para trabalhar com os serviços Mobizon API", "readmeFilename": "README.md", - "main": "src/index.js", + "main": "dist/index.js", "license": "MIT", "keywords": [ "mobizon", @@ -13,7 +13,8 @@ "url_shortener", "gateway", "messaging", - "A2P" + "A2P", + "es6" ], "author": { "name": "Caio Agiani", @@ -35,16 +36,20 @@ "url": "https://github.com/caioagiani/mobizon-node/issues" }, "scripts": { - "lint": "eslint . --ext .js", - "test": "yarn lint && jest --setupFiles dotenv/config --detectOpenHandles --forceExit", - "test:clear": "jest --clearCache" + "lint": "eslint src --ext .js", + "build": "sucrase ./src -d ./dist --transforms imports", + "dev:start": "sucrase-node example.js", + "dev:test": "yarn lint && jest --setupFiles dotenv/config --detectOpenHandles --forceExit", + "dev:test:clear": "jest --clearCache" }, "dependencies": { "axios": "^0.21.1", "jest": "^26.6.3", - "mobizon-node": "^0.2.3" + "mobizon-node": "^0.3.0", + "qs": "^6.9.6" }, "devDependencies": { + "@sucrase/jest-plugin": "^2.0.0", "dotenv": "^8.2.0", "eslint": "^7.17.0", "eslint-config-airbnb-base": "^14.2.1", @@ -52,6 +57,12 @@ "eslint-plugin-import": "^2.22.1", "eslint-plugin-import-helpers": "^1.1.0", "eslint-plugin-prettier": "^3.3.1", - "prettier": "^2.2.1" + "prettier": "^2.2.1", + "sucrase": "^3.17.1" + }, + "jest": { + "transform": { + ".(js|jsx|ts|tsx)": "@sucrase/jest-plugin" + } } } diff --git a/src/environment.js b/src/environment.js index 25ed434..6e17a69 100644 --- a/src/environment.js +++ b/src/environment.js @@ -1,4 +1,4 @@ -module.exports = { +export default { /** * User API key. * Each user has their key, it represents their access and allows access to API routes. @@ -18,14 +18,4 @@ module.exports = { * Default: v1. */ apiVersion: 'v1', - /** - * Function to set up a default query for requests. - */ - defaultQuery() { - return { - output: this.format, - api: this.apiVersion, - apiKey: this.apiKey, - }; - }, }; diff --git a/src/index.js b/src/index.js index bf382e7..5e826ef 100644 --- a/src/index.js +++ b/src/index.js @@ -1,37 +1,23 @@ -const environment = require('./environment'); -const balance = require('./structures/balance'); -const short = require('./structures/shortlink'); -const sms = require('./structures/sms'); +import environment from './environment'; +import balance from './structures/balance'; +import short from './structures/shortlink'; +import sms from './structures/sms'; -module.exports = { +export default { environment, setConfig({ apiServer, apiKey, format }) { - this.environment.apiKey = apiKey; - this.environment.format = format || 'json'; - this.environment.apiServer = apiServer; - }, - getBalance() { - return balance.get.call(this); - }, - shortCreate(data) { - return short.create.call(this, data); - }, - shortDelete(data) { - return short.delete.call(this, data); - }, - shortGet(data) { - return short.get.call(this, data); - }, - shortUpdate(data) { - return short.update.call(this, data); - }, - sendSms(data) { - return sms.send.call(this, data); - }, - listSms(data) { - return sms.list.call(this, data); - }, - getSms(data) { - return sms.get.call(this, data); - }, + environment.apiKey = apiKey; + environment.format = format || 'json'; + environment.apiServer = apiServer; + }, + getBalance: () => balance.get(), + getSms: (data) => sms.get(data), + sendSms: (data) => sms.send(data), + listSms: (data) => sms.list(data), + getShort: (data) => short.get(data), + listShort: (data) => short.list(data), + createShort: (data) => short.create(data), + deleteShort: (data) => short.delete(data), + updateShort: (data) => short.update(data), + getStatsShort: (data) => short.getstats(data), }; diff --git a/src/services/mobizon.js b/src/services/mobizon.js index 085e74d..ec2741b 100644 --- a/src/services/mobizon.js +++ b/src/services/mobizon.js @@ -1,36 +1,44 @@ -const axios = require('axios'); -const https = require('https'); - -const { urlEncode } = require('../utils/url'); - -module.exports = { - async mobizon(provider, method, postParams, queryParams) { - const request = axios.create({ - baseURL: this.environment.apiServer, - headers: { 'Content-Type': 'application/json' }, - httpsAgent: new https.Agent({ - rejectUnauthorized: false, - }), - }); - - const loadQuery = this.environment.defaultQuery(); - const queryDefault = urlEncode(loadQuery); - - if (postParams) { - const { data } = await request.post( - `/service/${provider}/${method}?${queryDefault}`, - postParams - ); +import { create } from 'axios'; +import { Agent } from 'https'; +import { stringify } from 'qs'; + +import environment from '../environment'; + +export default async (provider, method, postParams, queryParams) => { + const { format, apiVersion, apiKey, apiServer } = environment; + + const request = create({ + baseURL: `${apiServer}/service`, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + httpsAgent: new Agent({ + rejectUnauthorized: false, + }), + }); + + const queryDefault = stringify({ + output: format, + api: apiVersion, + apiKey, + }); + + if (postParams) { + const body = stringify(postParams); + + const { data } = await request.post( + `${provider}/${method}?${queryDefault}`, + body + ); - return data; - } + return data; + } - const query = queryParams ? `${queryParams}&${queryDefault}` : queryDefault; + const query = queryParams + ? `${stringify(queryParams)}&${queryDefault}` + : queryDefault; - const { data } = await request.get( - `/service/${provider}/${method}?${query}` - ); + const { data } = await request.get(`${provider}/${method}?${query}`); - return data; - }, + return data; }; diff --git a/src/structures/balance.js b/src/structures/balance.js index 834e7d6..51f3e8b 100644 --- a/src/structures/balance.js +++ b/src/structures/balance.js @@ -1,7 +1,5 @@ -const { mobizon } = require('../services/mobizon'); +import mobizon from '../services/mobizon'; -module.exports = { - get() { - return mobizon.call(this, 'user', 'getownbalance'); - }, +export default { + get: () => mobizon('user', 'getownbalance'), }; diff --git a/src/structures/shortlink.js b/src/structures/shortlink.js index 97be784..46d5dd3 100644 --- a/src/structures/shortlink.js +++ b/src/structures/shortlink.js @@ -1,29 +1,10 @@ -const { mobizon } = require('../services/mobizon'); - -module.exports = { - create({ fullLink, expirationDate, comment }) { - const body = { - data: { - fullLink, - status: 1, - expirationDate, - comment, - }, - }; - - return mobizon.call(this, 'link', 'create', body); - }, - delete(ids) { - const body = { ids }; - - return mobizon.call(this, 'link', 'delete', body); - }, - get(id) { - const body = { code: id }; - - return mobizon.call(this, 'link', 'get', body); - }, - update(body) { - return mobizon.call(this, 'link', 'update', body); - }, +import mobizon from '../services/mobizon'; + +export default { + get: (body) => mobizon('link', 'get', body), + list: (body) => mobizon('link', 'list', body), + create: (body) => mobizon('link', 'create', body), + delete: (body) => mobizon('link', 'delete', body), + update: (body) => mobizon('link', 'update', body), + getstats: (body) => mobizon('link', 'getstats', body), }; diff --git a/src/structures/sms.js b/src/structures/sms.js index 043d9db..558f3da 100644 --- a/src/structures/sms.js +++ b/src/structures/sms.js @@ -1,18 +1,7 @@ -const { mobizon } = require('../services/mobizon'); -const { urlEncode } = require('../utils/url'); +import mobizon from '../services/mobizon'; -module.exports = { - send(query) { - const queryParams = query ? urlEncode(query) : undefined; - - return mobizon.call(this, 'message', 'sendsmsmessage', null, queryParams); - }, - list(body) { - return mobizon.call(this, 'message', 'list', body); - }, - get(ids) { - const body = { ids }; - - return mobizon.call(this, 'message', 'getsmsstatus', body); - }, +export default { + get: (body) => mobizon('message', 'getsmsstatus', body), + list: (body) => mobizon('message', 'list', body), + send: (query) => mobizon('message', 'sendsmsmessage', null, query), }; diff --git a/src/utils/url.js b/src/utils/url.js deleted file mode 100644 index b2aa3b7..0000000 --- a/src/utils/url.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - urlEncode(query) { - return Object.keys(query) - .map( - (key) => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}` - ) - .join('&'); - }, -};