|
libfuoten 0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
|
#include <Fuoten/API/GetServerStatus>
Public Types | |
| enum | SetupPossible { NotPossible = 0 , Manual = 1 , LoginFlow = 2 , LoginFlowV2 = 3 } |
| Public Types inherited from Component | |
| enum | ExpectedJSONType : quint8 { Empty = 0 , Array = 1 , Object = 2 } |
Properties | |
| QString | edition |
| bool | hasExtendedSupport |
| bool | isInMaintenance |
| bool | isInstalled |
| bool | needsDbUpgrade |
| QString | productname |
| Fuoten::GetServerStatus::SetupPossible | setupPossible |
| QString | versionString |
| Properties inherited from Component | |
| Fuoten::AbstractConfiguration * | configuration |
| Fuoten::Error * | error |
| bool | inOperation |
| Fuoten::AbstractNotificator * | notificator |
| quint16 | requestTimeout |
| Fuoten::AbstractStorage * | storage |
| bool | useStorage |
| Fuoten::WipeManager * | wipeManager |
Public Member Functions | |
| GetServerStatus (QObject *parent=nullptr) | |
| ~GetServerStatus () override | |
| Q_INVOKABLE int | compareVersion (const QString &versionString) const |
| int | compareVersion (const QVersionNumber &version) const |
| QString | edition () const |
| Q_INVOKABLE void | execute () override |
| bool | hasExtendedSupport () const |
| bool | isInMaintenance () const |
| bool | isInstalled () const |
| bool | needsDbUpgrade () const |
| QString | productname () const |
| Fuoten::GetServerStatus::SetupPossible | setupPossible () const |
| QVersionNumber | version () const |
| QString | versionString () const |
| Public Member Functions inherited from Component | |
| Component (QObject *parent=nullptr) | |
| ~Component () override | |
| AbstractConfiguration * | configuration () const |
| Error * | error () const |
| bool | inOperation () const |
| bool | isUseStorageEnabled () const |
| AbstractNotificator * | notificator () const |
| quint16 | requestTimeout () const |
| void | setConfiguration (AbstractConfiguration *nAbstractConfiguration) |
| void | setNotificator (AbstractNotificator *notificator) |
| void | setRequestTimeout (quint16 seconds) |
| void | setStorage (AbstractStorage *localStorage) |
| void | setUseStorage (bool useStorage) |
| void | setWipeManager (WipeManager *wipeManager) |
| AbstractStorage * | storage () const |
| WipeManager * | wipeManager () const |
Protected Member Functions | |
| void | successCallback () override |
| Protected Member Functions inherited from Component | |
| void | addRequestHeader (const QByteArray &headerName, const QByteArray &headerValue) |
| void | addRequestHeaders (const QHash< QByteArray, QByteArray > &headers) |
| virtual bool | checkInput () |
| virtual bool | checkOutput () |
| virtual void | extractError (QNetworkReply *reply) |
| QJsonDocument | jsonResult () const |
| void | notify (AbstractNotificator::Type type, QtMsgType severity, const QVariant &data) const |
| void | notify (const Error *e) const |
| QHash< QByteArray, QByteArray > | requestHeaders () const |
| void | sendRequest () |
| void | setApiRoute (const QString &route) |
| void | setApiRoute (const QStringList &routeParts) |
| void | setError (Error *nError) |
| void | setExpectedJSONType (ExpectedJSONType type) |
| void | setInOperation (bool nInOperation) |
| void | setNetworkOperation (QNetworkAccessManager::Operation operation) |
| void | setPayload (const QByteArray &payload) |
| void | setPayload (const QJsonObject &payload) |
| void | setRequestHeaders (const QHash< QByteArray, QByteArray > &headers) |
| void | setRequiresAuth (bool reqAuth) |
| void | setUrlQuery (const QUrlQuery &query) |
Additional Inherited Members | |
| Static Public Member Functions inherited from Component | |
| static AbstractConfiguration * | defaultConfiguration () |
| static AbstractNotificator * | defaultNotificator () |
| static AbstractStorage * | defaultStorage () |
| static WipeManager * | defaultWipeManager () |
| static AbstractNamFactory * | networkAccessManagerFactory () |
| static void | setDefaultConfiguration (AbstractConfiguration *config) |
| static void | setDefaultNotificator (AbstractNotificator *notificator) |
| static void | setDefaultStorage (AbstractStorage *storage) |
| static void | setDefaultWipeManager (WipeManager *wipeManager) |
| static void | setNetworkAccessManagerFactory (AbstractNamFactory *factory) |
Requests the server status from status.php.
This is not really part of the News App API but a helper class. It should be especially helpful to support the login flow. The request gets the information every Nextcloud server publicly exports via its status.php file. That returns a JSON object containing some helpful information about the Nextcloud instance like state of maintenance mode and current version.
The result is exposed to the appropriate properties of this class as well as QJsonDocument via the Component::succeeded() signal.
| enum SetupPossible |
This enum describes the setup possibility.
| Enumerator | |
|---|---|
| NotPossible | Setup is not possible, either the Nextcloud instance is not completely installed and/or it is in maintenance mode. |
| Manual | Only manual setup is possible. This means, that account setup via Login Flow is not possible. |
| LoginFlow | Login Flow setup is possible. |
| LoginFlowV2 | Login Flow v2 setup is possible. |
|
read |
This property holds the edition of the Nextcloud.
The default value is an empty string. It will be set in the successCallback().
| QString | edition() const |
| void | editionChanged(const QString &edition) |
|
read |
Returns true when the Nextcloud has extended support, otherwise false.
The default value is false. It will be set in the successCallback().
| bool | hasExtendedSupport() const |
| void | hasExtendedSupportChanged(bool hasExtendedSupport) |
|
read |
Returns true when the Nextcloud is in maintenance mode, otherwise false.
The default value is false. It will be set in the successCallback().
| bool | isInMaintenance() const |
| void | isInMaintenanceChanged(bool isInMaintenance) |
|
read |
Returns true when the Nextcloud is completely installed, otherwise false.
The default value is false. It will be set in the successCallback().
| bool | isInstalled() const |
| void | isInstalledChanged(bool isInstalled) |
|
read |
Returns true when the Nextcloud needs a database upgrade, otherwise false.
The default value is false. It will be set in the successCallback().
| bool | needsDbUpgrade() const |
| void | needsDbUpgradeChanged(bool needsDbUpgrade) |
|
read |
This property holds the product name of the Nextcloud.
The default value is an empty string. It will be set in the successCallback().
| QString | productname() const |
| void | productnameChanged(const QString &productname) |
|
read |
This property describes the possibility of setting up an account for the Nextcloud.
The default value is GetServerStatus::NotPossible. It will be set in the successCallback(). The value of this property will be calculated by the values of isInstalled(), isInMaintenance(), needsDbUpgrade() and version().
| GetServerStatus::SetupPossible | setupPossible() const |
| void | setupPossibleChanged(GetServerStatus::SetupPossible setupPossible) |
|
read |
This property holds the version of the Nextcloud as string.
The default value is an empty string. It will be set in the successCallback().
| QString | versionString() const |
| void | versionStringChanged(const QString &versionString) |
|
explicit |
Constructs a new GetServerStatus object with the given parent.
|
override |
Deconstructs the GetServerStatus object.
| int compareVersion | ( | const QString & | versionString | ) | const |
Compares versionString with the requested Nextcloud version.
Returns an integer less than, equal to, or greater than zero depending on wether the requested Nextcloud version is less than, equal to, or greater than versionString.
| int compareVersion | ( | const QVersionNumber & | version | ) | const |
Compares version with the requested Nextcloud version.
Returns an integer less than, equal to, or greater than zero depending on wether the requested Nextcloud version is less than, equal to, or greater than version.
| QString edition | ( | ) | const |
Returns the edition of the Nextcloud.
The default value is an empty string.
|
signal |
Emitted when the value of edition changes.
This signal will be triggered in the successCallback().
|
overridevirtual |
Executes the API request to get the server status.
Implements Component.
| bool hasExtendedSupport | ( | ) | const |
Returns true when the Nextcloud has extended support, otherwise false.
The default value is false. It will be set in the successCallback().
|
signal |
Emitted when the value of hasExtendedSupport changes.
This signal will be triggered in the successCallback().
| bool isInMaintenance | ( | ) | const |
Returns true when the Nextcloud is in maintenance mode, otherwise false.
The default value for this is false.
|
signal |
Emitted when the isInMaintenance values changes.
This signal will be triggered in the successCallback().
| bool isInstalled | ( | ) | const |
Returns true when the Nextcloud is completely installed, otherwise false.
The default value for this is false.
|
signal |
Emitted when the isInstalled value changes.
This signal will be triggered in the successCallback().
| bool needsDbUpgrade | ( | ) | const |
Returns true when the Nextcloud needs a database upgrade, otherwise false.
The default value for this is false.
|
signal |
Emitted when the needsDbUpgrade values changes.
This signal will be triggered in the successCallback().
| QString productname | ( | ) | const |
Returns the product name of the Nextcloud.
The default value is an empty string.
|
signal |
Emitted when the value of productname changes.
This signal will be triggered in the successCallback().
| Fuoten::GetServerStatus::SetupPossible setupPossible | ( | ) | const |
This property describes the possibility of setting up an account for the Nextcloud.
The default value is GetServerStatus::NotPossible. It will be set in the successCallback(). The value of this property will be calculated by the values of isInstalled(), isInMaintenance(), needsDbUpgrade() and version().
|
signal |
Emitted when the value of setupPossible changes.
This signal will be triggered in the successCallback().
|
overrideprotectedvirtual |
Extracts the server response and sets the property values.
Implements Component.
| QVersionNumber version | ( | ) | const |
Returns the version of the Nextcloud.
The default value is a null version.
|
signal |
Emitted when the value of version() changes.
This signal will be triggered in the successCallback().
| QString versionString | ( | ) | const |
Returns the version of the Nextcloud as a string.
The default value is an empty string.
|
signal |
Emitted when the value of versionString changes.
This signal will be triggered in the successCallback().