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

#include <Fuoten/API/GetStatus>

Inheritance diagram for GetStatus:
Component

Properties

bool impropertyConfiguredCron
bool incorrectDbCharset
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

 GetStatus (QObject *parent=nullptr)
 ~GetStatus () override
Q_INVOKABLE void execute () override
bool improperlyConfiguredCron () const
bool incorrectDbCharset () 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 improperlyConfiguredCronChanged (bool improperlyConfiguredCron)
void incorrectDbCharsetChanged (bool incorrectDbCharset)
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

bool checkOutput () override
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 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

Public Types inherited from Component
enum  ExpectedJSONType : quint8 { Empty = 0 , Array = 1 , Object = 2 }
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 status from the News App.

The status reply will contain the News App version number and possible warnings about improperly configurations. To request the status, set the configuration property and call execute().

The requested data will be stored in the versionString, improperlyConfiguredCron and incorrectDbCharset properties. You can get the raw JSON response from the Component::succeeded() signal. If the request failed for some reason, Component::failed() will be emitted and the Component::inOperation property will contain a valid pointer to an Error object.

Mandatory properties
Component::configuration
API route
/status
Method
GET

Property Documentation

◆ impropertyConfiguredCron

bool impropertyConfiguredCron
read

Returns true when the Nextcloud News app will fail to update the feed correctly, otherwise false.

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

Since
0.8.0
Access functions:
boolimpropertyConfiguredCron() const
Notifier signal:
voidimproperlyConfiguredCronChanged(bool impropertyConfiguredCron)

◆ incorrectDbCharset

bool incorrectDbCharset
read

Returns true when the database charset of the Nextcloud News app is set up incorrectly, otherwise false.

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

Since
0.8.0
Access functions:
boolincorrectDbCharset() const
Notifier signal:
voidincorrectDbCharsetChanged(bool incorrectDbCharset)

◆ versionString

QString versionString
read

This property holds the version of the Nextcoud News app as a string.

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

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

Constructor & Destructor Documentation

◆ GetStatus()

GetStatus ( QObject * parent = nullptr)
explicit

Constructs an API request object with the given parent to query the status from the remote server.

◆ ~GetStatus()

~GetStatus ( )
override

Destroys the GetStatus object.

Member Function Documentation

◆ checkOutput()

bool checkOutput ( )
overrideprotectedvirtual

Checks if version and warnings are present in the JSON reply.

Will at first perform the checks from Component::checkOutput().

Reimplemented from Component.

◆ execute()

void execute ( )
overridevirtual

Executes the API request.

To perform a successful API request, Component::configuration has to be set to a valid AbstractConfiguration object.

Execution will not run if Component::inOperation returns true and will itself set that property to true when start to perform the request.

Implements Component.

◆ improperlyConfiguredCron()

bool improperlyConfiguredCron ( ) const

Returns true if the webapp will fail to update the feed correctly.

Since
0.8.0
See also
improperlyConfiguredCron, improperlyConfiguredCronChanged()

◆ improperlyConfiguredCronChanged

void improperlyConfiguredCronChanged ( bool improperlyConfiguredCron)
signal

Emitted when the improperlyConfiguredCron value changed.

This signal will be triggered in the successCallback().

Since
0.8.0
See also
improperlyConfiguredCron, improperlyConfiguredCron()

◆ incorrectDbCharset()

bool incorrectDbCharset ( ) const

Returns true if the database charset is set up incorrectly.

Since
0.8.0
See also
incorrectDbCharset, incorrectDbCharsetChanged()

◆ incorrectDbCharsetChanged

void incorrectDbCharsetChanged ( bool incorrectDbCharset)
signal

Emitted when the incorrectDbCharset value changed.

This signal will be triggered in the successCallback().

Since
0.8.0
See also
incorrectDbCharset, incorrectDbCharset()

◆ successCallback()

void successCallback ( )
overrideprotectedvirtual

Finishes the status request if it was successful.

Will set the versionString, improperlyConfiguredCron and incorrectDbCharset properties. Afterwards it willset Component::inOperation to false and emits the Component::succeeded() signal.

Implements Component.

◆ versionString()

QString versionString ( ) const

Returns the version of the Nextcloud News app as a string.

The default value is an empty string.

Since
0.8.0
See also
versionString, versionStringChanged()

◆ versionStringChanged

void versionStringChanged ( const QString & versionString)
signal

Emitted when the versionString value changed.

This signal will be triggered in the successCallback().

Since
0.8.0
See also
versionString, versionString()