Struct SessionTokens

Source
pub struct SessionTokens {
    pub encrypt_key: String,
    pub decrypt_key: String,
    pub partner_id: Option<String>,
    pub partner_token: Option<String>,
    pub user_id: Option<String>,
    pub user_token: Option<String>,
    /* private fields */
}
Expand description

A convenience type that holds all the values necessary to maintain an active session with the Pandora service.

Fields§

§encrypt_key: String

The key used to encrypt the body of certain API requests.

§decrypt_key: String

The key used to decrypt certain values from the body of certain API responses.

§partner_id: Option<String>

The partner id token returned by the partner login request

§partner_token: Option<String>

The partner auth token returned by the partner login request

§user_id: Option<String>

The user id token returned by the user login request

§user_token: Option<String>

The user auth token returned by the user login request

Implementations§

Source§

impl SessionTokens

Source

pub fn new<T: ToEncryptionTokens>(to_encryption_tokens: &T) -> Self

Initialize a SessionTokens object with only the encryption keys, as those are needed even before authentication begins

Source

pub fn update_partner_tokens<T: ToPartnerTokens>( &mut self, to_partner_tokens: &T, )

Update the current SessionTokens instance using values from the response to the PartnerLogin request.

Source

pub fn update_user_tokens<T: ToUserTokens>(&mut self, to_user_tokens: &T)

Update the current SessionTokens instance using values from the response to the UserLogin request.

Source

pub fn set_sync_time(&mut self, sync_time: u64)

The current server time as of the last request. Submitted requests must include a value of syncTime that corresponds to the new server time, based on the amount of time elapsed since authenticating.

Source

pub fn clear_sync_time(&mut self)

Clear the session syncTime base.

Source

pub fn get_sync_time(&self) -> Option<u64>

Returns the current syncTime relative to the

Source

pub fn clear_partner_tokens(&mut self)

Clears all active partner session tokens.

Source

pub fn clear_user_tokens(&mut self)

Clears all active user session tokens.

Trait Implementations§

Source§

impl Clone for SessionTokens

Source§

fn clone(&self) -> SessionTokens

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionTokens

Source§

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

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

impl<T: ToEncryptionTokens> From<&T> for SessionTokens

Source§

fn from(tokens: &T) -> Self

Converts to this type from the input type.
Source§

impl ToEncryptionTokens for SessionTokens

Source§

fn to_encrypt_key(&self) -> String

Retrieve the encryption key for this session

Source§

fn to_decrypt_key(&self) -> String

Retrieve the decryption key for this session

Source§

fn encrypt(&self, data: &str) -> String

Encrypt the provided data using the session encryption key.
Source§

fn decrypt(&self, hex_data: &str) -> Vec<u8>

Decrypt the provided data using the session decryption key.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,