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

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