File indexing completed on 2024-12-15 03:45:02
0001 /* 0002 SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #ifndef KUSERFEEDBACK_CONSOLE_RESTAPI_H 0008 #define KUSERFEEDBACK_CONSOLE_RESTAPI_H 0009 0010 #include <QVector> 0011 0012 class QNetworkReply; 0013 0014 namespace KUserFeedback { 0015 namespace Console { 0016 0017 class Product; 0018 class RESTClient; 0019 class Sample; 0020 class Survey; 0021 0022 /** C++ wrapper for the server-side API. 0023 * Precondition for all methods is that client->isConnected() returns @c true. 0024 */ 0025 namespace RESTApi 0026 { 0027 /** Check if server database schema is up-to-date. */ 0028 QNetworkReply* checkSchema(RESTClient *client); 0029 0030 /** List all products. */ 0031 QNetworkReply* listProducts(RESTClient *client); 0032 0033 /** Add a new product. 0034 * @param p The product to add. Must be valid. 0035 */ 0036 QNetworkReply* createProduct(RESTClient *client, const Product &p); 0037 0038 /** Update an existing product. 0039 * @param p The product to add. Must be valid. 0040 */ 0041 QNetworkReply* updateProduct(RESTClient *client, const Product &p); 0042 0043 /** Deletes a product. 0044 * @param p The product to add. Must be valid. 0045 */ 0046 QNetworkReply* deleteProduct(RESTClient *client, const Product &p); 0047 0048 /** Get all samples for a product. 0049 * @param p The product to add. Must be valid. 0050 */ 0051 QNetworkReply* listSamples(RESTClient *client, const Product &p); 0052 0053 /** Add the given samples to a product. 0054 * @param p The product to add. Must be valid. 0055 */ 0056 QNetworkReply* addSamples(RESTClient *client, const Product &p, const QVector<Sample> &samples); 0057 0058 /** List all surveys for product @p p. */ 0059 QNetworkReply* listSurveys(RESTClient *client, const Product &p); 0060 0061 /** Create a new survey. */ 0062 QNetworkReply* createSurvey(RESTClient *client, const Product &p, const Survey &s); 0063 0064 /** Update an existing survey. */ 0065 QNetworkReply* updateSurvey(RESTClient *client, const Survey &s); 0066 0067 /** Delete a survey. */ 0068 QNetworkReply* deleteSurvey(RESTClient *client, const Survey &s); 0069 } 0070 0071 } 0072 } 0073 0074 #endif // KUSERFEEDBACK_CONSOLE_RESTAPI_H