libfuoten 0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
Loading...
Searching...
No Matches
GetServerStatus Class Reference

#include <Fuoten/API/GetServerStatus>

Inheritance diagram for GetServerStatus:
Component

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::AbstractConfigurationconfiguration
Fuoten::Errorerror
bool inOperation
Fuoten::AbstractNotificatornotificator
quint16 requestTimeout
Fuoten::AbstractStoragestorage
bool useStorage
Fuoten::WipeManagerwipeManager

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
AbstractConfigurationconfiguration () const
Errorerror () const
bool inOperation () const
bool isUseStorageEnabled () const
AbstractNotificatornotificator () 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)
AbstractStoragestorage () const
WipeManagerwipeManager () const

Signals

void editionChanged (const QString &edition)
void hasExtendedSupportChanged (bool hasExtendedSupport)
void isInMaintenanceChanged (bool isInMaitenance)
void isInstalledChanged (bool isInstalled)
void needsDbUpgradeChanged (bool needsDbUpgrade)
void productnameChanged (const QString &productname)
void setupPossibleChanged (Fuoten::GetServerStatus::SetupPossible setupPossible)
void versionChanged (const QVersionNumber &version)
void versionStringChanged (const QString &versionString)
Signals inherited from Component
void configurationChanged (Fuoten::AbstractConfiguration *configuration)
void errorChanged (Fuoten::Error *error)
void failed (Fuoten::Error *error)
void inOperationChanged (bool inOperation)
void notificatorChanged (Fuoten::AbstractNotificator *notificator)
void requestTimeoutChanged (quint16 requestTimeout)
void sslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
void storageChanged (Fuoten::AbstractStorage *storage)
void succeeded (const QJsonDocument &result)
void useStorageChanged (bool useStorage)
void wipeManagerChanged (Fuoten::WipeManager *wipeManager)

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 AbstractConfigurationdefaultConfiguration ()
static AbstractNotificatordefaultNotificator ()
static AbstractStoragedefaultStorage ()
static WipeManagerdefaultWipeManager ()
static AbstractNamFactorynetworkAccessManagerFactory ()
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)

Detailed Description

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.

Since
0.8.0
Mandatory properties
Component::configuration
API route
Not part of the News App API, will directly call status.php in the root of your nextcloud installation
Method
GET

Member Enumeration Documentation

◆ 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.

Property Documentation

◆ edition

QString edition
read

This property holds the edition of the Nextcloud.

The default value is an empty string. It will be set in the successCallback().

Access functions:
QStringedition() const
Notifier signal:
voideditionChanged(const QString &edition)

◆ hasExtendedSupport

bool hasExtendedSupport
read

Returns true when the Nextcloud has extended support, otherwise false.

The default value is false. It will be set in the successCallback().

Access functions:
boolhasExtendedSupport() const
Notifier signal:
voidhasExtendedSupportChanged(bool hasExtendedSupport)

◆ isInMaintenance

bool isInMaintenance
read

Returns true when the Nextcloud is in maintenance mode, otherwise false.

The default value is false. It will be set in the successCallback().

Access functions:
boolisInMaintenance() const
Notifier signal:
voidisInMaintenanceChanged(bool isInMaintenance)

◆ isInstalled

bool isInstalled
read

Returns true when the Nextcloud is completely installed, otherwise false.

The default value is false. It will be set in the successCallback().

Access functions:
boolisInstalled() const
Notifier signal:
voidisInstalledChanged(bool isInstalled)

◆ needsDbUpgrade

bool needsDbUpgrade
read

Returns true when the Nextcloud needs a database upgrade, otherwise false.

The default value is false. It will be set in the successCallback().

Access functions:
boolneedsDbUpgrade() const
Notifier signal:
voidneedsDbUpgradeChanged(bool needsDbUpgrade)

◆ productname

QString productname
read

This property holds the product name of the Nextcloud.

The default value is an empty string. It will be set in the successCallback().

Note
The default product name of a Nextcloud is “Nextcloud“ but can be changed by the administrators, so do not rely on this value.
Access functions:
QStringproductname() const
Notifier signal:
voidproductnameChanged(const QString &productname)

◆ setupPossible

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().

Access functions:
GetServerStatus::SetupPossiblesetupPossible() const
Notifier signal:
voidsetupPossibleChanged(GetServerStatus::SetupPossible setupPossible)

