DiscogsClient
Discogs API C# Client
Install / Use
/learn @David-Desmaisons/DiscogsClientREADME
DiscogsClient
C# Client library for Discogs API v2.0
Check demo application Music.Cover.Finder
Features
- Include API to authorize user (generating OAuth1.0 token and token secret)
- Full support to DataBase API including image download
- Support of identity API
- Transparent support of rate limit
- Asynchroneous and cancellable API using Tasks
- Transparent management of pagination using none blocking API (Reactive IObservable) or IEnumerable
Sample usage
Create discogs client
Oauth authentication
//Create authentication object using private and public keys: you should fournish real keys here
var oAuthCompleteInformation = new OAuthCompleteInformation("consumerKey",
"consumerSecret", "token", "tokenSecret");
//Create discogs client using the authentication
var discogsClient = new DiscogsClient(oAuthCompleteInformation);
Token based authentication
//Create authentication based on Discogs token
var tokenInformation = new TokenAuthenticationInformation("my-token");
//Create discogs client using the authentication
var discogsClient = new DiscogsClient(tokenInformation);
Search The DataBase
Using IObservable:
var discogsSearch = new DiscogsSearch()
{
artist = "Ornette Coleman",
release_title = "The Shape Of Jazz To Come"
};
//Retrieve observable result from search
var observable = _DiscogsClient.Search(discogsSearch);
Using IEnumerable:
//Alternatively retreive same result as enumerable
var enumerable = _DiscogsClient.SearchAsEnumerable(discogsSearch);
Get Release, Master, Artist or Label Information
var release = await _DiscogsClient.GetReleaseAsync(1704673);
var master = await _DiscogsClient.GetMasterAsync(47813);
var artist = await _DiscogsClient.GetArtistAsync(224506);
var label = await _DiscogsClient.GetLabelAsync(125);
Download Image
//Retrieve Release information
var res = await _DiscogsClient.GetMasterAsync(47813);
//Download the first image of the release
await _DiscogsClient.SaveImageAsync(res.images[0], Path.GetTempPath(), "Ornette-TSOAJTC");
OAuth: Authorize new user
//Create authentificator information: you should fournish real keys here
var oAuthConsumerInformation = new OAuthConsumerInformation("consumerKey", "consumerSecret");
//Create Authentifier client
var discogsAuthentifierClient = new DiscogsAuthentifierClient(oAuthConsumerInformation);
//Retreive Token and Token secret
var oauth = discogsClient.Authorize(s => Task.FromResult(GetToken(s))).Result;
Authorize takes a Func< string, Task< string>> as parameter, receiving the authentication url and returning the corresponding access key. Trivial implementation:
private static string GetToken(string url)
{
Console.WriteLine("Please authorize the application and enter the final key in the console");
Process.Start(url);
return Console.ReadLine();
}
See DiscogsClientTest and DiscogsAuthenticationConsole for full samples of available APIs.
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
