Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for alternative Listenbrainz hosts #6

Merged
merged 1 commit into from Aug 30, 2021

Conversation

shymega
Copy link
Collaborator

@shymega shymega commented Aug 30, 2021

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 of client_with_url(url: &str), the api_root_url field is set to the Listenbrainz instance
API 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 the format!() macro invoked, rather
than 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

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 of `client_with_url(url:
&str)`, the `api_root_url` field is set to the Listenbrainz instance
API 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 the `format!()` macro invoked, rather
than 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>
@InputUsername
Copy link
Owner

Looks great!

@InputUsername InputUsername merged commit 8b195d1 into main Aug 30, 2021
@InputUsername InputUsername deleted the feature/alternative-hosts branch September 24, 2021 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Look into setting alternative Listenbrainz hosts for a session
2 participants