Kgapi

phonenumber.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 {
24class PhoneNumber;
25}
26
27namespace KGAPI2::People
28{
29class FieldMetadata;
30
31/**
32 * A person's phone number.
33 *
34 * @see https://developers.google.com/people/api/rest/v1/people#phonenumber
35 * @since 5.23.0
36 **/
37class KGAPIPEOPLE_EXPORT PhoneNumber
38{
39public:
40 /** Constructs a new PhoneNumber **/
41 explicit PhoneNumber();
42 PhoneNumber(const PhoneNumber &);
43 PhoneNumber(PhoneNumber &&) noexcept;
44 PhoneNumber &operator=(const PhoneNumber &);
45 PhoneNumber &operator=(PhoneNumber &&) noexcept;
46 /** Destructor. **/
48
49 bool operator==(const PhoneNumber &) const;
50 bool operator!=(const PhoneNumber &) const;
51
52 [[nodiscard]] static PhoneNumber fromJSON(const QJsonObject &);
53 [[nodiscard]] static QList<PhoneNumber> fromJSONArray(const QJsonArray &data);
54 [[nodiscard]] QJsonValue toJSON() const;
55
56 [[nodiscard]] static PhoneNumber fromKContactsPhoneNumber(const KContacts::PhoneNumber &phoneNumber);
57 [[nodiscard]] static QList<PhoneNumber> fromKContactsPhoneNumberList(const QList<KContacts::PhoneNumber> &phoneNumberList);
58 [[nodiscard]] KContacts::PhoneNumber toKContactsPhoneNumber() const;
59
60 /** The phone number. **/
61 [[nodiscard]] QString value() const;
62 /** Sets value of the value property. **/
63 void setValue(const QString &value);
64
65 /** Output only. The type of the phone number translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. **/
66 [[nodiscard]] QString formattedType() const;
67
68 /** Output only. The canonicalized [ITU-T E.164](https://law.resource.org/pub/us/cfr/ibr/004/itu-t.E.164.1.2008.pdf) form of the phone number. **/
69 [[nodiscard]] QString canonicalForm() const;
70
71 /** The type of the phone number. The type can be custom or one of these predefined values: * `home` * `work` * `mobile` * `homeFax` * `workFax` *
72 * `otherFax` * `pager` * `workMobile` * `workPager` * `main` * `googleVoice` * `other` **/
73 [[nodiscard]] QString type() const;
74 /** Sets value of the type property. **/
75 void setType(const QString &value);
76
77 /** Metadata about the phone number. **/
78 [[nodiscard]] FieldMetadata metadata() const;
79 /** Sets value of the metadata property. **/
80 void setMetadata(const FieldMetadata &value);
81
82private:
83 class Private;
85}; // PhoneNumber
86
87} // namespace KGAPI2::People
Metadata about a field.
QString formattedType() const
Output only.
PhoneNumber()
Constructs a new PhoneNumber.
void setValue(const QString &value)
Sets value of the value property.
QString type() const
The type of the phone number.
FieldMetadata metadata() const
Metadata about the phone number.
QString value() const
The phone number.
void setType(const QString &value)
Sets value of the type property.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
QString canonicalForm() const
Output only.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:48:08 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.