Kgapi

nickname.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 KGAPI2::People
24{
25class FieldMetadata;
26
27/**
28 * A person's nickname.
29 *
30 * @see https://developers.google.com/people/api/rest/v1/people#nickname
31 * @since 5.23.0
32 **/
33class KGAPIPEOPLE_EXPORT Nickname
34{
35public:
36 enum class Type {
37 DEFAULT, ///< Generic nickname.
38 MAIDEN_NAME, ///< Maiden name or birth family name. Used when the person's family name has changed as a result of marriage.
39 INITIALS, ///< Initials.
40 GPLUS, ///< Google+ profile nickname.
41 OTHER_NAME, ///< A professional affiliation or other name; for example, `Dr. Smith.`
42 ALTERNATE_NAME, ///< Alternate name person is known by.
43 SHORT_NAME, ///< A shorter version of the person's name.
44 };
45
46 /** Constructs a new Nickname **/
47 explicit Nickname();
48 Nickname(const Nickname &);
49 Nickname(Nickname &&) noexcept;
50 Nickname &operator=(const Nickname &);
51 Nickname &operator=(Nickname &&) noexcept;
52 /** Destructor. **/
54
55 bool operator==(const Nickname &) const;
56 bool operator!=(const Nickname &) const;
57
58 [[nodiscard]] static Nickname fromJSON(const QJsonObject &);
59 [[nodiscard]] static QList<Nickname> fromJSONArray(const QJsonArray &data);
60 [[nodiscard]] QJsonValue toJSON() const;
61
62 /** The nickname. **/
63 [[nodiscard]] QString value() const;
64 /** Sets value of the value property. **/
65 void setValue(const QString &value);
66
67 /** The type of the nickname. **/
68 [[nodiscard]] Nickname::Type type() const;
69 /** Sets value of the type property. **/
70 void setType(Nickname::Type value);
71
72 /** Metadata about the nickname. **/
73 [[nodiscard]] FieldMetadata metadata() const;
74 /** Sets value of the metadata property. **/
75 void setMetadata(const FieldMetadata &value);
76
77private:
78 class Private;
79 QSharedDataPointer<Private> d;
80}; // Nickname
81
82} // namespace KGAPI2::People
Metadata about a field.
A person's nickname.
Definition nickname.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:50:41 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.