File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
const Ebay = require ( '../src/index' ) ;
2
2
let access_token = "" ;
3
3
let ebay = new Ebay ( {
4
- clientID : "--- Client Id- -----" ,
5
- clientSecret : '-- Client Secret---- ' ,
4
+ clientID : "-- Client ID -----" ,
5
+ clientSecret : '-- Client Secret---' ,
6
6
body : {
7
7
grant_type : "client_credentials" ,
8
- scope : 'PRD-f1a91299c206-f184-45e0-b068-f139 '
8
+ scope : 'https://api.ebay.com/oauth/api_scope '
9
9
10
10
}
11
11
} ) ;
@@ -62,3 +62,5 @@ ebay.getAccessToken()
62
62
} ) ;
63
63
64
64
65
+
66
+
Original file line number Diff line number Diff line change
1
+ let { getRequest, makeRequest, base64Encode } = require ( './request' ) ;
2
+
1
3
const getItem = function ( itemId ) {
2
- // console.log(this.options);
3
4
if ( ! itemId ) throw new Error ( "Item Id is required" ) ;
4
5
if ( ! this . options . access_token ) throw new Error ( "Missing Access token, Generate access token" ) ;
5
6
const auth = "Bearer " + this . options . access_token ;
@@ -46,9 +47,10 @@ const getItemByItemGroup = function (itemGroupId) {
46
47
} ;
47
48
48
49
const searchItems = function ( searchConfig ) {
49
- if ( ! searchConfig ) throw new Error ( "Missing or invalid input parameter to search" ) ;
50
- if ( ! searchConfig . keyword || ! searchConfig . categoryId ) throw new Error ( "Error Keyword or category id is required in query param" ) ;
51
- if ( ! this . options . access_token ) throw new Error ( "Missing Access token, Generate access token" ) ;
50
+ if ( ! searchConfig ) throw new Error ( "Error --> Missing or invalid input parameter to search" ) ;
51
+ if ( ! searchConfig . keyword || ! searchConfig . categoryId ) throw new Error ( "Error --> Keyword or category id is required in query param" ) ;
52
+ if ( ! this . options . access_token ) throw new Error ( "Error -->Missing Access token, Generate access token" ) ;
53
+ if ( searchConfig . fieldgroups . length > 0 && ! Array . isArray ( searchConfig . fieldgroups ) ) throw new Error ( "Error -->Field groups should be an array" ) ;
52
54
const auth = "Bearer " + this . options . access_token ;
53
55
let queryParam = searchConfig . keyword ? "q=" + searchConfig . keyword + "&" : "" ;
54
56
queryParam = queryParam + searchConfig . categoryId ? "category_ids=" + searchConfig . categoryId + "&" : '' ;
You can’t perform that action at this time.
0 commit comments