exports.postJsonResource = function (url, obj, next, token, opts) { if (!token) { return next(null, 'no_token'); } return http.postResource(url, obj ? JSON.stringify(obj) : null, function (resp, err) { if (err) { return next(null, err); } var json = JSON.parse(resp); if (!json) { return next(null, 'bad_response'); } return next(json); }, exports.addAuthHeader(token, exports.addJsonHeader(opts))); };
exports.revokeToken = function (next, token) { return http.postResource(http.addQueryToUrl({ 'access_token': token }, 'https://cloud.digitalocean.com/v1/oauth/revoke'), null, next); };