|
libfuoten 0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
|
#include <Fuoten/API/GetItems>
Properties | |
| int | batchSize |
| bool | getRead |
| qint64 | offset |
| bool | oldestFirst |
| qint64 | parentId |
| Fuoten::FuotenEnums::Type | type |
| 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 | |
| GetItems (int batchSize, qint64 offset, FuotenEnums::Type type, qint64 parentId, bool getRead, bool oldestFirst, QObject *parent=nullptr) | |
| GetItems (QObject *parent=nullptr) | |
| ~GetItems () override | |
| int | batchSize () const |
| Q_INVOKABLE void | execute () override |
| bool | getRead () const |
| qint64 | offset () const |
| bool | oldestFirst () const |
| qint64 | parentId () const |
| void | setBatchSize (int nBatchSize) |
| void | setGetRead (bool nGetRead) |
| void | setOffset (qint64 nOffset) |
| void | setOldestFirst (bool nOldestFirst) |
| void | setParentId (qint64 nParentId) |
| void | setType (FuotenEnums::Type nType) |
| FuotenEnums::Type | type () 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 |
Signals | |
| void | batchSizeChanged (int batchSize) |
| void | getReadChanged (bool getRead) |
| void | offsetChanged (qint64 offset) |
| void | oldestFirstChanged (bool oldestFirst) |
| void | parentIdChanged (qint64 parentId) |
| void | typeChanged (FuotenEnums::Type type) |
| 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 |
| 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 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) |
Requests items/articles from the News App API.
To request the items/articles, the Component::configuration property has to be set to a valid AbstractConfiguration object. After setting it, call execute() to perform the API request.
If a valid AbstractStorage object is set to the Component::storage property, AbstractStorage::itemsRequested will be called in the successCallback() to save the requested items in the local storage. If the request succeeded, the Component::succeeded() signal will be emitted, containing the JSON api reply.
If something failed, Component::failed() will be emitted and the Component::error property will contain a valid pointer to an Error object.
|
readwrite |
The number of items/articles that should be returned.
Defaults to -1, -1 returns all items. This property can not be changed while Component::inOperation() returns true.
| int | batchSize() const |
| void | setBatchSize(int nBatchSize) |
| void | batchSizeChanged(int batchSize) |
|
readwrite |
If true, it returns all items, false returns only unread items.
This property can not be changed while Component::inOperation() returns true.
| bool | getRead() const |
| void | setGetRead(bool nGetRead) |
| void | getReadChanged(bool getRead) |
|
readwrite |
Only return older (lower than equal that ID) items.
Defaults to 0. This property can not be changed while Component::inOperation() returns true.
| qint64 | offset() const |
| void | setOffset(qint64 nOffset) |
| void | offsetChanged(qint64 offset) |
|
readwrite |
If true, it reverses the sort order.
This property can not be changed while Component::inOperation() returns true.
| bool | oldestFirst() const |
| void | setOldestFirst(bool nOldestFirst) |
| void | oldestFirstChanged(bool oldestFirst) |
|
readwrite |
ID of the folder or feed, 0 for starred and all.
Defaults to 0. This property can not be changed while Component::inOperation() returns true.
| qint64 | parentId() const |
| void | setParentId(qint64 nParentId) |
| void | parentIdChanged(qint64 parentId) |
|
readwrite |
Type of the query.
Defines for which parent items/articles should be queried. Defaults to FuotenEnums::All.
true.| FuotenEnums::Type | type() const |
| void | setType(FuotenEnums::Type nType) |
| void | typeChanged(FuotenEnums::Type type) |
|
explicit |
Constructs an API request object with the given parent to query items from the remote server.
| GetItems | ( | int | batchSize, |
| qint64 | offset, | ||
| FuotenEnums::Type | type, | ||
| qint64 | parentId, | ||
| bool | getRead, | ||
| bool | oldestFirst, | ||
| QObject * | parent = nullptr ) |
Constructs an API request object with the given parameters and parent to query items from the remote server.
|
override |
Destroys the GetItems object.
| int batchSize | ( | ) | const |
Getter function for the batchSize property.
|
signal |
This is emitted if the value of the batchSize property changes.
|
overrideprotectedvirtual |
Checks for valid input values.
Will at first perfrom the checks from Component::checkInput() and will than check if the values of the properties are in valid ranges.
Reimplemented from Component.
|
overrideprotectedvirtual |
Checks for an items array in the JSON API reply.
Will at first perform the checks from Component::checkOutput() and will than check if the items array is present. Will not check if the array is empty.
Reimplemented from Component.
|
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.
| bool getRead | ( | ) | const |
Getter function for the getRead property.
|
signal |
This is emitted if the value of the getRead property changes.
| qint64 offset | ( | ) | const |
Getter function for the offset property.
|
signal |
This is emitted if the value of the offset property changes.
| bool oldestFirst | ( | ) | const |
Getter function for the oldestFirst property.
|
signal |
This is emitted if the value of the oldestFirst property changes.
| qint64 parentId | ( | ) | const |
Getter function for the parentId property.
|
signal |
This is emitted if the value of the parentId property changes.
| void setBatchSize | ( | int | nBatchSize | ) |
Setter function for the batchSize property. Emits the batchSizeChanged() signal if nBatchSize is not equal to the stored value.
| void setGetRead | ( | bool | nGetRead | ) |
Setter function for the getRead property. Emits the getReadChanged() signal if nGetRead is not equal to the stored value.
| void setOffset | ( | qint64 | nOffset | ) |
Setter function for the offset property. Emits the offsetChanged() signal if nOffset is not equal to the stored value.
| void setOldestFirst | ( | bool | nOldestFirst | ) |
Setter function for the oldestFirst property. Emits the oldestFirstChanged() signal if nOldestFirst is not equal to the stored value.
| void setParentId | ( | qint64 | nParentId | ) |
Setter function for the parentId property. Emits the parentIdChanged() signal if nParentId is not equal to the stored value.
| void setType | ( | FuotenEnums::Type | nType | ) |
Setter function for the type property. Emits the typeChanged() signal if nType is not equal to the stored value.
|
overrideprotectedvirtual |
Finishes the the operation if the request was successful.
If Component::storage points to a valid object, it will use AbstractStorage::itemsRequested() to store, update and delete the items in the local storage according to the server reply. Afterwards it will set Component::inOperation to false and will emit the Component::succeeded() signal.
Implements Component.
| FuotenEnums::Type type | ( | ) | const |
Getter function for the type property.
|
signal |
This is emitted if the value of the type property changes.