Trait PandoraJsonApiRequest

Source
pub trait PandoraJsonApiRequest: Serialize {
    type Response: Debug + DeserializeOwned;
    type Error: Debug + From<Error> + From<Error> + From<JsonError> + Send;

    // Required method
    fn get_method(&self) -> String;

    // Provided methods
    fn get_json(&self) -> Result<Value, Self::Error> { ... }
    fn encrypt_request(&self) -> bool { ... }
    fn request(
        &self,
        session: &mut PandoraSession,
    ) -> Result<RequestBuilder, Self::Error> { ... }
    fn response<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 mut PandoraSession,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

A trait for accessing information and capabilities specific to each Pandora JSON API call, including the method name, the json body content, and whether the body content should be encrypted before transmission.

It also includes two convenience methods for submitting the request.

Required Associated Types§

Source

type Response: Debug + DeserializeOwned

The type that the json response will be deserialized to.

Source

type Error: Debug + From<Error> + From<Error> + From<JsonError> + Send

The Error type to be returned by fallible calls on this trait.

Required Methods§

Source

fn get_method(&self) -> String

Returns the name of the Pandora JSON API call in the form that it must appear when making that call.

Provided Methods§

Source

fn get_json(&self) -> Result<Value, Self::Error>

Returns the root json Value that should be serialized into the body of the API call.

Source

fn encrypt_request(&self) -> bool

Whether the json body of the API call is expected to be encrypted before transmission.

Source

fn request( &self, session: &mut PandoraSession, ) -> Result<RequestBuilder, Self::Error>

Generate an HTTP request that, when send() is called on it, will submit the built request.

Source

fn response<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 mut PandoraSession, ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Build the request, submit it, and extract the response content from the body json, and deserialize it into the Self::Response type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PandoraJsonApiRequest for GetAdMetadata

Source§

impl PandoraJsonApiRequest for RegisterAd

Source§

impl PandoraJsonApiRequest for PartnerLogin

Source§

impl PandoraJsonApiRequest for UserLogin

Source§

impl PandoraJsonApiRequest for AddArtistBookmark

Source§

impl PandoraJsonApiRequest for AddSongBookmark

Source§

impl PandoraJsonApiRequest for DeleteArtistBookmark

Source§

impl PandoraJsonApiRequest for DeleteSongBookmark

Source§

impl PandoraJsonApiRequest for GetTrack

Source§

impl PandoraJsonApiRequest for AddFeedback

Source§

impl PandoraJsonApiRequest for AddMusic

Source§

impl PandoraJsonApiRequest for CreateStation

Source§

impl PandoraJsonApiRequest for DeleteFeedback

Source§

impl PandoraJsonApiRequest for DeleteMusic

Source§

impl PandoraJsonApiRequest for DeleteStation

Source§

impl PandoraJsonApiRequest for GetGenreStations

Source§

impl PandoraJsonApiRequest for GetGenreStationsChecksum

Source§

impl PandoraJsonApiRequest for GetPlaylist

Source§

impl PandoraJsonApiRequest for GetStation

Source§

impl PandoraJsonApiRequest for RenameStation

Source§

impl PandoraJsonApiRequest for ShareStation

Source§

impl PandoraJsonApiRequest for TransformSharedStation

Source§

impl PandoraJsonApiRequest for CheckLicensing

Source§

impl PandoraJsonApiRequest for ExplainTrack

Source§

impl PandoraJsonApiRequest for CanSubscribe

Source§

impl PandoraJsonApiRequest for ChangeSettings

Source§

impl PandoraJsonApiRequest for CreateUser

Source§

impl PandoraJsonApiRequest for EmailPassword

Source§

impl PandoraJsonApiRequest for GetBookmarks

Source§

impl PandoraJsonApiRequest for GetSettings

Source§

impl PandoraJsonApiRequest for GetStationList

Source§

impl PandoraJsonApiRequest for GetStationListChecksum

Source§

impl PandoraJsonApiRequest for GetUsageInfo

Source§

impl PandoraJsonApiRequest for SetQuickMix

Source§

impl PandoraJsonApiRequest for SleepSong

Source§

impl PandoraJsonApiRequest for StartComplimentaryTrial

Source§

impl PandoraJsonApiRequest for ValidateUsername