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

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
0003  * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only
0006  * SPDX-License-Identifier: LGPL-3.0-only
0007  * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
0008  */
0009 
0010 #pragma once
0011 
0012 #include <QSharedDataPointer>
0013 #include "kgapipeople_export.h"
0014 
0015 #include <QString>
0016 
0017 #include <optional>
0018 
0019 class QJsonArray;
0020 class QJsonObject;
0021 class QJsonValue;
0022 
0023 namespace KGAPI2::People
0024 {
0025 class FieldMetadata;
0026 
0027 /**
0028  * Arbitrary user data that is populated by the end users.
0029  *
0030  * @see https://developers.google.com/people/api/rest/v1/people#userdefined
0031  * @since 5.23.0
0032  **/
0033 class KGAPIPEOPLE_EXPORT UserDefined
0034 {
0035 public:
0036     /** Constructs a new UserDefined **/
0037     explicit UserDefined();
0038     UserDefined(const UserDefined &);
0039     UserDefined(UserDefined &&) noexcept;
0040     UserDefined &operator=(const UserDefined &);
0041     UserDefined &operator=(UserDefined &&) noexcept;
0042     /** Destructor. **/
0043     ~UserDefined();
0044 
0045     bool operator==(const UserDefined &) const;
0046     bool operator!=(const UserDefined &) const;
0047 
0048     [[nodiscard]] static UserDefined fromJSON(const QJsonObject &);
0049     [[nodiscard]] static QList<UserDefined> fromJSONArray(const QJsonArray &data);
0050     [[nodiscard]] QJsonValue toJSON() const;
0051 
0052     /** The end user specified value of the user defined data. **/
0053     [[nodiscard]] QString value() const;
0054     /** Sets value of the value property. **/
0055     void setValue(const QString &value);
0056 
0057     /** The end user specified key of the user defined data. **/
0058     [[nodiscard]] QString key() const;
0059     /** Sets value of the key property. **/
0060     void setKey(const QString &value);
0061 
0062     /** Metadata about the user defined data. **/
0063     [[nodiscard]] FieldMetadata metadata() const;
0064     /** Sets value of the metadata property. **/
0065     void setMetadata(const FieldMetadata &value);
0066 
0067 private:
0068     class Private;
0069     QSharedDataPointer<Private> d;
0070 }; // UserDefined
0071 
0072 } // namespace KGAPI2::People