Beispiel #1
0
        public async Task <DiscogsAlbum> GetMasterAlbumById(string id)
        {
            string args = $"/masters/{id}?{_credentials}";

            var jsonSource = await GetRequestJson(args);

            try
            {
                JObject      json  = JObject.Parse(jsonSource);
                DiscogsAlbum album = DiscogsAlbum.ParseAlbum(json);
                return(album);
            }
            catch (JsonReaderException jException)
            {
                throw new Exception(jsonSource, jException);
            }
            catch (Exception ex)
            {
                throw new Exception("A error as occur", ex);
            }
        }
Beispiel #2
0
        public async Task <DiscogsAlbum> GetReleaseAlbumById(string id)
        {
            string args = string.Format("/releases/{0}?{1}", id, _credentials);
            Uri    url  = new Uri(Domain + args);


            HttpClient webClient  = CreateDiscogsClient();
            string     jsonSource = await webClient.GetStringAsync(url);

            try
            {
                JObject      json  = JObject.Parse(jsonSource);
                DiscogsAlbum album = DiscogsAlbum.ParseAlbum(json);
                return(album);
            }
            catch (JsonReaderException jException)
            {
                throw new Exception(jsonSource, jException);
            }
            catch (Exception ex)
            {
                throw new Exception("A error as occur", ex);
            }
        }