File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const Ebay = require ( '../src/index' ) ;
22let access_token = "" ;
33let ebay = new Ebay ( {
4- clientID : "--- Client Id- -----" ,
5- clientSecret : '-- Client Secret---- ' ,
4+ clientID : "-- Client ID -----" ,
5+ clientSecret : '-- Client Secret---' ,
66 body : {
77 grant_type : "client_credentials" ,
8- scope : 'PRD-f1a91299c206-f184-45e0-b068-f139 '
8+ scope : 'https://api.ebay.com/oauth/api_scope '
99
1010 }
1111} ) ;
@@ -62,3 +62,5 @@ ebay.getAccessToken()
6262 } ) ;
6363
6464
65+
66+
Original file line number Diff line number Diff line change 1+ let { getRequest, makeRequest, base64Encode } = require ( './request' ) ;
2+
13const getItem = function ( itemId ) {
2- // console.log(this.options);
34 if ( ! itemId ) throw new Error ( "Item Id is required" ) ;
45 if ( ! this . options . access_token ) throw new Error ( "Missing Access token, Generate access token" ) ;
56 const auth = "Bearer " + this . options . access_token ;
@@ -46,9 +47,10 @@ const getItemByItemGroup = function (itemGroupId) {
4647} ;
4748
4849const 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" ) ;
5254 const auth = "Bearer " + this . options . access_token ;
5355 let queryParam = searchConfig . keyword ? "q=" + searchConfig . keyword + "&" : "" ;
5456 queryParam = queryParam + searchConfig . categoryId ? "category_ids=" + searchConfig . categoryId + "&" : '' ;
You can’t perform that action at this time.
0 commit comments