pipedrive 19.0.1 → 19.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/ApiClient.js CHANGED
@@ -822,6 +822,74 @@ var ApiClient = /*#__PURE__*/function () {
822
822
  }
823
823
  }
824
824
 
825
+ /**
826
+ * Revoke Refresh Token aka marking an app uninstalled or revoke the Access Token.
827
+ * @param {Object} optional opts object with tokenTypeHint param, values can be: 'access_token' or 'refresh_token'.
828
+ */
829
+ }, {
830
+ key: "revokeToken",
831
+ value: function () {
832
+ var _revokeToken = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
833
+ var opts,
834
+ tokenTypeHint,
835
+ token,
836
+ clientId,
837
+ clientSecret,
838
+ host,
839
+ revokeUrl,
840
+ clientIdAndSecretInBase64,
841
+ request,
842
+ response,
843
+ exception,
844
+ _args4 = arguments;
845
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
846
+ while (1) {
847
+ switch (_context4.prev = _context4.next) {
848
+ case 0:
849
+ opts = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
850
+ tokenTypeHint = opts.tokenTypeHint;
851
+ if (this.isOauth2Supported()) {
852
+ _context4.next = 4;
853
+ break;
854
+ }
855
+ throw new Error('Could not revoke the token. OAuth 2 is not supported.');
856
+ case 4:
857
+ token = tokenTypeHint === 'refresh_token' ? this.getOAuth2Property('refreshToken') : encodeURIComponent(this.getOAuth2Property('accessToken'));
858
+ clientId = this.getOAuth2Property('clientId');
859
+ clientSecret = this.getOAuth2Property('clientSecret');
860
+ host = this.getOAuth2Property('host');
861
+ revokeUrl = "".concat(host, "/oauth/revoke");
862
+ clientIdAndSecretInBase64 = Buffer.from("".concat(clientId, ":").concat(clientSecret)).toString('base64');
863
+ _context4.prev = 10;
864
+ request = _superagent["default"].post(revokeUrl).set('User-Agent', this.getUserAgent()).set('Authorization', "Basic ".concat(clientIdAndSecretInBase64)).send("token=".concat(token));
865
+ if (tokenTypeHint) {
866
+ request = request.send("token_type_hint=".concat(tokenTypeHint));
867
+ }
868
+ _context4.next = 15;
869
+ return request;
870
+ case 15:
871
+ response = _context4.sent;
872
+ return _context4.abrupt("return", response.body);
873
+ case 19:
874
+ _context4.prev = 19;
875
+ _context4.t0 = _context4["catch"](10);
876
+ exception = new _OAuthProviderException["default"]();
877
+ exception.message = _context4.t0.response.res.statusMessage;
878
+ exception.errorCode = _context4.t0.status;
879
+ exception.context = _context4.t0.response;
880
+ throw exception;
881
+ case 26:
882
+ case "end":
883
+ return _context4.stop();
884
+ }
885
+ }
886
+ }, _callee4, this, [[10, 19]]);
887
+ }));
888
+ function revokeToken() {
889
+ return _revokeToken.apply(this, arguments);
890
+ }
891
+ return revokeToken;
892
+ }()
825
893
  /**
826
894
  * Parses an ISO-8601 string representation or epoch representation of a date value.
827
895
  * @param {String} str The date value as a string.
@@ -13,7 +13,7 @@ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
13
13
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
14
14
  *
15
15
  * The version of the OpenAPI document: 1.0.0
16
- *
16
+ *
17
17
  *
18
18
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
19
19
  * https://openapi-generator.tech
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipedrive",
3
- "version": "19.0.1",
3
+ "version": "19.1.0",
4
4
  "description": "Pipedrive REST client for NodeJS",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",