brotherlogic / discogs

Golang discogs implementation
Apache License 2.0
0 stars 0 forks source link

A little help #129

Closed VinylVault closed 4 months ago

VinylVault commented 6 months ago

Hi @brotherlogic

Found this on the go package repo, I am new to go, so please forgive what may be a stupid question ... but how can I add my discogs token in to this so I can use your library to build the API that will power the new website I will be creating?

also, not understanding the code properly, does the code gracefuly handle the insanely limiting discogs API Rate Limit? (429 error)

brotherlogic commented 6 months ago

Do you mean your personal token, or the oauth token?

So you can use discogs.DiscogsWithAuth to create a generic client - and that will handle the oauth flow if you're going that route. Once you have a user, use the ForUser method to build out a client that'll act as that user. I think the personal token in there may work, I use it with oauth so I'm not sure I tested that.

For rate limiting, it'll just return PERMISSION_DENIED and I use that as signal to back off and retry later but I guess I could stick some of the extra header info (like the wait time) in there.

Happy to take feature requests - I'm using this in personal projects, so I haven't fully implemented everything.