Skip to content

Commit 8671257

Browse files
committed
added getuserdetails method
1 parent f2f6f99 commit 8671257

7 files changed

Lines changed: 34 additions & 7 deletions

File tree

demo/fetchItemsByCategory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Ebay = require('../src/index');
22

33
let ebay = new Ebay({
4-
clientID: "Ajaykuma-nodeapi-PRD-bf1a91299-ed4deb45",
4+
clientID: "-- Client APP ID ----",
55
limit: 6
66
});
77
ebay.findItemsByCategory(10181).then((data) => {

demo/fetchItemsByKeyword.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Ebay = require('../src/index');
22

33
let ebay = new Ebay({
4-
clientID: "Ajaykuma-nodeapi-PRD-bf1a91299-ed4deb45",
4+
clientID: "-- Client APP ID ----",
55
limit: 6
66
});
77
ebay.findItemsByKeywords("iphone").then((data) => {

demo/getAllCategories.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const Ebay = require('../src/index');
22

33
let ebay = new Ebay({
4-
clientID: "Ajaykuma-nodeapi-PRD-bf1a91299-ed4deb45"
4+
clientID: "-- Client App id ----",
5+
details: "childCategories" //optional parameter
56
});
67

78
ebay.getAllCategories().then((data) => {

demo/getUserDetails.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Ebay = require('../src/index');
2+
3+
let ebay = new Ebay({
4+
clientID: "-- Client App ID ----",
5+
details: true // To require detailed info or put false
6+
});
7+
ebay.getUserDetails("ajaykumapratha_0").then((data) => {
8+
console.log(data);
9+
}, (error) => {
10+
console.log(error);
11+
});

demo/getVersion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Ebay = require('../src/index');
22

33
let ebay = new Ebay({
4-
clientID: "Ajaykuma-nodeapi-PRD-bf1a91299-ed4deb45",
4+
clientID: "-- Client APP ID ----",
55
limit: 6
66
});
77
ebay.getVersion().then((data) => {

src/buildURL.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ const buildURL = {
3636
base_url += "appid=" + options.clientID;
3737
base_url += "&callname=" + options.operationName;
3838
base_url += "&version=967&siteid=0&responseencoding=JSON&";
39-
base_url += options.param + "=" + options.name + "&IncludeSelector=ChildCategories";
39+
base_url += options.param + "=" + options.name;
40+
base_url += options.includeSelector ? "&IncludeSelector=" + options.includeSelector : '';
4041
//base_url += "&GLOBAL-ID=" + oglobalID;
4142
return base_url;
4243
},

src/index.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,30 @@ Ebay.prototype = {
6363
},
6464

6565
getVersion: function () {
66-
//this.options.name = categoryID ? categoryID : -1;
6766
this.options.operationName = "getVersion";
68-
//this.options.param = "CategoryID";
6967
let url = urlObject.buildSearchUrl(this.options);
7068
return makeRequest(url).then((data) => {
7169
let result = JSON.parse(data);
7270
return result["getVersionResponse"][0];
7371
}, (error) => {
7472
console.log(error);
7573
})
74+
},
75+
76+
getUserDetails: function (userID) {
77+
this.options.operationName = "GetUserProfile";
78+
this.options.param = "UserID";
79+
this.options.name = userID;
80+
this.options.includeSelector = this.options.details ? "Details" : null;
81+
let url = urlObject.buildShoppingUrl(this.options);
82+
console.log(url);
83+
return makeRequest(url).then((data) => {
84+
let result = JSON.parse(data);
85+
console.log(result);
86+
return result;
87+
}, (error) => {
88+
console.log(error);
89+
})
7690
}
7791

7892
};

0 commit comments

Comments
 (0)