public static string ToApiValue(this HotItemType type) { switch (type) { case HotItemType.BoardGame: return("boardgame"); case HotItemType.Rpg: return("rpg"); case HotItemType.Videogame: return("videogame"); case HotItemType.BoardGamePerson: return("boardgameperson"); case HotItemType.RpgPerson: return("rpgperson"); case HotItemType.BoardGameCompany: return("boardgamecompany"); case HotItemType.RpgCompany: return("rpgcompany"); case HotItemType.VideogameCompany: return("videogamecompany"); default: throw new ArgumentOutOfRangeException("type"); } }
public async Task <List <HotItem> > Get(HotItemType type) { var result = await ApiConnection.Get <HotItemsResponse>(ApiUrls.HotItems, new Dictionary <string, string> { { "type", type.ToApiValue() } }).ConfigureAwait(false); return(result.ToModel()); }
public async Task <HotItemResult> GetHotItemsAsync(HotItemType type) { string uri = $"{EndpointsV2.HOT_ITEMS_URI}?type={type}"; HttpResponseMessage resp = await xmlRestClient.GetAsync(uri); if (!resp.IsSuccessStatusCode) { return(new HotItemResult { StatusCode = (int)resp.StatusCode }); } _ItemsResult result = await resp.Content.DeserializeXml <_ItemsResult>(); return(result.ConvertToHotItemResult()); }