File indexing completed on 2024-05-12 05:22:21
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 "file.h" 0010 #include "kgapidrive_export.h" 0011 #include "object.h" 0012 #include "types.h" 0013 0014 #include <QString> 0015 #include <QUrl> 0016 0017 namespace KGAPI2 0018 { 0019 0020 namespace Drive 0021 { 0022 0023 /** 0024 * @brief ParentReference contains a reference to a file's parent. 0025 * 0026 * Getters and setters' documentation is based on Google Drive's API v2 reference 0027 * @see <a href="https://developers.google.com/drive/v2/reference/parents">Parents</a> 0028 * 0029 * @since 2.0 0030 * @author Andrius da Costa Ribas <andriusmao@gmail.com> 0031 * @author Daniel Vrátil <dvratil@redhat.com> 0032 */ 0033 class KGAPIDRIVE_EXPORT ParentReference : public KGAPI2::Object 0034 { 0035 public: 0036 explicit ParentReference(const QString &id); 0037 explicit ParentReference(const ParentReference &other); 0038 ~ParentReference() override; 0039 bool operator==(const ParentReference &other) const; 0040 bool operator!=(const ParentReference &other) const 0041 { 0042 return !operator==(other); 0043 } 0044 0045 /** 0046 * @brief Returns the id of the parent. 0047 */ 0048 [[nodiscard]] QString id() const; 0049 0050 /** 0051 * @brief Returns a link back to this reference. 0052 */ 0053 [[nodiscard]] QUrl selfLink() const; 0054 0055 /** 0056 * @brief Returns a link to the parent. 0057 */ 0058 [[nodiscard]] QUrl parentLink() const; 0059 0060 /** 0061 * @brief Returns whether or not the parent is the root folder. 0062 */ 0063 [[nodiscard]] bool isRoot() const; 0064 0065 static ParentReferencePtr fromJSON(const QByteArray &jsonData); 0066 static ParentReferencesList fromJSONFeed(const QByteArray &jsonData); 0067 static QByteArray toJSON(const ParentReferencePtr &reference); 0068 0069 private: 0070 class Private; 0071 Private *const d; 0072 friend class Private; 0073 friend class File; 0074 friend class File::Private; 0075 }; 0076 0077 } /* namespace Drive */ 0078 0079 } /* namespace KGAPI2 */