◆ versionString

QString versionString
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().

Access functions:
QStringversionString() const
Notifier signal:
voidversionStringChanged(const QString &versionString)

Constructor & Destructor Documentation

◆ GetServerStatus()

GetServerStatus ( QObject * parent = nullptr)
explicit

Constructs a new GetServerStatus object with the given parent.

◆ ~GetServerStatus()

~GetServerStatus ( )
override

Deconstructs the GetServerStatus object.

Member Function Documentation

◆ compareVersion() [1/2]

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.

◆ compareVersion() [2/2]

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.

◆ edition()

QString edition ( ) const

Returns the edition of the Nextcloud.

The default value is an empty string.

See also
edition, editionChanged()

◆ editionChanged

void editionChanged ( const QString & edition)
signal

Emitted when the value of edition changes.

This signal will be triggered in the successCallback().

See also
edition, edition()

◆ execute()

void execute ( )
overridevirtual

Executes the API request to get the server status.

Implements Component.

◆ hasExtendedSupport()

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().

See also
hasExtendedSupport, hasExtendedSupportChanged()

◆ hasExtendedSupportChanged

void hasExtendedSupportChanged ( bool hasExtendedSupport)
signal

Emitted when the value of hasExtendedSupport changes.

This signal will be triggered in the successCallback().

See also
hasExtendedSupport, hasExtendedSupport()

◆ isInMaintenance()

bool isInMaintenance ( ) const

Returns true when the Nextcloud is in maintenance mode, otherwise false.

The default value for this is false.

See also
isInMaintenance, isInMaintenanceChanged()

◆ isInMaintenanceChanged

void isInMaintenanceChanged ( bool isInMaitenance)
signal

Emitted when the isInMaintenance values changes.

This signal will be triggered in the successCallback().

See also
isInMaitenance, isInMaintenance()

◆ isInstalled()

bool isInstalled ( ) const

Returns true when the Nextcloud is completely installed, otherwise false.

The default value for this is false.

See also
isInstalled, isInstalledChanged()

◆ isInstalledChanged

void isInstalledChanged ( bool isInstalled)
signal

Emitted when the isInstalled value changes.

This signal will be triggered in the successCallback().

See also
isInstalled, isInstalled()

◆ needsDbUpgrade()

bool needsDbUpgrade ( ) const

Returns true when the Nextcloud needs a database upgrade, otherwise false.

The default value for this is false.

See also
needsDbUpgrade, needsDbUpgradeChanged()

◆ needsDbUpgradeChanged

void needsDbUpgradeChanged ( bool needsDbUpgrade)
signal

Emitted when the needsDbUpgrade values changes.

This signal will be triggered in the successCallback().

See also
needsDbUpgrade, needsDbUpgrade()

◆ productname()

QString productname ( ) const

Returns the product name of the Nextcloud.

The default value is an empty string.

Note
The default product name of a Nextcloud is “Nextcloud“ but can be changed by the administrators, so do not rely on this value.
See also
productname, productnameChanged()

◆ productnameChanged

void productnameChanged ( const QString & productname)
signal

Emitted when the value of productname changes.

This signal will be triggered in the successCallback().

See also
productname, productname()

◆ setupPossible()

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().

See also
setupPossible, setupPossibleChanged()

◆ setupPossibleChanged

void setupPossibleChanged ( Fuoten::GetServerStatus::SetupPossible setupPossible)
signal

Emitted when the value of setupPossible changes.

This signal will be triggered in the successCallback().

See also
setupPossible, setupPossible()

◆ successCallback()

void successCallback ( )
overrideprotectedvirtual

Extracts the server response and sets the property values.

Implements Component.

◆ version()

QVersionNumber version ( ) const

Returns the version of the Nextcloud.

The default value is a null version.

See also
versionString(), versionChanged()

◆ versionChanged

void versionChanged ( const QVersionNumber & version)
signal

Emitted when the value of version() changes.

This signal will be triggered in the successCallback().

See also
version()

◆ versionString()

QString versionString ( ) const

Returns the version of the Nextcloud as a string.

The default value is an empty string.

See also
versionString, version(), versionStringChanged()

◆ versionStringChanged

void versionStringChanged ( const QString & versionString)
signal

Emitted when the value of versionString changes.

This signal will be triggered in the successCallback().

See also
versionString, versionString()