
Public Member Functions | |
| WebService (const std::string &host="musicbrainz.org", const int port=80, const std::string &pathPrefix="/ws", const std::string &username=std::string(), const std::string &password=std::string(), const std::string &realm="musicbrainz.org") | |
| Constructor. | |
| virtual | ~WebService () |
| Destructor. | |
| void | setHost (const std::string &host) |
| Sets the host. | |
| std::string | getHost () const |
| Returns the host. | |
| void | setPort (const int port) |
| Sets the port. | |
| int | getPort () const |
| Returns the port. | |
| void | setPathPrefix (const std::string &pathPrefix) |
| Sets the path prefix. | |
| std::string | getPathPrefix () const |
| Returns the path prefix. | |
| void | setUserName (const std::string &username) |
| Sets the MusicBrainz user name. | |
| std::string | getUserName () const |
| Returns the MusicBrainz user name. | |
| void | setPassword (const std::string &password) |
| Sets the MusicBrainz user password. | |
| std::string | getPassword () const |
| Returns the MusicBrainz user password. | |
| void | setRealm (const std::string &realm) |
| Sets the HTTP authentification realm. | |
| std::string | getRealm () const |
| Returns the HTTP authentification realm. | |
| void | setProxyHost (const std::string &host) |
| Sets the proxy host. | |
| std::string | getProxyHost () const |
| Returns the proxy host. | |
| void | setProxyPort (const int port) |
| Sets the proxy port. | |
| int | getProxyPort () const |
| Returns the proxy port. | |
| void | setProxyUserName (const std::string &username) |
| Sets the proxy user name. | |
| std::string | getProxyUserName () const |
| Returns the proxy user name. | |
| void | setProxyPassword (const std::string &password) |
| Sets the proxy password. | |
| std::string | getProxyPassword () const |
| Returns the proxy password. | |
| std::string | get (const std::string &entity, const std::string &id, const IIncludes::IncludeList &include, const IFilter::ParameterList &filter, const std::string &version="1") |
| Query the web service via HTTP-GET. | |
| void | post (const std::string &entity, const std::string &id, const std::string &data, const std::string &version="1") |
| Send data to the web service via HTTP-POST. | |
By default, this class uses the MusicBrainz server but may be configured for accessing other servers as well using the constructor (WebService::WebService). This implements IWebService, so additional documentation on method parameters can be found there.
| MusicBrainz::WebService::WebService | ( | const std::string & | host = "musicbrainz.org", |
|
| const int | port = 80, |
|||
| const std::string & | pathPrefix = "/ws", |
|||
| const std::string & | username = std::string(), |
|||
| const std::string & | password = std::string(), |
|||
| const std::string & | realm = "musicbrainz.org" | |||
| ) |
Constructor.
This can be used without parameters. In this case, the MusicBrainz server will be used.
| host | a string containing a host name | |
| port | an integer containing a port number | |
| pathPrefix | a string prepended to all URLs | |
| username | a string containing a MusicBrainz user name | |
| password | a string containing the user's password | |
| realm | a string containing the realm used for authentication |
| virtual MusicBrainz::WebService::~WebService | ( | ) | [virtual] |
Destructor.
| void MusicBrainz::WebService::setHost | ( | const std::string & | host | ) |
Sets the host.
| host | a string containing the host name |
| std::string MusicBrainz::WebService::getHost | ( | ) | const |
Returns the host.
| void MusicBrainz::WebService::setPort | ( | const int | port | ) |
Sets the port.
| port | an int containing the port number |
| int MusicBrainz::WebService::getPort | ( | ) | const |
Returns the port.
| void MusicBrainz::WebService::setPathPrefix | ( | const std::string & | pathPrefix | ) |
Sets the path prefix.
| pathPrefix | a string containing the path prefix |
| std::string MusicBrainz::WebService::getPathPrefix | ( | ) | const |
Returns the path prefix.
| void MusicBrainz::WebService::setUserName | ( | const std::string & | username | ) |
| std::string MusicBrainz::WebService::getUserName | ( | ) | const |
| void MusicBrainz::WebService::setPassword | ( | const std::string & | password | ) |
| std::string MusicBrainz::WebService::getPassword | ( | ) | const |
| void MusicBrainz::WebService::setRealm | ( | const std::string & | realm | ) |
Sets the HTTP authentification realm.
| realm | a string containing the realm |
| std::string MusicBrainz::WebService::getRealm | ( | ) | const |
Returns the HTTP authentification realm.
| void MusicBrainz::WebService::setProxyHost | ( | const std::string & | host | ) |
Sets the proxy host.
| host | a string containing the host name |
| std::string MusicBrainz::WebService::getProxyHost | ( | ) | const |
Returns the proxy host.
| void MusicBrainz::WebService::setProxyPort | ( | const int | port | ) |
Sets the proxy port.
| port | an int containing the port number |
| int MusicBrainz::WebService::getProxyPort | ( | ) | const |
Returns the proxy port.
| void MusicBrainz::WebService::setProxyUserName | ( | const std::string & | username | ) |
Sets the proxy user name.
| username | a string containing the user name |
| std::string MusicBrainz::WebService::getProxyUserName | ( | ) | const |
Returns the proxy user name.
| void MusicBrainz::WebService::setProxyPassword | ( | const std::string & | password | ) |
Sets the proxy password.
| password | a string containing the password |
| std::string MusicBrainz::WebService::getProxyPassword | ( | ) | const |
Returns the proxy password.
| std::string MusicBrainz::WebService::get | ( | const std::string & | entity, | |
| const std::string & | id, | |||
| const IIncludes::IncludeList & | include, | |||
| const IFilter::ParameterList & | filter, | |||
| const std::string & | version = "1" | |||
| ) | [virtual] |
Query the web service via HTTP-GET.
Returns a string containing the result or raises a WebServiceError. Conditions leading to errors may be invalid entities, IDs, include or filter parameters and unsupported version numbers.
| ConnectionError | couldn't connect to server | |
| RequestError | invalid IDs or parameters | |
| AuthenticationError | invalid user name and/or password | |
| ResourceNotFoundError | resource doesn't exist |
Implements MusicBrainz::IWebService.
| void MusicBrainz::WebService::post | ( | const std::string & | entity, | |
| const std::string & | id, | |||
| const std::string & | data, | |||
| const std::string & | version = "1" | |||
| ) | [virtual] |
Send data to the web service via HTTP-POST.
Note that this may require authentication. You can set user name, password and realm in the constructor (WebService::WebService).
| ConnectionError | couldn't connect to server | |
| RequestError | invalid IDs or parameters | |
| AuthenticationError | invalid user name and/or password | |
| ResourceNotFoundError | resource doesn't exist |
Implements MusicBrainz::IWebService.
1.5.5