File indexing completed on 2024-05-12 05:22:17
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 ChildReference contains a reference to a folder's child. 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/children">Children</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 ChildReference : public KGAPI2::Object 0033 { 0034 public: 0035 explicit ChildReference(const QString &id); 0036 explicit ChildReference(const ChildReference &other); 0037 ~ChildReference() override; 0038 bool operator==(const ChildReference &other) const; 0039 bool operator!=(const ChildReference &other) const 0040 { 0041 return !operator==(other); 0042 } 0043 0044 /** 0045 * @brief Returns the id of the child. 0046 */ 0047 [[nodiscard]] QString id() const; 0048 0049 /** 0050 * @brief Returns a link back to this reference. 0051 */ 0052 [[nodiscard]] QUrl selfLink() const; 0053 0054 /** 0055 * @brief Returns a link to the child. 0056 */ 0057 [[nodiscard]] QUrl childLink() const; 0058 0059 static ChildReferencePtr fromJSON(const QByteArray &jsonData); 0060 static ChildReferencesList fromJSONFeed(const QByteArray &jsonData, FeedData &feedData); 0061 static QByteArray toJSON(const ChildReferencePtr &reference); 0062 0063 private: 0064 class Private; 0065 Private *const d; 0066 friend class Private; 0067 }; 0068 0069 } /* namespace Drive */ 0070 0071 } /* namespace KGAPI2 */