@knocklabs/client
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -20,4 +20,16 @@ "use strict"; | ||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); | ||
var DEFAULT_PREFERENCE_SET_ID = "default"; | ||
function buildUpdateParam(param) { | ||
if ((0, _typeof2["default"])(param) === "object") { | ||
return param; | ||
} | ||
return { | ||
subscribed: param | ||
}; | ||
} | ||
var Preferences = /*#__PURE__*/function () { | ||
@@ -265,2 +277,3 @@ function Preferences(instance) { | ||
preferenceSetId, | ||
params, | ||
result, | ||
@@ -274,16 +287,15 @@ _args7 = arguments; | ||
preferenceSetId = options.preferenceSet || DEFAULT_PREFERENCE_SET_ID; | ||
_context7.next = 4; | ||
params = buildUpdateParam(setting); | ||
_context7.next = 5; | ||
return this.instance.client().makeRequest({ | ||
method: "PUT", | ||
url: "/v1/users/".concat(this.instance.userId, "/preferences/").concat(preferenceSetId, "/workflows/").concat(workflowKey), | ||
data: { | ||
subscribed: setting | ||
} | ||
data: params | ||
}); | ||
case 4: | ||
case 5: | ||
result = _context7.sent; | ||
return _context7.abrupt("return", this.handleResponse(result)); | ||
case 6: | ||
case 7: | ||
case "end": | ||
@@ -347,2 +359,3 @@ return _context7.stop(); | ||
preferenceSetId, | ||
params, | ||
result, | ||
@@ -356,16 +369,15 @@ _args9 = arguments; | ||
preferenceSetId = options.preferenceSet || DEFAULT_PREFERENCE_SET_ID; | ||
_context9.next = 4; | ||
params = buildUpdateParam(setting); | ||
_context9.next = 5; | ||
return this.instance.client().makeRequest({ | ||
method: "PUT", | ||
url: "/v1/users/".concat(this.instance.userId, "/preferences/").concat(preferenceSetId, "/categories/").concat(categoryKey), | ||
data: { | ||
subscribed: setting | ||
} | ||
data: params | ||
}); | ||
case 4: | ||
case 5: | ||
result = _context9.sent; | ||
return _context9.abrupt("return", this.handleResponse(result)); | ||
case 6: | ||
case 7: | ||
case "end": | ||
@@ -372,0 +384,0 @@ return _context9.stop(); |
@@ -5,2 +5,12 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; | ||
function buildUpdateParam(param) { | ||
if (typeof param === "object") { | ||
return param; | ||
} | ||
return { | ||
subscribed: param | ||
}; | ||
} | ||
class Preferences { | ||
@@ -113,8 +123,7 @@ constructor(instance) { | ||
var preferenceSetId = options.preferenceSet || DEFAULT_PREFERENCE_SET_ID; | ||
var params = buildUpdateParam(setting); | ||
var result = yield _this7.instance.client().makeRequest({ | ||
method: "PUT", | ||
url: "/v1/users/".concat(_this7.instance.userId, "/preferences/").concat(preferenceSetId, "/workflows/").concat(workflowKey), | ||
data: { | ||
subscribed: setting | ||
} | ||
data: params | ||
}); | ||
@@ -148,8 +157,7 @@ return _this7.handleResponse(result); | ||
var preferenceSetId = options.preferenceSet || DEFAULT_PREFERENCE_SET_ID; | ||
var params = buildUpdateParam(setting); | ||
var result = yield _this9.instance.client().makeRequest({ | ||
method: "PUT", | ||
url: "/v1/users/".concat(_this9.instance.userId, "/preferences/").concat(preferenceSetId, "/categories/").concat(categoryKey), | ||
data: { | ||
subscribed: setting | ||
} | ||
data: params | ||
}); | ||
@@ -156,0 +164,0 @@ return _this9.handleResponse(result); |
{ | ||
"name": "@knocklabs/client", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "The clientside library for interacting with Knock", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/knocklabs/knock-client-js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
184544
2152