node-steamcommunity/classes/CConfirmation.js
Alex Corn 86e87e88ed
Merge branch 'master' into v4
# Conflicts:
#	components/confirmations.js
#	components/inventoryhistory.js
#	components/twofactor.js
#	components/users.js
#	components/webapi.js
#	index.js
#	package.json
2023-06-27 01:19:00 -04:00

38 lines
1.1 KiB
JavaScript

const SteamCommunity = require('../index.js');
module.exports = CConfirmation;
function CConfirmation(community, data) {
Object.defineProperty(this, '_community', {value: community});
this.id = data.id.toString();
this.type = data.type;
this.creator = data.creator.toString();
this.key = data.key;
this.title = data.title;
this.receiving = data.receiving;
this.sending = data.sending;
this.time = data.time;
this.timestamp = data.timestamp;
this.icon = data.icon;
this.offerID = this.type == SteamCommunity.ConfirmationType.Trade ? this.creator : null;
}
CConfirmation.prototype.getOfferID = function(time, key, callback) {
if (this.type && this.creator) {
if (this.type != SteamCommunity.ConfirmationType.Trade) {
callback(new Error('Not a trade confirmation'));
return;
}
callback(null, this.creator);
return;
}
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);
};