File indexing completed on 2024-05-12 05:22:15

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #pragma once
0010 
0011 #include "job.h"
0012 #include "kgapicore_export.h"
0013 
0014 namespace KGAPI2
0015 {
0016 
0017 /**
0018  * @headerfile deletejob.h
0019  * @brief Abstract superclass for all jobs that delete resources from Google
0020  *
0021  * @author Daniel Vrátil <dvratil@redhat.com>
0022  * @since 2.0
0023  */
0024 class KGAPICORE_EXPORT DeleteJob : public KGAPI2::Job
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     /**
0030      * Constructor for jobs that don't require authentication
0031      *
0032      * @param parent
0033      */
0034     explicit DeleteJob(QObject *parent = nullptr);
0035 
0036     /**
0037      * @brief Constructor for jobs that require authentication
0038      *
0039      * @param account Account to use to authenticate the requests sent by this job
0040      * @param parent
0041      */
0042     explicit DeleteJob(const KGAPI2::AccountPtr &account, QObject *parent = nullptr);
0043 
0044     /**
0045      * @brief Destructor
0046      */
0047     ~DeleteJob() override;
0048 
0049 protected:
0050     /**
0051      * @brief KGAPI::Job::dispatchRequest implementation
0052      *
0053      * @param accessManager
0054      * @param request
0055      * @param data
0056      * @param contentType
0057      */
0058     void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override;
0059 
0060     /**
0061      * KGAPI2::Job::handleReply implementation
0062      *
0063      * This implementation will automatically call start() again in order to
0064      * process another item in queue. Programmer should call emitFinished()
0065      * from start() if there are no further items to delete.
0066      *
0067      * If you need more control over deleting or handling the reply, you can
0068      * reimplement this method in your subclass.
0069      *
0070      * @param reply
0071      * @param rawData
0072      */
0073     void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
0074 
0075 private:
0076     class Private;
0077     Private *const d;
0078     friend class Private;
0079 };
0080 
0081 } // namespace KGAPI2