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 * A person's short biography. 0029 * 0030 * @see https://developers.google.com/people/api/rest/v1/people#biography 0031 * @since 5.23.0 0032 **/ 0033 class KGAPIPEOPLE_EXPORT Biography 0034 { 0035 public: 0036 enum class ContentType { 0037 CONTENT_TYPE_UNSPECIFIED, ///< Unspecified. 0038 TEXT_PLAIN, ///< Plain text. 0039 TEXT_HTML, ///< HTML text. 0040 }; 0041 0042 /** Constructs a new Biography **/ 0043 explicit Biography(); 0044 Biography(const Biography &); 0045 Biography(Biography &&) noexcept; 0046 Biography &operator=(const Biography &); 0047 Biography &operator=(Biography &&) noexcept; 0048 /** Destructor. **/ 0049 ~Biography(); 0050 0051 bool operator==(const Biography &) const; 0052 bool operator!=(const Biography &) const; 0053 0054 [[nodiscard]] static Biography fromJSON(const QJsonObject &obj); 0055 [[nodiscard]] static QList<Biography> fromJSONArray(const QJsonArray &data); 0056 [[nodiscard]] QJsonValue toJSON() const; 0057 0058 /** Metadata about the biography. **/ 0059 [[nodiscard]] FieldMetadata metadata() const; 0060 /** Sets value of the metadata property. **/ 0061 void setMetadata(const FieldMetadata &value); 0062 0063 /** The content type of the biography. **/ 0064 [[nodiscard]] Biography::ContentType contentType() const; 0065 /** Sets value of the contentType property. **/ 0066 void setContentType(Biography::ContentType value); 0067 0068 /** The short biography. **/ 0069 [[nodiscard]] QString value() const; 0070 /** Sets value of the value property. **/ 0071 void setValue(const QString &value); 0072 0073 private: 0074 class Private; 0075 QSharedDataPointer<Private> d; 0076 }; // Biography 0077 0078 } // namespace KGAPI2::People