Discogs, Using DiscordClient to access the API

349 Views Asked by At

I would like to build an app that i'll use for myself so i'm targeting the simple authentification through Token. I had my token from Discog and i know it works because i tried it in a third party app.

I'm using DiscogClient which seems to be the most popular client.

I'm following the Sample usage in the following way :

  var tokenInformation = new TokenAuthenticationInformation("My token"); // i'm using my real token of course
        //Create discogs client using the authentication
            var discogsClient = new DiscogsClient.DiscogsClient(tokenInformation);

        var discogsSearch = new DiscogsSearch()
        {
            artist = "Michael Jackson"
        };
        //Retrieve observable result from search
        var observable = discogsClient.Search(discogsSearch);

I dont have any exception when i run that code, but if i look at the observable var in debug mode, there is no result whatsoever.

I'm lost and am seeking help.

Thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

ok so this is how i made it work, sound simple but i'm not used to thread programming.

var tokenInformation = new TokenAuthenticationInformation("My token"); // i'm using my real token of course
{
    //Create discogs client using the authentication
        var discogsClient = new DiscogsClient.DiscogsClient(tokenInformation);

    var discogsSearch = new DiscogsSearch()
    {
        artist = "Michael Jackson"
    };
await SearchDis(discogsClient, discogsSearch);
}

then the function

 private async static  Task SearchDis (DiscogsClient.DiscogsClient dc, DiscogsSearch ds)        
    {
      var res = await dc.SearchAsync (ds);
    }