forked from bhushankummar/eBay-node-client
-
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.
update README, add example to write category into JSON file
- Loading branch information
BL
committed
Oct 28, 2018
1 parent
8793d71
commit 47b6f4a
Showing
4 changed files
with
41 additions
and
3 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 |
---|---|---|
|
@@ -62,3 +62,6 @@ typings/ | |
|
||
#IDE | ||
.idea | ||
|
||
#Temp Directory | ||
temp/* |
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 |
---|---|---|
|
@@ -58,10 +58,13 @@ eBay.setApiKey('YOUR_KEY', 'YOUR_SECRET'); | |
- Contributors can send their Pull Request to `development` branch. | ||
- Kindly validate test cases & linting before opening new PR. | ||
|
||
## Do you need an expert? | ||
Are you finding a developer for your word class product? If yes, please contact here. [Submit your project request here.](https://goo.gl/forms/UofdG5GY5iHMoUWg2) | ||
``` | ||
Originally by [Bhushankumar Lilapara](https://github.com/bhushankumarl) ([email protected]). | ||
``` | ||
|
||
## Examples | ||
### Application | ||
#### Oauth Token | ||
``` | ||
|
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
32 changes: 32 additions & 0 deletions
32
examples/javaScript/commerce/taxonomy/getCategoryTreeToFile.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
|
||
var eBay = require('../../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var fse = require('fs-extra'); | ||
|
||
var categoryRequest = async function () { | ||
try { | ||
var token = await eBay.application.getOAuthToken({ | ||
grant_type: 'client_credentials', | ||
scope: 'https://api.ebay.com/oauth/api_scope' | ||
}); | ||
eBay.setToken(token.access_token); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
|
||
var categoryTreeId = '0'; | ||
try { | ||
var response = await eBay.taxonomy.getCategoryTree(categoryTreeId); | ||
console.log('response', JSON.stringify(response)); | ||
fse.writeFileSync('temp/response.json', JSON.stringify(response)); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
categoryRequest(); |