Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getEntrySnapshots (entryId, query = {}) {
return http.get(`entries/${entryId}/snapshots`, createRequestConfig({query: query}))
.then((response) => wrapSnapshotCollection(http, response.data), errorHandler)
}
function getAssets (query = {}) {
normalizeSelect(query)
return http.get('assets', createRequestConfig({query: query}))
.then((response) => wrapAssetCollection(http, response.data), errorHandler)
}
query.sync_token = query.nextSyncToken
delete query.nextSyncToken
}
if (query.nextPageToken) {
query.sync_token = query.nextPageToken
delete query.nextPageToken
}
if (query.sync_token) {
delete query.initial
delete query.type
delete query.content_type
}
return http.get('sync', createRequestConfig({query: query}))
.then((response) => {
const data = response.data
items = items.concat(data.items)
if (data.nextPageUrl) {
if (paginate) {
delete query.initial
query.sync_token = getToken(data.nextPageUrl)
return getSyncPage(http, items, query, { paginate })
}
return {
items: items,
nextPageToken: getToken(data.nextPageUrl)
}
} else if (data.nextSyncUrl) {
return {
items: items,
getSnapshots: function (query = {}) {
return http.get(`entries/${this.sys.id}/snapshots`, createRequestConfig({query: query}))
.then((response) => wrapSnapshotCollection(http, response.data), errorHandler)
},
function getEntries (query = {}) {
raiseDeprecationWarning('getEntries')
normalizeSelect(query)
return http.get('entries', createRequestConfig({query: query}))
.then((response) => wrapEntryCollection(http, response.data), errorHandler)
}
function getAsset (id, query = {}) {
switchToEnvironment(http)
normalizeSelect(query)
return http.get('assets/' + id, createRequestConfig({query: query}))
.then((response) => wrapAsset(response.data), errorHandler)
}
function getAsset (id, query = {}) {
raiseDeprecationWarning('getAsset')
normalizeSelect(query)
return http.get('assets/' + id, createRequestConfig({query: query}))
.then((response) => wrapAsset(http, response.data), errorHandler)
}
function getAssets (query = {}) {
raiseDeprecationWarning('getAssets')
normalizeSelect(query)
return http.get('assets', createRequestConfig({query: query}))
.then((response) => wrapAssetCollection(http, response.data), errorHandler)
}
getSnapshots: function (query = {}) {
return http.get(`content_types/${this.sys.id}/snapshots`, createRequestConfig({query: query}))
.then((response) => wrapSnapshotCollection(http, response.data), errorHandler)
},