File indexing completed on 2024-05-12 05:22:24
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 <QJsonArray> 0014 #include <QJsonObject> 0015 #include "kgapipeople_export.h" 0016 0017 #include <QString> 0018 0019 #include <optional> 0020 0021 class QJsonValue; 0022 0023 namespace KGAPI2::People 0024 { 0025 class FieldMetadata; 0026 0027 /** 0028 * A person's physical address. May be a P.O. box or street address. All fields are 0029 * optional. 0030 * 0031 * @see https://developers.google.com/people/api/rest/v1/people#address 0032 * @since 5.23.0 0033 **/ 0034 class KGAPIPEOPLE_EXPORT Address 0035 { 0036 public: 0037 /** Constructs a new Address **/ 0038 explicit Address(); 0039 Address(const Address &); 0040 Address(Address &&) noexcept; 0041 Address &operator=(const Address &); 0042 Address &operator=(Address &&) noexcept; 0043 /** Destructor. **/ 0044 ~Address(); 0045 0046 bool operator==(const Address &) const; 0047 bool operator!=(const Address &) const; 0048 0049 [[nodiscard]] static Address fromJSON(const QJsonObject &obj); 0050 [[nodiscard]] static QList<Address> fromJSONArray(const QJsonArray &data); 0051 [[nodiscard]] QJsonValue toJSON() const; 0052 0053 /** Output only. The type of the address translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. **/ 0054 [[nodiscard]] QString formattedType() const; 0055 0056 /** The city of the address. **/ 0057 [[nodiscard]] QString city() const; 0058 /** Sets value of the city property. **/ 0059 void setCity(const QString &value); 0060 0061 /** Metadata about the address. **/ 0062 [[nodiscard]] FieldMetadata metadata() const; 0063 /** Sets value of the metadata property. **/ 0064 void setMetadata(const FieldMetadata &value); 0065 0066 /** The [ISO 3166-1 alpha-2](http://www.iso.org/iso/country_codes.htm) country code of the address. **/ 0067 [[nodiscard]] QString countryCode() const; 0068 /** Sets value of the countryCode property. **/ 0069 void setCountryCode(const QString &value); 0070 0071 /** The postal code of the address. **/ 0072 [[nodiscard]] QString postalCode() const; 0073 /** Sets value of the postalCode property. **/ 0074 void setPostalCode(const QString &value); 0075 0076 /** The P.O. box of the address. **/ 0077 [[nodiscard]] QString poBox() const; 0078 /** Sets value of the poBox property. **/ 0079 void setPoBox(const QString &value); 0080 0081 /** The type of the address. The type can be custom or one of these predefined values: * `home` * `work` * `other` **/ 0082 [[nodiscard]] QString type() const; 0083 /** Sets value of the type property. **/ 0084 void setType(const QString &value); 0085 0086 /** The unstructured value of the address. If this is not set by the user it will be automatically constructed from structured values. **/ 0087 [[nodiscard]] QString formattedValue() const; 0088 /** Sets value of the formattedValue property. **/ 0089 void setFormattedValue(const QString &value); 0090 0091 /** The extended address of the address; for example, the apartment number. **/ 0092 [[nodiscard]] QString extendedAddress() const; 0093 /** Sets value of the extendedAddress property. **/ 0094 void setExtendedAddress(const QString &value); 0095 0096 /** The region of the address; for example, the state or province. **/ 0097 [[nodiscard]] QString region() const; 0098 /** Sets value of the region property. **/ 0099 void setRegion(const QString &value); 0100 0101 /** The street address. **/ 0102 [[nodiscard]] QString streetAddress() const; 0103 /** Sets value of the streetAddress property. **/ 0104 void setStreetAddress(const QString &value); 0105 0106 /** The country of the address. **/ 0107 [[nodiscard]] QString country() const; 0108 /** Sets value of the country property. **/ 0109 void setCountry(const QString &value); 0110 0111 private: 0112 class Private; 0113 QSharedDataPointer<Private> d; 0114 }; // Address 0115 0116 } // namespace KGAPI2::People