|
libfuoten 0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
|
#include <Fuoten/API/MarkFeedRead>
Properties | |
| qint64 | newestItemId |
| 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 | |
| MarkAllItemsRead (qint64 newestItemId, QObject *parent=nullptr) | |
| MarkAllItemsRead (QObject *parent=nullptr) | |
| ~MarkAllItemsRead () override | |
| Q_INVOKABLE void | execute () override |
| qint64 | newestItemId () const |
| void | setNewestItemId (qint64 nNewestItemId) |
| 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 |
Signals | |
| void | newestItemIdChanged (qint64 newestItemId) |
| void | succeeded (qint64 newestItemId) |
| 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 | checkInput () 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 | 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 | |
| Public Types inherited from Component | |
| enum | ExpectedJSONType : quint8 { Empty = 0 , Array = 1 , Object = 2 } |
| 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) |
Marks all articles as read on the News App server.
To mark all articles/items as read, you have to provide the newest/highest local available item ID to MarkAllItemsRead::newestItemId and you have to set a valid AbstractConfiguration derived class to Component::configuration to provide authentication credentials and server configuration. After setting the mandatory properties, call execute() to perform the API request.
If a valid AbstractStorage object is set to the Component::storage property, AbstractStorage::allItemsMarkedRead() will be called in the successCallback() to update the local storage. If the request succeeded, the MarkAllItemsRead::succeeded() signal will be emitted, containing the newestItemId. If something failed, the Component::failed() signal will be emitted and Component::error will contain a valid pointer to an Error object.
|
readwrite |
ID of the newest local available item/article.
This property can not be changed while Component::inOperation() returns true.
| qint64 | newestItemId() const |
| void | setNewestItemId(qint64 nNewestItemId) |
| void | newestItemIdChanged(qint64 newestItemId) |
|
explicit |
Constructs a new MarkAllItemsRead object with default values and the given parent.
|
explicit |
Constructs a new MarkAllItemsRead object with the given arguments and parent.
|
override |
Destroys the MarkAllItemsRead object.
|
overrideprotectedvirtual |
Will check for a valid newestItemId.
Will at first perform the checks of Component::checkInput(). Will than simply check if newestItemId is not lower or equal to 0.
Reimplemented from Component.
|
overridevirtual |
Executes the API request.
To perform a successful API request to mark all items/articles as read, MarkAllItemsRead::newestItemId has to be valid ID and there has to be an AbstractConfiguration object set to Component::configuration.
Execution will not run while Component::inOperation returns true and will itself set that property to true when the request starts.
Implements Component.
| qint64 newestItemId | ( | ) | const |
Getter function for the newestItemId property.
|
signal |
This is emitted if the value of the newestItemId property changes.
| void setNewestItemId | ( | qint64 | nNewestItemId | ) |
Setter function for the newestItemId property. Emits the newestItemIdChanged() signal if nNewestItemId is not equal to the stored value.
|
signal |
This signal is emitted if the request to mark all items as read was successful.
| newestItemId | ID of the newest/highest local available item |
|
overrideprotectedvirtual |
Finishes the item/article marking if the request was successful.
If Component::storage contains a valid pointer, the AbstractStorage::allItemsMarkedRead() slot will be called to update the local storage. After that the Component::inOperation property will be set to false and the succeeded() signal will be emitted.
Implements Component.