Spotify-NetStandard icon indicating copy to clipboard operation
Spotify-NetStandard copied to clipboard

Feedback

Open hansmbakker opened this issue 6 years ago • 7 comments
trafficstars

Nice that you're creating this! I was wondering whether you considered https://github.com/reactiveui/refit to simplify creating your REST client?

hansmbakker avatar Feb 04 '19 08:02 hansmbakker

Thanks - I'd based this client on the Groove Music SDK but anything I can do with it later might be worth considering as a later improvement using something like this!

RoguePlanetoid avatar Feb 07 '19 20:02 RoguePlanetoid

The REST Library has been rewritten to improve the workflow, hopefully this makes it much easier to understand

RoguePlanetoid avatar Feb 24 '19 12:02 RoguePlanetoid

I meant that it might make it much easier for you to maintain this library and to add new functionality if you do not hand-write the REST Client code yourself. Also it might make your code much cleaner.

Refit just asks you to write a .Net interface and specify the REST method, parameters and url route to disclose an endpoint.

hansmbakker avatar Feb 25 '19 21:02 hansmbakker

More specifically, it would make a part of the contents in your Spotify.NetStandard/Spotify.NetStandard/Client/Internal folder redundant. I understand you started from the Groove Music SDK but I believe using Refit would be much simpler.

hansmbakker avatar Feb 25 '19 21:02 hansmbakker

Besides the point about Refit, I was wondering how you think about the circular dependency between SpotifyApi and SpotifyClient. Personally I find it very confusing and I think it could improve the code if there is one class that makes the REST calls and one class that might add some logic to the REST calls.

hansmbakker avatar May 26 '19 14:05 hansmbakker

Good point about that circular dependancy - I'd intended that ISpotifyApi Interface to be a wrapper for the ISpotifyClient one but agree it is confusing and could refactor this to remove that

RoguePlanetoid avatar May 26 '19 19:05 RoguePlanetoid

Nice :) I was wondering whether you've had the chance to look at Refit, and what you think of it?

My recommended approach would be:

  • let ISpotifyApi handle all REST calls using Refit attribute decorations
  • remove SimpleServiceClient - all this code can be generated using Refit so that you do not need to maintain it
  • create ISpotifyClient / SpotifyClient for the extra logic on top of the REST calls (e.g. the modification of parameters, etc). In the implementation, use ISpotifyApi to make the API calls.
  • use the authentication pattern from Refit to handle the authentication part

hansmbakker avatar May 26 '19 19:05 hansmbakker