Add support for alternative Listenbrainz hosts #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds support for alternative Listenbrainz hosts.
L10 defines the most used official host for Listenbrainz.
I have refactored the Client struct to have the
api_root_url
field.This is automatically set to the value L10 defines, when a Client is
instantiated with
new()
. On the invocation ofclient_with_url(url: &str)
, theapi_root_url
field is set to the Listenbrainz instanceAPI root URL passed to the function.
The 1:1 functions <-> API methods have been modified to use
self.api_root_url
as the base of theformat!()
macro invoked, ratherthan the global constant of
API_ROOT_URL
.This commit has been tested with the examples, and appears to be
functional.
Fixes #2.
Signed-off-by: Dom Rodriguez shymega@shymega.org.uk