==== Qt SDK for Phoenix Services The Qt SDK for Phoenix Services provides source libraries for manipulating project metadata and notifications for Phoenix projects. ===== Basic usage The primary interface for Phoenix services involves the `PhoenixServicesClient`, which contains the main methods that interact with the server. Subsequently, using this API usually starts by attaching slots up to the main signals of this interface, then starting interaction. #include <phoenix.h>; using namespace phoenix; PhoenixServicesClient client; // Each client should be tied to a particular Perforce Web Services instance. client.setUrl("http://p4_web_services.mycompany.com"); connect(client, &PhoenixServicesClient::logInDone, myObj, &MyObj::logInDone); connect(client, &PhoenixServicesClient::fetchProjectsDone, myObj, &MyObj::fetchProjectsDone); connect(client, &PhoenixServicesClient::fetchProjectDone, myObj, &MyObj::fetchProjectDone); connect(client, &PhoenixServicesClient::createProjectDone, myObj, &MyObj::createProjectDone); client.logIn("myuser", "mypassword"); void MyObj::logInDone(RequestErrorPtr err, SessionPtr session) { // You should probably check for errors, and probably cache the session // here so you don't have to re-log in // Load all projects just for a fun starting point client.fetchProjects(); } void MyObj::fetchProjectsDone(RequestErrorPtr err, PhoenixProjectListPtr projects) { qDebug() << "I have " << projects->size(); << " projects"; } Each PhoenixServicesClient instance requires a Session. A session can be created by calling the `PhoenixServicesClient::logIn` method, which will then store the session locally. (That Session instance can be stored locally and then, instead of calling `PhoenixServicesClient::logIn, you call PhoenixServicesClient.setSession.) This session will be valid as long as the underlying Perforce server ticket allows. If you start to receive authentication errors, your client will have to log in again, and restore a new session. Authentication errors are returned with the code `RequestError::AUTHENTICATION_ERROR` of any `RequestError` returned by pretty much any server call. ===== `PhoenixServicesClient` Reference ====== Methods [cols='2*',options='header'] |=== | Method | Description | `bool hasSession() const` | When `true`, the client has an associated Session object, which it will use on the next slot call to the web server. Does not guarantee that the session has not expired. | `const QString & phoenixPrefixPath() const` | In some cases, you might have a special prefix where the Phoenix Web Services are deployed on the client, in which case you'd need to configure this path. | `const Session & session() const` | Returns the current Session instance. This might be an empty session that has no actual token values set, if you have not logged in or just set the session directly. | `void setPhoenixPrefixPath(const QString & path)` | Set the prefix path to the Phoenix web services instance. This is typically not needed, unless you mount the services to a different path on the server. Defaults to `/p4_phoenix_services/v1`. | `void setSession(const Session & session)` | Set the session instance on the client. Really only needs to be done when not using `logIn` to create the session. If you're calling `logIn`, this will be set automatically when successful. | `void setUrl(const QUrl & url)` | Set the Perforce Web Service URL. | `const QUrl & url() const` | The Perforce web services URL we should connect to. Should be set before making any request. |=== Slots Slot Description void createProject(const PhoenixProject & project) Requests a new project be created on the server. At the moment, only the name property of the project should be set. The phoenix web services instance will decide other defaults as necessary. void fetchProject(const QString & id) Requests a single project from the server, based on it's id. This will likely include filtering in the future, when we've defined the workflow better. void fetchProjects() Requests the complete list of Phoenix projects to the server. This will likely include filtering in the future, when we've defined the workflow better. void logIn(const QString & user, const QString & password) Will attempt to log in as the user and password to the Perforce web services instance (configured as the URL property of the client). If successful, calls the logInDone signal, and, caches the Session instance locally. Signals Signal Description void createProjectDone(RequestErrorPtr error, PhoenixProjectPtr project) When successful, error will be null, and the project should actually be expanded to include any default settings, such as the id, which should generally be a unique string for the project, and the Phoenix extensions on the project model, including the underlying p4d connection URL. void fetchProjectDone(RequestErrorPtr error, PhoenixProjectPtr project) Called on completion or failure offetchProject(id). If there's any problem, error will not be null, and you should not use theproject. void fetchProjectsDone(RequestErrorPtr error, PhoenixProjectListPtr projects) Called on completion or failure offetchProjects(). If there's any problem, error will not be null, and you should not use theprojects. void logInDone(RequestErrorPtr error, SessionPtr session) Called on success or failure of the logIn(user, password) slot. If there's any problem, error will not be null, and you should not use thesession.
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 14030 | tjuricek | Remove 'phoenix' reference in doc names | ||
#5 | 14025 | tjuricek |
Revise Qt SDK to a single 'helix_web_services_client' project. Most references to "Phoenix" have now been removed. Additionally, this is more similar to the other platform client SDKs in Ruby and JavaScript. Documentation via Doxygen is now available, and will be how much of the SDK reference should occur. |
||
#4 | 14002 | tjuricek | Some preliminary API documentation for the JavaScript SDK. | ||
#3 | 13614 | tjuricek | Update the Qt guide to include the QSettings* constructor. | ||
#2 | 13612 | tjuricek | Update deployment guide, switch built documentation to asciidoc, remove unused packaging script for p4_web_api | ||
#1 | 13555 | tjuricek |
Starting Asciidoc conversion of documentation. Removed the "Shared Quality" document, that basically is online now at: https://confluence.perforce.com:8443/display/PWS/Quality+Assurance Adding some topology graphviz images used for online documentation. |