File indexing completed on 2024-05-12 05:22:30
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 associated URLs. 0029 * 0030 * @see https://developers.google.com/people/api/rest/v1/people#url 0031 * @since 5.23.0 0032 **/ 0033 class KGAPIPEOPLE_EXPORT Url 0034 { 0035 public: 0036 /** Constructs a new Url **/ 0037 explicit Url(); 0038 Url(const Url &); 0039 Url(Url &&) noexcept; 0040 Url &operator=(const Url &); 0041 Url &operator=(Url &&) noexcept; 0042 /** Destructor. **/ 0043 ~Url(); 0044 0045 bool operator==(const Url &) const; 0046 bool operator!=(const Url &) const; 0047 0048 [[nodiscard]] static Url fromJSON(const QJsonObject &); 0049 [[nodiscard]] static QList<Url> fromJSONArray(const QJsonArray &data); 0050 [[nodiscard]] QJsonValue toJSON() const; 0051 0052 /** The URL. **/ 0053 [[nodiscard]] QString value() const; 0054 /** Sets value of the value property. **/ 0055 void setValue(const QString &value); 0056 0057 /** 0058 * The type of the URL. The type can be custom or one of these predefined values: 0059 * * `home` 0060 * * `work` 0061 * * `blog` 0062 * * `profile` 0063 * * `homePage` 0064 * * `ftp` 0065 * * `reservations` 0066 * * `appInstallPage`: website for a Currents application. 0067 * * `other` 0068 **/ 0069 [[nodiscard]] QString type() const; 0070 /** Sets value of the type property. **/ 0071 void setType(const QString &value); 0072 0073 /** Metadata about the URL. **/ 0074 [[nodiscard]] FieldMetadata metadata() const; 0075 /** Sets value of the metadata property. **/ 0076 void setMetadata(const FieldMetadata &value); 0077 0078 /** Output only. The type of the URL translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. **/ 0079 [[nodiscard]] QString formattedType() const; 0080 0081 private: 0082 class Private; 0083 QSharedDataPointer<Private> d; 0084 }; // Url 0085 0086 } // namespace KGAPI2::People