File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ ebay.getAccessToken().then((data) => {
99
99
100
100
### Finding Api
101
101
``` javascript
102
- // This call searches for items on eBay using specific eBay category ID numbers
102
+ // This call searches for items on eBay using specific eBay category ID numbers
103
103
ebay .findItemsByCategory (10181 ).then ((data ) => {
104
104
console .log (data);
105
105
}, (error ) => {
@@ -113,6 +113,18 @@ ebay.findItemsByKeywords('iphone').then((data) => {
113
113
console .log (error);
114
114
});
115
115
116
+
117
+ ebay .findItemsByKeywords ({
118
+ keywords: ' Garmin nuvi 1300 Automotive GPS Receiver' ,
119
+ sortOrder: ' PricePlusShippingLowest' , // https://developer.ebay.com/devzone/finding/callref/extra/fndcmpltditms.rqst.srtordr.html
120
+ pageNumber: 2 ,
121
+ limit: 10
122
+ }).then ((data ) => {
123
+ console .log (data);
124
+ }, (error ) => {
125
+ console .log (error);
126
+ });
127
+
116
128
// 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.
117
129
ebay .findCompletedItems ({
118
130
keywords: ' Garmin nuvi 1300 Automotive GPS Receiver' ,
@@ -292,7 +304,7 @@ ebay.getAllCategories('1234').then((data) => {
292
304
console .log (error);
293
305
});
294
306
295
- // Get User Profile
307
+ // Get User Profile
296
308
// https://developer.ebay.com/devzone/shopping/docs/callref/GetUserProfile.html
297
309
ebay .getUserDetails ({ userId: ' ajaykumapratha_0' , details: true }).then ((data ) => {
298
310
console .log (data);
Original file line number Diff line number Diff line change 3
3
const urlObject = require ( './buildURL' ) ;
4
4
const { getRequest } = require ( './request' ) ;
5
5
6
- const findItemsByKeywords = function ( keyword ) {
7
- if ( ! keyword ) throw new Error ( 'Keyword is missing, Keyword is required' ) ;
8
- this . options . name = keyword ;
6
+ const findItemsByKeywords = function ( options ) {
7
+ if ( ! options || ! options . keywords ) {
8
+ throw new Error ( 'Keyword is missing, Keyword is required' ) ;
9
+ }
10
+
9
11
this . options . operationName = 'findItemsByKeywords' ;
10
12
this . options . param = 'keywords' ;
13
+
14
+ if ( ! options . keywords ) {
15
+ this . options . name = options ;
16
+ }
17
+ else {
18
+ this . options . name = encodeURIComponent ( options . keywords ) ;
19
+ this . options . sortOrder = options . sortOrder ;
20
+ this . options . pageNumber = options . pageNumber ;
21
+ this . options . limit = options . limit ;
22
+ }
23
+
11
24
const url = urlObject . buildSearchUrl ( this . options ) ;
12
25
return getRequest ( url ) . then ( ( data ) => {
13
26
return JSON . parse ( data ) . findItemsByKeywordsResponse ;
You can’t perform that action at this time.
0 commit comments