libfuoten 0.8.2
Qt based library to access the Nextcloud News App API.
Loading...
Searching...
No Matches
Fuoten::RenameFeed Class Reference

Renames a feed on the News App server. More...

#include <Fuoten/API/RenameFolder>

Inheritance diagram for Fuoten::RenameFeed:
Fuoten::Component QObject

Properties

qint64 feedId
 The ID of the feed that should be renamed.
QString newName
 The new name for the feed.
Properties inherited from Fuoten::Component
Fuoten::AbstractConfigurationconfiguration
 Pointer to an AbstractConfiguration derived object.
Fuoten::Errorerror
 Pointer to an error object, if any error occurred.
bool inOperation
 Returns true while the request is in operation.
Fuoten::AbstractNotificatornotificator
 Pointer to an object derived from AbstractNotificator.
quint16 requestTimeout
 Timeout in seconds for network requests.
Fuoten::AbstractStoragestorage
 Pointer to an AbstractStorage derived object.
bool useStorage
 If true (the default), a local storage should be used in the successCallback() function to further process the request results.
Fuoten::WipeManagerwipeManager
 Pointer to a WipeManager to handle remote wipe requests.

Public Member Functions

 RenameFeed (QObject *parent=nullptr)
 Constructs an API request object with the given parent to rename a feed on the remote server.
 ~RenameFeed () override
 Destroys the RenameFeed object.
Q_INVOKABLE void execute () override
 Executes the API request.
qint64 feedId () const
 Returns the ID of the feed that should be renamed.
QString newName () const
 Returns the new name for the feed.
void setFeedId (qint64 nFeedId)
 Sets the ID of the feed that should be renamed.
void setNewName (const QString &nNewName)
 Sets the new name for the feed.
Public Member Functions inherited from Fuoten::Component
 Component (QObject *parent=nullptr)
 Constructs a component with the given parent.
 ~Component () override
 Destroys the Component object.
AbstractConfigurationconfiguration () const
 Returns a pointer to the AbstractConfiguration that is currently set.
Errorerror () const
 Returns a pointer to an Error object, if any error occurred.
bool inOperation () const
 Returns true while the API request is running.
bool isUseStorageEnabled () const
 Getter function for the useStorage property.
AbstractNotificatornotificator () const
 Getter function for the notificator property.
quint16 requestTimeout () const
 Returns the currently set request timeout.
void setConfiguration (AbstractConfiguration *nAbstractConfiguration)
 Sets a pointer to a AbstractConfiguration to use for the API request.
void setNotificator (AbstractNotificator *notificator)
 Setter function for the notificator property.
void setRequestTimeout (quint16 seconds)
 Sets the timeout for the API request in seconds.
void setStorage (AbstractStorage *localStorage)
 Setter function for the storage property.
void setUseStorage (bool useStorage)
 Setter function for the useStorage property.
void setWipeManager (WipeManager *wipeManager)
 Setter function for the wipeManager property.
AbstractStoragestorage () const
 Getter function for the storage property.
WipeManagerwipeManager () const
 Getter function for the wipeManager property.

Signals

void feedIdChanged (qint64 feedId)
 This signal is emitted if the feedId property changes.
void newNameChanged (const QString &newName)
 This signal is emitted if the newName property changes.
void succeeded (qint64 id, const QString &newName)
 Will be emitted when the request was successful.
Signals inherited from Fuoten::Component
void configurationChanged (Fuoten::AbstractConfiguration *configuration)
 This signal is emitted when the pointer to the AbstractConfiguration object changes.
void errorChanged (Fuoten::Error *error)
 This signal is emitted when the pointer to the Error object changes. error will be a nullptr if no error occurred or the current error has been reset.
void failed (Fuoten::Error *error)
 Emit this signal in a subclass when the request failed for some reason.
void inOperationChanged (bool inOperation)
 This signal is emitted when the in operation status changes.
void notificatorChanged (Fuoten::AbstractNotificator *notificator)
 Notifier signal for the notificator property.
void requestTimeoutChanged (quint16 requestTimeout)
 This signal is emitte when the timeout for the request changes.
void sslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 This signal is emitted if the SSL/TLS session encountered errors during the set up.
void storageChanged (Fuoten::AbstractStorage *storage)
 Notifier signal for the storage property.
void succeeded (const QJsonDocument &result)
 Emit this signal in a subclass when the request was successful.
void useStorageChanged (bool useStorage)
 Notifier signal for the useStorage property.
void wipeManagerChanged (Fuoten::WipeManager *wipeManager)
 Notifier signal for the wipeManager property.

Protected Member Functions

bool checkInput () override
 Checks for valid feedId and newName properties.
void extractError (QNetworkReply *reply) override
 Extracts possible errors replied by the News App API.
void successCallback () override
 Finishes the renaming if it was successful.
Protected Member Functions inherited from Fuoten::Component
void addRequestHeader (const QByteArray &headerName, const QByteArray &headerValue)
 Adds a header to the HTTP request.
void addRequestHeaders (const QHash< QByteArray, QByteArray > &headers)
 Adds headers to the HTTP request.
virtual bool checkOutput ()
 Performs basic output checks.
QJsonDocument jsonResult () const
 Returns the JSON result document.
void notify (AbstractNotificator::Type type, QtMsgType severity, const QVariant &data) const
 Checks if a notificator has been set and will use it to notify the user.
void notify (const Error *e) const
 Checks if a notificator has been set and will use it to notify about an occured error.
QHash< QByteArray, QByteArrayrequestHeaders () const
 Returns the currently set HTTP headers for the request.
void sendRequest ()
 Sends the request to the server.
void setApiRoute (const QString &route)
 Sets the API route.
void setApiRoute (const QStringList &routeParts)
 Sets the API route constructed from a route part list.
void setError (Error *nError)
 Sets the pointer of the error property.
void setExpectedJSONType (ExpectedJSONType type)
 Sets the expected JSON type for initial output check.
void setInOperation (bool nInOperation)
 Sets the value of the inOperation property.
void setNetworkOperation (QNetworkAccessManager::Operation operation)
 Sets the operation the network manager should perform for this call.
void setPayload (const QByteArray &payload)
 Sets the payload for the request.
void setPayload (const QJsonObject &payload)
 Sets the payload for the request.
void setRequestHeaders (const QHash< QByteArray, QByteArray > &headers)
 Sets the headers to use for the HTTP request.
void setRequiresAuth (bool reqAuth)
 Set this to true if the request requires authentication.
void setUrlQuery (const QUrlQuery &query)
 Sets the URL query for the request.

Additional Inherited Members

Public Types inherited from Fuoten::Component
enum  ExpectedJSONType : quint8 { Empty = 0 , Array = 1 , Object = 2 }
 Defines the expected JSON type. More...
Static Public Member Functions inherited from Fuoten::Component
static AbstractConfigurationdefaultConfiguration ()
 Returns the global default configuration.
static QNetworkAccessManagerdefaultNam ()
 Returns the global network access manager.
static AbstractNotificatordefaultNotificator ()
 Returns the global default notificator.
static AbstractStoragedefaultStorage ()
 Returns the global default storage.
static WipeManagerdefaultWipeManager ()
 Returns the global default wipe manager.
static AbstractNamFactorynetworkAccessManagerFactory ()
 Returns the currently set network access manager factory.
static void setDefaultConfiguration (AbstractConfiguration *config)
 Sets the global default configuration.
static void setDefaultNam (QNetworkAccessManager *nam)
 Sets the global default network access manager.
static void setDefaultNotificator (AbstractNotificator *notificator)
 Sets the global default notificator.
static void setDefaultStorage (AbstractStorage *storage)
 Sets the global default storage.
static void setDefaultWipeManager (WipeManager *wipeManager)
 Sets the global default wipe manager.
static void setNetworkAccessManagerFactory (AbstractNamFactory *factory)
 Sets the network access manager factory. The factory will be used to create QNetworkAccessManager objects on demand. If no factory is set, a default QNetworkAccessManager object will be created. The Component class will take ownership of the created QNetworkAccessManager.

Detailed Description

Renames a feed on the News App server.

To rename a feed, set the RenameFeed::feedId and RenameFeed::newName as well as the Component::configuration property. Optionally set the Component::storage property to save the renamed folder. After setting the mandatory properties, call execute() to perform the API request.

