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 #include "source.h" 0015 0016 #include <optional> 0017 0018 class QJsonObject; 0019 class QJsonValue; 0020 0021 namespace KGAPI2::People 0022 { 0023 /** 0024 * Metadata about a field. 0025 * 0026 * @see https://developers.google.com/people/api/rest/v1/people#fieldmetadata 0027 * @since 5.23.0 0028 **/ 0029 class KGAPIPEOPLE_EXPORT FieldMetadata 0030 { 0031 public: 0032 /** Constructs a new FieldMetadata **/ 0033 explicit FieldMetadata(); 0034 FieldMetadata(const FieldMetadata &); 0035 FieldMetadata(FieldMetadata &&) noexcept; 0036 FieldMetadata &operator=(const FieldMetadata &); 0037 FieldMetadata &operator=(FieldMetadata &&) noexcept; 0038 /** Destructor. **/ 0039 ~FieldMetadata(); 0040 0041 bool operator==(const FieldMetadata &) const; 0042 bool operator!=(const FieldMetadata &) const; 0043 0044 [[nodiscard]] static FieldMetadata fromJSON(const QJsonObject &); 0045 [[nodiscard]] QJsonValue toJSON() const; 0046 0047 /** The source of the field. **/ 0048 [[nodiscard]] Source source() const; 0049 /** Sets value of the source property. **/ 0050 void setSource(const Source &value); 0051 0052 /** True if the field is the primary field for the source. Each source must have at most one field with `source_primary` set to true. **/ 0053 [[nodiscard]] bool sourcePrimary() const; 0054 /** Sets value of the sourcePrimary property. **/ 0055 void setSourcePrimary(bool value); 0056 0057 /** Output only. True if the field is the primary field for all sources in the person. Each person will have at most one field with `primary` set to true. 0058 * **/ 0059 [[nodiscard]] bool primary() const; 0060 0061 /** Output only. True if the field is verified; false if the field is unverified. A verified field is typically a name, email address, phone number, or 0062 * website that has been confirmed to be owned by the person. **/ 0063 [[nodiscard]] bool verified() const; 0064 0065 private: 0066 class Private; 0067 QSharedDataPointer<Private> d; 0068 }; // FieldMetadata 0069 0070 } // namespace KGAPI2::People