mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-24 09:16:12 +01:00
f4e3aa13eb
The methods allow to set and get the Telegram bot API url.
18 lines
448 B
Rust
18 lines
448 B
Rust
use std::sync::Arc;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub(crate) enum ApiUrl {
|
|
Default,
|
|
Custom(Arc<reqwest::Url>),
|
|
}
|
|
|
|
impl ApiUrl {
|
|
pub(crate) fn get(&self) -> reqwest::Url {
|
|
match self {
|
|
// FIXME(waffle): parse once
|
|
ApiUrl::Default => reqwest::Url::parse(crate::net::TELEGRAM_API_URL)
|
|
.expect("failed to parse default url"),
|
|
ApiUrl::Custom(url) => (&**url).clone(),
|
|
}
|
|
}
|
|
}
|