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 <QDate> 0016 #include <QString> 0017 0018 #include <optional> 0019 0020 class QJsonObject; 0021 class QJsonValue; 0022 class QJsonArray; 0023 0024 namespace KGAPI2::People 0025 { 0026 class FieldMetadata; 0027 0028 /** 0029 * A person's birthday. At least one of the `date` and `text` fields are specified. 0030 * The `date` and `text` fields typically represent the same date, but are not 0031 * guaranteed to. 0032 * 0033 * @see https://developers.google.com/people/api/rest/v1/people#birthday 0034 * @since 5.23.0 0035 **/ 0036 class KGAPIPEOPLE_EXPORT Birthday 0037 { 0038 public: 0039 /** Constructs a new Birthday **/ 0040 explicit Birthday(); 0041 Birthday(const Birthday &); 0042 Birthday(Birthday &&) noexcept; 0043 Birthday &operator=(const Birthday &); 0044 Birthday &operator=(Birthday &&) noexcept; 0045 /** Destructor. **/ 0046 ~Birthday(); 0047 0048 bool operator==(const Birthday &) const; 0049 bool operator!=(const Birthday &) const; 0050 0051 [[nodiscard]] static Birthday fromJSON(const QJsonObject &obj); 0052 [[nodiscard]] static QList<Birthday> fromJSONArray(const QJsonArray &data); 0053 [[nodiscard]] QJsonValue toJSON() const; 0054 0055 /** A free-form string representing the user's birthday. **/ 0056 [[nodiscard]] QString text() const; 0057 /** Sets value of the text property. **/ 0058 void setText(const QString &value); 0059 0060 /** Metadata about the birthday. **/ 0061 [[nodiscard]] FieldMetadata metadata() const; 0062 /** Sets value of the metadata property. **/ 0063 void setMetadata(const FieldMetadata &value); 0064 0065 /** The date of the birthday. **/ 0066 [[nodiscard]] QDate date() const; 0067 /** Sets value of the date property. **/ 0068 void setDate(const QDate &value); 0069 0070 private: 0071 class Private; 0072 QSharedDataPointer<Private> d; 0073 }; // Birthday 0074 0075 } // namespace KGAPI2::People