Kgapi

contactgroup.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#include "object.h"
15#include "types.h"
16
17#include <QList>
18#include <QString>
19
20#include <optional>
21
22class QJsonObject;
23class QJsonValue;
24
25namespace KGAPI2::People
26{
27class ContactGroupMetadata;
28class GroupClientData;
29
30/**
31 * A contact group.
32 *
33 * @see https://developers.google.com/people/api/rest/v1/people#contactgroup
34 * @since 5.23.0
35 **/
36class KGAPIPEOPLE_EXPORT ContactGroup : public KGAPI2::Object
37{
38public:
39 enum class GroupType {
40 GROUP_TYPE_UNSPECIFIED, ///< Unspecified.
41 USER_CONTACT_GROUP, ///< User defined contact group.
42 SYSTEM_CONTACT_GROUP, ///< System defined contact group.
43 };
44
45 /** Constructs a new ContactGroup **/
46 explicit ContactGroup();
47 /** Destructor. **/
49
50 bool operator==(const ContactGroup &) const;
51 bool operator!=(const ContactGroup &) const;
52
53 [[nodiscard]] static ContactGroupPtr fromJSON(const QJsonObject &);
54 [[nodiscard]] QJsonValue toJSON() const;
55
56 /** Output only. The name translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale for system groups names. Group
57 * names set by the owner are the same as name. **/
58 [[nodiscard]] QString formattedName() const;
59
60 /** Output only. The total number of contacts in the group irrespective of max members in specified in the request. **/
61 [[nodiscard]] int memberCount() const;
62
63 /** The [HTTP entity tag](https://en.wikipedia.org/wiki/HTTP_ETag) of the resource. Used for web cache validation. **/
64 [[nodiscard]] QString etag() const;
65 /** Sets value of the etag property. **/
66 void setEtag(const QString &value);
67
68 /** Output only. The contact group type. **/
69 [[nodiscard]] ContactGroup::GroupType groupType() const;
70
71 /** The group's client data. **/
72 [[nodiscard]] QList<GroupClientData> clientData() const;
73 /** Sets value of the clientData property. **/
74 void setClientData(const QList<GroupClientData> &value);
75 /** Appends the given @c value to the list of clientData. **/
76 void addGroupClientData(const GroupClientData &value);
77 /** Removes the given @c value from the list of clientData if it exists. **/
78 void removeGroupClientData(const GroupClientData &value);
79 /** Clears the list of clientData. **/
80 void clearClientData();
81
82 /** The contact group name set by the group owner or a system provided name for system groups. For
83 * [`contactGroups.create`](/people/api/rest/v1/contactGroups/create) or [`contactGroups.update`](/people/api/rest/v1/contactGroups/update) the name must be
84 * unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. **/
85 [[nodiscard]] QString name() const;
86 /** Sets value of the name property. **/
87 void setName(const QString &value);
88
89 /** Output only. Metadata about the contact group. **/
90 [[nodiscard]] ContactGroupMetadata metadata() const;
91
92 /** The resource name for the contact group, assigned by the server. An ASCII string, in the form of `contactGroups/{contact_group_id}`. **/
93 [[nodiscard]] QString resourceName() const;
94 /** Sets value of the resourceName property. **/
95 void setResourceName(const QString &value);
96
97 /** Output only. The list of contact person resource names that are members of the contact group. The field is only populated for GET requests and will only
98 * return as many members as `maxMembers` in the get request. **/
99 [[nodiscard]] QList<QString> memberResourceNames() const;
100
101private:
102 class Private;
103 std::unique_ptr<Private> d;
104}; // ContactGroup
105
106} // namespace KGAPI2::People
Base class for all objects.
Definition object.h:31
The metadata about a contact group.
Arbitrary client data that is populated by clients.
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.