Skip to content

Commit

Permalink
fix: args -> options
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaledgarbaya committed Nov 23, 2017
1 parent 04b882e commit 21411b4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/get/get-full-source-space.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function getFullSourceSpace ({
title: 'Fetching content types data',
task: (ctx, task) => {
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet(ctx.space, 'getContentTypes')
return pagedGet({space: ctx.space, method: 'getContentTypes'})
.then(extractItems)
.then((items) => {
ctx.data.contentTypes = items
Expand All @@ -73,7 +73,7 @@ export default function getFullSourceSpace ({
title: 'Fetching content entries data',
task: (ctx, task) => {
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet(ctx.space, 'getEntries', 0, null, query)
return pagedGet({space: ctx.space, method: 'getEntries', query})
.then(extractItems)
.then(sortEntries)
.then((items) => filterDrafts(items, includeDrafts))
Expand All @@ -88,7 +88,7 @@ export default function getFullSourceSpace ({
title: 'Fetching assets data',
task: (ctx, task) => {
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet(ctx.space, 'getAssets', 0, null, query)
return pagedGet({space: ctx.space, method: 'getAssets', query})
.then(extractItems)
.then((items) => {
ctx.data.assets = items
Expand All @@ -101,7 +101,7 @@ export default function getFullSourceSpace ({
title: 'Fetching locales data',
task: (ctx, task) => {
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet(ctx.space, 'getLocales')
return pagedGet({space: ctx.space, method: 'getLocales'})
.then(extractItems)
.then((items) => {
ctx.data.locales = items
Expand All @@ -114,7 +114,7 @@ export default function getFullSourceSpace ({
title: 'Fetching webhooks data',
task: (ctx, task) => {
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet(ctx.space, 'getWebhooks')
return pagedGet({space: ctx.space, method: 'getWebhooks'})
.then(extractItems)
.then((items) => {
ctx.data.webhooks = items
Expand Down Expand Up @@ -162,7 +162,7 @@ function getEditorInterfaces (contentTypes) {
* The first call will have no aggregated response. Subsequent calls will
* concatenate the new responses to the original one.
*/
function pagedGet (space, method, skip = 0, aggregatedResponse = null, query = null) {
function pagedGet ({space, method, skip = 0, aggregatedResponse = null, query = null}) {
const fullQuery = Object.assign({},
{
skip: skip,
Expand All @@ -183,7 +183,7 @@ function pagedGet (space, method, skip = 0, aggregatedResponse = null, query = n
const pages = Math.ceil(response.total / pageLimit)
logEmitter.emit('info', `Fetched page ${page} of ${pages}`)
if (skip + pageLimit <= response.total) {
return pagedGet(space, method, skip + pageLimit, aggregatedResponse, query)
return pagedGet({space, method, skip: skip + pageLimit, aggregatedResponse, query})
}
return aggregatedResponse
})
Expand Down

0 comments on commit 21411b4

Please sign in to comment.