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

0001 /*
0002  * SPDX-FileCopyrightText: 2019 David Barchiesi <david@barchie.si>
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 "kgapidrive_export.h"
0010 
0011 #include "searchquery.h"
0012 
0013 #include <QSharedDataPointer>
0014 #include <QVariant>
0015 
0016 namespace KGAPI2
0017 {
0018 namespace Drive
0019 {
0020 
0021 /**
0022  * DrivesSearchQuery class allows simply building even complex shared drive search queries
0023  * for DrivesFetchJob.
0024  *
0025  * See https://developers.google.com/drive/api/v2/search-shareddrives for allowed
0026  * combinations of fields, compare operators, and value types.
0027  */
0028 class KGAPIDRIVE_EXPORT DrivesSearchQuery : public SearchQuery
0029 {
0030 public:
0031     enum Field { Name, Hidden, CreatedDate, MemberCount, OrganizerCount };
0032 
0033     using SearchQuery::SearchQuery;
0034 
0035     using SearchQuery::addQuery;
0036     void addQuery(Field field, CompareOperator op, const QVariant &value);
0037 
0038 private:
0039     QString fieldToString(Field field);
0040     QString valueToString(DrivesSearchQuery::Field field, const QVariant &var);
0041 };
0042 }
0043 }