public AuctionDetails(long itemDataId, AuctionDuration auctionDuration = AuctionDuration.OneHour, uint startingBid = 150, uint buyNowPrice = 0) { if (itemDataId < 1) throw new ArgumentException("Invalid itemDataId", "itemDataId"); if (startingBid < 150) throw new ArgumentException("startingBid", "Starting bid can't be less than 150"); if (buyNowPrice != 0 && buyNowPrice < startingBid) throw new ArgumentException("Buy now price can't be lower than starting bid", "buyNowPrice"); ItemDataId = itemDataId; AuctionDuration = auctionDuration; StartingBid = startingBid; BuyNowPrice = buyNowPrice; }
public async Task<ListAuctionResponse> ListAuctionAsync(long id, uint buyNowPrice = 0, AuctionDuration duration = AuctionDuration.OneHour, uint startingBid = 150) { if (id < 1) throw new ArgumentException("Invalid id", "id"); if (buyNowPrice != 0 && buyNowPrice < startingBid) throw new ArgumentException("Buy now price can't be lower than starting bid", "buyNowPrice"); if (startingBid < 150) throw new ArgumentOutOfRangeException("startingBid", "Starting bid can't be less than 150"); // TODO: Validate starting bid var content = string.Format("{{\"itemData\":{{\"id\":{0}}},\"buyNowPrice\":{1},\"duration\":{2},\"startingBid\":{3}}}", id, buyNowPrice, (uint)duration, startingBid); var response = await Client.SendAsync(CreateRequestMessage(content, Resources.FutHostName + Resources.AuctionHouse, HttpMethod.Post)); response.EnsureSuccessStatusCode(); return await Deserialize<ListAuctionResponse>(response); }
public AuctionDetails(long itemDataId, AuctionDuration auctionDuration = AuctionDuration.OneHour, uint startingBid = 150, uint buyNowPrice = 0) { if (itemDataId < 1) { throw new ArgumentException("Invalid itemDataId", "itemDataId"); } if (startingBid < 150) { throw new ArgumentException("startingBid", "Starting bid can't be less than 150"); } if (buyNowPrice != 0 && buyNowPrice < startingBid) { throw new ArgumentException("Buy now price can't be lower than starting bid", "buyNowPrice"); } ItemDataId = itemDataId; AuctionDuration = auctionDuration; StartingBid = startingBid; BuyNowPrice = buyNowPrice; }
public async Task <ListAuctionResponse> ListAuctionAsync(long id, uint buyNowPrice = 0, AuctionDuration duration = AuctionDuration.OneHour, uint startingBid = 150) { if (id < 1) { throw new ArgumentException("Invalid id", "id"); } if (buyNowPrice != 0 && buyNowPrice < startingBid) { throw new ArgumentException("Buy now price can't be lower than starting bid", "buyNowPrice"); } if (startingBid < 150) { throw new ArgumentOutOfRangeException("startingBid", "Starting bid can't be less than 150"); } // TODO: Validate starting bid var content = string.Format("{{\"itemData\":{{\"id\":{0}}},\"buyNowPrice\":{1},\"duration\":{2},\"startingBid\":{3}}}", id, buyNowPrice, (uint)duration, startingBid); var response = await Client.SendAsync(CreateRequestMessage(content, Resources.FutHostName + Resources.AuctionHouse, HttpMethod.Post)); response.EnsureSuccessStatusCode(); return(await Deserialize <ListAuctionResponse>(response)); }