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

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 "kgapitasks_export.h"
0012 #include "modifyjob.h"
0013 
0014 #include <QScopedPointer>
0015 
0016 namespace KGAPI2
0017 {
0018 
0019 /**
0020  * @brief A job to modify tasks in a tasklist in user's Google Tasks account.
0021  *
0022  * @author Daniel Vrátil <dvratil@redhat.com>
0023  * @since 2.0
0024  */
0025 class KGAPITASKS_EXPORT TaskModifyJob : public KGAPI2::ModifyJob
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     /**
0031      * @brief Constructs a job that will write changes in given @p task to
0032      *        corresponding task in a tasklist with given @p taskListId
0033      *
0034      * @param task Task to modify
0035      * @param taskListId ID of tasklist where the event is stored
0036      * @param account Account to authenticate the request
0037      * @param parent
0038      */
0039     explicit TaskModifyJob(const TaskPtr &task, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr);
0040 
0041     /**
0042      * @brief Constructs a job that will write changes in given @p tasks to
0043      *        corresponding tasks in tasklist with given @p taskListId
0044      *
0045      * @param tasks Tasks to modify
0046      * @param taskListId ID of tasklist where the event is stored
0047      * @param account Account to authenticate the request
0048      * @param parent
0049      */
0050     explicit TaskModifyJob(const TasksList &tasks, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr);
0051 
0052     /**
0053      * @brief Destructor
0054      */
0055     ~TaskModifyJob() override;
0056 
0057 protected:
0058     /**
0059      * @brief KGAPI2::Job::start implementation
0060      */
0061     void start() override;
0062 
0063     /**
0064      * @brief KGAPI2::ModifyJob::handleReplyWithItems implementation
0065      *
0066      * @param reply
0067      * @param rawData
0068      */
0069     ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
0070 
0071 private:
0072     class Private;
0073     QScopedPointer<Private> const d;
0074     friend class Private;
0075 };
0076 
0077 } // namespace KGAPI2