Kgapi

emailaddress.h
1/*
2 * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
3 * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 * SPDX-License-Identifier: LGPL-3.0-only
7 * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
8 */
9
10#pragma once
11
12#include <QSharedDataPointer>
13#include "kgapipeople_export.h"
14
15#include <QString>
16
17#include <optional>
18
19class QJsonObject;
20class QJsonValue;
21class QJsonArray;
22
23namespace KContacts
24{
25class Email;
26}
27
28namespace KGAPI2::People
29{
30class FieldMetadata;
31
32/**
33 * A person's email address.
34 *
35 * @see https://developers.google.com/people/api/rest/v1/people#emailaddress
36 * @since 5.23.0
37 **/
38class KGAPIPEOPLE_EXPORT EmailAddress
39{
40public:
41 /** Constructs a new EmailAddress **/
42 explicit EmailAddress();
44 EmailAddress(EmailAddress &&) noexcept;
45 EmailAddress &operator=(const EmailAddress &);
46 EmailAddress &operator=(EmailAddress &&) noexcept;
47 /** Destructor. **/
49
50 bool operator==(const EmailAddress &) const;
51 bool operator!=(const EmailAddress &) const;
52
53 [[nodiscard]] static EmailAddress fromJSON(const QJsonObject &obj);
54 [[nodiscard]] static QList<EmailAddress> fromJSONArray(const QJsonArray &data);
55 [[nodiscard]] QJsonValue toJSON() const;
56
57 [[nodiscard]] static EmailAddress fromKContactsEmail(const KContacts::Email &email);
58 [[nodiscard]] static QList<EmailAddress> fromKContactsEmailList(const QList<KContacts::Email> &emailList);
59 [[nodiscard]] KContacts::Email toKContactsEmail() const;
60
61 /** The email address. **/
62 [[nodiscard]] QString value() const;
63 /** Sets value of the value property. **/
64 void setValue(const QString &value);
65
66 /** Metadata about the email address. **/
67 [[nodiscard]] FieldMetadata metadata() const;
68 /** Sets value of the metadata property. **/
69 void setMetadata(const FieldMetadata &value);
70
71 /** The type of the email address. The type can be custom or one of these predefined values: * `home` * `work` * `other` **/
72 [[nodiscard]] QString type() const;
73 /** Sets value of the type property. **/
74 void setType(const QString &value);
75
76 /** The display name of the email. **/
77 [[nodiscard]] QString displayName() const;
78 /** Sets value of the displayName property. **/
79 void setDisplayName(const QString &value);
80
81 /** Output only. The type of the email address translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. **/
82 [[nodiscard]] QString formattedType() const;
83
84private:
85 class Private;
87}; // EmailAddress
88
89} // namespace KGAPI2::People
A person's email address.
Metadata about a field.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.