Add api_url() method to raw::Client and wrapper::ListenBrainz

This commit is contained in:
Koen Bolhuis 2021-12-03 12:46:33 +01:00
parent 0b18a3230b
commit 0c3125bd14
2 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,11 @@ impl Client {
}
}
/// Get the API URL of this client.
pub fn api_url(&self) -> &str {
&self.api_root_url
}
/// Helper method to perform a GET request against an endpoint
/// without any query parameters.
fn get<R: ResponseType>(&self, endpoint: Endpoint) -> Result<R, Error> {

View File

@ -40,6 +40,11 @@ impl ListenBrainz {
}
}
/// Get the API URL of this client.
pub fn api_url(&self) -> &str {
self.client.api_url()
}
/// Check if this client is authenticated.
pub fn is_authenticated(&self) -> bool {
self.auth.is_some()