File indexing completed on 2024-05-12 05:22:16
0001 /* 0002 SPDX-FileCopyrightText: 2012 Andrius da Costa Ribas <andriusmao@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "kgapidrive_export.h" 0010 #include "object.h" 0011 #include "types.h" 0012 0013 #include <QString> 0014 #include <QUrl> 0015 0016 namespace KGAPI2 0017 { 0018 0019 namespace Drive 0020 { 0021 0022 /** 0023 * @brief Change contains the representation of a change to a file 0024 * 0025 * Getters and setters' documentation is based on Google Drive's API v2 reference 0026 * @see <a href="https://developers.google.com/drive/v2/reference/changes">Changes</a> 0027 * 0028 * @since 2.0 0029 * @author Andrius da Costa Ribas <andriusmao@gmail.com> 0030 * @author Daniel Vrátil <dvratil@redhat.com> 0031 */ 0032 class KGAPIDRIVE_EXPORT Change : public KGAPI2::Object 0033 { 0034 public: 0035 explicit Change(); 0036 explicit Change(const Change &other); 0037 ~Change() override; 0038 bool operator==(const Change &other) const; 0039 bool operator!=(const Change &other) const 0040 { 0041 return !operator==(other); 0042 } 0043 0044 /** 0045 * @brief Returns the id of the change. 0046 */ 0047 [[nodiscard]] qlonglong id() const; 0048 0049 /** 0050 * @brief Returns the id of the file associated with this change. 0051 */ 0052 [[nodiscard]] QString fileId() const; 0053 0054 /** 0055 * @brief Returns a link back to this change. 0056 */ 0057 [[nodiscard]] QUrl selfLink() const; 0058 0059 /** 0060 * Returns whether this file has been deleted. 0061 */ 0062 [[nodiscard]] bool deleted() const; 0063 0064 /** 0065 * @brief Returns the updated state of the file. 0066 * 0067 * Present if the file has not been deleted. 0068 */ 0069 [[nodiscard]] FilePtr file() const; 0070 0071 static ChangePtr fromJSON(const QByteArray &jsonData); 0072 static ChangesList fromJSONFeed(const QByteArray &jsonData, FeedData &feedData); 0073 0074 private: 0075 class Private; 0076 Private *const d; 0077 friend class Private; 0078 friend class File; 0079 }; 0080 0081 } /* namespace Drive */ 0082 0083 } /* namespace KGAPI2 */