From 87e3d4b0a9616c19d69e3d6213c196948240d93e Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Tue, 28 Nov 2017 18:17:13 -0500 Subject: [PATCH] Adding default values --- src/Models/BaseModel.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Models/BaseModel.js b/src/Models/BaseModel.js index 97170f6f..d03963e1 100644 --- a/src/Models/BaseModel.js +++ b/src/Models/BaseModel.js @@ -1,9 +1,9 @@ const LinkParser = require('parse-link-header'); -async function getAllPages(client, endpoint, options = {}, results = []) { +async function getAllPages(client, endpoint, options, results = []) { const response = await client.get(endpoint, options, true); - if(!response.headers['x-page']){ + if (!response.headers['x-page']) { return response; } @@ -23,7 +23,7 @@ class BaseModel { this.client = APIClient; } - get(endpoint, options) { + get(endpoint, options = {}) { if (!options.page) { return getAllPages(this.client, endpoint, options); } @@ -31,19 +31,19 @@ class BaseModel { return this.client.get(endpoint, options); } - post(endpoint, options) { + post(endpoint, options = {}) { return this.client.post(endpoint, options); } - postForm(endpoint, options) { + postForm(endpoint, options = {}) { return this.client.postForm(endpoint, options); } - put(endpoint, options) { + put(endpoint, options = {}) { return this.client.put(endpoint, options); } - delete(endpoint, options) { + delete(endpoint, options = {}) { return this.client.delete(endpoint, options); } }