File indexing completed on 2024-05-12 05:22:26
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 gender. 0029 * 0030 * @see https://developers.google.com/people/api/rest/v1/people#gender 0031 * @since 5.23.0 0032 **/ 0033 class KGAPIPEOPLE_EXPORT Gender 0034 { 0035 public: 0036 /** Constructs a new Gender **/ 0037 explicit Gender(); 0038 Gender(const Gender &); 0039 Gender(Gender &&) noexcept; 0040 Gender &operator=(const Gender &); 0041 Gender &operator=(Gender &&) noexcept; 0042 /** Destructor. **/ 0043 ~Gender(); 0044 0045 bool operator==(const Gender &) const; 0046 bool operator!=(const Gender &) const; 0047 0048 [[nodiscard]] static Gender fromJSON(const QJsonObject &); 0049 [[nodiscard]] static QList<Gender> fromJSONArray(const QJsonArray &data); 0050 [[nodiscard]] QJsonValue toJSON() const; 0051 0052 /** Metadata about the gender. **/ 0053 [[nodiscard]] FieldMetadata metadata() const; 0054 /** Sets value of the metadata property. **/ 0055 void setMetadata(const FieldMetadata &value); 0056 0057 /** Output only. The value of the gender translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. Unspecified or 0058 * custom value are not localized. **/ 0059 [[nodiscard]] QString formattedValue() const; 0060 0061 /** The gender for the person. The gender can be custom or one of these predefined values: * `male` * `female` * `unspecified` **/ 0062 [[nodiscard]] QString value() const; 0063 /** Sets value of the value property. **/ 0064 void setValue(const QString &value); 0065 0066 /** Free form text field for pronouns that should be used to address the person. Common values are: * `he`/`him` * `she`/`her` * `they`/`them` **/ 0067 [[nodiscard]] QString addressMeAs() const; 0068 /** Sets value of the addressMeAs property. **/ 0069 void setAddressMeAs(const QString &value); 0070 0071 private: 0072 class Private; 0073 QSharedDataPointer<Private> d; 0074 }; // Gender 0075 0076 } // namespace KGAPI2::People