File indexing completed on 2024-05-12 05:22:25
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org> 0003 * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only 0006 * SPDX-License-Identifier: LGPL-3.0-only 0007 * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL 0008 */ 0009 0010 #pragma once 0011 0012 #include <QSharedDataPointer> 0013 #include "kgapipeople_export.h" 0014 #include "object.h" 0015 #include "types.h" 0016 0017 #include <QList> 0018 #include <QString> 0019 0020 #include <optional> 0021 0022 class QJsonObject; 0023 class QJsonValue; 0024 0025 namespace KGAPI2::People 0026 { 0027 class ContactGroupMetadata; 0028 class GroupClientData; 0029 0030 /** 0031 * A contact group. 0032 * 0033 * @see https://developers.google.com/people/api/rest/v1/people#contactgroup 0034 * @since 5.23.0 0035 **/ 0036 class KGAPIPEOPLE_EXPORT ContactGroup : public KGAPI2::Object 0037 { 0038 public: 0039 enum class GroupType { 0040 GROUP_TYPE_UNSPECIFIED, ///< Unspecified. 0041 USER_CONTACT_GROUP, ///< User defined contact group. 0042 SYSTEM_CONTACT_GROUP, ///< System defined contact group. 0043 }; 0044 0045 /** Constructs a new ContactGroup **/ 0046 explicit ContactGroup(); 0047 /** Destructor. **/ 0048 ~ContactGroup(); 0049 0050 bool operator==(const ContactGroup &) const; 0051 bool operator!=(const ContactGroup &) const; 0052 0053 [[nodiscard]] static ContactGroupPtr fromJSON(const QJsonObject &); 0054 [[nodiscard]] QJsonValue toJSON() const; 0055 0056 /** 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 0057 * names set by the owner are the same as name. **/ 0058 [[nodiscard]] QString formattedName() const; 0059 0060 /** Output only. The total number of contacts in the group irrespective of max members in specified in the request. **/ 0061 [[nodiscard]] int memberCount() const; 0062 0063 /** The [HTTP entity tag](https://en.wikipedia.org/wiki/HTTP_ETag) of the resource. Used for web cache validation. **/ 0064 [[nodiscard]] QString etag() const; 0065 /** Sets value of the etag property. **/ 0066 void setEtag(const QString &value); 0067 0068 /** Output only. The contact group type. **/ 0069 [[nodiscard]] ContactGroup::GroupType groupType() const; 0070 0071 /** The group's client data. **/ 0072 [[nodiscard]] QList<GroupClientData> clientData() const; 0073 /** Sets value of the clientData property. **/ 0074 void setClientData(const QList<GroupClientData> &value); 0075 /** Appends the given @c value to the list of clientData. **/ 0076 void addGroupClientData(const GroupClientData &value); 0077 /** Removes the given @c value from the list of clientData if it exists. **/ 0078 void removeGroupClientData(const GroupClientData &value); 0079 /** Clears the list of clientData. **/ 0080 void clearClientData(); 0081 0082 /** The contact group name set by the group owner or a system provided name for system groups. For 0083 * [`contactGroups.create`](/people/api/rest/v1/contactGroups/create) or [`contactGroups.update`](/people/api/rest/v1/contactGroups/update) the name must be 0084 * unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. **/ 0085 [[nodiscard]] QString name() const; 0086 /** Sets value of the name property. **/ 0087 void setName(const QString &value); 0088 0089 /** Output only. Metadata about the contact group. **/ 0090 [[nodiscard]] ContactGroupMetadata metadata() const; 0091 0092 /** The resource name for the contact group, assigned by the server. An ASCII string, in the form of `contactGroups/{contact_group_id}`. **/ 0093 [[nodiscard]] QString resourceName() const; 0094 /** Sets value of the resourceName property. **/ 0095 void setResourceName(const QString &value); 0096 0097 /** 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 0098 * return as many members as `maxMembers` in the get request. **/ 0099 [[nodiscard]] QList<QString> memberResourceNames() const; 0100 0101 private: 0102 class Private; 0103 std::unique_ptr<Private> d; 0104 }; // ContactGroup 0105 0106 } // namespace KGAPI2::People