Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub api_base_url: String,
    pub auth_base_url: String,
    pub cache_path: PathBuf,
    pub pagination_chunks: u32,
    pub token_cached: bool,
    pub token_refreshing: bool,
    pub token_callback_fn: Arc<Option<TokenCallback>>,
}
Expand description

Struct to configure the Spotify client.

Fields§

§api_base_url: String

The Spotify API prefix, DEFAULT_API_BASE_URL by default.

§auth_base_url: String

The Spotify Authentication prefix, DEFAULT_AUTH_BASE_URL by default.

§cache_path: PathBuf

The cache file path, in case it’s used. By default it’s DEFAULT_CACHE_PATH

§pagination_chunks: u32

The pagination chunk size used when performing automatically paginated requests, like artist_albums. This means that a request will be performed every pagination_chunks items. By default this is DEFAULT_PAGINATION_CHUNKS.

Note that most endpoints set a maximum to the number of items per request, which most times is 50.

§token_cached: bool

Whether or not to save the authentication token into a JSON file, then reread the token from JSON file when launching the program without following the full auth process again

§token_refreshing: bool

Whether or not to check if the token has expired when sending a request with credentials, and in that case, automatically refresh it.

§token_callback_fn: Arc<Option<TokenCallback>>

Whenever client succeeds to request or refresh a token, the callback function will be invoked

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.