@vtex/api
Advanced tools
Comparing version 0.8.3 to 0.8.4
@@ -64,12 +64,47 @@ 'use strict'; | ||
}, { | ||
key: 'getAppSettings', | ||
value: function getAppSettings(account, workspace, app) { | ||
var _ref2 = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
var _ref2$context = _ref2.context; | ||
var context = _ref2$context === undefined ? [] : _ref2$context; | ||
(0, _required2.default)({ account: account, workspace: workspace, app: app }); | ||
var url = '' + this.endpointUrl + this.routes.Settings(account, workspace, app); | ||
return this.http.get(url).query({ | ||
context: contextQuery(context) | ||
}).thenJson(); | ||
} | ||
}, { | ||
key: 'updateAppSettings', | ||
value: function updateAppSettings(account, workspace, app, settings) { | ||
var _ref3 = arguments.length <= 4 || arguments[4] === undefined ? {} : arguments[4]; | ||
var _ref3$context = _ref3.context; | ||
var context = _ref3$context === undefined ? [] : _ref3$context; | ||
(0, _required2.default)({ account: account, workspace: workspace, app: app, settings: settings }); | ||
var url = '' + this.endpointUrl + this.routes.App(account, workspace, app); | ||
var url = '' + this.endpointUrl + this.routes.Settings(account, workspace, app); | ||
return this.http.put(url).send({ | ||
settings: settings | ||
}).thenJson(); | ||
return this.http.put(url).query({ | ||
context: contextQuery(context) | ||
}).send(settings).thenJson(); | ||
} | ||
}, { | ||
key: 'patchAppSettings', | ||
value: function patchAppSettings(account, workspace, app, settings) { | ||
var _ref4 = arguments.length <= 4 || arguments[4] === undefined ? {} : arguments[4]; | ||
var _ref4$context = _ref4.context; | ||
var context = _ref4$context === undefined ? [] : _ref4$context; | ||
(0, _required2.default)({ account: account, workspace: workspace, app: app, settings: settings }); | ||
var url = '' + this.endpointUrl + this.routes.Settings(account, workspace, app); | ||
return this.http.patch(url).query({ | ||
context: contextQuery(context) | ||
}).send(settings).thenJson(); | ||
} | ||
}, { | ||
key: 'updateAppTtl', | ||
@@ -104,9 +139,9 @@ value: function updateAppTtl(account, workspace, app) { | ||
key: 'listAppFiles', | ||
value: function listAppFiles(account, workspace, app, _ref2) { | ||
var _ref2$prefix = _ref2.prefix; | ||
var prefix = _ref2$prefix === undefined ? '' : _ref2$prefix; | ||
var _ref2$context = _ref2.context; | ||
var context = _ref2$context === undefined ? [] : _ref2$context; | ||
var _ref2$nextMarker = _ref2.nextMarker; | ||
var nextMarker = _ref2$nextMarker === undefined ? '' : _ref2$nextMarker; | ||
value: function listAppFiles(account, workspace, app, _ref5) { | ||
var _ref5$prefix = _ref5.prefix; | ||
var prefix = _ref5$prefix === undefined ? '' : _ref5$prefix; | ||
var _ref5$context = _ref5.context; | ||
var context = _ref5$context === undefined ? [] : _ref5$context; | ||
var _ref5$nextMarker = _ref5.nextMarker; | ||
var nextMarker = _ref5$nextMarker === undefined ? '' : _ref5$nextMarker; | ||
@@ -170,2 +205,5 @@ (0, _required2.default)({ account: account, workspace: workspace, app: app }); | ||
}, | ||
Settings: function Settings(account, workspace, app) { | ||
return this.App(account, workspace, app) + '/settings'; | ||
}, | ||
Files: function Files(account, workspace, app) { | ||
@@ -172,0 +210,0 @@ return this.App(account, workspace, app) + '/files'; |
@@ -73,2 +73,36 @@ 'use strict'; | ||
}); | ||
}; | ||
var baseQuery = _request2.default.prototype.query; | ||
_request2.default.prototype.query = function (options) { | ||
var query = {}; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = Object.keys(options)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var key = _step.value; | ||
var value = options[key]; | ||
if (value !== undefined && value !== '') { | ||
query[key] = value; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return baseQuery.apply(this, [query]); | ||
}; |
@@ -29,5 +29,5 @@ 'use strict'; | ||
var _appsEndpoints = require('./utils/appsEndpoints.js'); | ||
var _apiEndpoints = require('./utils/apiEndpoints.js'); | ||
var _appsEndpoints2 = _interopRequireDefault(_appsEndpoints); | ||
var _apiEndpoints2 = _interopRequireDefault(_apiEndpoints); | ||
@@ -47,3 +47,3 @@ var _required = require('./utils/required.js'); | ||
var _ref$endpointUrl = _ref.endpointUrl; | ||
var endpointUrl = _ref$endpointUrl === undefined ? (0, _appsEndpoints2.default)('STABLE') : _ref$endpointUrl; | ||
var endpointUrl = _ref$endpointUrl === undefined ? (0, _apiEndpoints2.default)('STABLE') : _ref$endpointUrl; | ||
@@ -54,3 +54,3 @@ _classCallCheck(this, RegistryClient); | ||
this.authToken = authToken; | ||
this.endpointUrl = endpointUrl === 'BETA' ? (0, _appsEndpoints2.default)(endpointUrl) : endpointUrl; | ||
this.endpointUrl = endpointUrl === 'BETA' ? (0, _apiEndpoints2.default)(endpointUrl) : endpointUrl; | ||
this.userAgent = userAgent; | ||
@@ -57,0 +57,0 @@ this.headers = { |
{ | ||
"name": "@vtex/api", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "VTEX I/O API client", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
32188
667