pub struct Session(/* private fields */);
Expand description
A shared reference to a Spotify session.
After instantiating, you need to login via Session::connect.
You can either implement the whole playback logic yourself by using
this structs interface directly or hand it to a
Player
.
Note: Session instances cannot yet be reused once invalidated. After an unexpectedly closed connection, you’ll need to create a new Session.
Implementations§
Source§impl Session
impl Session
pub fn new(config: SessionConfig, cache: Option<Cache>) -> Self
pub async fn connect( &self, credentials: Credentials, store_credentials: bool, ) -> Result<(), Error>
pub fn apresolver(&self) -> &ApResolver
pub fn audio_key(&self) -> &AudioKeyManager
pub fn channel(&self) -> &ChannelManager
pub fn http_client(&self) -> &HttpClient
pub fn mercury(&self) -> &MercuryManager
pub fn spclient(&self) -> &SpClient
pub fn token_provider(&self) -> &TokenProvider
pub fn time_delta(&self) -> i64
pub fn spawn<T>(&self, task: T)
pub fn send_packet(&self, cmd: PacketType, data: Vec<u8>) -> Result<(), Error>
pub fn cache(&self) -> Option<&Arc<Cache>>
pub fn config(&self) -> &SessionConfig
pub fn user_data(&self) -> UserData
pub fn device_id(&self) -> &str
pub fn client_id(&self) -> String
pub fn set_client_id(&self, client_id: &str)
pub fn client_name(&self) -> String
pub fn set_client_name(&self, client_name: &str)
pub fn client_brand_name(&self) -> String
pub fn set_client_brand_name(&self, client_brand_name: &str)
pub fn client_model_name(&self) -> String
pub fn set_client_model_name(&self, client_model_name: &str)
pub fn connection_id(&self) -> String
pub fn set_connection_id(&self, connection_id: &str)
pub fn username(&self) -> String
pub fn set_username(&self, username: &str)
pub fn country(&self) -> String
pub fn filter_explicit_content(&self) -> bool
pub fn autoplay(&self) -> bool
pub fn set_user_attribute(&self, key: &str, value: &str) -> Option<String>
pub fn set_user_attributes(&self, attributes: UserAttributes)
pub fn get_user_attribute(&self, key: &str) -> Option<String>
pub fn shutdown(&self)
pub fn is_invalid(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more