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

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 "deletejob.h"
0012 #include "kgapicalendar_export.h"
0013 
0014 #include <QScopedPointer>
0015 
0016 namespace KGAPI2
0017 {
0018 
0019 /**
0020  * @brief A job to delete one or more events from calendar in user's Google
0021  *        Calendar account.
0022  *
0023  * Note that operation is irreversible.
0024  *
0025  * @author Daniel Vrátil <dvratil@redhat.com>
0026  * @since 2.0
0027  */
0028 class KGAPICALENDAR_EXPORT EventDeleteJob : public KGAPI2::DeleteJob
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     /**
0034      * @brief Constructs a new job that will delete given @p event from a
0035      *        calendar with given @p calendarId
0036      *
0037      * @param event Event to delete
0038      * @param calendarId ID of calendar in which the event is stored
0039      * @param account Account to authenticate the request
0040      * @param parent
0041      */
0042     explicit EventDeleteJob(const EventPtr &event, const QString &calendarId, const AccountPtr &account, QObject *parent);
0043 
0044     /**
0045      * @brief Constructs a new job that will delete given @p events from a
0046      *        calendar with given @p calendarId
0047      *
0048      * @param events Events to delete
0049      * @param calendarId ID of calendar in which the event is stored
0050      * @param account Account to authenticate the request
0051      * @param parent
0052      */
0053     explicit EventDeleteJob(const EventsList &events, const QString &calendarId, const AccountPtr &account, QObject *parent);
0054 
0055     /**
0056      * @brief Constructs a new job that will delete an event with given
0057      *        @p eventId from a calendar with given @p calendarId
0058      *
0059      * @param eventId ID of event to delete
0060      * @param calendarId ID of calendar in which the events is stored
0061      * @param account Account to authenticate the request
0062      * @param parent
0063      */
0064     explicit EventDeleteJob(const QString &eventId, const QString &calendarId, const AccountPtr &account, QObject *parent);
0065 
0066     /**
0067      * @brief Constructs a new job that will delete all events with given
0068      *        @p eventsIds from a calendar with given @p calendarId
0069      *
0070      * @param eventIds IDs of events to delete
0071      * @param calendarId ID of calendar in which the events is stored
0072      * @param account Account to authenticate the request
0073      * @param parent
0074      */
0075     explicit EventDeleteJob(const QStringList &eventIds, const QString &calendarId, const AccountPtr &account, QObject *parent);
0076 
0077     /**
0078      * @brief Destructor
0079      */
0080     ~EventDeleteJob() override;
0081 
0082 protected:
0083     /**
0084      * @brief KGAPI2::Job::start implementation
0085      */
0086     void start() override;
0087 
0088     /**
0089      * @brief KGAPI2::Job::handleReply implementation
0090      *
0091      * @param reply
0092      * @param rawData
0093      */
0094     void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
0095 
0096 private:
0097     class Private;
0098     QScopedPointer<Private> const d;
0099     friend class Private;
0100 };
0101 
0102 } // namespace KGAPI2