1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::ProtonClient;
use clickhouse::Client;

impl ProtonClient {
    /// Returns a reference to the internal clickhouse client.
    ///
    /// This can be used for making lower-level requests.
    ///
    /// For details on how to use the client, see the [clickhouse client crate](https://github.com/loyd/clickhouse.rs).
    ///
    /// # Example
    /// ```no_run
    /// use proton_client::prelude::{ProtonClient, Result};
    ///
    /// async fn example() -> Result<()> {
    ///
    /// let client = ProtonClient::new("http://localhost:8123");
    ///
    /// let url = client.client().await;
    ///
    /// Ok(())
    /// }
    /// ```
    ///
    pub async fn client(&self) -> &Client {
        &self.client
    }

    /// Returns the base URL of the Proton API endpoint.
    ///
    /// This is the root URL passed to the client during construction.
    ///
    /// # Example
    ///
    /// ```no_run
    /// use proton_client::prelude::{ProtonClient, Result};
    ///
    /// async fn example() -> Result<()> {
    ///
    /// let client = ProtonClient::new("http://localhost:8123");
    ///
    /// let url = client.url().await;
    ///
    /// assert_eq!(url, "http://localhost:8123");
    ///
    /// Ok(())
    /// }
    /// ```
    ///
    pub async fn url(&self) -> &str {
        &self.url
    }
}