示例#1
0
        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");
            }
        }
示例#2
0
        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());
        }
示例#3
0
        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());
        }