2016-09-09 07:23:15 +08:00
|
|
|
var SteamCommunity = require('../index.js');
|
|
|
|
|
2015-12-03 10:31:17 +08:00
|
|
|
module.exports = CConfirmation;
|
|
|
|
|
|
|
|
function CConfirmation(community, data) {
|
2016-07-14 01:11:56 +08:00
|
|
|
Object.defineProperty(this, "_community", {"value": community});
|
2015-12-03 10:31:17 +08:00
|
|
|
|
2019-02-07 08:36:01 +08:00
|
|
|
this.id = data.id.toString();
|
2016-09-09 07:23:15 +08:00
|
|
|
this.type = data.type;
|
2019-02-07 08:36:01 +08:00
|
|
|
this.creator = data.creator.toString();
|
2015-12-03 10:31:17 +08:00
|
|
|
this.key = data.key;
|
|
|
|
this.title = data.title;
|
|
|
|
this.receiving = data.receiving;
|
|
|
|
this.time = data.time;
|
|
|
|
this.icon = data.icon;
|
2016-09-09 07:23:15 +08:00
|
|
|
this.offerID = this.type == SteamCommunity.ConfirmationType.Trade ? this.creator : null;
|
2015-12-03 10:31:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CConfirmation.prototype.getOfferID = function(time, key, callback) {
|
2016-09-09 07:23:15 +08:00
|
|
|
if (this.type && this.creator) {
|
|
|
|
if (this.type != SteamCommunity.ConfirmationType.Trade) {
|
|
|
|
callback(new Error("Not a trade confirmation"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
callback(null, this.creator);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-12-03 10:31:17 +08:00
|
|
|
this._community.getConfirmationOfferID(this.id, time, key, callback);
|
|
|
|
};
|
|
|
|
|
|
|
|
CConfirmation.prototype.respond = function(time, key, accept, callback) {
|
|
|
|
this._community.respondToConfirmation(this.id, this.key, time, key, accept, callback);
|
|
|
|
};
|