public DiscogsUserListDetail Get(int id)
        {
            var request = new RestRequest();

            request.Resource = _resource;
            request.AddUrlSegment("listId", id);

            IRestResponse response = _restClient.Execute(request);

            JsonDeserializer deserializer = new JsonDeserializer();
            var listDetail = deserializer.Deserialize <DiscogsUserListDetail>(response);

            return(listDetail);
        }
Esempio n. 2
0
        public IEnumerable <List> GetUserLists()
        {
            List <List> userLists = new List <List>();

            IRestRequest request = new RestRequest();

            request.Resource = _resource;
            request.AddUrlSegment("username", _defaultDiscogsUser);

            IRestResponse response = _restClient.Execute(request);

            JsonDeserializer deserializer = new JsonDeserializer();
            var rootUserLists             = deserializer.Deserialize <DiscogsUserLists>(response);

            userLists.AddRange(rootUserLists.Lists);

            bool more = NextPage(rootUserLists);

            while (more == true)
            {
                Uri nextPageUri = new Uri(rootUserLists.Pagination.Urls.Next);

                _restClient.BaseUrl = nextPageUri;

                request = new RestRequest();

                response = _restClient.Execute(request);

                rootUserLists = deserializer.Deserialize <DiscogsUserLists>(response);

                userLists.AddRange(rootUserLists.Lists);

                more = NextPage(rootUserLists);
            }

            return(userLists);
        }