File indexing completed on 2024-05-12 05:22:28

0001 /*
0002     SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "types.h"
0010 #include "kgapipeople_export.h"
0011 
0012 #include <QUrl>
0013 
0014 namespace KGAPI2::People
0015 {
0016 
0017 /**
0018  * @brief Additional methods for implementing support for Google People service
0019  *
0020  * You should never need to use these methods, unless implementing your own Job
0021  */
0022 
0023 namespace PeopleService
0024 {
0025 
0026 [[nodiscard]] KGAPIPEOPLE_EXPORT QString allPersonFields();
0027 [[nodiscard]] KGAPIPEOPLE_EXPORT QString allUpdatablePersonFields();
0028 [[nodiscard]] KGAPIPEOPLE_EXPORT QString allContactGroupRecentlyCreatedAvailableFields();
0029 
0030 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl fetchAllContactsUrl(const QString &syncToken = {});
0031 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl fetchContactUrl(const QString &resourceName);
0032 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl createContactUrl();
0033 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl updateContactUrl(const QString &resourceName, const QString &personFields);
0034 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl deleteContactUrl(const QString &resourceName);
0035 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl updateContactPhotoUrl(const QString &resourceName);
0036 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl deleteContactPhotoUrl(const QString &resourceName, const QString &personFields);
0037 
0038 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl fetchAllContactGroupsUrl();
0039 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl fetchContactGroupUrl(const QString &resourceName);
0040 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl createContactGroupUrl();
0041 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl updateContactGroupUrl(const QString &resourceName);
0042 [[nodiscard]] KGAPIPEOPLE_EXPORT QUrl deleteContactGroupUrl(const QString &resourceName, const bool deleteContacts);
0043 
0044 [[nodiscard]] KGAPIPEOPLE_EXPORT ObjectsList parseConnectionsJSONFeed(FeedData &feedData, const QByteArray &jsonFeed, const QString &syncToken = {});
0045 [[nodiscard]] KGAPIPEOPLE_EXPORT ObjectsList parseContactGroupsJSONFeed(FeedData &feedData, const QByteArray &jsonFeed);
0046 }
0047 
0048 namespace PeopleUtils
0049 {
0050     void addValueToJsonObjectIfValid(QJsonObject &object, const QByteArray &key, const int value);
0051     void addValueToJsonObjectIfValid(QJsonObject &object, const QByteArray &key, const bool value);
0052     void addValueToJsonObjectIfValid(QJsonObject &object, const QByteArray &key, const QString &value);
0053     void addValueToJsonObjectIfValid(QJsonObject &object, const QByteArray &key, const QJsonValue &value);
0054 }
0055 
0056 }