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

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 QJsonObject;
0020 class QJsonValue;
0021 class QJsonArray;
0022 
0023 namespace KGAPI2::People
0024 {
0025 class FieldMetadata;
0026 
0027 /**
0028  * Arbitrary client data that is populated by clients. Duplicate keys and values
0029  * are allowed.
0030  *
0031  * @see https://developers.google.com/people/api/rest/v1/people#clientdata
0032  * @since 5.23.0
0033  **/
0034 class KGAPIPEOPLE_EXPORT ClientData
0035 {
0036 public:
0037     /** Constructs a new ClientData **/
0038     explicit ClientData();
0039     ClientData(const ClientData &);
0040     ClientData(ClientData &&) noexcept;
0041     ClientData &operator=(const ClientData &);
0042     ClientData &operator=(ClientData &&) noexcept;
0043     /** Destructor. **/
0044     ~ClientData();
0045 
0046     bool operator==(const ClientData &) const;
0047     bool operator!=(const ClientData &) const;
0048 
0049     [[nodiscard]] static ClientData fromJSON(const QJsonObject &obj);
0050     [[nodiscard]] static QList<ClientData> fromJSONArray(const QJsonArray &data);
0051     [[nodiscard]] QJsonValue toJSON() const;
0052 
0053     /** Metadata about the client data. **/
0054     [[nodiscard]] FieldMetadata metadata() const;
0055     /** Sets value of the metadata property. **/
0056     void setMetadata(const FieldMetadata &value);
0057 
0058     /** The client specified key of the client data. **/
0059     [[nodiscard]] QString key() const;
0060     /** Sets value of the key property. **/
0061     void setKey(const QString &value);
0062 
0063     /** The client specified value of the client data. **/
0064     [[nodiscard]] QString value() const;
0065     /** Sets value of the value property. **/
0066     void setValue(const QString &value);
0067 
0068 private:
0069     class Private;
0070     QSharedDataPointer<Private> d;
0071 }; // ClientData
0072 
0073 } // namespace KGAPI2::People