Permalink
Browse files

Added support for other Calais API parameters.

  • Loading branch information...
1 parent 9728f57 commit bc01533bb99b088b59da5de5d722d61f4b2d3246 @mcantelon committed Dec 31, 2010
Showing with 29 additions and 10 deletions.
  1. +29 −10 lib/calais.js
View
39 lib/calais.js
@@ -11,11 +11,17 @@ Calais.prototype = {
this.api_key = api_key
this.defaults = {
- 'apiHost': 'api.opencalais.com',
- 'apiPath': '/tag/rs/enrich',
- 'contentType': 'text/raw',
- 'outputFormat': 'application/json',
- 'cleanResult': true
+ 'apiHost': 'api.opencalais.com',
+ 'apiPath': '/tag/rs/enrich',
+ 'contentType': 'text/raw',
+ 'outputFormat': 'application/json',
+ 'reltagBaseURL': '',
+ 'calculateRelevanceScore': true,
+ 'enableMetadataType': 'GenericRelations,SocialTags',
+ 'docRDFaccessible': false,
+ 'allowDistribution': false,
+ 'allowSearch': false,
+ 'cleanResult': true
}
this._set_default_options(options)
@@ -68,11 +74,24 @@ Calais.prototype = {
var scope = this
var params = {
- 'Host': this.options.apiHost,
- 'x-calais-licenseID': this.api_key,
- 'Content-Type': this.options.contentType,
- 'Accept': this.options.outputFormat,
- 'Content-Length': this.options.content.length
+ 'Host': this.options.apiHost,
+ 'x-calais-licenseID': this.api_key,
+ 'Content-Type': this.options.contentType,
+ 'Accept': this.options.outputFormat,
+ 'Content-Length': this.options.content.length,
+ 'calculateRelevanceScore': this.options.calculateRelevanceScore,
+ 'enableMetadataType': this.options.enableMetadataType,
+ 'docRDFaccessible': this.options.docRDFaccessible,
+ 'allowDistribution': this.options.allowDistribution,
+ 'allowSearch': this.options.allowSearch
+ }
+
+ if (!this._undefined_or_null(this.options['externalID'])) {
+ params.externalID = this.options['externalID']
+ }
+
+ if (!this._undefined_or_null(this.options['submitter'])) {
+ params.submitter = his.options['submitter']
}
var client = http.createClient(80, this.options.apiHost)

0 comments on commit bc01533

Please sign in to comment.