├── DiscogsClient
├── Data
│ ├── Result
│ │ ├── DiscogsSortOrder.cs
│ │ ├── DiscogsImageType.cs
│ │ ├── DiscogsEntity.cs
│ │ ├── DiscogsTrack.cs
│ │ ├── DiscogsArtistSortType.cs
│ │ ├── DiscogsRating.cs
│ │ ├── DiscogsUser.cs
│ │ ├── DiscogsCommunityInfo.cs
│ │ ├── DiscogsSublabel.cs
│ │ ├── DiscogsCommunityReleaseRating.cs
│ │ ├── DiscogsIdentifier.cs
│ │ ├── DiscogsReleaseRating.cs
│ │ ├── DiscogsGroupOrBandMember.cs
│ │ ├── DiscogsPaginableResults.cs
│ │ ├── DiscogsIdentity.cs
│ │ ├── DiscogsFormat.cs
│ │ ├── DiscogsPaginedUrls.cs
│ │ ├── DiscogsVideo.cs
│ │ ├── DiscogsPaginedResult.cs
│ │ ├── DiscogsLabelReleases.cs
│ │ ├── DiscogsSearchResults.cs
│ │ ├── DiscogsArtistReleases.cs
│ │ ├── DiscogsReleaseVersions.cs
│ │ ├── DiscogsReleaseLabel.cs
│ │ ├── DiscogsCommunity.cs
│ │ ├── DiscogsReleaseArtist.cs
│ │ ├── DiscogsLabelRelease.cs
│ │ ├── DiscogsMaster.cs
│ │ ├── DiscogsImage.cs
│ │ ├── DiscogsSubtrack.cs
│ │ ├── DiscogsArtistRelease.cs
│ │ ├── DiscogsLabel.cs
│ │ ├── DiscogsReleaseBase.cs
│ │ ├── DiscogsReleaseVersion.cs
│ │ ├── DiscogsArtist.cs
│ │ ├── DiscogsSearchResult.cs
│ │ └── DiscogsRelease.cs
│ └── Query
│ │ ├── DiscogsImageType.cs
│ │ ├── DiscogsEntityType.cs
│ │ ├── DiscogsPaginable.cs
│ │ ├── DiscogsSortInformation.cs
│ │ └── DiscogsSearch.cs
├── DiscogsException.cs
├── Internal
│ ├── TokenAuthenticationInformation.cs
│ ├── IDiscogsWebClient.cs
│ └── DiscogsWebClient.cs
├── DiscogsAuthentifierClient.cs
├── IDiscogsUserIdentityClient.cs
├── DiscogsClient.csproj
├── IDiscogsReleaseRatingClient.cs
├── DiscogsClient.cs
└── IDiscogsDataBaseClient.cs
├── DiscogsAuthenticationConsole
├── App.config
├── packages.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── DiscogsAuthenticationConsole.csproj
├── LICENSE
├── DiscogsClient.Test
├── DiscogsClient.Test.csproj
├── DiscogsArtistDeserializationTest.cs
├── TrackDeserializationTest.cs
├── ImageDeserializationTest.cs
├── MasterDeserializationTest.cs
├── VersionDeserializationTest.cs
├── DiscogsClientTest.cs
├── ResultDeserializationTest.cs
└── ReleaseDeserializationTest.cs
├── DiscogsClient.sln
├── .gitattributes
├── .gitignore
└── README.md
/DiscogsClient/Data/Result/DiscogsSortOrder.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public enum DiscogsSortOrderType
4 | {
5 | asc,
6 | desc
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsImageType.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public enum DiscogsImageType
4 | {
5 | secondary,
6 | primary
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Query/DiscogsImageType.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Query
2 | {
3 | public enum DiscogsImageFormatType
4 | {
5 | Normal,
6 | Thumbnail
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsEntity.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public abstract class DiscogsEntity
4 | {
5 | public int id { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsTrack.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsTrack : DiscogsSubtrack
4 | {
5 | public DiscogsSubtrack[] sub_tracks { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsArtistSortType.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public enum DiscogsArtistSortType
4 | {
5 | year,
6 | title,
7 | format
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsRating.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsRating
4 | {
5 | public decimal average { get; set; }
6 | public int count { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/DiscogsAuthenticationConsole/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsUser.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsUser
4 | {
5 | public string resource_url { get; set; }
6 | public string username { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Query/DiscogsEntityType.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Query
2 | {
3 | public enum DiscogsEntityType
4 | {
5 | release,
6 | master,
7 | artist,
8 | label
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsCommunityInfo.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsCommunityInfo
4 | {
5 | public int want { get; set; }
6 | public int have { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsSublabel.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsSimplifiedLabel : DiscogsEntity
4 | {
5 | public string resource_url { get; set; }
6 | public string name { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsCommunityReleaseRating.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsCommunityReleaseRating
4 | {
5 | public DiscogsRating rating { get; set; }
6 |
7 | public int release_id { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsIdentifier.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsIdentifier
4 | {
5 | public string type { get; set; }
6 | public string value { get; set; }
7 | public string description { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsReleaseRating.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsReleaseRating
4 | {
5 | public string username { get; set; }
6 | public int release_id { get; set; }
7 | public int rating { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/DiscogsClient/DiscogsException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DiscogsClient
4 | {
5 | public class DiscogsException : Exception
6 | {
7 | public DiscogsException(string message, Exception innerException): base(message, innerException)
8 | {
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsGroupOrBandMember.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsGroupOrBandMember : DiscogsEntity
4 | {
5 | public bool active { get; set; }
6 | public string name { get; set; }
7 | public string resource_url { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsPaginableResults.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public abstract class DiscogsPaginableResults where T: DiscogsEntity
4 | {
5 | public DiscogsPaginedResult pagination { get; set; }
6 |
7 | public abstract T[] GetResults();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsIdentity.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsIdentity : DiscogsEntity
4 | {
5 | public string username { get; set; }
6 | public string resource_url { get; set; }
7 | public string consumer_name { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsFormat.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsFormat
4 | {
5 | public string[] descriptions { get; set; }
6 | public string name { get; set; }
7 | public string qty { get; set; }
8 | public string text { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsPaginedUrls.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsPaginedUrls
4 | {
5 | public string first { get; set; }
6 | public string last { get; set; }
7 | public string prev { get; set; }
8 | public string next { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsVideo.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsVideo
4 | {
5 | public string description { get; set; }
6 | public int duration { get; set; }
7 | public bool embed { get; set; }
8 | public string title { get; set; }
9 | public string uri { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsPaginedResult.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsPaginedResult
4 | {
5 | public int per_page { get; set; }
6 | public int pages { get; set; }
7 | public int page { get; set; }
8 | public int items { get; set; }
9 | public DiscogsPaginedUrls urls { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsLabelReleases.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public sealed class DiscogsLabelReleases: DiscogsPaginableResults
4 | {
5 | public DiscogsLabelRelease[] releases { get; set; }
6 |
7 | public override DiscogsLabelRelease[] GetResults()
8 | {
9 | return releases;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsSearchResults.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public sealed class DiscogsSearchResults : DiscogsPaginableResults
4 | {
5 | public DiscogsSearchResult[] results { get; set; }
6 |
7 | public override DiscogsSearchResult[] GetResults()
8 | {
9 | return results;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/DiscogsAuthenticationConsole/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsArtistReleases.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public sealed class DiscogsArtistReleases : DiscogsPaginableResults
4 | {
5 | public DiscogsArtistRelease[] releases { get; set; }
6 |
7 | public override DiscogsArtistRelease[] GetResults()
8 | {
9 | return releases;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsReleaseVersions.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public sealed class DiscogsReleaseVersions : DiscogsPaginableResults
4 | {
5 | public DiscogsReleaseVersion[] versions { get; set; }
6 |
7 | public override DiscogsReleaseVersion[] GetResults()
8 | {
9 | return versions;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsReleaseLabel.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsReleaseLabel : DiscogsEntity
4 | {
5 | public string catno { get; set; }
6 | public string entity_type { get; set; }
7 | public string entity_type_name { get; set; }
8 | public string name { get; set; }
9 | public string resource_url { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsCommunity.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsCommunity : DiscogsCommunityInfo
4 | {
5 | public DiscogsUser[] contributors { get; set; }
6 | public string data_quality { get; set; }
7 | public DiscogsRating rating { get; set; }
8 | public string status { get; set; }
9 | public DiscogsUser submitter { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsReleaseArtist.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsReleaseArtist : DiscogsEntity
4 | {
5 | public string name { get; set; }
6 | public string anv { get; set; }
7 | public string join { get; set; }
8 | public string resource_url { get; set; }
9 | public string role { get; set; }
10 | public string tracks { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Query/DiscogsPaginable.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Query
2 | {
3 | public class DiscogsPaginable
4 | {
5 | ///
6 | /// number(optional) Example: 3
7 | /// The page you want to request
8 | ///
9 | public int? page { get; set; }
10 |
11 | ///
12 | /// number(optional) Example: 25
13 | /// The number of item per page
14 | ///
15 | public int? per_page { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsLabelRelease.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsLabelRelease : DiscogsEntity
4 | {
5 | public string artist { get; set; }
6 | public string catno { get; set; }
7 | public string format { get; set; }
8 | public string resource_url { get; set; }
9 | public string status { get; set; }
10 | public string thumb { get; set; }
11 | public string title { get; set; }
12 | public int year { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsMaster.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsMaster : DiscogsReleaseBase
4 | {
5 | public int main_release { get; set; }
6 | public string main_release_url { get; set; }
7 | public int most_recent_release { get; set; }
8 | public string most_recent_release_url { get; set; }
9 | public int num_for_sale { get; set; }
10 | public decimal lowest_price { get; set; }
11 | public string versions_url { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Query/DiscogsSortInformation.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 |
3 | namespace DiscogsClient.Data.Query
4 | {
5 | public class DiscogsSortInformation
6 | {
7 | ///
8 | /// Sort items by this field
9 | ///
10 | public DiscogsArtistSortType sort { get; set; }
11 |
12 | ///
13 | /// Sort items in a particular order (one of asc, desc)
14 | ///
15 | public DiscogsSortOrderType sort_order { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsImage.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 |
4 | namespace DiscogsClient.Data.Result
5 | {
6 | public class DiscogsImage
7 | {
8 | public string uri { get; set; }
9 | public string resource_url { get; set; }
10 | public string uri150 { get; set; }
11 | [JsonConverter(typeof(StringEnumConverter))]
12 | public DiscogsImageType type { get; set; }
13 | public int height { get; set; }
14 | public int width { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/DiscogsClient/Internal/TokenAuthenticationInformation.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Internal
2 | {
3 | public class TokenAuthenticationInformation
4 | {
5 | public string Token { get; }
6 | private readonly string _SecretToken;
7 |
8 | public TokenAuthenticationInformation(string token)
9 | {
10 | Token = token;
11 | _SecretToken = $"Discogs token={token}";
12 | }
13 |
14 | public string GetDiscogsSecretToken()
15 | {
16 | return _SecretToken;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsSubtrack.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using RestSharpHelper;
4 |
5 | namespace DiscogsClient.Data.Result
6 | {
7 | public class DiscogsSubtrack
8 | {
9 | public string title { get; set; }
10 | public string type_ { get; set; }
11 | [JsonConverter(typeof(BasicTimeSpanConverter))]
12 | public TimeSpan? duration { get; set; }
13 | public string position { get; set; }
14 | public DiscogsReleaseArtist[] extraartists { get; set; }
15 | public DiscogsReleaseArtist[] artists { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DiscogsClient/DiscogsAuthentifierClient.cs:
--------------------------------------------------------------------------------
1 | using RestSharpHelper.OAuth1;
2 |
3 | namespace DiscogsClient
4 | {
5 | ///
6 | /// Discogs implementation of
7 | ///
8 | public class DiscogsAuthentifierClient : OAuthAuthentifierClient
9 | {
10 | protected override string RequestUrl => @"https://api.discogs.com";
11 |
12 | protected override string AuthorizeUrl => @"https://www.discogs.com";
13 |
14 | public DiscogsAuthentifierClient(OAuthConsumerInformation consumerInformation) : base(consumerInformation)
15 | {
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsArtistRelease.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsArtistRelease : DiscogsEntity
4 | {
5 | public string artist { get; set; }
6 | public int main_release { get; set; }
7 | public string resource_url { get; set; }
8 | public string role { get; set; }
9 | public string thumb { get; set; }
10 | public string title { get; set; }
11 | public string type { get; set; }
12 | public int year { get; set; }
13 | public string format { get; set; }
14 | public string label { get; set; }
15 | public string status { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsLabel.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsLabel : DiscogsEntity
4 | {
5 | public DiscogsImage[] images { get; set; }
6 | public DiscogsSimplifiedLabel[] sublabels { get; set; }
7 | public DiscogsSimplifiedLabel parent_label { get; set; }
8 | public string[] urls { get; set; }
9 | public string profile { get; set; }
10 | public string releases_url { get; set; }
11 | public string name { get; set; }
12 | public string contact_info { get; set; }
13 | public string uri { get; set; }
14 | public string resource_url { get; set; }
15 | public string data_quality { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsReleaseBase.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsReleaseBase : DiscogsEntity
4 | {
5 | public DiscogsReleaseArtist[] artists { get; set; }
6 | public DiscogsVideo[] videos { get; set; }
7 | public DiscogsImage[] images { get; set; }
8 | public DiscogsTrack[] tracklist { get; set; }
9 | public string resource_url { get; set; }
10 | public string data_quality { get; set; }
11 | public int year { get; set; }
12 | public string title { get; set; }
13 | public string uri { get; set; }
14 | public string[] genres { get; set; }
15 | public string[] styles { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsReleaseVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using RestSharpHelper;
4 |
5 | namespace DiscogsClient.Data.Result
6 | {
7 | public class DiscogsReleaseVersion : DiscogsEntity
8 | {
9 | public string catno { get; set; }
10 | public string country { get; set; }
11 | public string format { get; set; }
12 | public string label { get; set; }
13 | [JsonConverter(typeof(BasicDateTimeConverter))]
14 | public DateTime? released { get; set; }
15 | public string resource_url { get; set; }
16 | public string status { get; set; }
17 | public string thumb { get; set; }
18 | public string title { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsArtist.cs:
--------------------------------------------------------------------------------
1 | namespace DiscogsClient.Data.Result
2 | {
3 | public class DiscogsArtist : DiscogsEntity
4 | {
5 | public string name { get; set; }
6 | public string realname { get; set; }
7 | public DiscogsImage[] images { get; set; }
8 | public DiscogsGroupOrBandMember[] members { get; set; }
9 | public DiscogsGroupOrBandMember[] groups { get; set; }
10 | public string[] urls { get; set; }
11 | public string[] namevariations { get; set; }
12 | public string profile { get; set; }
13 | public string releases_url { get; set; }
14 | public string resource_url { get; set; }
15 | public string uri { get; set; }
16 | public string data_quality { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsSearchResult.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Query;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Converters;
4 |
5 | namespace DiscogsClient.Data.Result
6 | {
7 | public class DiscogsSearchResult : DiscogsEntity
8 | {
9 | public string[] genre { get; set; }
10 | public string[] style { get; set; }
11 | public string[] label { get; set; }
12 | public string[] format { get; set; }
13 | public string[] barcode { get; set; }
14 | public int? year { get; set; }
15 | public string title { get; set; }
16 | public string thumb { get; set; }
17 | public string country { get; set; }
18 | public DiscogsCommunityInfo community { get; set; }
19 | public string catno { get; set; }
20 | public string resource_url { get; set; }
21 | public string uri { get; set; }
22 | [JsonConverter(typeof(StringEnumConverter))]
23 | public DiscogsEntityType type { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright (c) 2016-2017 David Desmaisons
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 |
--------------------------------------------------------------------------------
/DiscogsClient.Test/DiscogsClient.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/DiscogsAuthenticationConsole/Program.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient;
2 | using System;
3 | using System.Diagnostics;
4 | using System.Threading.Tasks;
5 | using RestSharpHelper.OAuth1;
6 |
7 | namespace DiscogsAuthenticationConsole
8 | {
9 | public class Program
10 | {
11 | public static void Main(string[] args)
12 | {
13 | var oAuthConsumerInformation = new OAuthConsumerInformation("", "");
14 | var discogsClient = new DiscogsAuthentifierClient(oAuthConsumerInformation);
15 |
16 | var aouth = discogsClient.Authorize(s => Task.FromResult(GetToken(s))).Result;
17 |
18 | Console.WriteLine($"{((aouth != null)? "Success": "Fail")}");
19 | Console.WriteLine($"Token:{aouth?.TokenInformation?.Token}, Token:{aouth?.TokenInformation?.TokenSecret}");
20 | }
21 |
22 | private static string GetToken(string url)
23 | {
24 | Console.WriteLine("Please authourize the application and enter the final key in the console");
25 | Process.Start(url);
26 | string tokenKey = Console.ReadLine();
27 | tokenKey = string.IsNullOrEmpty(tokenKey) ? null : tokenKey;
28 | return tokenKey;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Result/DiscogsRelease.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DiscogsClient.Data.Result
4 | {
5 | public class DiscogsRelease : DiscogsReleaseBase
6 | {
7 | public DiscogsReleaseArtist[] extraartists { get; set; }
8 | public DiscogsReleaseLabel[] labels { get; set; }
9 | public DiscogsReleaseLabel[] companies { get; set; }
10 | public DiscogsFormat[] formats { get; set; }
11 | public DiscogsIdentifier[] identifiers { get; set; }
12 | public DiscogsCommunity community { get; set; }
13 | public DiscogsReleaseLabel[] series { get; set; }
14 | public string artists_sort { get; set; }
15 | public string catno { get; set; }
16 | public string country { get; set; }
17 | public DateTime date_added { get; set; }
18 | public DateTime date_changed { get; set; }
19 | public int estimated_weight { get; set; }
20 | public int format_quantity { get; set; }
21 | public decimal? lowest_price { get; set; }
22 | public int master_id { get; set; }
23 | public string master_url { get; set; }
24 | public string notes { get; set; }
25 | public int num_for_sale { get; set; }
26 | public string released { get; set; }
27 | public string released_formatted { get; set; }
28 | public string status { get; set; }
29 | public string thumb { get; set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/DiscogsClient/IDiscogsUserIdentityClient.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | namespace DiscogsClient
6 | {
7 | public interface IDiscogsUserIdentityClient
8 | {
9 | ///
10 | /// Retrieve basic information about the authenticated user.
11 | /// You can use this resource to find out who you’re authenticated as, and
12 | /// it also doubles as a good sanity check to ensure that you’re using OAuth correctly.
13 | /// See https://www.discogs.com/developers/#page:user-identity,header:user-identity-identity
14 | ///
15 | /// Cancellation Token
16 | /// The current discogs user identity
17 | Task GetUserIdentityAsync(CancellationToken cancellationToken);
18 |
19 | ///
20 | /// Retrieve basic information about the authenticated user.
21 | /// You can use this resource to find out who you’re authenticated as, and
22 | /// it also doubles as a good sanity check to ensure that you’re using OAuth correctly.
23 | /// See https://www.discogs.com/developers/#page:user-identity,header:user-identity-identity
24 | ///
25 | /// The current discogs user identity
26 | Task GetUserIdentityAsync();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/DiscogsClient.Test/DiscogsArtistDeserializationTest.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 | using FluentAssertions;
3 | using Newtonsoft.Json;
4 | using Xunit;
5 |
6 | namespace DiscogsClient.Test
7 | {
8 | public class DiscogsArtistDeserializationTest
9 | {
10 | private const string _JsonResponse = "{\"profile\": \"\", \"realname\": \"Steve Destailleur\", \"releases_url\": \"https://api.discogs.com/artists/20861/releases\", \"name\": \"Tevatron\", \"uri\": \"https://www.discogs.com/artist/20861-Tevatron\", \"images\": [{\"uri\": \"\", \"height\": 113, \"width\": 150, \"resource_url\": \"\", \"type\": \"primary\", \"uri150\": \"\"}], \"resource_url\": \"https://api.discogs.com/artists/20861\", \"aliases\": [{\"resource_url\": \"https://api.discogs.com/artists/575215\", \"id\": 575215, \"name\": \"St\\u00e9phane Destailleur\"}, {\"resource_url\": \"https://api.discogs.com/artists/8324\", \"id\": 8324, \"name\": \"Steve D\"}], \"id\": 20861, \"data_quality\": \"Needs Vote\", \"namevariations\": [\"Tevathron\"]}";
11 | private readonly DiscogsArtist _Result;
12 |
13 | public DiscogsArtistDeserializationTest()
14 | {
15 | _Result = JsonConvert.DeserializeObject(_JsonResponse);
16 | }
17 |
18 | [Fact]
19 | public void DeserializeResult_IsNotNull()
20 | {
21 | _Result.Should().NotBeNull();
22 | }
23 |
24 | [Fact]
25 | public void DeserializeResult_Has_RealName()
26 | {
27 | _Result.realname.Should().Be("Steve Destailleur");
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/DiscogsAuthenticationConsole/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DiscogsAuthenticationConsole")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DiscogsAuthenticationConsole")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("1c7e9ecb-f292-440a-ba38-b2a0c63e31ed")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DiscogsClient/Internal/IDiscogsWebClient.cs:
--------------------------------------------------------------------------------
1 | using RestSharp;
2 | using System.IO;
3 | using System.Net;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 |
7 | namespace DiscogsClient.Internal
8 | {
9 | internal interface IDiscogsWebClient
10 | {
11 | IRestRequest GetSearchRequest();
12 |
13 | IRestRequest GetReleaseRequest(int relaseId);
14 |
15 | IRestRequest GetMasterRequest(int masterId);
16 |
17 | IRestRequest GetMasterReleaseVersionRequest(int masterId);
18 |
19 | IRestRequest GetArtistRequest(int artistId);
20 |
21 | IRestRequest GetLabelRequest(int artistId);
22 |
23 | IRestRequest GetArtistReleaseVersionRequest(int artistId);
24 |
25 | IRestRequest GetAllLabelReleasesRequest(int labelId);
26 |
27 | IRestRequest GetGetUserReleaseRatingRequest(string userName, int releaseId);
28 |
29 | IRestRequest GetPutUserReleaseRatingRequest(string username, int releaseId);
30 |
31 | IRestRequest GetDeleteUserReleaseRatingRequest(string userName, int releaseId);
32 |
33 | IRestRequest GetCommunityReleaseRatingRequest(int releaseId);
34 |
35 | IRestRequest GetUserIdentityRequest();
36 |
37 | Task Execute(IRestRequest request, CancellationToken cancellationToken);
38 |
39 | Task Execute(IRestRequest request, CancellationToken cancellationToken);
40 |
41 | Task Download(string url, Stream copyStream, CancellationToken cancellationToken, int timeOut=15000);
42 |
43 | Task SaveFile(string url, string path, string fileName, CancellationToken cancellationToken, int timeOut = 15000);
44 | }
45 | }
--------------------------------------------------------------------------------
/DiscogsClient/DiscogsClient.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;net461
5 | true
6 | DiscogsClient
7 | DiscogsClient
8 | David Desmaisons
9 | 2.7.1
10 |
11 | https://github.com/David-Desmaisons/DiscogsClient
12 | https://github.com/David-Desmaisons/DiscogsClient/blob/master/LICENSE
13 | C# Client library for Discogs API v2.0
14 |
15 | Features
16 |
17 | Include API to authorize user (generating OAuth1.0 token and token secret)
18 | Full support to DataBase API including image download
19 | Support of identity API
20 | Asynchroneous and cancellable API using Tasks
21 | Transparent management of pagination using none blocking API (Reactive IObservable) or IEnumerable
22 | DiscogsClient
23 | true
24 | DiscogsClient, Asynchronous, Client
25 | 2.7.1.0
26 | 2.7.1.0
27 | Add async method for paginated queries
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/DiscogsClient.Test/TrackDeserializationTest.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 | using FluentAssertions;
3 | using Newtonsoft.Json;
4 | using System;
5 | using Xunit;
6 |
7 | namespace DiscogsClient.Test
8 | {
9 | public class TrackDeserializationTest
10 | {
11 | private const string _Track = "{\"duration\": \"7:13\",\"position\": \"2\",\"type_\": \"track\",\"extraartists\": [ {\"join\": \"\",\"name\": \"DJ Sangeet\",\"anv\": \"\",\"tracks\": \"\",\"role\": \"Written-By, Producer\",\"resource_url\": \"https://api.discogs.com/ReleaseArtists/25460\",\"id\": 25460 }],\"title\": \"From The Heart\"}";
12 |
13 | private readonly DiscogsTrack _Result;
14 |
15 | public TrackDeserializationTest()
16 | {
17 | _Result = JsonConvert.DeserializeObject(_Track);
18 | }
19 |
20 | [Fact]
21 | public void DeserializeResult_IsNotNull()
22 | {
23 | _Result.Should().NotBeNull();
24 | }
25 |
26 | [Fact]
27 | public void DeserializeDuration_IsOK()
28 | {
29 | _Result.duration.Should().Be(new TimeSpan(0,7,13));
30 | }
31 |
32 | [Fact]
33 | public void DeserializePosition_IsCorrect()
34 | {
35 | _Result.position.Should().Be("2");
36 | }
37 |
38 | [Fact]
39 | public void DeserializeTitle_IsCorrect()
40 | {
41 | _Result.title.Should().Be("From The Heart");
42 | }
43 |
44 | [Fact]
45 | public void DeserializeExtraArtists_HasCorrectSize()
46 | {
47 | _Result.extraartists.Should().NotBeNull();
48 | _Result.extraartists.Should().HaveCount(1);
49 | }
50 |
51 | [Fact]
52 | public void DeserializeExtraArtists_HasCorrectInformation()
53 | {
54 | _Result.extraartists[0].name.Should().Be("DJ Sangeet");
55 | _Result.extraartists[0].resource_url.Should().Be("https://api.discogs.com/ReleaseArtists/25460");
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/DiscogsClient.Test/ImageDeserializationTest.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 | using FluentAssertions;
3 | using Newtonsoft.Json;
4 | using Xunit;
5 |
6 | namespace DiscogsClient.Test
7 | {
8 | public class ImageDeserializationTest
9 | {
10 | private const string _Image = "{ \"height\": 569, \"resource_url\": \"https://api-img.discogs.com/_0K5t_iLs6CzLPKTB4mwHVI3Vy0=/fit-in/600x569/filters:strip_icc():format(jpeg):mode_rgb():quality(96)/discogs-images/R-66785-1213949871.jpeg.jpg\", \"type\": \"primary\", \"uri\": \"https://api-img.discogs.com/_0K5t_iLs6CzLPKTB4mwHVI3Vy0=/fit-in/600x569/filters:strip_icc():format(jpeg):mode_rgb():quality(96)/discogs-images/R-66785-1213949871.jpeg.jpg\", \"uri150\": \"https://api-img.discogs.com/sSWjXKczZseDjX2QohG1Lc77F-w=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-66785-1213949871.jpeg.jpg\", \"width\": 600}";
11 | private readonly DiscogsImage _Result;
12 |
13 | public ImageDeserializationTest()
14 | {
15 | _Result = JsonConvert.DeserializeObject(_Image);
16 | }
17 |
18 | [Fact]
19 | public void DeserializeResult_IsNotNull()
20 | {
21 | _Result.Should().NotBeNull();
22 | }
23 |
24 | [Fact]
25 | public void DeserializeHeight_IsOK()
26 | {
27 | _Result.height.Should().Be(569);
28 | }
29 |
30 | [Fact]
31 | public void DeserializeWidth_IsCorrect()
32 | {
33 | _Result.width.Should().Be(600);
34 | }
35 |
36 | [Fact]
37 | public void DeserializeResource_url_IsCorrect()
38 | {
39 | _Result.resource_url.Should().Be(@"https://api-img.discogs.com/_0K5t_iLs6CzLPKTB4mwHVI3Vy0=/fit-in/600x569/filters:strip_icc():format(jpeg):mode_rgb():quality(96)/discogs-images/R-66785-1213949871.jpeg.jpg");
40 | }
41 |
42 | [Fact]
43 | public void Deserializetype_HasCorrectValue()
44 | {
45 | _Result.type.Should().Be(DiscogsImageType.primary);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/DiscogsClient.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscogsClient", "DiscogsClient\DiscogsClient.csproj", "{F0138D25-8712-4DCA-880A-507067AC1326}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscogsClient.Test", "DiscogsClient.Test\DiscogsClient.Test.csproj", "{532D1353-37AA-4548-A711-0E54B04A590A}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscogsAuthenticationConsole", "DiscogsAuthenticationConsole\DiscogsAuthenticationConsole.csproj", "{1C7E9ECB-F292-440A-BA38-B2A0C63E31ED}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {F0138D25-8712-4DCA-880A-507067AC1326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {F0138D25-8712-4DCA-880A-507067AC1326}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {F0138D25-8712-4DCA-880A-507067AC1326}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {F0138D25-8712-4DCA-880A-507067AC1326}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {532D1353-37AA-4548-A711-0E54B04A590A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {532D1353-37AA-4548-A711-0E54B04A590A}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {532D1353-37AA-4548-A711-0E54B04A590A}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {532D1353-37AA-4548-A711-0E54B04A590A}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {1C7E9ECB-F292-440A-BA38-B2A0C63E31ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {1C7E9ECB-F292-440A-BA38-B2A0C63E31ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {1C7E9ECB-F292-440A-BA38-B2A0C63E31ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {1C7E9ECB-F292-440A-BA38-B2A0C63E31ED}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/DiscogsClient/Data/Query/DiscogsSearch.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace DiscogsClient.Data.Query
4 | {
5 | public class DiscogsSearch
6 | {
7 | ///
8 | /// Your search query. Example: nirvana
9 | ///
10 | [Description("q")]
11 | public string query { get; set; }
12 |
13 | ///
14 | /// Example: release
15 | ///
16 | public DiscogsEntityType? type { get; set; }
17 |
18 | ///
19 | /// Search by combined “Artist Name - Release Title” title field.
20 | /// Example: nirvana - nevermind
21 | ///
22 | public string title { get; set; }
23 |
24 | ///
25 | /// Search release titles. Example: nevermind
26 | ///
27 | public string release_title { get; set; }
28 |
29 | ///
30 | /// Search release credits.Example: kurt
31 | ///
32 | public string credit { get; set; }
33 |
34 | ///
35 | /// Search artist names. Example: nirvana
36 | ///
37 | public string artist { get; set; }
38 |
39 | ///
40 | /// Search artist ANV. Example: nirvana
41 | ///
42 | public string anv { get; set; }
43 |
44 | ///
45 | /// Search label names. Example: dgc
46 | ///
47 | public string label { get; set; }
48 |
49 | ///
50 | /// Search genres. Example: rock
51 | ///
52 | public string genre { get; set; }
53 |
54 | ///
55 | /// Search style. Example: grunge
56 | ///
57 | public string style { get; set; }
58 |
59 | ///
60 | /// Search country. Example: canada
61 | ///
62 | public string country { get; set; }
63 |
64 | ///
65 | /// Search release year. Example: 1991
66 | ///
67 | public int? year { get; set; }
68 |
69 | ///
70 | /// Search formats. Example: album
71 | ///
72 | public string format { get; set; }
73 |
74 | ///
75 | /// Search catalog number. Example: DGCD-24425
76 | ///
77 | public string catno { get; set; }
78 |
79 | ///
80 | /// Search barcodes. Example: 7 2064-24425-2 4
81 | ///
82 | public string barcode { get; set; }
83 |
84 | ///
85 | /// Search track titles. Example: smells like teen spirit
86 | ///
87 | public string track { get; set; }
88 |
89 | ///
90 | /// Search submitter username. Example: milKt
91 | ///
92 | public string submitter { get; set; }
93 |
94 | ///
95 | /// Search contributor usernames. Example: jerome99
96 | ///
97 | public string contributor { get; set; }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/DiscogsClient.Test/MasterDeserializationTest.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 | using FluentAssertions;
3 | using Newtonsoft.Json;
4 | using Xunit;
5 |
6 | namespace DiscogsClient.Test
7 | {
8 | public class MasterDeserializationTest
9 | {
10 | private const string _Master = "{\"styles\": [\"Techno\", \"Deep Techno\", \"Deep House\", \"Disco\"], \"genres\": [\"Electronic\"], \"num_for_sale\": 7, \"title\": \"Conceptions Inspirations b/w Sweet Love \", \"most_recent_release\": 13111150, \"main_release\": 13111150, \"main_release_url\": \"https://api.discogs.com/releases/13111150\", \"uri\": \"https://www.discogs.com/Vintage-Future-ft-Vann-Johnson-and-Syndicate-Of-Swing-Conceptions-Inspirations-bw-Sweet-Love-/master/1489926\", \"artists\": [{\"join\": \"ft.\", \"name\": \"Vintage Future\", \"anv\": \"\", \"tracks\": \"\", \"role\": \"\", \"resource_url\": \"https://api.discogs.com/artists/65478\", \"id\": 65478}, {\"join\": \"and\", \"name\": \"Vann Johnson\", \"anv\": \"\", \"tracks\": \"\", \"role\": \"\", \"resource_url\": \"https://api.discogs.com/artists/603935\", \"id\": 603935}, {\"join\": \"\", \"name\": \"Syndicate Of Swing\", \"anv\": \"\", \"tracks\": \"\", \"role\": \"\", \"resource_url\": \"https://api.discogs.com/artists/1185799\", \"id\": 1185799}], \"versions_url\": \"https://api.discogs.com/masters/1489926/versions\", \"data_quality\": \"Correct\", \"most_recent_release_url\": \"https://api.discogs.com/releases/13111150\", \"year\": 2019, \"images\": [{\"uri\": \"\", \"height\": 600, \"width\": 600, \"resource_url\": \"\", \"type\": \"primary\", \"uri150\": \"\"}, {\"uri\": \"\", \"height\": 600, \"width\": 600, \"resource_url\": \"\", \"type\": \"secondary\", \"uri150\": \"\"}, {\"uri\": \"\", \"height\": 600, \"width\": 600, \"resource_url\": \"\", \"type\": \"secondary\", \"uri150\": \"\"}], \"resource_url\": \"https://api.discogs.com/masters/1489926\", \"lowest_price\": 13.51, \"id\": 1489926, \"tracklist\": [{\"duration\": \"08:05\", \"position\": \"A\", \"type_\": \"track\", \"title\": \"Conceptions Inspirations\"}, {\"duration\": \"13:18\", \"position\": \"B\", \"type_\": \"track\", \"title\": \"Sweet Love\"}]}";
11 | private readonly DiscogsMaster _Result;
12 | public MasterDeserializationTest()
13 | {
14 | _Result = JsonConvert.DeserializeObject(_Master);
15 | }
16 |
17 | [Fact]
18 | public void DeserializeResult_IsNotNull()
19 | {
20 | _Result.Should().NotBeNull();
21 | }
22 |
23 | [Fact]
24 | public void DeserializeResult_Deserialize_most_recent_release()
25 | {
26 | _Result.most_recent_release.Should().Be(13111150);
27 | }
28 |
29 | [Fact]
30 | public void DeserializeResult_Deserialize_most_recent_release_url()
31 | {
32 | _Result.most_recent_release_url.Should().Be("https://api.discogs.com/releases/13111150");
33 | }
34 |
35 | [Fact]
36 | public void DeserializeResult_Deserialize_num_for_sale()
37 | {
38 | _Result.num_for_sale.Should().Be(7);
39 | }
40 |
41 | [Fact]
42 | public void DeserializeResult_Deserialize_lowest_price()
43 | {
44 | _Result.lowest_price.Should().Be(13.51m);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/DiscogsClient.Test/VersionDeserializationTest.cs:
--------------------------------------------------------------------------------
1 | using DiscogsClient.Data.Result;
2 | using FluentAssertions;
3 | using Newtonsoft.Json;
4 | using System;
5 | using System.Collections.Generic;
6 | using Xunit;
7 |
8 | namespace DiscogsClient.Test
9 | {
10 | public class VersionDeserializationTest
11 | {
12 | private const string _Version = "{ \"catno\": \"2078-2\", \"country\": \"Israel\", \"format\": \"CD, Album, Mixed\", \"id\": 528753, \"label\": \"Phonokol\", \"released\": \"1997\", \"resource_url\": \"http://api.discogs.com/releases/528753\", \"status\": \"Accepted\", \"thumb\": \"https://api-img.discogs.com/53aTwkmfs6fwWZhq5ma7-vbU7TY=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-528753-1127942810.jpeg.jpg\", \"title\": \"Stardiver\" }";
13 | private const string _Version2 = " { \"catno\": \"SPIRIT ZONE 027\", \"country\": \"Germany\", \"format\": \"CD, Album, Mixed\", \"id\": 66785, \"label\": \"Spirit Zone Recordings\", \"released\": \"1997-03-14\", \"resource_url\": \"http://api.discogs.com/releases/66785\", \"status\": \"Accepted\", \"thumb\": \"https://api-img.discogs.com/sSWjXKczZseDjX2QohG1Lc77F-w=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-66785-1213949871.jpeg.jpg\", \"title\": \"Stardiver\" }";
14 | private const string _Version3 = " { \"catno\": \"SPIRIT ZONE 027\", \"country\": \"Germany\", \"format\": \"CD, Album, Mixed\", \"id\": 66785, \"label\": \"Spirit Zone Recordings\", \"released\": \"1997-03-0\", \"resource_url\": \"http://api.discogs.com/releases/66785\", \"status\": \"Accepted\", \"thumb\": \"https://api-img.discogs.com/sSWjXKczZseDjX2QohG1Lc77F-w=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-66785-1213949871.jpeg.jpg\", \"title\": \"Stardiver\" }";
15 | private const string _Version4 = " { \"catno\": \"SPIRIT ZONE 027\", \"country\": \"Germany\", \"format\": \"CD, Album, Mixed\", \"id\": 66785, \"label\": \"Spirit Zone Recordings\", \"resource_url\": \"http://api.discogs.com/releases/66785\", \"status\": \"Accepted\", \"thumb\": \"https://api-img.discogs.com/sSWjXKczZseDjX2QohG1Lc77F-w=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-66785-1213949871.jpeg.jpg\", \"title\": \"Stardiver\" }";
16 |
17 | public static IEnumerable