If an AbstractStorage object is present, AbstractStorage::feedRenamed() will be used in the successCallback() to save the new feed name. If the request succeeded, the RenameFeed::succeeded() signal will be emitted. If something failed, the Component::failed() signal will be emitted and Component::error will contain a valid pointer to an Error object.

Mandatory properties
RenamFeed::folderId, RenameFeed::newName
API route
/feeds/{feedId}/rename
Method
PUT

Property Documentation

◆ feedId

qint64 Fuoten::RenameFeed::feedId
readwrite

The ID of the feed that should be renamed.

Access functions:
qint64feedId() const
voidsetFeedId(qint64 nFeedId)
Notifier signal:
voidfeedIdChanged(qint64 feedId)

◆ newName

QString Fuoten::RenameFeed::newName
readwrite

The new name for the feed.

Access functions:
QStringnewName() const
voidsetNewName(const QString &nNewName)
Notifier signal:
voidnewNameChanged(const QString &newName)

Constructor & Destructor Documentation

◆ RenameFeed()

RenameFeed::RenameFeed ( QObject * parent = nullptr)
explicit

Constructs an API request object with the given parent to rename a feed on the remote server.

◆ ~RenameFeed()

RenameFeed::~RenameFeed ( )
override

Destroys the RenameFeed object.

Member Function Documentation

◆ checkInput()

bool RenameFeed::checkInput ( )
overrideprotectedvirtual

Checks for valid feedId and newName properties.

Will at first perform the checks from Component::checkInput() and will than check if RenameFeed::feedId is greater than zero and RenameFeed::newName is not empty.

Reimplemented from Fuoten::Component.

◆ execute()

void RenameFeed::execute ( )
overridevirtual

Executes the API request.

To perform a successful API request, RenameFeed::feedId and RenameFeed::newName have to be valid.

Execution will not run while Component::inOperation returns true and will itself set that property to true when the request starts.

Implements Fuoten::Component.

◆ extractError()

void RenameFeed::extractError ( QNetworkReply * reply)
overrideprotectedvirtual

Extracts possible errors replied by the News App API.

Reimplemented from Fuoten::Component.

◆ feedId()

qint64 RenameFeed::feedId ( ) const

Returns the ID of the feed that should be renamed.

See also
feedId

◆ feedIdChanged

void Fuoten::RenameFeed::feedIdChanged ( qint64 feedId)
signal

This signal is emitted if the feedId property changes.

Parameters
feedIdthe ID of the feed to change the name
See also
feedId

◆ newName()

QString RenameFeed::newName ( ) const

Returns the new name for the feed.

See also
newName

◆ newNameChanged

void Fuoten::RenameFeed::newNameChanged ( const QString & newName)
signal

This signal is emitted if the newName property changes.

Parameters
newNamethe new name for the feed
See also
newName

◆ setFeedId()

void RenameFeed::setFeedId ( qint64 nFeedId)

Sets the ID of the feed that should be renamed.

Parameters
nFeedIdID of the feed
See also
feedId

◆ setNewName()

void RenameFeed::setNewName ( const QString & nNewName)

Sets the new name for the feed.

Parameters
nNewNamethe new name for the feed \ſa newName

◆ succeeded

void Fuoten::RenameFeed::succeeded ( qint64 id,
const QString & newName )
signal

Will be emitted when the request was successful.

Will contain the ID of the renamed folder as well as the new name.

Parameters
idthe ID of the feed that has changed the name
newNamethe new name for the feed
See also
Component::failed()

◆ successCallback()

void RenameFeed::successCallback ( )
overrideprotectedvirtual

Finishes the renaming if it was successful.

If Component::storage points to a valid object, it will use AbstractStorage::feedRenamed() to store the renamed feed. Afterwards it will set Component::inOperation to false and will emit the RenameFeed::succeeded() signal.

Implements Fuoten::Component.


The documentation for this class was generated from the following files:
  • Fuoten/API/renamefeed.h
  • build/Fuoten/FuotenQt5_autogen/include/moc_renamefeed.cpp
  • Fuoten/API/renamefeed.cpp