Skip to content

Commit f41db9f

Browse files
committed
final changes
1 parent 246e491 commit f41db9f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

demo/browseApi.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const Ebay = require('../src/index');
22
let access_token = "";
33
let 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+

src/buy-api.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
let { getRequest, makeRequest, base64Encode } = require('./request');
2+
13
const 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

4849
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");
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 + "&" : '';

0 commit comments

Comments
 (0)