Kgapi

personmetadata.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 <QList>
16#include <QString>
17
18#include <optional>
19
20class QJsonObject;
21class QJsonValue;
22
23namespace KGAPI2::People
24{
25class Source;
26
27/**
28 * The metadata about a person.
29 *
30 * @see https://developers.google.com/people/api/rest/v1/people#personmetadata
31 * @since 5.23.0
32 **/
33class KGAPIPEOPLE_EXPORT PersonMetadata
34{
35public:
36 enum class ObjectType {
37 OBJECT_TYPE_UNSPECIFIED, ///< Unspecified.
38 PERSON, ///< Person.
39 PAGE, ///< [Currents Page.](https://workspace.google.com/products/currents/)
40 };
41
42 /** Constructs a new PersonMetadata **/
43 explicit PersonMetadata();
45 PersonMetadata(PersonMetadata &&) noexcept;
46 PersonMetadata &operator=(const PersonMetadata &);
47 PersonMetadata &operator=(PersonMetadata &&) noexcept;
48 /** Destructor. **/
50
51 bool operator==(const PersonMetadata &) const;
52 bool operator!=(const PersonMetadata &) const;
53
54 [[nodiscard]] static PersonMetadata fromJSON(const QJsonObject &);
55 [[nodiscard]] QJsonValue toJSON() const;
56
57 /** Output only. Resource names of people linked to this resource. **/
58 [[nodiscard]] QList<QString> linkedPeopleResourceNames() const;
59
60 /** Output only. **DEPRECATED** (Please use `person.metadata.sources.profileMetadata.objectType` instead) The type of the person object. **/
61 [[nodiscard]] PersonMetadata::ObjectType objectType() const;
62
63 /** Output only. Any former resource names this person has had. Populated only for `people.connections.list` requests that include a sync token. The
64 * resource name may change when adding or removing fields that link a contact and profile such as a verified email, verified phone number, or profile URL.
65 * **/
66 [[nodiscard]] QList<QString> previousResourceNames() const;
67
68 /** Output only. True if the person resource has been deleted. Populated only for `people.connections.list` and `otherContacts.list` sync requests. **/
69 [[nodiscard]] bool deleted() const;
70
71 /** The sources of data for the person. **/
72 [[nodiscard]] QList<Source> sources() const;
73 /** Sets value of the sources property. **/
74 void setSources(const QList<Source> &value);
75 /** Appends the given @c value to the list of sources. **/
76 void addSource(const Source &value);
77 /** Removes the given @c value from the list of sources if it exists. **/
78 void removeSource(const Source &value);
79 /** Clears the list of sources. **/
80 void clearSources();
81
82private:
83 class Private;
84 QSharedDataPointer<Private> d;
85}; // PersonMetadata
86
87} // namespace KGAPI2::People
The metadata about a person.
The source of a field.
Definition source.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:54:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.