-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removal of 'request' module requirement, improved documentation
- Loading branch information
Cameron James
committed
Jul 25, 2021
1 parent
edb40e7
commit 1c256eb
Showing
5 changed files
with
92 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
test.js |
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,27 @@ | ||
const client = require('./index')('XXX'); // XXX being your api key found at: https://www.bigdatacloud.net/customer/account | ||
|
||
/* | ||
* All api endpoints can be accessed via magic methods in the following camelised format: | ||
* method | endpoint | ||
* For example: an asynchronous "GET" call to the "ip-geolocation-full" endpoint would be: client.getIpGeolocationFull(); | ||
* All endpoints return a promise | ||
*/ | ||
|
||
//Asynchronous example using 'then': | ||
client | ||
.getIpGeolocationFull({ip:'8.8.8.8'}) | ||
.then(jsonResult => { | ||
console.log('Asynchronous "then" result:',jsonResult); | ||
}).catch(exception => { | ||
console.log(exception); | ||
}); | ||
|
||
//Asynchronous example using 'await': | ||
(async () => { | ||
try { | ||
var jsonResult = await client.getIpGeolocationFull({ip:'8.8.8.8'}); | ||
console.log('Asynchronous "await" result:',jsonResult); | ||
} catch (error) { | ||
console.error('Asynchronous "await" error:', error); | ||
} | ||
})(); |
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