Front end to making requests against the Phoenix web services API.
More...
#include <Client.h>
|
typedef QList< QVariantMap > | QVariantMapList |
|
typedef QHash< QString, QString > | QStringHash |
|
|
void | validateSession () |
|
void | logIn (const QString &user, const QString &password) |
|
void | executeMethod (const QString &method, const QString &path, const QSharedPointer< QStringHash > params=QSharedPointer< QStringHash >(), const QSharedPointer< QByteArray > body=QSharedPointer< QByteArray >()) |
|
void | executeMethod (const QString &method, const QString &path, const QSharedPointer< QStringHash > params, const QVariantMap &body) |
|
void | executeMethod (const QString &method, const QString &path, const QSharedPointer< QStringHash > params, const QVariantMapList &body) |
|
Front end to making requests against the Phoenix web services API.
Destroy the client. Any open connections for updates will get automatically disconnected.
void hws::Client::addRequestConfig |
( |
QString |
key, |
|
|
QString |
value |
|
) |
| |
Creates a per-request configuration setting.
See the documentation for details, but this will apply the correct prefix to the key, and leave the value untouched.
- Parameters
-
key | The configuration key, e.g., P4PORT |
value | The 'raw' header value |
void hws::Client::executeMethod |
( |
const QString & |
method, |
|
|
const QString & |
path, |
|
|
const QSharedPointer< QStringHash > |
params = QSharedPointer<QStringHash>() , |
|
|
const QSharedPointer< QByteArray > |
body = QSharedPointer<QByteArray>() |
|
) |
| |
|
slot |
Execute a method of Helix Web Services.
- Parameters
-
method | An HTTP verb, e.g., "POST" |
path | The method path to use, e.g., '/helix_versioning_engine/v78/changes' |
params | Optional URL parameters to set |
body | Optional request body to use |
void hws::Client::executeMethod |
( |
const QString & |
method, |
|
|
const QString & |
path, |
|
|
const QSharedPointer< QStringHash > |
params, |
|
|
const QVariantMap & |
body |
|
) |
| |
|
slot |
Execute a method of Helix Web Services.
- Parameters
-
method | An HTTP verb, e.g., "POST" |
path | The method path to use, e.g., '/helix_versioning_engine/v78/changes' |
params | URL parameters to set (for no parameters, set to empty pointer) |
body | Request body set as a QVariantMap, will be serialized as JSON |
void hws::Client::executeMethod |
( |
const QString & |
method, |
|
|
const QString & |
path, |
|
|
const QSharedPointer< QStringHash > |
params, |
|
|
const QVariantMapList & |
body |
|
) |
| |
|
slot |
Execute a method of Helix Web Services.
- Parameters
-
method | An HTTP verb, e.g., "POST" |
path | The method path to use, e.g., '/helix_versioning_engine/v78/changes' |
params | URL parameters to set (for no parameters, set to empty pointer) |
body | Request body set as a list of QVariantMaps, will be serialized as JSON |
void hws::Client::executeMethodDone |
( |
RequestErrorPtr |
error, |
|
|
const QString & |
method, |
|
|
const QString & |
path, |
|
|
const QSharedPointer< QVariantMapList > |
body |
|
) |
| |
|
signal |
Main callback for most method calls to Helix Web Services.
If the error is set, the body is definitely null.
If no error occurred, you may have one or more values, depending on the method called.
- Parameters
-
error | If set, details on the problem. |
method | HTTP verb of the method run |
path | Subpath (without the prefix) of the method |
body | If the response included a body, we convert it from JSON to a list of hashes. |
bool hws::Client::hasSession |
( |
| ) |
const |
When true, this should have a session instance that was known to work at some point.
const QString & hws::Client::hwsPrefixPath |
( |
| ) |
const |
This is a leading path to almost every request in the system. It's configurable since some development environment setups don't have a nice way to handle creating DNS entries, which leads to services sometimes getting mounted locally under subpaths.
void hws::Client::ignoreSslErrors |
( |
bool |
ignore | ) |
|
Ignore SSL certificate errors in the connection.
This is required in situations where your certificate is self-signed or otherwise not valid.
void hws::Client::logIn |
( |
const QString & |
user, |
|
|
const QString & |
password |
|
) |
| |
|
slot |
This should attempt a login as the user and password to the url that's been configured on this client.
IMPORTANT: this will attempt to resolve the hostname of the client itself, which we'll use to generate a host locked ticket.
void hws::Client::logInDone |
( |
RequestErrorPtr |
error, |
|
|
SessionPtr |
session |
|
) |
| |
|
signal |
When the login request has resolved this is called.
Authentication errors will result in no session being created.
void hws::Client::setHWSPrefixPath |
( |
const QString & |
path | ) |
|
This is a leading path to almost every request in the system. It's configurable since some development environment setups don't have a nice way to handle creating DNS entries, which leads to services sometimes getting mounted locally under subpaths.
void hws::Client::setSession |
( |
const Session & |
session | ) |
|
If you have stored a previously used session, you can just assign it to this client instance.
const QSharedPointer<QSettings> hws::Client::settings |
( |
| ) |
const |
Returns the current settings handle for the client. If it exists, The settings will store the session data by URL under a particular key.
const QString& hws::Client::settingsKey |
( |
| ) |
const |
All stored sessions are saved as a JSON object under this settings key, which is defaulted to "HelixWebServicesSettings".
This should be set on construction only.
void hws::Client::validateSession |
( |
| ) |
|
|
slot |
Trigger a remote call to the web services instance to validate that the session (and ticket) is still valid.
Even if this client has no session, we'll still double check that we can call back to the server.
void hws::Client::validateSessionDone |
( |
RequestErrorPtr |
error | ) |
|
|
signal |
Callback after validating a session.
The error value indicates a networking or remote system problem.
If the session is invalid, the error will not be set. Instead, you should double check the output of client.hasSession()
. If that is false, you'll need to sign in again.
At this point, if the session is invalid, it will be cleared from any QSettings cachce as well, if the client was initialized with a settings handle.
The documentation for this class was generated from the following files: