@nodeswork/applet
Version:
Nodeswork Applet Framework
166 lines (164 loc) • 5.26 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("underscore");
const account_1 = require("../account");
const base_accounts_1 = require("./base-accounts");
const services_1 = require("../services");
let FifaFut18Account = class FifaFut18Account extends base_accounts_1.BaseAccount {
constructor($request) {
super($request);
this.$request = $request;
}
async getUserMassInfo() {
return await this.$operate({
name: 'getUserMassInfo',
ref: 'ut/game/fifa18/usermassinfo',
method: 'GET',
});
}
async getTradePile() {
return await this.$operate({
name: 'getTradePile',
ref: 'ut/game/fifa18/tradepile',
method: 'GET',
});
}
async searchMarket(options) {
const query = _.mapObject(options, (val) => val.toString());
return await this.$operate({
name: 'searchMarket',
ref: 'ut/game/fifa18/transfermarket',
method: 'GET',
query,
});
}
async bid(tradeId, price) {
const url = `ut/game/fifa18/trade/${tradeId}/bid`;
return await this.$operate({
name: 'bid',
ref: url,
method: 'PUT',
body: {
bid: price,
},
});
}
async tradeStatus(tradeIds) {
return await this.$operate({
name: 'tradeStatus',
ref: 'ut/game/fifa18/trade/status',
method: 'GET',
query: {
tradeIds: tradeIds.join(','),
},
});
}
async getWatchList() {
return await this.$operate({
name: 'getWatchList',
ref: 'ut/game/fifa18/watchlist',
method: 'GET',
});
}
async deleteWatchlist(tradeIds) {
return await this.$operate({
name: 'deleteWatchlist',
ref: `ut/game/fifa18/watchlist?tradeId=${tradeIds.join(',')}`,
method: 'DELETE',
});
}
async sendToMyClub(itemIds) {
const itemData = _.map(itemIds, (itemId) => {
return {
id: itemId,
pile: 'club',
};
});
return await this.$operate({
name: 'sendToMyClub',
ref: 'ut/game/fifa18/item',
method: 'PUT',
body: {
itemData,
},
});
}
async getClubDevelopmentConsumables() {
return await this.$operate({
name: 'getClubDevelopmentConsumables',
ref: 'ut/game/fifa18/club/consumables/development',
method: 'GET',
});
}
async sendResourceToTransferList(resourceIds) {
const itemData = _.map(resourceIds, (resourceId) => {
return {
id: resourceId,
pile: 'trade',
};
});
return await this.$operate({
name: 'sendResourceToTransferList',
ref: 'ut/game/fifa18/item/resource',
method: 'PUT',
body: {
itemData,
},
});
}
async list(options) {
const body = {
buyNowPrice: options.buyNowPrice,
duration: options.duration,
startingBid: options.startingBid,
itemData: {
id: options.itemId,
},
};
return await this.$operate({
name: 'list',
ref: 'ut/game/fifa18/auctionhouse',
method: 'POST',
body,
});
}
async getItems() {
return await this.$operate({
name: 'getItems',
ref: 'ut/game/fifa18/purchased/items',
method: 'GET',
});
}
async deleteSold() {
await this.$operate({
name: 'deleteSold',
ref: 'ut/game/fifa18/trade/sold',
method: 'DELETE',
});
}
async relist() {
return await this.$operate({
name: 'relist',
ref: 'ut/game/fifa18/auctionhouse/relist',
method: 'PUT',
});
}
};
FifaFut18Account = __decorate([
account_1.Account({
accountType: 'FifaFut18Account',
provider: 'fifa-fut-18',
}),
__metadata("design:paramtypes", [services_1.RequestService])
], FifaFut18Account);
exports.FifaFut18Account = FifaFut18Account;
//# sourceMappingURL=fifa-fut-18-accounts.js.map