yandex_music/
lib.rs

1use std::borrow::Cow;
2
3use error::ClientError;
4
5use crate::client::builder::ClientBuilder;
6
7pub mod api;
8pub mod client;
9pub mod error;
10pub mod model;
11
12pub const API_PATH: &str = "https://api.music.yandex.net:443/";
13pub const DEFAULT_CLIENT_ID: &str = "YandexMusicAndroid/24023621";
14
15/// A client to interact with the Yandex Music API.
16pub struct YandexMusicClient {
17    /// Internal reqwest client.
18    pub inner: reqwest::Client,
19}
20
21impl YandexMusicClient {
22    /// Create a client builder.
23    pub fn builder<'a>(token: impl Into<Cow<'a, str>>) -> ClientBuilder<'a> {
24        ClientBuilder::new(token)
25    }
26
27    /// Create a client from a reqwest client.
28    /// This will override all other options. You will have to provide all the headers yourself.
29    pub fn from_client(client: reqwest::Client) -> Self {
30        Self { inner: client }
31    }
32}