[][src]Struct aspotify::authorization::c_c_flow::CCFlow

pub struct CCFlow<'cc> { /* fields omitted */ }

An object that holds a reference to your client credentials, and caches access tokens with the Client Credentials authorization flow.

Examples

use aspotify::{ClientCredentials, CCFlow};

// Create a flow, taking credentials from environment variables.
let flow = CCFlow::new(
    ClientCredentials::from_env()
        .expect("CLIENT_ID or CLIENT_SECRET environment variables not set")
);

// Get a client credentials access token with:
let token = flow.send().await.unwrap();

Methods

impl<'cc> CCFlow<'cc>[src]

pub fn new(credentials: &'cc ClientCredentials) -> Self[src]

Creates a new CCFlow from the client's credentials.

pub fn get_credentials(&self) -> &ClientCredentials[src]

Get the client credentials.

pub async fn send<'_>(
    &'_ self
) -> Result<AccessToken, EndpointError<AuthenticationError>>
[src]

Return the cache or send a request.

Trait Implementations

impl<'cc> Debug for CCFlow<'cc>[src]

Auto Trait Implementations

impl<'cc> !RefUnwindSafe for CCFlow<'cc>

impl<'cc> Send for CCFlow<'cc>

impl<'cc> Sync for CCFlow<'cc>

impl<'cc> Unpin for CCFlow<'cc>

impl<'cc> !UnwindSafe for CCFlow<'cc>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,