contential
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -201,8 +201,9 @@ "use strict"; | ||
}, { | ||
key: "search", | ||
key: "query", | ||
value: function () { | ||
var _search = (0, _asyncToGenerator2["default"])( | ||
var _query2 = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee4(_ref5) { | ||
var regionId, spaceId, listId, localeId, pageSize, page, fields, query, apiKey, apiKeyId, queryData, url, response; | ||
var regionId, spaceId, listId, localeId, pageSize, page, apiKey, _query, orderBy, orderByDirection, apiKeyId, queryObject, url, response; | ||
return _regenerator["default"].wrap(function _callee4$(_context4) { | ||
@@ -212,20 +213,23 @@ while (1) { | ||
case 0: | ||
regionId = _ref5.regionId, spaceId = _ref5.spaceId, listId = _ref5.listId, localeId = _ref5.localeId, pageSize = _ref5.pageSize, page = _ref5.page, fields = _ref5.fields, query = _ref5.query, apiKey = _ref5.apiKey; | ||
regionId = _ref5.regionId, spaceId = _ref5.spaceId, listId = _ref5.listId, localeId = _ref5.localeId, pageSize = _ref5.pageSize, page = _ref5.page, apiKey = _ref5.apiKey, _query = _ref5.query, orderBy = _ref5.orderBy, orderByDirection = _ref5.orderByDirection; | ||
_context4.prev = 1; | ||
apiKeyId = apiKey || this.client.apiKey; | ||
regionId = regionId || 'global'; | ||
queryData = { | ||
queryObject = { | ||
localeId: localeId, | ||
pageSize: pageSize, | ||
page: page, | ||
fields: fields, | ||
query: query | ||
page: page | ||
}; | ||
url = "".concat(this.client.config[regionId].CONTENT_URL, "/spaces/").concat(spaceId, "/lists/").concat(listId, "/search?").concat(_querystring["default"].stringify(queryData)); | ||
url = "".concat(this.client.config[regionId].CONTENT_URL, "/spaces/").concat(spaceId, "/lists/").concat(listId, "/query?").concat(_querystring["default"].stringify(queryObject)); | ||
_context4.next = 8; | ||
return (0, _axios["default"])({ | ||
method: 'GET', | ||
method: 'POST', | ||
url: url, | ||
headers: { | ||
'x-api-key': apiKeyId | ||
}, | ||
data: { | ||
query: _query, | ||
orderBy: orderBy, | ||
orderByDirection: orderByDirection | ||
} | ||
@@ -251,15 +255,15 @@ }); | ||
function search(_x4) { | ||
return _search.apply(this, arguments); | ||
function query(_x4) { | ||
return _query2.apply(this, arguments); | ||
} | ||
return search; | ||
return query; | ||
}() | ||
}, { | ||
key: "remove", | ||
key: "search", | ||
value: function () { | ||
var _remove = (0, _asyncToGenerator2["default"])( | ||
var _search = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee5(_ref6) { | ||
var regionId, spaceId, listId, localeId, apiKey, apiKeyId, query, url, response; | ||
var regionId, spaceId, listId, localeId, pageSize, page, fields, query, apiKey, apiKeyId, queryData, url, response; | ||
return _regenerator["default"].wrap(function _callee5$(_context5) { | ||
@@ -269,13 +273,17 @@ while (1) { | ||
case 0: | ||
regionId = _ref6.regionId, spaceId = _ref6.spaceId, listId = _ref6.listId, localeId = _ref6.localeId, apiKey = _ref6.apiKey; | ||
regionId = _ref6.regionId, spaceId = _ref6.spaceId, listId = _ref6.listId, localeId = _ref6.localeId, pageSize = _ref6.pageSize, page = _ref6.page, fields = _ref6.fields, query = _ref6.query, apiKey = _ref6.apiKey; | ||
_context5.prev = 1; | ||
apiKeyId = apiKey || this.client.apiKey; | ||
regionId = regionId || 'global'; | ||
query = { | ||
localeId: localeId | ||
queryData = { | ||
localeId: localeId, | ||
pageSize: pageSize, | ||
page: page, | ||
fields: fields, | ||
query: query | ||
}; | ||
url = "".concat(this.client.config[regionId].CONTENT_URL, "/spaces/").concat(spaceId, "/lists/").concat(listId, "?").concat(_querystring["default"].stringify(query)); | ||
url = "".concat(this.client.config[regionId].CONTENT_URL, "/spaces/").concat(spaceId, "/lists/").concat(listId, "/search?").concat(_querystring["default"].stringify(queryData)); | ||
_context5.next = 8; | ||
return (0, _axios["default"])({ | ||
method: 'DELETE', | ||
method: 'GET', | ||
url: url, | ||
@@ -304,3 +312,54 @@ headers: { | ||
function remove(_x5) { | ||
function search(_x5) { | ||
return _search.apply(this, arguments); | ||
} | ||
return search; | ||
}() | ||
}, { | ||
key: "remove", | ||
value: function () { | ||
var _remove = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee6(_ref7) { | ||
var regionId, spaceId, listId, localeId, apiKey, apiKeyId, query, url, response; | ||
return _regenerator["default"].wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
regionId = _ref7.regionId, spaceId = _ref7.spaceId, listId = _ref7.listId, localeId = _ref7.localeId, apiKey = _ref7.apiKey; | ||
_context6.prev = 1; | ||
apiKeyId = apiKey || this.client.apiKey; | ||
regionId = regionId || 'global'; | ||
query = { | ||
localeId: localeId | ||
}; | ||
url = "".concat(this.client.config[regionId].CONTENT_URL, "/spaces/").concat(spaceId, "/lists/").concat(listId, "?").concat(_querystring["default"].stringify(query)); | ||
_context6.next = 8; | ||
return (0, _axios["default"])({ | ||
method: 'DELETE', | ||
url: url, | ||
headers: { | ||
'x-api-key': apiKeyId | ||
} | ||
}); | ||
case 8: | ||
response = _context6.sent; | ||
return _context6.abrupt("return", response.data); | ||
case 12: | ||
_context6.prev = 12; | ||
_context6.t0 = _context6["catch"](1); | ||
throw _context6.t0.response.data; | ||
case 15: | ||
case "end": | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _callee6, this, [[1, 12]]); | ||
})); | ||
function remove(_x6) { | ||
return _remove.apply(this, arguments); | ||
@@ -307,0 +366,0 @@ } |
{ | ||
"name": "contential", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "JavaScript client for Contential.", | ||
@@ -5,0 +5,0 @@ "author": "Marcel Thomas", |
@@ -108,2 +108,45 @@ import axios from 'axios'; | ||
async query({ | ||
regionId, | ||
spaceId, | ||
listId, | ||
localeId, | ||
pageSize, | ||
page, | ||
apiKey, | ||
query, | ||
orderBy, | ||
orderByDirection, | ||
}) { | ||
try { | ||
const apiKeyId = apiKey || this.client.apiKey; | ||
regionId = regionId || 'global'; | ||
const queryObject = { | ||
localeId, | ||
pageSize, | ||
page, | ||
}; | ||
const url = `${ | ||
this.client.config[regionId].CONTENT_URL | ||
}/spaces/${spaceId}/lists/${listId}/query?${queryString.stringify( | ||
queryObject, | ||
)}`; | ||
const response = await axios({ | ||
method: 'POST', | ||
url, | ||
headers: { | ||
'x-api-key': apiKeyId, | ||
}, | ||
data: { | ||
query, | ||
orderBy, | ||
orderByDirection, | ||
}, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
throw error.response.data; | ||
} | ||
} | ||
async search({ | ||
@@ -110,0 +153,0 @@ regionId, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61296
1561