mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-01-30 19:00:28 +08:00
86e87e88ed
# Conflicts: # components/confirmations.js # components/inventoryhistory.js # components/twofactor.js # components/users.js # components/webapi.js # index.js # package.json
38 lines
1.1 KiB
JavaScript
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);
|
|
};
|