|
pianod2
multisource multiuser scriptable networked music player
|
Pandora communication class. More...
#include <pandoracomm.h>

Public Member Functions | |
| Communication (const std::string &name, const std::string &pass, const std::string &prox, const JSONProtocolParameters &proto_params) | |
| Construct a new communicator given the user's name and password, and an optional proxy server. More... | |
| Status | execute (Request &request, bool retry_if_auth_required=true) |
| Execute an HTTP request. More... | |
| Status | partnerAuthenticate () |
| Authenticate with Pandora. More... | |
| void | resetState () |
| Parsnip::Data | persist () const |
| Persist communication settings. More... | |
| void | restore (const Parsnip::Data &data) |
| Restore communication settings. More... | |
| time_t | retryTime () const |
| const UserFeatures & | getFeatures () const |
| const time_t | offlineUntil () const |
| const time_t | sessionExpires () const |
| const bool | isFailed () const |
Private Types | |
| enum class | State { Uninitialized , Initialized , Authenticated , Failed } |
Private Member Functions | |
| Status | performRequest (Request &request) |
| Perform an API request. More... | |
| Status | authenticate () |
| Authenticate with Pandora. More... | |
Private Attributes | |
| JSONProtocolParameters | protocol |
| const bool | automatic_protocol_parameters {false} |
| std::string | username |
| std::string | password |
| std::string | proxy |
| std::string | partner_auth_token |
| Partner authorization token, for JSON protocol. More... | |
| std::string | partner_id |
| std::string | user_auth_token |
| Authorization token, retrieved during login. More... | |
| std::string | listener_id |
| time_t | synctime_offset |
| int | sequential_failures {0} |
| Number of failed transactions without successes. More... | |
| time_t | lockout_until {0} |
| Time until which communications are blocked/automatically fail. More... | |
| time_t | session_expiration {0} |
| Time at which session expires from inactivity. More... | |
| UserFeatures | features |
| User capabilities, retrieved from login response. More... | |
| State | state {State::Uninitialized} |
| HttpClient | http_client |
| BlowFish | encryptor |
| BlowFish | decryptor |
Pandora communication class.
Provided a request, assembles a JSON request and issues it to Pandora, then decodes the response. This class manages the CSRF (cross-site request forgery) and authorization tokens, and reauthenticates if/when necessary.
|
strongprivate |
| Pandora::Communication::Communication | ( | const std::string & | name, |
| const std::string & | pass, | ||
| const std::string & | prox, | ||
| const JSONProtocolParameters & | proto_params | ||
| ) |
Construct a new communicator given the user's name and password, and an optional proxy server.
|
private |
Authenticate with Pandora.


Execute an HTTP request.
Acquire CSRF token and authenticate if necessary.
| request | The request to perform. |
| retry_if_auth_required | Internal use (for managing recursion). |


|
inline |

|
inline |

|
inline |

| Status Pandora::Communication::partnerAuthenticate | ( | ) |
Authenticate with Pandora.


Perform an API request.
| request | The request to perform. |
| Exceptions | thrown by message decoders. |


| Parsnip::Data Pandora::Communication::persist | ( | void | ) | const |
Persist communication settings.


| void Pandora::Communication::resetState | ( | ) |

| void Pandora::Communication::restore | ( | const Parsnip::Data & | data | ) |
Restore communication settings.
| data | A dictionary of previous settings from which to restore. |


|
inline |

|
inline |
|
private |
|
private |
|
private |
|
private |
User capabilities, retrieved from login response.
|
private |
|
private |
|
private |
Time until which communications are blocked/automatically fail.
|
private |
Partner authorization token, for JSON protocol.
|
private |
|
private |
|
private |
|
private |
|
private |
Number of failed transactions without successes.
|
private |
Time at which session expires from inactivity.
|
private |
|
private |
|
private |
Authorization token, retrieved during login.
|
private |