Skip to content

Commit 5fa29d5

Browse files
authored
Added better documentation using docsify (#74)
* v2.7.7 * added docsify support
1 parent 3baf2f8 commit 5fa29d5

31 files changed

+2677
-315
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ node_modules/
22
npm-debug.log
33
.vscode/
44
.gitcredentials
5-
**/credentials/
5+
**/credentials/
6+
.DS_Store
7+
package-lock.json

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Thanks for being willing to contribute!
1010
4. Create a branch for your PR
1111
5. Try to include test cases for your code
1212

13+
## Edit Documentation
14+
1. Documentation is powered by [docsify]() to REAME.md file in docs folder.
15+
1316
## Commit and Push
1417

1518
Once you completed making the change, Please make sure to run the tests before you commit your changes. You can run

README.md

Lines changed: 6 additions & 313 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,9 @@ The intent is to simplify the request process by handling the tedious logic. It'
1111

1212
## 📒 Table of Contents
1313

14-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
15-
16-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
17-
18-
* [Installation](#installation)
14+
* [Installation](# installation)
1915
* [Usage](#usage)
20-
* [Examples](#examples)
21-
* [Getting Access Token](#getaccesstoken)
22-
* [Finding Api(findItemsByKeywords, findItemsByCategory, findCompletedItems, findItemsByProduct, findItemsAdvanced, getVersion)](#finding-api)
23-
* [Fetch Items By Keyword](#fetchitemsbykeyword)
24-
* [Get Items By Category](#getitemsbycategory)
25-
* [Get Single Item](#getitem)
26-
* [Get Item By Legacy Id](#getitembylegacyid)
27-
* [Get Items By Group Id](#getitemsbygroupid)
28-
* [Search Items by Keyword](#searchitemsbykeyword)
29-
* [Search Items with Free Shipping](#searchitemsbyfreeshipping)
30-
* [Search Items Based on Price and Condition](#searchitemsbyfilter)
31-
* [Taxonomy Api(getDefaultCategoryTreeId, getCategoryTree, getCategorySubtree, getCategorySuggestions)](#taxonomyapi)
32-
* [Get Most Watched item, Get Most Similar Items](#merchandisingapi)
33-
* [Get All Categories, GetUserDetails, GetShippingCost, GetItemStatus](#shoppingapi)
16+
* [Starter Guide](#starter-guide)
3417
* [Test](#test)
3518
* [Issues](#issues)
3619
* [Contribution](#contribution)
@@ -57,300 +40,10 @@ let ebay = new eBay({
5740
}
5841
})
5942
```
60-
Creates a new `Ebay` instance.
61-
62-
### Getting Client ID:
63-
64-
Join eBay developers program.
65-
Register your app here https://go.developer.ebay.com/quick-start-guide.
66-
67-
If you using Sandbox environment, make sure to provide `env` variable in options as mentioned above.
68-
69-
#### Options
70-
71-
- `clientID` - Required(`String`) - Client Id key provided when you register in eBay developers program.
72-
- `limit` - optional(`Number`) - fetch items functionality - Number that limits the number of data you need in response.
73-
- `details` - optional(`Boolean`) - Get User Details functionality - true, if you need details about the user.
74-
- `env` - optional(`String`) - Environment, default value is PRODUCTION.
75-
- `headers` - optional(`Object`) - Add custom request headers. For reference [Header Section](https://developer.ebay.com/api-docs/static/rest-request-components.html#HTTP)
76-
- `countryCode` - optional(`String`) - sets the GLOBAL-ID parameter which specifies the eBay site to use for searches. [Possible IDs](https://developer.ebay.com/DevZone/merchandising/docs/Concepts/SiteIDToGlobalID.html)
77-
78-
## Example
79-
80-
### GetAccessToken
81-
82-
```javascript
83-
const Ebay = require('ebay-node-api');
84-
85-
let ebay = new Ebay({
86-
clientID: '--Client Id----',
87-
clientSecret: '-- Client Secret --',
88-
body: {
89-
grant_type: 'client_credentials',
90-
//you may need to define the oauth scope
91-
scope: 'https://api.ebay.com/oauth/api_scope'
92-
}
93-
});
94-
ebay.getAccessToken().then((data) => {
95-
console.log(data); // data.access_token
96-
}, (error) => {
97-
console.log(error);
98-
});
99-
```
100-
101-
### Finding Api
102-
```javascript
103-
//This call searches for items on eBay using specific eBay category ID numbers
104-
ebay.findItemsByCategory(10181).then((data) => {
105-
console.log(data);
106-
}, (error) => {
107-
console.log(error);
108-
});
109-
110-
//This call searches for items on eBay by a keyword query (keywords).
111-
ebay.findItemsByKeywords('iphone').then((data) => {
112-
console.log(data);
113-
}, (error) => {
114-
console.log(error);
115-
});
116-
117-
118-
ebay.findItemsByKeywords({
119-
keywords: 'Garmin nuvi 1300 Automotive GPS Receiver',
120-
sortOrder: 'PricePlusShippingLowest', //https://developer.ebay.com/devzone/finding/callref/extra/fndcmpltditms.rqst.srtordr.html
121-
pageNumber: 2,
122-
limit: 10
123-
}).then((data) => {
124-
console.log(data);
125-
}, (error) => {
126-
console.log(error);
127-
});
128-
129-
// This call searches for items whose listings are completed and are no longer available for sale by category (using categoryId), by keywords (using keywords), or a combination of the two.
130-
ebay.findCompletedItems({
131-
keywords: 'Garmin nuvi 1300 Automotive GPS Receiver',
132-
categoryId: '156955',
133-
sortOrder: 'PricePlusShippingLowest', //https://developer.ebay.com/devzone/finding/callref/extra/fndcmpltditms.rqst.srtordr.html
134-
Condition: 3000,
135-
SoldItemsOnly: true,
136-
entriesPerPage: 2
137-
}).then((data) => {
138-
console.log(data);
139-
}, (error) => {
140-
console.log(error);
141-
});
142-
143-
// https://developer.ebay.com/DevZone/finding/CallRef/findItemsByProduct.html#findItemsByProduct
144-
ebay.findItemsByProduct({
145-
productId: 53039031
146-
}).then((data) => {
147-
console.log(data);
148-
}, (error) => {
149-
console.log(error);
150-
});
151-
152-
// https://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html
153-
ebay.findItemsAdvanced({
154-
entriesPerPage: 2,
155-
keywords: 'ipad',
156-
ExpeditedShippingType: 'OneDayShipping' //Filtering results with item filters see: https://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html#Request.itemFilter
157-
}).then((data) => {
158-
console.log(data);
159-
}, (error) => {
160-
console.log(error);
161-
});
162-
163-
ebay.getVersion().then((data) => {
164-
console.log(data.version);
165-
}, (error) => {
166-
console.log(error);
167-
});
168-
169-
```
170-
### GetItem
171-
```javascript
172-
// Get access token and pass it to this method
173-
ebay.getAccessToken()
174-
.then((data) => {
175-
ebay.getItem('v1|202117468662|0').then((data) => {
176-
console.log(data);
177-
// Data is in format of JSON
178-
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
179-
})
180-
});
181-
```
182-
183-
### GetItemByLegacyId
184-
```javascript
185-
ebay.getAccessToken()
186-
.then((data) => {
187-
ebay.getItemByLegacyId({
188-
'legacyItemId': 2628001 // Get Item Details Using a Legacy ID
189-
'legacyVariationSku': 'V-00031-WHM' // default null
190-
}).then((data) => {
191-
if (!data) console.log(data);
192-
// Data is in format of JSON
193-
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
194-
});
195-
});
196-
```
19743

44+
## Starter Guide
19845

199-
### GetItemsByGroupId
200-
```javascript
201-
ebay.getAccessToken()
202-
.then((data) => {
203-
ebay.getItemByItemGroup('151915076499').then((data) => {
204-
// Data is in format of JSON
205-
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
206-
console.log(data)
207-
}, (error) => {
208-
console.log(error);
209-
});
210-
});
211-
```
212-
213-
### SearchItemsByKeyword
214-
```javascript
215-
ebay.getAccessToken()
216-
.then((data) => {
217-
ebay.searchItems({
218-
keyword: 'drone',
219-
limit: '3'
220-
}).then((data) => {
221-
console.log(data);
222-
// Data is in format of JSON
223-
// To check the format of Data, Go to this url (https://developer.ebay.com/api- docs/buy/browse/resources/item_summary/methods/search#w4-w1-w4-SearchforItemsbyKeyword-0)
224-
})
225-
});
226-
```
227-
228-
### SearchItemsByFreeShipping
229-
```javascript
230-
ebay.getAccessToken()
231-
.then((data) => {
232-
ebay.searchItems({
233-
keyword: 'drone',
234-
limit: 3,
235-
// filter: { maxDeliveryCost: 0 } old object based filter method
236-
filter: 'maxDeliveryCost:0' // new string based filter method. Format here: https://developer.ebay.com/api-docs/buy/static/ref-buy-browse-filters.html#conditionIds
237-
}).then((data) => {
238-
console.log(data);
239-
// Data is in format of JSON
240-
// To check the format of Data, Go to this url https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search#w4-w1-w4-ReturnItemswithFreeShipping-6.
241-
})
242-
});
243-
```
244-
245-
### SearchItemsByFilter
246-
```javascript
247-
248-
ebay.getAccessToken()
249-
.then((data) => {
250-
ebay.searchItems({
251-
keyword: 'iphone',
252-
limit: 3,
253-
// filter: { price: '[300..800]', priceCurrency: 'USD', conditions: 'NEW' } old object based filter method
254-
filter: 'price:[300..800],priceCurrency:USD,conditions{NEW}' // new string based filter method. Format here: https://developer.ebay.com/api-docs/buy/static/ref-buy-browse-filters.html#conditionIds
255-
}).then((data) => {
256-
console.log(data);
257-
// Data is in format of JSON
258-
// To check the format of Data, Go to this url https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search#w4-w1-w4-ReturnItemsBasedonPriceandCondition-7.
259-
})
260-
});
261-
```
262-
263-
### MerchandisingApi
264-
```javascript
265-
266-
ebay.getMostWatchedItems({
267-
maxResults: 3, // optional
268-
categoryId: 267 // optional
269-
}).then((data) => {
270-
if (data.errorMessage) {
271-
console.log('Error:' + data.errorMessage);
272-
}
273-
console.log(JSON.stringify(data));
274-
});
275-
276-
277-
ebay.getSimilarItems({
278-
maxResults: 3, // optional
279-
itemId=280254552262 // optional
280-
}).then((data) => {
281-
if (data.errorMessage) {
282-
console.log('Error:' + data.errorMessage);
283-
}
284-
console.log(JSON.stringify(data));
285-
// JSON format of similar items.
286-
});
287-
```
288-
### TaxonomyApi
289-
290-
```javascript
291-
ebay.getAccessToken()
292-
.then((data) => {
293-
ebay.getDefaultCategoryTreeId('EBAY_US').then((data) => {
294-
console.log(data);
295-
// for EN_US { categoryTreeId: '0', categoryTreeVersion: '119' }
296-
});
297-
298-
ebay.getCategoryTree(0).then((data) => {
299-
console.log(data);
300-
// JSON format of complete category tree.
301-
});
302-
303-
ebay.getCategorySubtree(0, 11450).then((data) => {
304-
console.log(data);
305-
// JSON format of complete category sub tree.
306-
});
307-
308-
ebay.getCategorySuggestions(0, 'iphone').then((data) => {
309-
console.log(data);
310-
// JSON format of category suggestions.
311-
});
312-
313-
ebay.getItemAspectsForCategory(0, 67726).then((data) => {
314-
console.log(data);
315-
// JSON format of complete category sub tree.
316-
});
317-
});
318-
```
319-
### ShoppingApi
320-
```javascript
321-
322-
ebay.getAllCategories('1234').then((data) => {
323-
console.log(data); //extract data.CategoryArray
324-
}, (error) => {
325-
console.log(error);
326-
});
327-
328-
// Get User Profile
329-
//https://developer.ebay.com/devzone/shopping/docs/callref/GetUserProfile.html
330-
ebay.getUserDetails({ userId: 'ajaykumapratha_0', details: true }).then((data) => {
331-
console.log(data);
332-
}, (error) => {
333-
console.log(error);
334-
});
335-
336-
// Get Item Status
337-
//https://developer.ebay.com/devzone/shopping/docs/callref/GetItemStatus.html
338-
ebay.getItemStatus(['153265274986', '153265274986']).then((data) => {
339-
console.log(data);
340-
}, (error) => {
341-
console.log(error);
342-
});
343-
344-
//https://developer.ebay.com/devzone/shopping/docs/callref/GetShippingCosts.html
345-
ebay.getShippingCosts({
346-
itemId: '153265274986', destCountryCode: 'US',
347-
destPostalCode: '95128'
348-
}).then((data) => {
349-
console.log(data);
350-
}, (error) => {
351-
console.log(error);
352-
});
353-
```
46+
Check out the [Starter Guide](https://pajaydev.github.io/ebay-node-api) documentation with examples to get started.
35447

35548
## Test
35649
All test files are present inside test folder. You can run using
@@ -359,7 +52,7 @@ All test files are present inside test folder. You can run using
35952
npm run test
36053
```
36154
## Issues:
362-
If you are facing any issues, you can create the issues [here](https://github.com/pajaydev/ebay-node-api/issues).
55+
If you are facing any issues or missing something, you can create the issues [here](https://github.com/pajaydev/ebay-node-api/issues).
36356

36457
## 👍 Contribution:
36558
Show your ❤️ and support by giving a ⭐. Willing to share your idea or ready to contribute, check [here](https://github.com/pajaydev/ebay-node-api/blob/master/CONTRIBUTING.md)
@@ -368,5 +61,5 @@ Show your ❤️ and support by giving a ⭐. Willing to share your idea or read
36861
MIT.
36962

37063
## Examples:
371-
I have mentioned the examples here
64+
I have provided the examples here
37265
https://github.com/pajaydev/ebay-node-api/tree/master/demo.

docs/.nojekyll

Whitespace-only changes.

0 commit comments

Comments
 (0)