forked from watson-developer-cloud/node-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(compare-comply): add documentation and an example
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const CompareComplyV1 = require('watson-developer-cloud/compare-comply/v1'); | ||
|
||
const compareComply = new CompareComplyV1({ | ||
// if left unspecified here, the SDK will fall back to the COMPARE_COMPLY_IAM_APIKEY | ||
// environment property, and then Bluemix's VCAP_SERVICES environment property | ||
iam_apikey: 'YOUR APIKEY', | ||
url: 'https://gateway.watsonplatform.net/compare-comply/api', | ||
version: '2018-12-06' | ||
}); | ||
|
||
const params = { | ||
file_1: fs.createReadStream(__dirname + '/../test/resources/contract_A.pdf'), | ||
file_1_filename: 'contract_A.pdf', | ||
file_1_label: 'example-file-1', | ||
file_2: fs.createReadStream(__dirname + '/../test/resources/contract_B.pdf'), | ||
file_2_filename: 'contract_B.pdf', | ||
file_2_label: 'example-file-2', | ||
}; | ||
|
||
compareComply.compareDocuments(params, (error, data) => { | ||
if (error) { | ||
console.log(error); | ||
} else { | ||
console.log(data); | ||
} | ||
); |