sentry-api
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -37,2 +37,8 @@ var fs = require('fs'); | ||
var Client = function(dsn, config) { | ||
// If no DSN is provided, use the default. | ||
if (lodash.isObject(dsn)) { | ||
config = dsn; | ||
dsn = 'https://app.getsentry.com'; | ||
} | ||
this.dsn = new DSN(dsn); | ||
@@ -43,2 +49,3 @@ | ||
logging: false, | ||
token: null, | ||
}); | ||
@@ -116,9 +123,19 @@ | ||
return new Promise(function (resolve, reject) { | ||
request(lodash.extend({ | ||
var requestOptions = lodash.extend({ | ||
uri: uri, | ||
json: true, | ||
auth: { | ||
}, options); | ||
if (this.config.token) { | ||
requestOptions.auth = { | ||
bearer: this.config.token, | ||
}; | ||
} | ||
else { | ||
requestOptions.auth = { | ||
user: this.dsn.publicKey, | ||
}, | ||
}, options), function(error, response, body) { | ||
}; | ||
} | ||
request(requestOptions, function(error, response, body) { | ||
if (error) { | ||
@@ -125,0 +142,0 @@ this.logger.error(error); |
{ | ||
"name": "sentry-api", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A client for the Sentry API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,2 +28,14 @@ # sentry-api | ||
// If you're using authentication tokens, you'll want to pass the token as | ||
// a configuration option. | ||
var sentry = new Sentry('https://abc123:@app.getsentry.com', { | ||
token: 'mytoken' | ||
}); | ||
// You can also leave off the DSN if you're using token authentication and | ||
// hosted sentry. | ||
var sentry = new Sentry({ | ||
token: 'mytoken' | ||
}); | ||
// Retrieve a project using the callback style. | ||
@@ -30,0 +42,0 @@ sentry.projects.get('org-slug', 'project-slug', function(error, project) { |
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
29436
12
793
121