From 0c3125bd14ee9b33e52515602eb405eac8f03b99 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Fri, 3 Dec 2021 12:46:33 +0100 Subject: [PATCH] Add api_url() method to raw::Client and wrapper::ListenBrainz --- src/raw/client.rs | 5 +++++ src/wrapper.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/raw/client.rs b/src/raw/client.rs index b12720d..74161c5 100644 --- a/src/raw/client.rs +++ b/src/raw/client.rs @@ -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(&self, endpoint: Endpoint) -> Result { diff --git a/src/wrapper.rs b/src/wrapper.rs index f51e8bc..5d0cb6a 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -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()