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

0001 /*
0002     SPDX-FileCopyrightText: 2012-2018 Daniel Vrátil <dvratil@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 "kgapitasks_export.h"
0010 #include "types.h"
0011 
0012 namespace KGAPI2
0013 {
0014 
0015 /**
0016  * @brief Additional methods for implementing support for Google Tasks service
0017  *
0018  * You should never need to use these methods, unless implementing your own Job
0019  */
0020 namespace TasksService
0021 {
0022 
0023 /**
0024  * @brief Parses JSON data into a Task object
0025  *
0026  * @param jsonData
0027  */
0028 KGAPITASKS_EXPORT TaskPtr JSONToTask(const QByteArray &jsonData);
0029 
0030 /**
0031  * @brief Serializes a Task object into JSON
0032  *
0033  * @param task
0034  */
0035 KGAPITASKS_EXPORT QByteArray taskToJSON(const TaskPtr &task);
0036 
0037 /**
0038  * @brief Parses JSON data into a TaskList object
0039  *
0040  * @param jsonData
0041  */
0042 KGAPITASKS_EXPORT TaskListPtr JSONToTaskList(const QByteArray &jsonData);
0043 
0044 /**
0045  * @brief Serializes a TaskList into JSON data
0046  *
0047  * @param taskList
0048  */
0049 KGAPITASKS_EXPORT QByteArray taskListToJSON(const TaskListPtr &taskList);
0050 
0051 /**
0052  * @brief Parses JSON feed into list of Tasks or TaskLists
0053  *
0054  * @param jsonFeed
0055  * @param feedData The structure will be filled with additional information
0056  *                 about the feed
0057  */
0058 KGAPITASKS_EXPORT ObjectsList parseJSONFeed(const QByteArray &jsonFeed, FeedData &feedData);
0059 
0060 /**
0061  * @brief Returns URL to create a single task
0062  *
0063  * @param tasklistID ID of parent task list
0064  */
0065 KGAPITASKS_EXPORT QUrl createTaskUrl(const QString &tasklistID);
0066 
0067 /**
0068  * @brief Returns URL to fetch all tasks from a single tasklist
0069  *
0070  * @param tasklistID ID of parent task list
0071  */
0072 KGAPITASKS_EXPORT QUrl fetchAllTasksUrl(const QString &tasklistID);
0073 
0074 /**
0075  * @brief Returns URL for fetching a single task
0076  *
0077  * @param tasklistID ID of parent task list
0078  * @param taskID ID of task to fetch
0079  */
0080 KGAPITASKS_EXPORT QUrl fetchTaskUrl(const QString &tasklistID, const QString &taskID);
0081 
0082 /**
0083  * @brief Returns URL for updating a task
0084  *
0085  * @param tasklistID ID of parent task list
0086  * @param taskID ID of task to update
0087  */
0088 KGAPITASKS_EXPORT QUrl updateTaskUrl(const QString &tasklistID, const QString &taskID);
0089 
0090 /**
0091  * @brief Returns URL for removing a task
0092  *
0093  * @param tasklistID ID of parent task list
0094  * @param taskID ID of task to remove
0095  */
0096 KGAPITASKS_EXPORT QUrl removeTaskUrl(const QString &tasklistID, const QString &taskID);
0097 
0098 /**
0099  * @brief Returns URL to reparent task.
0100  *
0101  * @param tasklistID ID of parent task list
0102  * @param taskID ID of task to move
0103  * @param newParent UID of new parent item
0104  */
0105 KGAPITASKS_EXPORT QUrl moveTaskUrl(const QString &tasklistID, const QString &taskID, const QString &newParent);
0106 
0107 /**
0108  * @brief Returns URL for fetching all tasklists
0109  */
0110 KGAPITASKS_EXPORT QUrl fetchTaskListsUrl();
0111 
0112 /**
0113  * @brief Returns URL for creating a new tasklist
0114  */
0115 KGAPITASKS_EXPORT QUrl createTaskListUrl();
0116 
0117 /**
0118  * @brief Returns URL for modifying a tasklist
0119  *
0120  * @param tasklistID ID of task list to update
0121  */
0122 KGAPITASKS_EXPORT QUrl updateTaskListUrl(const QString &tasklistID);
0123 
0124 /**
0125  * @brief Returns URL for deleting a tasklist
0126  *
0127  * @param tasklistID ID of task list to remove
0128  */
0129 KGAPITASKS_EXPORT QUrl removeTaskListUrl(const QString &tasklistID);
0130 
0131 } /* namespace TasksServices */
0132 
0133 } /* namespace KGAPI2 */