├── .gitignore ├── LICENSE ├── README.md ├── autotest ├── autotest.pro └── main.cpp ├── bin ├── clean.csh ├── cygwin-build.csh ├── git-clean.csh ├── mod-tar.csh ├── stone2Qt.tgz └── win-configure-open-ide.bat ├── examples ├── app.info ├── authorize │ ├── authorize.pro │ └── main.cpp ├── examples-common.pri ├── gcontactbash │ ├── GcontactCommands.cpp │ ├── GcontactCommands.h │ ├── gcontactbash.pro │ └── main.cpp ├── gdrivebash │ ├── GdriveCommands.cpp │ ├── GdriveCommands.h │ ├── gdrivebash.pro │ └── main.cpp ├── gmailbash │ ├── GmailCommands.cpp │ ├── GmailCommands.h │ ├── gmailbash.pro │ ├── main.cpp │ └── myemail.txt └── gtaskbash │ ├── GtaskCommands.cpp │ ├── GtaskCommands.h │ ├── gtaskbash.pro │ └── main.cpp ├── prj ├── googleQt.pro └── googleQt.sln └── src ├── Endpoint.cpp ├── Endpoint.h ├── GoogleClient.cpp ├── GoogleClient.h ├── GoogleRouteBase.h ├── gcontact ├── AUTOTEST │ ├── GcontactAutotest.cpp │ └── GcontactAutotest.h ├── GcontactCache.cpp ├── GcontactCache.h ├── GcontactCacheUtil.cpp ├── GcontactCacheUtil.h ├── GcontactParts.cpp ├── GcontactParts.h ├── GcontactRequestArg.cpp ├── GcontactRequestArg.h ├── GcontactRoutes.cpp ├── GcontactRoutes.h ├── contact_group │ ├── ContactGroupRoutes.cpp │ └── ContactGroupRoutes.h └── contacts │ ├── ContactsRoutes.cpp │ └── ContactsRoutes.h ├── gdrive ├── AUTOTEST │ ├── GdriveAutotest.cpp │ └── GdriveAutotest.h ├── GdriveRequestArg.cpp ├── GdriveRequestArg.h ├── GdriveRoutes.cpp ├── GdriveRoutes.h ├── about │ ├── AboutAboutResource.cpp │ ├── AboutAboutResource.h │ ├── AboutRoutes.cpp │ ├── AboutRoutes.h │ ├── AboutStorageQuota.cpp │ ├── AboutStorageQuota.h │ ├── AboutUserInfo.cpp │ └── AboutUserInfo.h ├── comments │ ├── CommentsComment.cpp │ ├── CommentsComment.h │ ├── CommentsCommentListResult.cpp │ ├── CommentsCommentListResult.h │ ├── CommentsQuotedFileContent.cpp │ ├── CommentsQuotedFileContent.h │ ├── CommentsReply.cpp │ ├── CommentsReply.h │ ├── CommentsRoutes.cpp │ ├── CommentsRoutes.h │ ├── CommentsUser.cpp │ └── CommentsUser.h ├── files │ ├── FilesContentHints.cpp │ ├── FilesContentHints.h │ ├── FilesCreateFileDetails.cpp │ ├── FilesCreateFileDetails.h │ ├── FilesFileResource.cpp │ ├── FilesFileResource.h │ ├── FilesFileResourcesCollection.cpp │ ├── FilesFileResourcesCollection.h │ ├── FilesGeneratedIdsCollection.cpp │ ├── FilesGeneratedIdsCollection.h │ ├── FilesImageMediaMetadata.cpp │ ├── FilesImageMediaMetadata.h │ ├── FilesLocationData.cpp │ ├── FilesLocationData.h │ ├── FilesRoutes.cpp │ ├── FilesRoutes.h │ ├── FilesThumbnailInfo.cpp │ ├── FilesThumbnailInfo.h │ ├── FilesUpdateFileDetails.cpp │ ├── FilesUpdateFileDetails.h │ ├── FilesVideoMediaMetadata.cpp │ └── FilesVideoMediaMetadata.h ├── permissions │ ├── PermissionsPermissionResourcesCollection.cpp │ ├── PermissionsPermissionResourcesCollection.h │ ├── PermissionsResourcePermission.cpp │ ├── PermissionsResourcePermission.h │ ├── PermissionsRoutes.cpp │ └── PermissionsRoutes.h └── revisions │ ├── RevisionsRevisionResource.cpp │ ├── RevisionsRevisionResource.h │ ├── RevisionsRevisionResourceCollection.cpp │ ├── RevisionsRevisionResourceCollection.h │ ├── RevisionsRevisionUser.cpp │ ├── RevisionsRevisionUser.h │ ├── RevisionsRoutes.cpp │ ├── RevisionsRoutes.h │ ├── RevisionsUpdateRevisionDetails.cpp │ └── RevisionsUpdateRevisionDetails.h ├── gmail ├── AUTOTEST │ ├── GmailAutotest.cpp │ └── GmailAutotest.h ├── GmailCache.cpp ├── GmailCache.h ├── GmailCacheRoutes.cpp ├── GmailCacheRoutes.h ├── GmailRequestArg.cpp ├── GmailRequestArg.h ├── GmailRoutes.cpp ├── GmailRoutes.h ├── attachments │ ├── AttachmentsMessageAttachment.cpp │ ├── AttachmentsMessageAttachment.h │ ├── AttachmentsRoutes.cpp │ └── AttachmentsRoutes.h ├── drafts │ ├── DraftsDraftListRes.cpp │ ├── DraftsDraftListRes.h │ ├── DraftsDraftResource.cpp │ ├── DraftsDraftResource.h │ ├── DraftsRoutes.cpp │ └── DraftsRoutes.h ├── errors │ ├── ErrorsErrorInfo.cpp │ ├── ErrorsErrorInfo.h │ ├── ErrorsErrorPart.cpp │ └── ErrorsErrorPart.h ├── history │ ├── HistoryHistoryRecord.cpp │ ├── HistoryHistoryRecord.h │ ├── HistoryHistoryRecordList.cpp │ ├── HistoryHistoryRecordList.h │ ├── HistoryLabelHistoryRecord.cpp │ ├── HistoryLabelHistoryRecord.h │ ├── HistoryRoutes.cpp │ └── HistoryRoutes.h ├── labels │ ├── LabelsLabelResource.cpp │ ├── LabelsLabelResource.h │ ├── LabelsLabelsResultList.cpp │ ├── LabelsLabelsResultList.h │ ├── LabelsRoutes.cpp │ └── LabelsRoutes.h ├── messages │ ├── MessagesBatchDeleteBodyArg.cpp │ ├── MessagesBatchDeleteBodyArg.h │ ├── MessagesMessageListRes.cpp │ ├── MessagesMessageListRes.h │ ├── MessagesMessageMimeBody.cpp │ ├── MessagesMessageMimeBody.h │ ├── MessagesMessagePart.cpp │ ├── MessagesMessagePart.h │ ├── MessagesMessagePartBody.cpp │ ├── MessagesMessagePartBody.h │ ├── MessagesMessagePayload.cpp │ ├── MessagesMessagePayload.h │ ├── MessagesMessagePayloadHeader.cpp │ ├── MessagesMessagePayloadHeader.h │ ├── MessagesMessageResource.cpp │ ├── MessagesMessageResource.h │ ├── MessagesRoutes.cpp │ └── MessagesRoutes.h ├── threads │ ├── ThreadsRoutes.cpp │ ├── ThreadsRoutes.h │ ├── ThreadsThreadListRes.cpp │ ├── ThreadsThreadListRes.h │ ├── ThreadsThreadResource.cpp │ └── ThreadsThreadResource.h └── users │ ├── UsersGetProfileResponse.cpp │ ├── UsersGetProfileResponse.h │ ├── UsersRoutes.cpp │ └── UsersRoutes.h ├── google ├── AUTOTEST │ ├── GoogleAutotest.cpp │ └── GoogleAutotest.h ├── demo │ ├── ApiListener.cpp │ ├── ApiListener.h │ ├── ApiTerminal.cpp │ └── ApiTerminal.h └── endpoint │ ├── ApiAppInfo.cpp │ ├── ApiAppInfo.h │ ├── ApiAuthInfo.cpp │ ├── ApiAuthInfo.h │ ├── ApiAutotest.cpp │ ├── ApiAutotest.h │ ├── ApiBase.cpp │ ├── ApiBase.h │ ├── ApiClient.cpp │ ├── ApiClient.h │ ├── ApiEndpoint.cpp │ ├── ApiEndpoint.h │ ├── ApiException.cpp │ ├── ApiException.h │ ├── ApiUtil.h │ ├── BatchRunner.h │ ├── Cache.cpp │ ├── Cache.h │ ├── GoogleHost.cpp │ ├── GoogleHost.h │ ├── GoogleTask.cpp │ ├── GoogleTask.h │ ├── GoogleWebAuth.cpp │ └── GoogleWebAuth.h └── gtask ├── AUTOTEST ├── GtaskAutotest.cpp └── GtaskAutotest.h ├── GtaskCache.cpp ├── GtaskCache.h ├── GtaskRequestArg.cpp ├── GtaskRequestArg.h ├── GtaskRoutes.cpp ├── GtaskRoutes.h ├── tasklists ├── TasklistsRoutes.cpp ├── TasklistsRoutes.h ├── TasklistsTaskListCollectionRes.cpp ├── TasklistsTaskListCollectionRes.h ├── TasklistsTaskListResource.cpp └── TasklistsTaskListResource.h └── tasks ├── TasksRoutes.cpp ├── TasksRoutes.h ├── TasksTaskCollectionRes.cpp ├── TasksTaskCollectionRes.h ├── TasksTaskLink.cpp ├── TasksTaskLink.h ├── TasksTaskResource.cpp └── TasksTaskResource.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | .qmake.stash 4 | Makefile 5 | moc_*.cpp 6 | moc_*.h 7 | *.user 8 | *.vcxproj 9 | *.vcxproj.filters 10 | *.sqlite 11 | *.DS_Store 12 | res.txt 13 | 14 | autotest/autotest 15 | examples/authorize/authorize 16 | examples/authorize/scope-auth-url.info 17 | examples/gdrivebash/gdrivebash 18 | examples/gmailbash/gmailbash 19 | examples/gtaskbash/gtaskbash 20 | examples/gcontactbash/gcontactbash 21 | examples/gcontactbash/download/ 22 | examples/token.info 23 | examples/app.info 24 | examples/gmailbash/data/ 25 | examples/gmailbash/download 26 | examples/gdrivebash/downloads/ 27 | examples/gcontactbash/download/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 prokarpaty.net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /autotest/autotest.pro: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # autotest generation (internal profiling usage) # 3 | # # 4 | ################################################################ 5 | 6 | 7 | QT += core network sql xml 8 | QT += gui 9 | CONFIG += console 10 | CONFIG -= app_bundle 11 | TEMPLATE = app 12 | 13 | SRC_DIR = ../src 14 | INCLUDEPATH += $${SRC_DIR} 15 | 16 | ############################################################## 17 | # specify path to the gmailQt lib, on windows it can be # 18 | # ../../prj/debug/ on unix - shadow build path # 19 | ############################################################## 20 | 21 | unix { 22 | LIBS += -L../prj/ -lgoogleQt 23 | } 24 | 25 | win32 { 26 | contains(QT_ARCH, i386) { 27 | LIBS += -L../prj/debug/ -lgoogleQt 28 | } else { 29 | LIBS += -L../prj/x64/debug/ -lgoogleQt 30 | } 31 | } 32 | 33 | DEFINES += API_QT_AUTOTEST 34 | 35 | SOURCES += main.cpp 36 | 37 | -------------------------------------------------------------------------------- /autotest/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "GoogleClient.h" 4 | #include "google/AUTOTEST/GoogleAutotest.h" 5 | 6 | #ifndef API_QT_AUTOTEST 7 | #error API_QT_AUTOTEST is not defined. If you need autotest functionality please reconfigure with 'ARD_AUTOTEST YES' env variable, rebuild library and autotest projects. 8 | #endif 9 | 10 | using namespace googleQt; 11 | 12 | int main(int argc, char *argv[]) { 13 | 14 | QCoreApplication app(argc, argv); 15 | 16 | if (argc != 2) { 17 | std::string s = "\nUsage: COMMAND \n" 18 | "\n" 19 | ": The file where results of autotest procedure will be generated" 20 | " Press ENTER to proceed."; 21 | 22 | std::cout << s << std::endl; 23 | std::cin.ignore(); 24 | return 0; 25 | } 26 | 27 | const char* argResFile = argv[1]; 28 | std::unique_ptrappInfo(new ApiAppInfo); 29 | appInfo->setKeySecret("my-key", "my-secret"); 30 | std::unique_ptr authInfo(new ApiAuthInfo()); 31 | authInfo->setEmail("me@gmail.com"); 32 | auto c = googleQt::createClient(appInfo.release(), authInfo.release()); 33 | DECLARE_AUTOTEST_INSTANCE(c.get(), argResFile); 34 | 35 | autotest.generateCalls(); 36 | googleQt::releaseClient(c); 37 | std::cout << "finished" << std::endl; 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /bin/clean.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | 3 | 4 | 5 | ### delete specified folders 6 | foreach p("debug" "release" "__tmp" "lib" "_a-docs" "iphoneos" "iphonesimulator" "Debug" "Release-iphoneos" "Release-iphonesimulator" "project.xcworkspace" "xcshareddata" "__pycache__" "x64" ".vs") 7 | set ftemp=$p 8 | echo $p `find . -type d -name "$ftemp" | wc -l` 9 | find . -type d -name "$ftemp" -exec rm -r {} \; 10 | end 11 | 12 | echo "delete specified files by extention" 13 | echo "cleaning tmp-files.." 14 | foreach p("pdb" "o" "a" "lib" "so" "ilk" "res" "exe" "sdf" "pro.user" "vcxproj" "vcxproj.user" "vcxproj.filters" "so-deployment-settings.json" "qmake.stash" "DS_Store" "log" "mak" "pbxproj" "plist" "suo" "VC.db" "htm") 15 | set ftemp="*."$p 16 | echo $p `find . -type f -name "$ftemp" | wc -l` 17 | find . -type f -name "$ftemp" -exec rm {} \; 18 | end 19 | 20 | ### delete specified files by name 21 | foreach p("Makefile" "core" "._") 22 | set ftemp=$p"*" 23 | echo $p `find . -type f -name "$ftemp" | wc -l` 24 | find . -type f -name "$ftemp" -exec rm {} \; 25 | end 26 | 27 | 28 | echo "qrc_.....-res.cpp" `find . -type f -name "qrc_*-res.cpp" | wc -l` 29 | find . -type f -name "qrc_*-res.cpp" -exec rm {} \; 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /bin/cygwin-build.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | 3 | 4 | cygstart "win-configure-open-ide.bat" 5 | 6 | -------------------------------------------------------------------------------- /bin/git-clean.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | 3 | find . -name "*.h" -exec bash -c 'expand -t 4 "$0" > $0.tmp && mv $0.tmp "$0"' {} \; 4 | 5 | find . -name "*.cpp" -exec bash -c 'expand -t 4 "$0" > $0.tmp && mv $0.tmp "$0"' {} \; 6 | 7 | find . -name "*.h"| xargs dos2unix 8 | find . -name "*.cpp"| xargs dos2unix 9 | -------------------------------------------------------------------------------- /bin/mod-tar.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | 3 | ##################################################### 4 | # 5 | # script will zip up manually edited source 6 | # that were modifid during last 5 days(optional) 7 | # all autogenerated files will be skippet 8 | # 9 | #################################################### 10 | 11 | ./bin/clean.csh 12 | 13 | set days_test = $1 14 | if($days_test == "")then 15 | set days_test = 5 16 | endif 17 | 18 | set date_label=`date +"%Y-%m-%d"` 19 | set host_label=`hostname` 20 | set tar_name=../mods-$host_label-$date_label.tar.gz 21 | 22 | echo "=====================================================" 23 | 24 | #tar -czvf $tar_name `find . -mtime -$days_test \( -name "*.cpp" -or -name "*.h" -or -name "*.pro" -or -name "*.csh" -or -name "*.bat" \) | grep -v __tmp` 25 | tar -czvf $tar_name `find . -mtime -5 \( -name "*.cpp" -or -name "*.h" -or -name "*.pro" -or -name "*.csh" -or -name "*.bat" \) | grep -v __tmp | grep -v "./src/gtask/tasklists/" | grep -v "./src/gtask/AUTOTEST/" | grep -v "./src/gtask/tasks/" | grep -v "./src/gmail/messages" | grep -v "./src/gmail/labels/" | grep -v "./src/gmail/threads" | grep -v "./src/gmail/users" | grep -v "./src/gmail/history"| grep -v "./src/gmail/errors"| grep -v "./src/gmail/drafts"| grep -v "./src/gmail/attachments"|grep -v "./src/gmail/AUTOTEST"|grep -v "./src/gdrive/revisions"|grep -v "./src/gdrive/permissions"|grep -v "./src/gdrive/files"|grep -v "./src/gdrive/comments"|grep -v "./src/gdrive/about"|grep -v "./src/gdrive/AUTOTEST"|grep -v "./src/gcontact/contacts"|grep -v "./src/gcontact/AUTOTEST"` 26 | 27 | 28 | echo "=====================================================" 29 | tar -tvf $tar_name |sort -nk 3 | awk '{printf("%3.1fK\t%s\t%s\n", $3/1024, $4, $6)}' 30 | split -b 140000 $tar_name ../mseg 31 | echo "=====================================================" 32 | 33 | echo "older then "$days_test "days.." `ls -lsh $tar_name | awk '{print $1}'` 34 | 35 | -------------------------------------------------------------------------------- /bin/stone2Qt.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osoftteam/googleQt/bd73b2569dbc280e3d1fe7c2aaacc458d5188cbb/bin/stone2Qt.tgz -------------------------------------------------------------------------------- /bin/win-configure-open-ide.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Windows script to configure gmailQt and solution file in IDE 4 | REM requirement: Qt 5 should be installed and path to qmake 5 | REM should listed in PATH environment variable 6 | REM *note: usually this script is run from Visual Studio Command Prompt 7 | 8 | 9 | cd ..\prj 10 | echo "configuring %cd%" 11 | qmake -tp vc 12 | 13 | cd ..\examples 14 | for /D %%d in (*) do ( 15 | echo "configuring %%d" 16 | cd "%%d" 17 | qmake -tp vc 18 | cd .. 19 | ) 20 | 21 | cd ..\bin 22 | 23 | echo "opening IDE.." 24 | ..\prj\googleQt.sln 25 | 26 | pause 27 | -------------------------------------------------------------------------------- /examples/app.info: -------------------------------------------------------------------------------- 1 | { 2 | "key": "my_key", 3 | "secret": "my_secret" 4 | } -------------------------------------------------------------------------------- /examples/authorize/authorize.pro: -------------------------------------------------------------------------------- 1 | include( ../examples-common.pri ) 2 | 3 | 4 | SOURCES += main.cpp 5 | 6 | -------------------------------------------------------------------------------- /examples/examples-common.pri: -------------------------------------------------------------------------------- 1 | QT += core network sql xml 2 | QT += gui 3 | CONFIG += console 4 | CONFIG -= app_bundle 5 | TEMPLATE = app 6 | 7 | SRC_DIR = ../../src 8 | INCLUDEPATH += $${SRC_DIR} 9 | 10 | ################################################################ 11 | # autotest generation (internal profiling usage) 12 | # you probably don't need it, unless you design/profile library 13 | ################################################################ 14 | ARD_AUTOTEST=$$(ARD_AUTOTEST) 15 | if(!isEmpty( ARD_AUTOTEST )){ 16 | DEFINES += API_QT_AUTOTEST 17 | DEFINES += API_QT_DIAGNOSTICS 18 | !build_pass:message("+autotest") 19 | } 20 | 21 | ARD_DEBUG=$$(ARD_DEBUG) 22 | if(!isEmpty( ARD_DEBUG )){ 23 | unix { 24 | QMAKE_CXXFLAGS += -O0 -g 25 | !build_pass:message("+debug") 26 | } 27 | } 28 | 29 | ############################################################## 30 | # specify path to the gmailQt lib, on windows it can be # 31 | # ../../prj/debug/ on unix - shadow build path # 32 | ############################################################## 33 | 34 | unix { 35 | LIBS += -L../../prj/ -lgoogleQt 36 | } 37 | 38 | win32 { 39 | contains(QT_ARCH, i386) { 40 | LIBS += -L../../prj/debug/ -lgoogleQt 41 | } else { 42 | LIBS += -L../../prj/x64/debug/ -lgoogleQt 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /examples/gcontactbash/gcontactbash.pro: -------------------------------------------------------------------------------- 1 | include( ../examples-common.pri ) 2 | 3 | SOURCES += main.cpp GcontactCommands.cpp 4 | HEADERS += GcontactCommands.h 5 | -------------------------------------------------------------------------------- /examples/gdrivebash/gdrivebash.pro: -------------------------------------------------------------------------------- 1 | include( ../examples-common.pri ) 2 | 3 | SOURCES += main.cpp GdriveCommands.cpp 4 | HEADERS += GdriveCommands.h 5 | -------------------------------------------------------------------------------- /examples/gmailbash/gmailbash.pro: -------------------------------------------------------------------------------- 1 | include( ../examples-common.pri ) 2 | 3 | SOURCES += main.cpp GmailCommands.cpp 4 | HEADERS += GmailCommands.h 5 | -------------------------------------------------------------------------------- /examples/gmailbash/myemail.txt: -------------------------------------------------------------------------------- 1 | To:ykhodak@yahoo.com 2 | From:yuriy.khodak@gmail.com 3 | Subject: this is a subject 4 | And this is the body of the message 5 | -------------------------------------------------------------------------------- /examples/gtaskbash/GtaskCommands.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "GoogleClient.h" 4 | #include "gtask/GtaskCache.h" 5 | 6 | using namespace googleQt; 7 | 8 | namespace googleQt { 9 | namespace tasks 10 | { 11 | class TaskResource; 12 | }; 13 | 14 | namespace tasklists { 15 | class TaskListResource; 16 | }; 17 | /* 18 | namespace gtask_cache{ 19 | class TaskInfo; 20 | class TaskInfo{ 21 | class ptr; 22 | }; 23 | };*/ 24 | }//googleQt 25 | 26 | class GtaskCommands 27 | { 28 | public: 29 | GtaskCommands(GoogleClient& c); 30 | 31 | /** 32 | * ls - list tasks in a tasklist 33 | */ 34 | void ls(QString tasklist); 35 | 36 | /** 37 | * get - get task by tasklist ID and task ID 38 | */ 39 | void get(QString tlistid_space_taskid); 40 | 41 | /** 42 | * insert - insert new task into tasklist ID with title 43 | */ 44 | void insert(QString tlistid_space_title); 45 | 46 | /** 47 | * update - update title of a task, requires tasklist ID, task ID 48 | */ 49 | void update(QString tlistid_space_taskid_title); 50 | 51 | /** 52 | * update_note - update note of a task, requires tasklist ID, task ID 53 | */ 54 | void update_note(QString tlistid_space_taskid_note); 55 | 56 | 57 | /** 58 | * deleteTask - delete task by task list ID and task ID 59 | */ 60 | void delete_task(QString tlistid_space_taskid); 61 | 62 | /** 63 | * clearCompleted - hide all completed tasks in task list 64 | */ 65 | void clearCompleted(QString tlistid); 66 | 67 | /** 68 | * move - move task, requires four space-separated arguments tasklistID, taskID, parentID, positionID 69 | */ 70 | void move(QString four_arguments); 71 | 72 | /** 73 | * display list of tasklists 74 | */ 75 | void ls_tlist(QString pageToken); 76 | 77 | /** 78 | * get tasklist by tasklist_id 79 | */ 80 | void get_tlist(QString tasklist_id); 81 | 82 | /** 83 | * insert new tasklist with title 84 | */ 85 | void insert_tlist(QString title); 86 | 87 | /** 88 | * update title of a tasklist ID, by tasklist ID 89 | */ 90 | void update_tlist(QString tlistid_space_title); 91 | 92 | /** 93 | * deleteTask - delete tasklist by tasklistID 94 | */ 95 | void delete_tlist(QString tlistid); 96 | 97 | void reload_cache(QString tlistids); 98 | 99 | protected: 100 | void printTask(tasks::TaskResource*); 101 | void printTaskList(tasklists::TaskListResource*); 102 | void printCacheTitles(); 103 | void printCacheParents(); 104 | void printCacheTree(); 105 | void printTaskInTree(googleQt::gtask_cache::TaskInfo::ptr p, int ident); 106 | 107 | protected: 108 | GoogleClient& m_c; 109 | GtaskRoutes* m_gt; 110 | }; 111 | -------------------------------------------------------------------------------- /examples/gtaskbash/gtaskbash.pro: -------------------------------------------------------------------------------- 1 | include( ../examples-common.pri ) 2 | 3 | SOURCES += main.cpp GtaskCommands.cpp 4 | HEADERS += GtaskCommands.h 5 | -------------------------------------------------------------------------------- /prj/googleQt.pro: -------------------------------------------------------------------------------- 1 | QT += network xml sql 2 | QT += gui 3 | CONFIG += staticlib 4 | CONFIG -= flat 5 | TEMPLATE = lib 6 | 7 | GM_MODULES = users messages labels threads drafts errors history attachments 8 | GT_MODULES = tasks tasklists 9 | GD_MODULES = about files permissions comments revisions 10 | GC_MODULES = contacts contact_group 11 | 12 | SRC_DIR = ../src 13 | G_DIR = $${SRC_DIR}/google 14 | GM_DIR = $${SRC_DIR}/gmail 15 | GT_DIR = $${SRC_DIR}/gtask 16 | GD_DIR = $${SRC_DIR}/gdrive 17 | GC_DIR = $${SRC_DIR}/gcontact 18 | 19 | #HEADERS += $${SRC_DIR}/*.h 20 | HEADERS += $$files($${SRC_DIR}/*.h, false) 21 | SOURCES += $$files($${SRC_DIR}/*.cpp, false) 22 | 23 | HEADERS += $$files($${G_DIR}/endpoint/*.h, false) 24 | SOURCES += $$files($${G_DIR}/endpoint/*.cpp, false) 25 | HEADERS += $$files($${G_DIR}/demo/*.h, false) 26 | SOURCES += $$files($${G_DIR}/demo/*.cpp, false) 27 | HEADERS += $$files($${GM_DIR}/*.h,false) $$files($${GT_DIR}/*.h,false) $$files($${GD_DIR}/*.h,false) $$files($${GC_DIR}/*.h,false) 28 | SOURCES += $$files($${GM_DIR}/*.cpp,false) $$files($${GT_DIR}/*.cpp,false) $$files($${GD_DIR}/*.cpp,false) $$files($${GC_DIR}/*.cpp,false) 29 | 30 | 31 | for(m, GM_MODULES){ 32 | d = $${GM_DIR}/$${m} 33 | exists($${d}){ 34 | HEADERS += $$files($${d}/*.h, false) 35 | SOURCES += $$files($${d}/*.cpp, false) 36 | } 37 | } 38 | 39 | for(m, GT_MODULES){ 40 | d = $${GT_DIR}/$${m} 41 | exists($${d}){ 42 | HEADERS += $$files($${d}/*.h, false) 43 | SOURCES += $$files($${d}/*.cpp, false) 44 | } 45 | } 46 | 47 | for(m, GD_MODULES){ 48 | d = $${GD_DIR}/$${m} 49 | exists($${d}){ 50 | HEADERS += $$files($${d}/*.h, false) 51 | SOURCES += $$files($${d}/*.cpp, false) 52 | } 53 | } 54 | 55 | for(m, GC_MODULES){ 56 | d = $${GC_DIR}/$${m} 57 | exists($${d}){ 58 | HEADERS += $$files($${d}/*.h, false) 59 | SOURCES += $$files($${d}/*.cpp, false) 60 | } 61 | } 62 | 63 | ################################################################ 64 | # some diagnostics, some non-intence logging/tracing 65 | ################################################################ 66 | #DEFINES += API_QT_DIAGNOSTICS 67 | 68 | ################################################################ 69 | # autotest generation (internal profiling usage) 70 | ################################################################ 71 | ARD_AUTOTEST=$$(ARD_AUTOTEST) 72 | if(!isEmpty( ARD_AUTOTEST )){ 73 | HEADERS += $${G_DIR}/AUTOTEST/*.h 74 | SOURCES += $${G_DIR}/AUTOTEST/*.cpp 75 | HEADERS += $${GM_DIR}/AUTOTEST/*.h $${GT_DIR}/AUTOTEST/*.h $${GD_DIR}/AUTOTEST/*.h $${GC_DIR}/AUTOTEST/*.h 76 | SOURCES += $${GM_DIR}/AUTOTEST/*.cpp $${GT_DIR}/AUTOTEST/*.cpp $${GD_DIR}/AUTOTEST/*.cpp $${GC_DIR}/AUTOTEST/*.cpp 77 | DEFINES += API_QT_AUTOTEST 78 | DEFINES += API_QT_DIAGNOSTICS 79 | !build_pass:message("+autotest") 80 | } 81 | ################################################################ 82 | ARD_DEBUG = $$(ARD_DEBUG) 83 | if(!isEmpty( ARD_DEBUG )){ 84 | CONFIG += debug 85 | CONFIG -= release 86 | unix { 87 | QMAKE_CXXFLAGS += -O0 -std=c++14 88 | } 89 | !build_pass:message("+debug") 90 | } 91 | 92 | INCLUDEPATH += $${SRC_DIR} 93 | 94 | -------------------------------------------------------------------------------- /src/Endpoint.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Endpoint.h" 3 | 4 | using namespace googleQt; 5 | 6 | Endpoint::Endpoint(ApiClient* c):ApiEndpoint(c) 7 | { 8 | 9 | } 10 | 11 | 12 | GoogleClient* Endpoint::client() 13 | { 14 | GoogleClient* rv = dynamic_cast(m_client); 15 | return rv; 16 | }; 17 | 18 | const GoogleClient* Endpoint::client()const 19 | { 20 | const GoogleClient* rv = dynamic_cast(m_client); 21 | return rv; 22 | }; 23 | 24 | void Endpoint::onErrorUnauthorized(const errors::ErrorInfo*) 25 | { 26 | if(!client()->refreshToken()) 27 | { 28 | qWarning() << "Failed to refresh token"; 29 | }; 30 | }; 31 | 32 | QString Endpoint::prepareErrorSummary(int status_code) 33 | { 34 | QString s; 35 | switch(status_code) 36 | { 37 | case 400:s = "Bad Request"; break; 38 | case 403:s = "Invalid access token. You have to get new access token.";break; 39 | case 404:s = "Resource not found on server.";break; 40 | case 500:s = "Internal Server Error. Generic server error."; break; 41 | } 42 | QString rv = QString("%1 - %2").arg(status_code).arg(s); 43 | return rv; 44 | }; 45 | 46 | QString Endpoint::prepareErrorInfo(int status_code, const QUrl& url, const QByteArray& data) 47 | { 48 | QString rv = QString("ERROR. Unexpected status %1 %2 ").arg(status_code).arg(url.url()); 49 | rv += data; 50 | #ifdef API_QT_DIAGNOSTICS 51 | rv += "\n"; 52 | rv += lastRequestInfo().request; 53 | #endif//API_QT_DIAGNOSTICS 54 | return rv; 55 | }; 56 | 57 | void Endpoint::addAppKeyParameter(QUrl& url)const 58 | { 59 | QUrlQuery q(url); 60 | q.addQueryItem("key", client()->getAppKey()); 61 | url.setQuery(q); 62 | }; 63 | -------------------------------------------------------------------------------- /src/GoogleRouteBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace googleQt{ 4 | 5 | class Endpoint; 6 | 7 | class GoogleRouteBase 8 | { 9 | public: 10 | GoogleRouteBase(Endpoint* ep):m_end_point(ep){} 11 | 12 | protected: 13 | Endpoint* m_end_point; 14 | }; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/gcontact/AUTOTEST/GcontactAutotest.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gcontact/GcontactRequestArg.h" 12 | #include 13 | #include 14 | #include 15 | #include "GoogleClient.h" 16 | #include "gcontact/GcontactRoutes.h" 17 | 18 | #ifdef API_QT_AUTOTEST 19 | namespace googleQt{ 20 | 21 | class GcontactAutotest { 22 | public: 23 | GcontactAutotest(GoogleClient&); 24 | 25 | void generateCalls(); 26 | 27 | 28 | };//GcontactAutotest 29 | 30 | }//googleQt 31 | #endif //API_QT_AUTOTEST 32 | -------------------------------------------------------------------------------- /src/gcontact/GcontactRoutes.cpp: -------------------------------------------------------------------------------- 1 | #include "GcontactRoutes.h" 2 | using namespace googleQt; 3 | 4 | GcontactRoutes::GcontactRoutes(Endpoint& e/*, gcontact::GContactCacheBase* cb*/) 5 | :m_endpoint(e)//, m_contacts_cache(cb) 6 | { 7 | 8 | }; 9 | 10 | contacts::ContactsRoutes* GcontactRoutes::getContacts() 11 | { 12 | if(!m_contacts){ 13 | m_contacts.reset(new contacts::ContactsRoutes(&m_endpoint)); 14 | } 15 | return m_contacts.get(); 16 | }; 17 | 18 | contact_group::ContactGroupRoutes* GcontactRoutes::getContactGroup() 19 | { 20 | if (!m_contact_group) { 21 | m_contact_group.reset(new contact_group::ContactGroupRoutes(&m_endpoint)); 22 | } 23 | return m_contact_group.get(); 24 | }; 25 | 26 | 27 | googleQt::gcontact::GcontactCacheRoutes* GcontactRoutes::cacheRoutes() 28 | { 29 | if(!m_CacheRoutes){ 30 | m_CacheRoutes.reset(new googleQt::gcontact::GcontactCacheRoutes(m_endpoint, *this)); 31 | } 32 | 33 | return m_CacheRoutes.get(); 34 | }; 35 | 36 | QString GcontactRoutes::encodeGroupUri(QString userId, QString groupId) 37 | { 38 | QString usr = QUrl::toPercentEncoding(userId); 39 | QString rv = QString("http://www.google.com/m8/feeds/groups/%2/base/%3") 40 | .arg(usr) 41 | .arg(groupId); 42 | return rv; 43 | }; 44 | 45 | #ifdef API_QT_AUTOTEST 46 | void GcontactRoutes::autotest() 47 | { 48 | cacheRoutes()->runAutotest(); 49 | }; 50 | #endif 51 | -------------------------------------------------------------------------------- /src/gcontact/GcontactRoutes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "google/endpoint/ApiUtil.h" 3 | #include "google/endpoint/ApiClient.h" 4 | 5 | #include "gcontact/contacts/ContactsRoutes.h" 6 | #include "gcontact/contact_group/ContactGroupRoutes.h" 7 | 8 | namespace googleQt 9 | { 10 | class Endpoint; 11 | 12 | namespace gcontact { 13 | class GcontactCacheRoutes; 14 | class GContactCacheBase; 15 | }; 16 | 17 | class GcontactRoutes { 18 | public: 19 | 20 | GcontactRoutes(Endpoint&/*, gcontact::GContactCacheBase**/); 21 | Endpoint& endpoint() { return m_endpoint; } 22 | 23 | contacts::ContactsRoutes* getContacts(); 24 | contact_group::ContactGroupRoutes* getContactGroup(); 25 | googleQt::gcontact::GcontactCacheRoutes* cacheRoutes(); 26 | 27 | static QString encodeGroupUri(QString userId, QString groupId); 28 | 29 | #ifdef API_QT_AUTOTEST 30 | void autotest(); 31 | #endif 32 | 33 | protected: 34 | Endpoint& m_endpoint; 35 | std::unique_ptr m_contacts; 36 | std::unique_ptr m_contact_group; 37 | std::unique_ptr m_CacheRoutes; 38 | //gcontact::GContactCacheBase* m_contacts_cache{nullptr}; 39 | }; 40 | };//googleQt 41 | 42 | -------------------------------------------------------------------------------- /src/gdrive/AUTOTEST/GdriveAutotest.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | #include 13 | #include 14 | #include 15 | #include "GoogleClient.h" 16 | #include "gdrive/GdriveRoutes.h" 17 | 18 | #ifdef API_QT_AUTOTEST 19 | namespace googleQt{ 20 | 21 | class GdriveAutotest { 22 | public: 23 | GdriveAutotest(GoogleClient&); 24 | 25 | void generateCalls(); 26 | 27 | 28 | };//GdriveAutotest 29 | 30 | }//googleQt 31 | #endif //API_QT_AUTOTEST 32 | -------------------------------------------------------------------------------- /src/gdrive/about/AboutAboutResource.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "about" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/about/AboutAboutResource.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace about{ 15 | ///AboutResource 16 | 17 | AboutResource::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void AboutResource::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_kind.isEmpty()) 27 | js["kind"] = QString(m_kind); 28 | js["user"] = (QJsonObject)m_user; 29 | js["storageQuota"] = (QJsonObject)m_storageQuota; 30 | } 31 | 32 | void AboutResource::fromJson(const QJsonObject& js){ 33 | 34 | m_kind = js["kind"].toString(); 35 | m_user.fromJson(js["user"].toObject()); 36 | m_storageQuota.fromJson(js["storageQuota"].toObject()); 37 | } 38 | 39 | QString AboutResource::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr AboutResource::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr AboutResource::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new AboutResource); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr AboutResource::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new AboutResource); 72 | rv->m_kind = ApiAutotest::INSTANCE().getString("about::AboutResource", "m_kind", QString("kind_%1").arg(example_idx)); 73 | rv->m_user = *(about::UserInfo::EXAMPLE(0, context_index).get()); 74 | rv->m_storageQuota = *(about::StorageQuota::EXAMPLE(0, context_index).get()); 75 | return rv; 76 | } 77 | #endif //API_QT_AUTOTEST 78 | 79 | }//about 80 | }//googleQt 81 | -------------------------------------------------------------------------------- /src/gdrive/about/AboutAboutResource.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "about" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | #include "gdrive/about/AboutUserInfo.h" 13 | #include "gdrive/about/AboutStorageQuota.h" 14 | 15 | namespace googleQt{ 16 | namespace about{ 17 | class AboutResource{ 18 | /** 19 | field: kind: This is always drive#about. 20 | field: user: The authenticated user. 21 | field: storage_quota: storage quota 22 | */ 23 | 24 | public: 25 | AboutResource(): 26 | m_kind("drive#about") 27 | {}; 28 | 29 | AboutResource(const QString& arg): 30 | m_kind("drive#about") 31 | { m_kind = arg; }; 32 | virtual ~AboutResource(){}; 33 | 34 | public: 35 | /** 36 | This is always drive#about. 37 | */ 38 | QString kind()const{return m_kind;}; 39 | AboutResource& setKind(const QString& arg){m_kind=arg;return *this;}; 40 | 41 | /** 42 | The authenticated user. 43 | */ 44 | const UserInfo& user()const{return m_user;}; 45 | AboutResource& setUser(const UserInfo& arg){m_user=arg;return *this;}; 46 | 47 | /** 48 | storage quota 49 | */ 50 | const StorageQuota& storagequota()const{return m_storageQuota;}; 51 | AboutResource& setStoragequota(const StorageQuota& arg){m_storageQuota=arg;return *this;}; 52 | 53 | public: 54 | operator QJsonObject ()const; 55 | virtual void fromJson(const QJsonObject& js); 56 | virtual void toJson(QJsonObject& js)const; 57 | virtual QString toString(bool multiline = true)const; 58 | 59 | 60 | class factory{ 61 | public: 62 | static std::unique_ptr create(const QByteArray& data); 63 | static std::unique_ptr create(const QJsonObject& js); 64 | }; 65 | 66 | 67 | #ifdef API_QT_AUTOTEST 68 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 69 | #endif //API_QT_AUTOTEST 70 | 71 | 72 | protected: 73 | /** 74 | This is always drive#about. 75 | */ 76 | QString m_kind; 77 | 78 | /** 79 | The authenticated user. 80 | */ 81 | UserInfo m_user; 82 | 83 | /** 84 | storage quota 85 | */ 86 | StorageQuota m_storageQuota; 87 | 88 | };//AboutResource 89 | 90 | }//about 91 | }//googleQt 92 | -------------------------------------------------------------------------------- /src/gdrive/about/AboutRoutes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "about" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/about/AboutRoutes.h" 10 | #include "Endpoint.h" 11 | #include "gdrive/GdriveRoutes.h" 12 | using namespace googleQt; 13 | using namespace about; 14 | 15 | std::unique_ptr AboutRoutes::get(const gdrive::AboutArg& arg){ 16 | return get_Async(arg)->waitForResultAndRelease(); 17 | } 18 | 19 | GoogleTask* AboutRoutes::get_Async(const gdrive::AboutArg& arg) 20 | { 21 | GoogleTask* t = m_end_point->produceTask(); 22 | m_end_point->getStyle< 23 | AboutResource, 24 | AboutResource::factory 25 | > 26 | (m_end_point->buildGdriveUrl("about", arg), 27 | t); 28 | return t; 29 | } 30 | 31 | void AboutRoutes::get_AsyncCB( 32 | const gdrive::AboutArg& arg, 33 | std::function)> completed_callback , 34 | std::function)> failed_callback) 35 | { 36 | m_end_point->getStyle 37 | < 38 | AboutResource, 39 | AboutResource::factory 40 | > 41 | (m_end_point->buildGdriveUrl("about", arg), 42 | completed_callback, 43 | failed_callback); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/gdrive/about/AboutRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "about" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gdrive/GdriveRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gdrive/about/AboutAboutResource.h" 15 | 16 | namespace googleQt{ 17 | namespace about{ 18 | 19 | 20 | class AboutRoutes: public GoogleRouteBase{ 21 | public: 22 | AboutRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 23 | /** 24 | ApiRoute('get') 25 | 26 | 27 | Gets information about the user, the user's Drive, and system 28 | capabilities. 29 | 30 | */ 31 | std::unique_ptr get(const gdrive::AboutArg& arg); 32 | GoogleTask* get_Async(const gdrive::AboutArg& arg); 33 | void get_AsyncCB( 34 | const gdrive::AboutArg&, 35 | std::function)> completed_callback = nullptr, 36 | std::function)> failed_callback = nullptr); 37 | 38 | protected: 39 | };//AboutRoutes 40 | 41 | }//about 42 | }//googleQt 43 | -------------------------------------------------------------------------------- /src/gdrive/about/AboutStorageQuota.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "about" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/about/AboutStorageQuota.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace about{ 15 | ///StorageQuota 16 | 17 | StorageQuota::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void StorageQuota::toJson(QJsonObject& js)const{ 25 | 26 | js["limit"] = m_limit; 27 | js["usage"] = m_usage; 28 | js["usageInDrive"] = QString("%1").arg(m_usageInDrive); 29 | js["usageInDriveTrash"] = QString("%1").arg(m_usageInDriveTrash); 30 | js["maxUploadSize"] = QString("%1").arg(m_maxUploadSize); 31 | js["appInstalled"] = m_appInstalled; 32 | } 33 | 34 | void StorageQuota::fromJson(const QJsonObject& js){ 35 | 36 | m_limit = js["limit"].toVariant().toFloat(); 37 | m_usage = js["usage"].toVariant().toFloat(); 38 | m_usageInDrive = js["usageInDrive"].toVariant().toString().toULongLong(); 39 | m_usageInDriveTrash = js["usageInDriveTrash"].toVariant().toString().toULongLong(); 40 | m_maxUploadSize = js["maxUploadSize"].toVariant().toString().toULongLong(); 41 | m_appInstalled = js["appInstalled"].toVariant().toBool(); 42 | } 43 | 44 | QString StorageQuota::toString(bool multiline)const 45 | { 46 | QJsonObject js; 47 | toJson(js); 48 | QJsonDocument doc(js); 49 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 50 | return s; 51 | } 52 | 53 | 54 | std::unique_ptr StorageQuota::factory::create(const QByteArray& data) 55 | { 56 | QJsonDocument doc = QJsonDocument::fromJson(data); 57 | QJsonObject js = doc.object(); 58 | return create(js); 59 | } 60 | 61 | 62 | std::unique_ptr StorageQuota::factory::create(const QJsonObject& js) 63 | { 64 | std::unique_ptr rv; 65 | rv = std::unique_ptr(new StorageQuota); 66 | rv->fromJson(js); 67 | return rv; 68 | } 69 | 70 | #ifdef API_QT_AUTOTEST 71 | std::unique_ptr StorageQuota::EXAMPLE(int context_index, int parent_context_index){ 72 | Q_UNUSED(context_index); 73 | Q_UNUSED(parent_context_index); 74 | static int example_idx = 0; 75 | example_idx++; 76 | std::unique_ptr rv(new StorageQuota); 77 | rv->m_limit = ApiAutotest::INSTANCE().getInt("about::StorageQuota", "m_limit", 1 + example_idx); 78 | rv->m_usage = ApiAutotest::INSTANCE().getInt("about::StorageQuota", "m_usage", 2 + example_idx); 79 | rv->m_usageInDrive = ApiAutotest::INSTANCE().getInt("about::StorageQuota", "m_usageInDrive", 3 + example_idx); 80 | rv->m_usageInDriveTrash = ApiAutotest::INSTANCE().getInt("about::StorageQuota", "m_usageInDriveTrash", 4 + example_idx); 81 | rv->m_maxUploadSize = ApiAutotest::INSTANCE().getInt("about::StorageQuota", "m_maxUploadSize", 5 + example_idx); 82 | return rv; 83 | } 84 | #endif //API_QT_AUTOTEST 85 | 86 | }//about 87 | }//googleQt 88 | -------------------------------------------------------------------------------- /src/gdrive/about/AboutUserInfo.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "about" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/about/AboutUserInfo.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace about{ 15 | ///UserInfo 16 | 17 | UserInfo::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void UserInfo::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_displayName.isEmpty()) 27 | js["displayName"] = QString(m_displayName); 28 | if(!m_kind.isEmpty()) 29 | js["kind"] = QString(m_kind); 30 | if(!m_photoLink.isEmpty()) 31 | js["photoLink"] = QString(m_photoLink); 32 | js["me"] = m_me; 33 | if(!m_permissionId.isEmpty()) 34 | js["permissionId"] = QString(m_permissionId); 35 | if(!m_emailAddress.isEmpty()) 36 | js["emailAddress"] = QString(m_emailAddress); 37 | } 38 | 39 | void UserInfo::fromJson(const QJsonObject& js){ 40 | 41 | m_displayName = js["displayName"].toString(); 42 | m_kind = js["kind"].toString(); 43 | m_photoLink = js["photoLink"].toString(); 44 | m_me = js["me"].toVariant().toBool(); 45 | m_permissionId = js["permissionId"].toString(); 46 | m_emailAddress = js["emailAddress"].toString(); 47 | } 48 | 49 | QString UserInfo::toString(bool multiline)const 50 | { 51 | QJsonObject js; 52 | toJson(js); 53 | QJsonDocument doc(js); 54 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 55 | return s; 56 | } 57 | 58 | 59 | std::unique_ptr UserInfo::factory::create(const QByteArray& data) 60 | { 61 | QJsonDocument doc = QJsonDocument::fromJson(data); 62 | QJsonObject js = doc.object(); 63 | return create(js); 64 | } 65 | 66 | 67 | std::unique_ptr UserInfo::factory::create(const QJsonObject& js) 68 | { 69 | std::unique_ptr rv; 70 | rv = std::unique_ptr(new UserInfo); 71 | rv->fromJson(js); 72 | return rv; 73 | } 74 | 75 | #ifdef API_QT_AUTOTEST 76 | std::unique_ptr UserInfo::EXAMPLE(int context_index, int parent_context_index){ 77 | Q_UNUSED(context_index); 78 | Q_UNUSED(parent_context_index); 79 | static int example_idx = 0; 80 | example_idx++; 81 | std::unique_ptr rv(new UserInfo); 82 | rv->m_displayName = ApiAutotest::INSTANCE().getString("about::UserInfo", "m_displayName", QString("displayName_%1").arg(example_idx)); 83 | rv->m_kind = ApiAutotest::INSTANCE().getString("about::UserInfo", "m_kind", QString("kind_%1").arg(example_idx)); 84 | rv->m_photoLink = ApiAutotest::INSTANCE().getString("about::UserInfo", "m_photoLink", QString("photoLink_%1").arg(example_idx)); 85 | rv->m_permissionId = ApiAutotest::INSTANCE().getString("about::UserInfo", "m_permissionId", QString("permissionId_%1").arg(example_idx)); 86 | rv->m_emailAddress = ApiAutotest::INSTANCE().getString("about::UserInfo", "m_emailAddress", QString("emailAddress_%1").arg(example_idx)); 87 | return rv; 88 | } 89 | #endif //API_QT_AUTOTEST 90 | 91 | }//about 92 | }//googleQt 93 | -------------------------------------------------------------------------------- /src/gdrive/comments/CommentsCommentListResult.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "comments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/comments/CommentsCommentListResult.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace comments{ 15 | ///CommentListResult 16 | 17 | CommentListResult::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void CommentListResult::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_nextPageToken.isEmpty()) 27 | js["nextPageToken"] = QString(m_nextPageToken); 28 | if(!m_kind.isEmpty()) 29 | js["kind"] = QString(m_kind); 30 | js["comments"] = struct_list2jsonarray(m_comments); 31 | } 32 | 33 | void CommentListResult::fromJson(const QJsonObject& js){ 34 | 35 | m_nextPageToken = js["nextPageToken"].toString(); 36 | m_kind = js["kind"].toString(); 37 | jsonarray2struct_list(js["comments"].toArray(), m_comments); 38 | } 39 | 40 | QString CommentListResult::toString(bool multiline)const 41 | { 42 | QJsonObject js; 43 | toJson(js); 44 | QJsonDocument doc(js); 45 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 46 | return s; 47 | } 48 | 49 | 50 | std::unique_ptr CommentListResult::factory::create(const QByteArray& data) 51 | { 52 | QJsonDocument doc = QJsonDocument::fromJson(data); 53 | QJsonObject js = doc.object(); 54 | return create(js); 55 | } 56 | 57 | 58 | std::unique_ptr CommentListResult::factory::create(const QJsonObject& js) 59 | { 60 | std::unique_ptr rv; 61 | rv = std::unique_ptr(new CommentListResult); 62 | rv->fromJson(js); 63 | return rv; 64 | } 65 | 66 | #ifdef API_QT_AUTOTEST 67 | std::unique_ptr CommentListResult::EXAMPLE(int context_index, int parent_context_index){ 68 | Q_UNUSED(context_index); 69 | Q_UNUSED(parent_context_index); 70 | static int example_idx = 0; 71 | example_idx++; 72 | std::unique_ptr rv(new CommentListResult); 73 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("comments::CommentListResult", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 74 | rv->m_kind = ApiAutotest::INSTANCE().getString("comments::CommentListResult", "m_kind", QString("kind_%1").arg(example_idx)); 75 | std::vector list_of_comments; 76 | for(int i = 0; i < 5; i++){ 77 | comments::Comment p = *(comments::Comment::EXAMPLE(i, context_index).get()); 78 | ApiAutotest::INSTANCE().prepareAutoTestObj("comments::CommentListResult", "comments::Comment", &p, i, context_index); 79 | rv->m_comments.push_back(p); 80 | } 81 | return rv; 82 | } 83 | #endif //API_QT_AUTOTEST 84 | 85 | }//comments 86 | }//googleQt 87 | -------------------------------------------------------------------------------- /src/gdrive/comments/CommentsCommentListResult.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "comments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | #include "gdrive/comments/CommentsComment.h" 13 | 14 | namespace googleQt{ 15 | namespace comments{ 16 | class CommentListResult{ 17 | /** 18 | field: next_page_token: The page token for the next page of 19 | comments. This will be absent if the end of the comments list 20 | has been reached. 21 | field: kind: This is always drive#commentList. 22 | */ 23 | 24 | public: 25 | CommentListResult(): 26 | m_kind("drive#commentList") 27 | {}; 28 | 29 | CommentListResult(const QString& arg): 30 | m_kind("drive#commentList") 31 | { m_nextPageToken = arg; }; 32 | virtual ~CommentListResult(){}; 33 | 34 | public: 35 | /** 36 | The page token for the next page of comments. This will be 37 | absent if the end of the comments list has been reached. 38 | */ 39 | QString nextpagetoken()const{return m_nextPageToken;}; 40 | 41 | /** 42 | This is always drive#commentList. 43 | */ 44 | QString kind()const{return m_kind;}; 45 | 46 | const std::vector& comments()const{return m_comments;}; 47 | 48 | public: 49 | operator QJsonObject ()const; 50 | virtual void fromJson(const QJsonObject& js); 51 | virtual void toJson(QJsonObject& js)const; 52 | virtual QString toString(bool multiline = true)const; 53 | 54 | 55 | class factory{ 56 | public: 57 | static std::unique_ptr create(const QByteArray& data); 58 | static std::unique_ptr create(const QJsonObject& js); 59 | }; 60 | 61 | 62 | #ifdef API_QT_AUTOTEST 63 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 64 | #endif //API_QT_AUTOTEST 65 | 66 | 67 | protected: 68 | /** 69 | The page token for the next page of comments. This will be 70 | absent if the end of the comments list has been reached. 71 | */ 72 | QString m_nextPageToken; 73 | 74 | /** 75 | This is always drive#commentList. 76 | */ 77 | QString m_kind; 78 | 79 | std::vector m_comments; 80 | 81 | };//CommentListResult 82 | 83 | }//comments 84 | }//googleQt 85 | -------------------------------------------------------------------------------- /src/gdrive/comments/CommentsQuotedFileContent.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "comments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/comments/CommentsQuotedFileContent.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace comments{ 15 | ///QuotedFileContent 16 | 17 | QuotedFileContent::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void QuotedFileContent::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_mimeType.isEmpty()) 27 | js["mimeType"] = QString(m_mimeType); 28 | if(!m_value.isEmpty()) 29 | js["value"] = QString(m_value); 30 | } 31 | 32 | void QuotedFileContent::fromJson(const QJsonObject& js){ 33 | 34 | m_mimeType = js["mimeType"].toString(); 35 | m_value = js["value"].toString(); 36 | } 37 | 38 | QString QuotedFileContent::toString(bool multiline)const 39 | { 40 | QJsonObject js; 41 | toJson(js); 42 | QJsonDocument doc(js); 43 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 44 | return s; 45 | } 46 | 47 | 48 | std::unique_ptr QuotedFileContent::factory::create(const QByteArray& data) 49 | { 50 | QJsonDocument doc = QJsonDocument::fromJson(data); 51 | QJsonObject js = doc.object(); 52 | return create(js); 53 | } 54 | 55 | 56 | std::unique_ptr QuotedFileContent::factory::create(const QJsonObject& js) 57 | { 58 | std::unique_ptr rv; 59 | rv = std::unique_ptr(new QuotedFileContent); 60 | rv->fromJson(js); 61 | return rv; 62 | } 63 | 64 | #ifdef API_QT_AUTOTEST 65 | std::unique_ptr QuotedFileContent::EXAMPLE(int context_index, int parent_context_index){ 66 | Q_UNUSED(context_index); 67 | Q_UNUSED(parent_context_index); 68 | static int example_idx = 0; 69 | example_idx++; 70 | std::unique_ptr rv(new QuotedFileContent); 71 | rv->m_mimeType = ApiAutotest::INSTANCE().getString("comments::QuotedFileContent", "m_mimeType", QString("mimeType_%1").arg(example_idx)); 72 | rv->m_value = ApiAutotest::INSTANCE().getString("comments::QuotedFileContent", "m_value", QString("value_%1").arg(example_idx)); 73 | return rv; 74 | } 75 | #endif //API_QT_AUTOTEST 76 | 77 | }//comments 78 | }//googleQt 79 | -------------------------------------------------------------------------------- /src/gdrive/comments/CommentsQuotedFileContent.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "comments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace comments{ 15 | class QuotedFileContent{ 16 | /** 17 | field: mime_type: The MIME type of the quoted content. 18 | field: value: The quoted content itself. This is interpreted as 19 | plain text if set through the API. 20 | */ 21 | 22 | public: 23 | QuotedFileContent(){}; 24 | 25 | QuotedFileContent(const QString& arg){ m_mimeType = arg; }; 26 | virtual ~QuotedFileContent(){}; 27 | 28 | public: 29 | /** 30 | The MIME type of the quoted content. 31 | */ 32 | QString mimetype()const{return m_mimeType;}; 33 | QuotedFileContent& setMimetype(const QString& arg){m_mimeType=arg;return *this;}; 34 | 35 | /** 36 | The quoted content itself. This is interpreted as plain text if 37 | set through the API. 38 | */ 39 | QString value()const{return m_value;}; 40 | QuotedFileContent& setValue(const QString& arg){m_value=arg;return *this;}; 41 | 42 | public: 43 | operator QJsonObject ()const; 44 | virtual void fromJson(const QJsonObject& js); 45 | virtual void toJson(QJsonObject& js)const; 46 | virtual QString toString(bool multiline = true)const; 47 | 48 | 49 | class factory{ 50 | public: 51 | static std::unique_ptr create(const QByteArray& data); 52 | static std::unique_ptr create(const QJsonObject& js); 53 | }; 54 | 55 | 56 | #ifdef API_QT_AUTOTEST 57 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 58 | #endif //API_QT_AUTOTEST 59 | 60 | 61 | protected: 62 | /** 63 | The MIME type of the quoted content. 64 | */ 65 | QString m_mimeType; 66 | 67 | /** 68 | The quoted content itself. This is interpreted as plain text if 69 | set through the API. 70 | */ 71 | QString m_value; 72 | 73 | };//QuotedFileContent 74 | 75 | }//comments 76 | }//googleQt 77 | -------------------------------------------------------------------------------- /src/gdrive/comments/CommentsRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "comments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gdrive/GdriveRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gdrive/comments/CommentsComment.h" 15 | #include "gdrive/comments/CommentsCommentListResult.h" 16 | 17 | namespace googleQt{ 18 | namespace comments{ 19 | 20 | 21 | class CommentsRoutes: public GoogleRouteBase{ 22 | public: 23 | CommentsRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 24 | /** 25 | ApiRoute('create') 26 | 27 | 28 | Create new Comment 29 | 30 | */ 31 | std::unique_ptr create(const gdrive::CreateCommentArg& arg, const Comment& body); 32 | GoogleTask* create_Async(const gdrive::CreateCommentArg& arg, const Comment& body); 33 | void create_AsyncCB( 34 | const gdrive::CreateCommentArg&, 35 | const Comment& body, 36 | std::function)> completed_callback = nullptr, 37 | std::function)> failed_callback = nullptr); 38 | 39 | /** 40 | ApiRoute('delete') 41 | 42 | 43 | Delete a Comment 44 | 45 | */ 46 | void deleteOperation(const gdrive::DeleteCommentArg& ); 47 | GoogleVoidTask* deleteOperation_Async(const gdrive::DeleteCommentArg& arg); 48 | void deleteOperation_AsyncCB( 49 | const gdrive::DeleteCommentArg&, 50 | std::function completed_callback = nullptr, 51 | std::function)> failed_callback = nullptr); 52 | 53 | /** 54 | ApiRoute('get') 55 | 56 | 57 | Get comment metadata. 58 | 59 | */ 60 | std::unique_ptr get(const gdrive::GetCommentArg& arg); 61 | GoogleTask* get_Async(const gdrive::GetCommentArg& arg); 62 | void get_AsyncCB( 63 | const gdrive::GetCommentArg&, 64 | std::function)> completed_callback = nullptr, 65 | std::function)> failed_callback = nullptr); 66 | 67 | /** 68 | ApiRoute('list') 69 | 70 | 71 | Lists a file's comments. 72 | 73 | */ 74 | std::unique_ptr list(const gdrive::CommentListArg& arg); 75 | GoogleTask* list_Async(const gdrive::CommentListArg& arg); 76 | void list_AsyncCB( 77 | const gdrive::CommentListArg&, 78 | std::function)> completed_callback = nullptr, 79 | std::function)> failed_callback = nullptr); 80 | 81 | protected: 82 | };//CommentsRoutes 83 | 84 | }//comments 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gdrive/comments/CommentsUser.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "comments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/comments/CommentsUser.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace comments{ 15 | ///User 16 | 17 | User::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void User::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_displayName.isEmpty()) 27 | js["displayName"] = QString(m_displayName); 28 | if(!m_kind.isEmpty()) 29 | js["kind"] = QString(m_kind); 30 | if(!m_photoLink.isEmpty()) 31 | js["photoLink"] = QString(m_photoLink); 32 | js["me"] = m_me; 33 | if(!m_permissionId.isEmpty()) 34 | js["permissionId"] = QString(m_permissionId); 35 | if(!m_emailAddress.isEmpty()) 36 | js["emailAddress"] = QString(m_emailAddress); 37 | } 38 | 39 | void User::fromJson(const QJsonObject& js){ 40 | 41 | m_displayName = js["displayName"].toString(); 42 | m_kind = js["kind"].toString(); 43 | m_photoLink = js["photoLink"].toString(); 44 | m_me = js["me"].toVariant().toBool(); 45 | m_permissionId = js["permissionId"].toString(); 46 | m_emailAddress = js["emailAddress"].toString(); 47 | } 48 | 49 | QString User::toString(bool multiline)const 50 | { 51 | QJsonObject js; 52 | toJson(js); 53 | QJsonDocument doc(js); 54 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 55 | return s; 56 | } 57 | 58 | 59 | std::unique_ptr User::factory::create(const QByteArray& data) 60 | { 61 | QJsonDocument doc = QJsonDocument::fromJson(data); 62 | QJsonObject js = doc.object(); 63 | return create(js); 64 | } 65 | 66 | 67 | std::unique_ptr User::factory::create(const QJsonObject& js) 68 | { 69 | std::unique_ptr rv; 70 | rv = std::unique_ptr(new User); 71 | rv->fromJson(js); 72 | return rv; 73 | } 74 | 75 | #ifdef API_QT_AUTOTEST 76 | std::unique_ptr User::EXAMPLE(int context_index, int parent_context_index){ 77 | Q_UNUSED(context_index); 78 | Q_UNUSED(parent_context_index); 79 | static int example_idx = 0; 80 | example_idx++; 81 | std::unique_ptr rv(new User); 82 | rv->m_displayName = ApiAutotest::INSTANCE().getString("comments::User", "m_displayName", QString("displayName_%1").arg(example_idx)); 83 | rv->m_kind = ApiAutotest::INSTANCE().getString("comments::User", "m_kind", QString("kind_%1").arg(example_idx)); 84 | rv->m_photoLink = ApiAutotest::INSTANCE().getString("comments::User", "m_photoLink", QString("photoLink_%1").arg(example_idx)); 85 | rv->m_permissionId = ApiAutotest::INSTANCE().getString("comments::User", "m_permissionId", QString("permissionId_%1").arg(example_idx)); 86 | rv->m_emailAddress = ApiAutotest::INSTANCE().getString("comments::User", "m_emailAddress", QString("emailAddress_%1").arg(example_idx)); 87 | return rv; 88 | } 89 | #endif //API_QT_AUTOTEST 90 | 91 | }//comments 92 | }//googleQt 93 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesContentHints.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesContentHints.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///ContentHints 16 | 17 | ContentHints::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void ContentHints::toJson(QJsonObject& js)const{ 25 | 26 | js["thumbnail"] = (QJsonObject)m_thumbnail; 27 | if(!m_indexableText.isEmpty()) 28 | js["indexableText"] = QString(m_indexableText); 29 | } 30 | 31 | void ContentHints::fromJson(const QJsonObject& js){ 32 | 33 | m_thumbnail.fromJson(js["thumbnail"].toObject()); 34 | m_indexableText = js["indexableText"].toString(); 35 | } 36 | 37 | QString ContentHints::toString(bool multiline)const 38 | { 39 | QJsonObject js; 40 | toJson(js); 41 | QJsonDocument doc(js); 42 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 43 | return s; 44 | } 45 | 46 | 47 | std::unique_ptr ContentHints::factory::create(const QByteArray& data) 48 | { 49 | QJsonDocument doc = QJsonDocument::fromJson(data); 50 | QJsonObject js = doc.object(); 51 | return create(js); 52 | } 53 | 54 | 55 | std::unique_ptr ContentHints::factory::create(const QJsonObject& js) 56 | { 57 | std::unique_ptr rv; 58 | rv = std::unique_ptr(new ContentHints); 59 | rv->fromJson(js); 60 | return rv; 61 | } 62 | 63 | #ifdef API_QT_AUTOTEST 64 | std::unique_ptr ContentHints::EXAMPLE(int context_index, int parent_context_index){ 65 | Q_UNUSED(context_index); 66 | Q_UNUSED(parent_context_index); 67 | static int example_idx = 0; 68 | example_idx++; 69 | std::unique_ptr rv(new ContentHints); 70 | rv->m_thumbnail = *(files::ThumbnailInfo::EXAMPLE(0, context_index).get()); 71 | rv->m_indexableText = ApiAutotest::INSTANCE().getString("files::ContentHints", "m_indexableText", QString("indexableText_%1").arg(example_idx)); 72 | return rv; 73 | } 74 | #endif //API_QT_AUTOTEST 75 | 76 | }//files 77 | }//googleQt 78 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesContentHints.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | #include "gdrive/files/FilesThumbnailInfo.h" 13 | 14 | namespace googleQt{ 15 | namespace files{ 16 | class ContentHints{ 17 | /** 18 | field: thumbnail: A thumbnail for a file. 19 | field: indexable_text: Text to be indexed for the file to improve 20 | fullText queries. This is limited to 128KB in length and may 21 | contain HTML elements. 22 | */ 23 | 24 | public: 25 | ContentHints(){}; 26 | 27 | ContentHints(const ThumbnailInfo& arg){ m_thumbnail = arg; }; 28 | virtual ~ContentHints(){}; 29 | 30 | public: 31 | /** 32 | A thumbnail for a file. 33 | */ 34 | const ThumbnailInfo& thumbnail()const{return m_thumbnail;}; 35 | ContentHints& setThumbnail(const ThumbnailInfo& arg){m_thumbnail=arg;return *this;}; 36 | 37 | /** 38 | Text to be indexed for the file to improve fullText queries. 39 | This is limited to 128KB in length and may contain HTML 40 | elements. 41 | */ 42 | QString indexabletext()const{return m_indexableText;}; 43 | ContentHints& setIndexabletext(const QString& arg){m_indexableText=arg;return *this;}; 44 | 45 | public: 46 | operator QJsonObject ()const; 47 | virtual void fromJson(const QJsonObject& js); 48 | virtual void toJson(QJsonObject& js)const; 49 | virtual QString toString(bool multiline = true)const; 50 | 51 | 52 | class factory{ 53 | public: 54 | static std::unique_ptr create(const QByteArray& data); 55 | static std::unique_ptr create(const QJsonObject& js); 56 | }; 57 | 58 | 59 | #ifdef API_QT_AUTOTEST 60 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 61 | #endif //API_QT_AUTOTEST 62 | 63 | 64 | protected: 65 | /** 66 | A thumbnail for a file. 67 | */ 68 | ThumbnailInfo m_thumbnail; 69 | 70 | /** 71 | Text to be indexed for the file to improve fullText queries. 72 | This is limited to 128KB in length and may contain HTML 73 | elements. 74 | */ 75 | QString m_indexableText; 76 | 77 | };//ContentHints 78 | 79 | }//files 80 | }//googleQt 81 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesFileResourcesCollection.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesFileResourcesCollection.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///FileResourcesCollection 16 | 17 | FileResourcesCollection::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void FileResourcesCollection::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_nextPageToken.isEmpty()) 27 | js["nextPageToken"] = QString(m_nextPageToken); 28 | if(!m_kind.isEmpty()) 29 | js["kind"] = QString(m_kind); 30 | js["files"] = struct_list2jsonarray(m_files); 31 | } 32 | 33 | void FileResourcesCollection::fromJson(const QJsonObject& js){ 34 | 35 | m_nextPageToken = js["nextPageToken"].toString(); 36 | m_kind = js["kind"].toString(); 37 | jsonarray2struct_list(js["files"].toArray(), m_files); 38 | } 39 | 40 | QString FileResourcesCollection::toString(bool multiline)const 41 | { 42 | QJsonObject js; 43 | toJson(js); 44 | QJsonDocument doc(js); 45 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 46 | return s; 47 | } 48 | 49 | 50 | std::unique_ptr FileResourcesCollection::factory::create(const QByteArray& data) 51 | { 52 | QJsonDocument doc = QJsonDocument::fromJson(data); 53 | QJsonObject js = doc.object(); 54 | return create(js); 55 | } 56 | 57 | 58 | std::unique_ptr FileResourcesCollection::factory::create(const QJsonObject& js) 59 | { 60 | std::unique_ptr rv; 61 | rv = std::unique_ptr(new FileResourcesCollection); 62 | rv->fromJson(js); 63 | return rv; 64 | } 65 | 66 | #ifdef API_QT_AUTOTEST 67 | std::unique_ptr FileResourcesCollection::EXAMPLE(int context_index, int parent_context_index){ 68 | Q_UNUSED(context_index); 69 | Q_UNUSED(parent_context_index); 70 | static int example_idx = 0; 71 | example_idx++; 72 | std::unique_ptr rv(new FileResourcesCollection); 73 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("files::FileResourcesCollection", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 74 | rv->m_kind = ApiAutotest::INSTANCE().getString("files::FileResourcesCollection", "m_kind", QString("kind_%1").arg(example_idx)); 75 | std::vector list_of_files; 76 | for(int i = 0; i < 5; i++){ 77 | files::FileResource p = *(files::FileResource::EXAMPLE(i, context_index).get()); 78 | ApiAutotest::INSTANCE().prepareAutoTestObj("files::FileResourcesCollection", "files::FileResource", &p, i, context_index); 79 | rv->m_files.push_back(p); 80 | } 81 | return rv; 82 | } 83 | #endif //API_QT_AUTOTEST 84 | 85 | }//files 86 | }//googleQt 87 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesGeneratedIdsCollection.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesGeneratedIdsCollection.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///GeneratedIdsCollection 16 | 17 | GeneratedIdsCollection::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void GeneratedIdsCollection::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_kind.isEmpty()) 27 | js["kind"] = QString(m_kind); 28 | if(!m_space.isEmpty()) 29 | js["space"] = QString(m_space); 30 | js["ids"] = ingrl_list2jsonarray(m_ids); 31 | } 32 | 33 | void GeneratedIdsCollection::fromJson(const QJsonObject& js){ 34 | 35 | m_kind = js["kind"].toString(); 36 | m_space = js["space"].toString(); 37 | jsonarray2ingrl_list(js["ids"].toArray(), m_ids); 38 | } 39 | 40 | QString GeneratedIdsCollection::toString(bool multiline)const 41 | { 42 | QJsonObject js; 43 | toJson(js); 44 | QJsonDocument doc(js); 45 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 46 | return s; 47 | } 48 | 49 | 50 | std::unique_ptr GeneratedIdsCollection::factory::create(const QByteArray& data) 51 | { 52 | QJsonDocument doc = QJsonDocument::fromJson(data); 53 | QJsonObject js = doc.object(); 54 | return create(js); 55 | } 56 | 57 | 58 | std::unique_ptr GeneratedIdsCollection::factory::create(const QJsonObject& js) 59 | { 60 | std::unique_ptr rv; 61 | rv = std::unique_ptr(new GeneratedIdsCollection); 62 | rv->fromJson(js); 63 | return rv; 64 | } 65 | 66 | #ifdef API_QT_AUTOTEST 67 | std::unique_ptr GeneratedIdsCollection::EXAMPLE(int context_index, int parent_context_index){ 68 | Q_UNUSED(context_index); 69 | Q_UNUSED(parent_context_index); 70 | static int example_idx = 0; 71 | example_idx++; 72 | std::unique_ptr rv(new GeneratedIdsCollection); 73 | rv->m_kind = ApiAutotest::INSTANCE().getString("files::GeneratedIdsCollection", "m_kind", QString("kind_%1").arg(example_idx)); 74 | rv->m_space = ApiAutotest::INSTANCE().getString("files::GeneratedIdsCollection", "m_space", QString("space_%1").arg(example_idx)); 75 | std::vector list_of_ids; 76 | for(int i = 0; i < 5; i++){ 77 | rv->m_ids.push_back(QString("id_%1").arg(i+1)); 78 | } 79 | QString tmp_m_ids = ApiAutotest::INSTANCE().getString4List("files::GeneratedIdsCollection", "m_ids"); 80 | if(!tmp_m_ids.isEmpty())rv->m_ids.push_back(tmp_m_ids); 81 | return rv; 82 | } 83 | #endif //API_QT_AUTOTEST 84 | 85 | }//files 86 | }//googleQt 87 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesLocationData.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesLocationData.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///LocationData 16 | 17 | LocationData::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void LocationData::toJson(QJsonObject& js)const{ 25 | 26 | js["latitude"] = m_latitude; 27 | js["longitude"] = m_longitude; 28 | js["altitude"] = m_altitude; 29 | } 30 | 31 | void LocationData::fromJson(const QJsonObject& js){ 32 | 33 | m_latitude = js["latitude"].toVariant().toFloat(); 34 | m_longitude = js["longitude"].toVariant().toFloat(); 35 | m_altitude = js["altitude"].toVariant().toFloat(); 36 | } 37 | 38 | QString LocationData::toString(bool multiline)const 39 | { 40 | QJsonObject js; 41 | toJson(js); 42 | QJsonDocument doc(js); 43 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 44 | return s; 45 | } 46 | 47 | 48 | std::unique_ptr LocationData::factory::create(const QByteArray& data) 49 | { 50 | QJsonDocument doc = QJsonDocument::fromJson(data); 51 | QJsonObject js = doc.object(); 52 | return create(js); 53 | } 54 | 55 | 56 | std::unique_ptr LocationData::factory::create(const QJsonObject& js) 57 | { 58 | std::unique_ptr rv; 59 | rv = std::unique_ptr(new LocationData); 60 | rv->fromJson(js); 61 | return rv; 62 | } 63 | 64 | #ifdef API_QT_AUTOTEST 65 | std::unique_ptr LocationData::EXAMPLE(int context_index, int parent_context_index){ 66 | Q_UNUSED(context_index); 67 | Q_UNUSED(parent_context_index); 68 | static int example_idx = 0; 69 | example_idx++; 70 | std::unique_ptr rv(new LocationData); 71 | rv->m_latitude = ApiAutotest::INSTANCE().getInt("files::LocationData", "m_latitude", 1 + example_idx); 72 | rv->m_longitude = ApiAutotest::INSTANCE().getInt("files::LocationData", "m_longitude", 2 + example_idx); 73 | rv->m_altitude = ApiAutotest::INSTANCE().getInt("files::LocationData", "m_altitude", 3 + example_idx); 74 | return rv; 75 | } 76 | #endif //API_QT_AUTOTEST 77 | 78 | }//files 79 | }//googleQt 80 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesLocationData.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace files{ 15 | class LocationData{ 16 | /** 17 | field: latitude: latitude 18 | field: longitude: longitude 19 | field: altitude: altitude 20 | */ 21 | 22 | public: 23 | LocationData(){}; 24 | 25 | LocationData(const float& arg){ m_latitude = arg; }; 26 | virtual ~LocationData(){}; 27 | 28 | public: 29 | /** 30 | latitude 31 | */ 32 | float latitude()const{return m_latitude;}; 33 | LocationData& setLatitude(const float& arg){m_latitude=arg;return *this;}; 34 | 35 | /** 36 | longitude 37 | */ 38 | float longitude()const{return m_longitude;}; 39 | LocationData& setLongitude(const float& arg){m_longitude=arg;return *this;}; 40 | 41 | /** 42 | altitude 43 | */ 44 | float altitude()const{return m_altitude;}; 45 | LocationData& setAltitude(const float& arg){m_altitude=arg;return *this;}; 46 | 47 | public: 48 | operator QJsonObject ()const; 49 | virtual void fromJson(const QJsonObject& js); 50 | virtual void toJson(QJsonObject& js)const; 51 | virtual QString toString(bool multiline = true)const; 52 | 53 | 54 | class factory{ 55 | public: 56 | static std::unique_ptr create(const QByteArray& data); 57 | static std::unique_ptr create(const QJsonObject& js); 58 | }; 59 | 60 | 61 | #ifdef API_QT_AUTOTEST 62 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 63 | #endif //API_QT_AUTOTEST 64 | 65 | 66 | protected: 67 | /** 68 | latitude 69 | */ 70 | float m_latitude; 71 | 72 | /** 73 | longitude 74 | */ 75 | float m_longitude; 76 | 77 | /** 78 | altitude 79 | */ 80 | float m_altitude; 81 | 82 | };//LocationData 83 | 84 | }//files 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesThumbnailInfo.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesThumbnailInfo.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///ThumbnailInfo 16 | 17 | ThumbnailInfo::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void ThumbnailInfo::toJson(QJsonObject& js)const{ 25 | 26 | js["image"] = m_image.constData(); 27 | if(!m_mimeType.isEmpty()) 28 | js["mimeType"] = QString(m_mimeType); 29 | } 30 | 31 | void ThumbnailInfo::fromJson(const QJsonObject& js){ 32 | 33 | m_image = js["image"].toVariant().toByteArray(); 34 | m_mimeType = js["mimeType"].toString(); 35 | } 36 | 37 | QString ThumbnailInfo::toString(bool multiline)const 38 | { 39 | QJsonObject js; 40 | toJson(js); 41 | QJsonDocument doc(js); 42 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 43 | return s; 44 | } 45 | 46 | 47 | std::unique_ptr ThumbnailInfo::factory::create(const QByteArray& data) 48 | { 49 | QJsonDocument doc = QJsonDocument::fromJson(data); 50 | QJsonObject js = doc.object(); 51 | return create(js); 52 | } 53 | 54 | 55 | std::unique_ptr ThumbnailInfo::factory::create(const QJsonObject& js) 56 | { 57 | std::unique_ptr rv; 58 | rv = std::unique_ptr(new ThumbnailInfo); 59 | rv->fromJson(js); 60 | return rv; 61 | } 62 | 63 | #ifdef API_QT_AUTOTEST 64 | std::unique_ptr ThumbnailInfo::EXAMPLE(int context_index, int parent_context_index){ 65 | Q_UNUSED(context_index); 66 | Q_UNUSED(parent_context_index); 67 | static int example_idx = 0; 68 | example_idx++; 69 | std::unique_ptr rv(new ThumbnailInfo); 70 | rv->m_image = ApiAutotest::INSTANCE().generateData("files::ThumbnailInfo", context_index, parent_context_index); 71 | rv->m_mimeType = ApiAutotest::INSTANCE().getString("files::ThumbnailInfo", "m_mimeType", QString("mimeType_%1").arg(example_idx)); 72 | return rv; 73 | } 74 | #endif //API_QT_AUTOTEST 75 | 76 | }//files 77 | }//googleQt 78 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesThumbnailInfo.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace files{ 15 | class ThumbnailInfo{ 16 | /** 17 | field: image: The thumbnail data encoded with URL-safe Base64 (RFC 18 | 4648 section 5). 19 | field: mime_type: The MIME type of the thumbnail. 20 | */ 21 | 22 | public: 23 | ThumbnailInfo(){}; 24 | 25 | ThumbnailInfo(const QByteArray& arg){ m_image = arg; }; 26 | virtual ~ThumbnailInfo(){}; 27 | 28 | public: 29 | /** 30 | The thumbnail data encoded with URL-safe Base64 (RFC 4648 31 | section 5). 32 | */ 33 | QByteArray image()const{return m_image;}; 34 | ThumbnailInfo& setImage(const QByteArray& arg){m_image=arg;return *this;}; 35 | 36 | /** 37 | The MIME type of the thumbnail. 38 | */ 39 | QString mimetype()const{return m_mimeType;}; 40 | ThumbnailInfo& setMimetype(const QString& arg){m_mimeType=arg;return *this;}; 41 | 42 | public: 43 | operator QJsonObject ()const; 44 | virtual void fromJson(const QJsonObject& js); 45 | virtual void toJson(QJsonObject& js)const; 46 | virtual QString toString(bool multiline = true)const; 47 | 48 | 49 | class factory{ 50 | public: 51 | static std::unique_ptr create(const QByteArray& data); 52 | static std::unique_ptr create(const QJsonObject& js); 53 | }; 54 | 55 | 56 | #ifdef API_QT_AUTOTEST 57 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 58 | #endif //API_QT_AUTOTEST 59 | 60 | 61 | protected: 62 | /** 63 | The thumbnail data encoded with URL-safe Base64 (RFC 4648 64 | section 5). 65 | */ 66 | QByteArray m_image; 67 | 68 | /** 69 | The MIME type of the thumbnail. 70 | */ 71 | QString m_mimeType; 72 | 73 | };//ThumbnailInfo 74 | 75 | }//files 76 | }//googleQt 77 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesUpdateFileDetails.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesUpdateFileDetails.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///UpdateFileDetails 16 | 17 | UpdateFileDetails::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void UpdateFileDetails::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_name.isEmpty()) 27 | js["name"] = QString(m_name); 28 | if(!m_mimeType.isEmpty()) 29 | js["mimeType"] = QString(m_mimeType); 30 | if(!m_description.isEmpty()) 31 | js["description"] = QString(m_description); 32 | js["contentHints"] = (QJsonObject)m_contentHints; 33 | if(!m_originalFilename.isEmpty()) 34 | js["originalFilename"] = QString(m_originalFilename); 35 | } 36 | 37 | void UpdateFileDetails::fromJson(const QJsonObject& js){ 38 | 39 | m_name = js["name"].toString(); 40 | m_mimeType = js["mimeType"].toString(); 41 | m_description = js["description"].toString(); 42 | m_contentHints.fromJson(js["contentHints"].toObject()); 43 | m_originalFilename = js["originalFilename"].toString(); 44 | } 45 | 46 | QString UpdateFileDetails::toString(bool multiline)const 47 | { 48 | QJsonObject js; 49 | toJson(js); 50 | QJsonDocument doc(js); 51 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 52 | return s; 53 | } 54 | 55 | 56 | std::unique_ptr UpdateFileDetails::factory::create(const QByteArray& data) 57 | { 58 | QJsonDocument doc = QJsonDocument::fromJson(data); 59 | QJsonObject js = doc.object(); 60 | return create(js); 61 | } 62 | 63 | 64 | std::unique_ptr UpdateFileDetails::factory::create(const QJsonObject& js) 65 | { 66 | std::unique_ptr rv; 67 | rv = std::unique_ptr(new UpdateFileDetails); 68 | rv->fromJson(js); 69 | return rv; 70 | } 71 | 72 | #ifdef API_QT_AUTOTEST 73 | std::unique_ptr UpdateFileDetails::EXAMPLE(int context_index, int parent_context_index){ 74 | Q_UNUSED(context_index); 75 | Q_UNUSED(parent_context_index); 76 | static int example_idx = 0; 77 | example_idx++; 78 | std::unique_ptr rv(new UpdateFileDetails); 79 | rv->m_name = ApiAutotest::INSTANCE().getString("files::UpdateFileDetails", "m_name", QString("name_%1").arg(example_idx)); 80 | rv->m_mimeType = ApiAutotest::INSTANCE().getString("files::UpdateFileDetails", "m_mimeType", QString("mimeType_%1").arg(example_idx)); 81 | rv->m_description = ApiAutotest::INSTANCE().getString("files::UpdateFileDetails", "m_description", QString("description_%1").arg(example_idx)); 82 | rv->m_contentHints = *(files::ContentHints::EXAMPLE(0, context_index).get()); 83 | rv->m_originalFilename = ApiAutotest::INSTANCE().getString("files::UpdateFileDetails", "m_originalFilename", QString("originalFilename_%1").arg(example_idx)); 84 | return rv; 85 | } 86 | #endif //API_QT_AUTOTEST 87 | 88 | }//files 89 | }//googleQt 90 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesVideoMediaMetadata.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/files/FilesVideoMediaMetadata.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace files{ 15 | ///VideoMediaMetadata 16 | 17 | VideoMediaMetadata::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void VideoMediaMetadata::toJson(QJsonObject& js)const{ 25 | 26 | js["width"] = QString("%1").arg(m_width); 27 | js["height"] = QString("%1").arg(m_height); 28 | js["durationMillis"] = QString("%1").arg(m_durationMillis); 29 | } 30 | 31 | void VideoMediaMetadata::fromJson(const QJsonObject& js){ 32 | 33 | m_width = js["width"].toVariant().toString().toULongLong(); 34 | m_height = js["height"].toVariant().toString().toULongLong(); 35 | m_durationMillis = js["durationMillis"].toVariant().toString().toULongLong(); 36 | } 37 | 38 | QString VideoMediaMetadata::toString(bool multiline)const 39 | { 40 | QJsonObject js; 41 | toJson(js); 42 | QJsonDocument doc(js); 43 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 44 | return s; 45 | } 46 | 47 | 48 | std::unique_ptr VideoMediaMetadata::factory::create(const QByteArray& data) 49 | { 50 | QJsonDocument doc = QJsonDocument::fromJson(data); 51 | QJsonObject js = doc.object(); 52 | return create(js); 53 | } 54 | 55 | 56 | std::unique_ptr VideoMediaMetadata::factory::create(const QJsonObject& js) 57 | { 58 | std::unique_ptr rv; 59 | rv = std::unique_ptr(new VideoMediaMetadata); 60 | rv->fromJson(js); 61 | return rv; 62 | } 63 | 64 | #ifdef API_QT_AUTOTEST 65 | std::unique_ptr VideoMediaMetadata::EXAMPLE(int context_index, int parent_context_index){ 66 | Q_UNUSED(context_index); 67 | Q_UNUSED(parent_context_index); 68 | static int example_idx = 0; 69 | example_idx++; 70 | std::unique_ptr rv(new VideoMediaMetadata); 71 | rv->m_width = ApiAutotest::INSTANCE().getInt("files::VideoMediaMetadata", "m_width", 1 + example_idx); 72 | rv->m_height = ApiAutotest::INSTANCE().getInt("files::VideoMediaMetadata", "m_height", 2 + example_idx); 73 | rv->m_durationMillis = ApiAutotest::INSTANCE().getInt("files::VideoMediaMetadata", "m_durationMillis", 3 + example_idx); 74 | return rv; 75 | } 76 | #endif //API_QT_AUTOTEST 77 | 78 | }//files 79 | }//googleQt 80 | -------------------------------------------------------------------------------- /src/gdrive/files/FilesVideoMediaMetadata.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "files" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace files{ 15 | class VideoMediaMetadata{ 16 | /** 17 | field: width: The width of the video in pixels. 18 | field: height: The height of the video in pixels. 19 | field: duration_millis: The duration of the video in milliseconds. 20 | */ 21 | 22 | public: 23 | VideoMediaMetadata(){}; 24 | 25 | VideoMediaMetadata(const quint64& arg){ m_width = arg; }; 26 | virtual ~VideoMediaMetadata(){}; 27 | 28 | public: 29 | /** 30 | The width of the video in pixels. 31 | */ 32 | quint64 width()const{return m_width;}; 33 | VideoMediaMetadata& setWidth(const quint64& arg){m_width=arg;return *this;}; 34 | 35 | /** 36 | The height of the video in pixels. 37 | */ 38 | quint64 height()const{return m_height;}; 39 | VideoMediaMetadata& setHeight(const quint64& arg){m_height=arg;return *this;}; 40 | 41 | /** 42 | The duration of the video in milliseconds. 43 | */ 44 | quint64 durationmillis()const{return m_durationMillis;}; 45 | VideoMediaMetadata& setDurationmillis(const quint64& arg){m_durationMillis=arg;return *this;}; 46 | 47 | public: 48 | operator QJsonObject ()const; 49 | virtual void fromJson(const QJsonObject& js); 50 | virtual void toJson(QJsonObject& js)const; 51 | virtual QString toString(bool multiline = true)const; 52 | 53 | 54 | class factory{ 55 | public: 56 | static std::unique_ptr create(const QByteArray& data); 57 | static std::unique_ptr create(const QJsonObject& js); 58 | }; 59 | 60 | 61 | #ifdef API_QT_AUTOTEST 62 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 63 | #endif //API_QT_AUTOTEST 64 | 65 | 66 | protected: 67 | /** 68 | The width of the video in pixels. 69 | */ 70 | quint64 m_width = {0}; 71 | 72 | /** 73 | The height of the video in pixels. 74 | */ 75 | quint64 m_height = {0}; 76 | 77 | /** 78 | The duration of the video in milliseconds. 79 | */ 80 | quint64 m_durationMillis = {0}; 81 | 82 | };//VideoMediaMetadata 83 | 84 | }//files 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gdrive/permissions/PermissionsPermissionResourcesCollection.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "permissions" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/permissions/PermissionsPermissionResourcesCollection.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace permissions{ 15 | ///PermissionResourcesCollection 16 | 17 | PermissionResourcesCollection::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void PermissionResourcesCollection::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_kind.isEmpty()) 27 | js["kind"] = QString(m_kind); 28 | js["permissions"] = struct_list2jsonarray(m_permissions); 29 | } 30 | 31 | void PermissionResourcesCollection::fromJson(const QJsonObject& js){ 32 | 33 | m_kind = js["kind"].toString(); 34 | jsonarray2struct_list(js["permissions"].toArray(), m_permissions); 35 | } 36 | 37 | QString PermissionResourcesCollection::toString(bool multiline)const 38 | { 39 | QJsonObject js; 40 | toJson(js); 41 | QJsonDocument doc(js); 42 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 43 | return s; 44 | } 45 | 46 | 47 | std::unique_ptr PermissionResourcesCollection::factory::create(const QByteArray& data) 48 | { 49 | QJsonDocument doc = QJsonDocument::fromJson(data); 50 | QJsonObject js = doc.object(); 51 | return create(js); 52 | } 53 | 54 | 55 | std::unique_ptr PermissionResourcesCollection::factory::create(const QJsonObject& js) 56 | { 57 | std::unique_ptr rv; 58 | rv = std::unique_ptr(new PermissionResourcesCollection); 59 | rv->fromJson(js); 60 | return rv; 61 | } 62 | 63 | #ifdef API_QT_AUTOTEST 64 | std::unique_ptr PermissionResourcesCollection::EXAMPLE(int context_index, int parent_context_index){ 65 | Q_UNUSED(context_index); 66 | Q_UNUSED(parent_context_index); 67 | static int example_idx = 0; 68 | example_idx++; 69 | std::unique_ptr rv(new PermissionResourcesCollection); 70 | rv->m_kind = ApiAutotest::INSTANCE().getString("permissions::PermissionResourcesCollection", "m_kind", QString("kind_%1").arg(example_idx)); 71 | std::vector list_of_permissions; 72 | for(int i = 0; i < 5; i++){ 73 | permissions::ResourcePermission p = *(permissions::ResourcePermission::EXAMPLE(i, context_index).get()); 74 | ApiAutotest::INSTANCE().prepareAutoTestObj("permissions::PermissionResourcesCollection", "permissions::ResourcePermission", &p, i, context_index); 75 | rv->m_permissions.push_back(p); 76 | } 77 | return rv; 78 | } 79 | #endif //API_QT_AUTOTEST 80 | 81 | }//permissions 82 | }//googleQt 83 | -------------------------------------------------------------------------------- /src/gdrive/permissions/PermissionsPermissionResourcesCollection.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "permissions" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gdrive/GdriveRequestArg.h" 12 | #include "gdrive/permissions/PermissionsResourcePermission.h" 13 | 14 | namespace googleQt{ 15 | namespace permissions{ 16 | class PermissionResourcesCollection{ 17 | /** 18 | field: kind: This is always drive#permissionList. 19 | field: permissions: The full list of permissions. 20 | */ 21 | 22 | public: 23 | PermissionResourcesCollection(): 24 | m_kind("drive#permissionList") 25 | {}; 26 | 27 | PermissionResourcesCollection(const QString& arg): 28 | m_kind("drive#permissionList") 29 | { m_kind = arg; }; 30 | virtual ~PermissionResourcesCollection(){}; 31 | 32 | public: 33 | /** 34 | This is always drive#permissionList. 35 | */ 36 | QString kind()const{return m_kind;}; 37 | PermissionResourcesCollection& setKind(const QString& arg){m_kind=arg;return *this;}; 38 | 39 | /** 40 | The full list of permissions. 41 | */ 42 | const std::vector& permissions()const{return m_permissions;}; 43 | PermissionResourcesCollection& setPermissions(const std::vector& arg){m_permissions=arg;return *this;}; 44 | 45 | public: 46 | operator QJsonObject ()const; 47 | virtual void fromJson(const QJsonObject& js); 48 | virtual void toJson(QJsonObject& js)const; 49 | virtual QString toString(bool multiline = true)const; 50 | 51 | 52 | class factory{ 53 | public: 54 | static std::unique_ptr create(const QByteArray& data); 55 | static std::unique_ptr create(const QJsonObject& js); 56 | }; 57 | 58 | 59 | #ifdef API_QT_AUTOTEST 60 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 61 | #endif //API_QT_AUTOTEST 62 | 63 | 64 | protected: 65 | /** 66 | This is always drive#permissionList. 67 | */ 68 | QString m_kind; 69 | 70 | /** 71 | The full list of permissions. 72 | */ 73 | std::vector m_permissions; 74 | 75 | };//PermissionResourcesCollection 76 | 77 | }//permissions 78 | }//googleQt 79 | -------------------------------------------------------------------------------- /src/gdrive/revisions/RevisionsRevisionResourceCollection.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "revisions" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/revisions/RevisionsRevisionResourceCollection.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace revisions{ 15 | ///RevisionResourceCollection 16 | 17 | RevisionResourceCollection::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void RevisionResourceCollection::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_nextPageToken.isEmpty()) 27 | js["nextPageToken"] = QString(m_nextPageToken); 28 | if(!m_kind.isEmpty()) 29 | js["kind"] = QString(m_kind); 30 | js["files"] = struct_list2jsonarray(m_files); 31 | } 32 | 33 | void RevisionResourceCollection::fromJson(const QJsonObject& js){ 34 | 35 | m_nextPageToken = js["nextPageToken"].toString(); 36 | m_kind = js["kind"].toString(); 37 | jsonarray2struct_list(js["files"].toArray(), m_files); 38 | } 39 | 40 | QString RevisionResourceCollection::toString(bool multiline)const 41 | { 42 | QJsonObject js; 43 | toJson(js); 44 | QJsonDocument doc(js); 45 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 46 | return s; 47 | } 48 | 49 | 50 | std::unique_ptr RevisionResourceCollection::factory::create(const QByteArray& data) 51 | { 52 | QJsonDocument doc = QJsonDocument::fromJson(data); 53 | QJsonObject js = doc.object(); 54 | return create(js); 55 | } 56 | 57 | 58 | std::unique_ptr RevisionResourceCollection::factory::create(const QJsonObject& js) 59 | { 60 | std::unique_ptr rv; 61 | rv = std::unique_ptr(new RevisionResourceCollection); 62 | rv->fromJson(js); 63 | return rv; 64 | } 65 | 66 | #ifdef API_QT_AUTOTEST 67 | std::unique_ptr RevisionResourceCollection::EXAMPLE(int context_index, int parent_context_index){ 68 | Q_UNUSED(context_index); 69 | Q_UNUSED(parent_context_index); 70 | static int example_idx = 0; 71 | example_idx++; 72 | std::unique_ptr rv(new RevisionResourceCollection); 73 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("revisions::RevisionResourceCollection", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 74 | rv->m_kind = ApiAutotest::INSTANCE().getString("revisions::RevisionResourceCollection", "m_kind", QString("kind_%1").arg(example_idx)); 75 | std::vector list_of_files; 76 | for(int i = 0; i < 5; i++){ 77 | revisions::RevisionResource p = *(revisions::RevisionResource::EXAMPLE(i, context_index).get()); 78 | ApiAutotest::INSTANCE().prepareAutoTestObj("revisions::RevisionResourceCollection", "revisions::RevisionResource", &p, i, context_index); 79 | rv->m_files.push_back(p); 80 | } 81 | return rv; 82 | } 83 | #endif //API_QT_AUTOTEST 84 | 85 | }//revisions 86 | }//googleQt 87 | -------------------------------------------------------------------------------- /src/gdrive/revisions/RevisionsRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "revisions" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gdrive/GdriveRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gdrive/revisions/RevisionsRevisionResource.h" 15 | #include "gdrive/revisions/RevisionsRevisionResourceCollection.h" 16 | 17 | namespace googleQt{ 18 | namespace revisions{ 19 | 20 | 21 | class RevisionsRoutes: public GoogleRouteBase{ 22 | public: 23 | RevisionsRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 24 | /** 25 | ApiRoute('delete') 26 | 27 | 28 | Permanently deletes a revision. This method is only applicable to 29 | files with binary content in Drive. 30 | 31 | */ 32 | void deleteOperation(const gdrive::DeleteRevisionArg& ); 33 | GoogleVoidTask* deleteOperation_Async(const gdrive::DeleteRevisionArg& arg); 34 | void deleteOperation_AsyncCB( 35 | const gdrive::DeleteRevisionArg&, 36 | std::function completed_callback = nullptr, 37 | std::function)> failed_callback = nullptr); 38 | 39 | /** 40 | ApiRoute('get') 41 | 42 | 43 | Gets a revision's metadata or content by ID 44 | 45 | */ 46 | std::unique_ptr get(const gdrive::GetRevisionArg& arg); 47 | GoogleTask* get_Async(const gdrive::GetRevisionArg& arg); 48 | void get_AsyncCB( 49 | const gdrive::GetRevisionArg&, 50 | std::function)> completed_callback = nullptr, 51 | std::function)> failed_callback = nullptr); 52 | 53 | /** 54 | ApiRoute('list') 55 | 56 | 57 | Lists a file's revisions 58 | 59 | */ 60 | std::unique_ptr list(const gdrive::ListRevisionArg& arg); 61 | GoogleTask* list_Async(const gdrive::ListRevisionArg& arg); 62 | void list_AsyncCB( 63 | const gdrive::ListRevisionArg&, 64 | std::function)> completed_callback = nullptr, 65 | std::function)> failed_callback = nullptr); 66 | 67 | /** 68 | ApiRoute('update') 69 | 70 | 71 | Updates a revision with patch semantics. 72 | 73 | */ 74 | std::unique_ptr update(const gdrive::UpdateRevisionArg& arg); 75 | GoogleTask* update_Async(const gdrive::UpdateRevisionArg& arg); 76 | void update_AsyncCB( 77 | const gdrive::UpdateRevisionArg&, 78 | std::function)> completed_callback = nullptr, 79 | std::function)> failed_callback = nullptr); 80 | 81 | protected: 82 | };//RevisionsRoutes 83 | 84 | }//revisions 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gdrive/revisions/RevisionsUpdateRevisionDetails.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "revisions" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gdrive/revisions/RevisionsUpdateRevisionDetails.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace revisions{ 15 | ///UpdateRevisionDetails 16 | 17 | UpdateRevisionDetails::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void UpdateRevisionDetails::toJson(QJsonObject& js)const{ 25 | 26 | js["keepForever"] = m_keepForever; 27 | js["published"] = m_published; 28 | js["publishAuto"] = m_publishAuto; 29 | js["publishedOutsideDomain"] = m_publishedOutsideDomain; 30 | } 31 | 32 | void UpdateRevisionDetails::fromJson(const QJsonObject& js){ 33 | 34 | m_keepForever = js["keepForever"].toVariant().toBool(); 35 | m_published = js["published"].toVariant().toBool(); 36 | m_publishAuto = js["publishAuto"].toVariant().toBool(); 37 | m_publishedOutsideDomain = js["publishedOutsideDomain"].toVariant().toBool(); 38 | } 39 | 40 | QString UpdateRevisionDetails::toString(bool multiline)const 41 | { 42 | QJsonObject js; 43 | toJson(js); 44 | QJsonDocument doc(js); 45 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 46 | return s; 47 | } 48 | 49 | 50 | std::unique_ptr UpdateRevisionDetails::factory::create(const QByteArray& data) 51 | { 52 | QJsonDocument doc = QJsonDocument::fromJson(data); 53 | QJsonObject js = doc.object(); 54 | return create(js); 55 | } 56 | 57 | 58 | std::unique_ptr UpdateRevisionDetails::factory::create(const QJsonObject& js) 59 | { 60 | std::unique_ptr rv; 61 | rv = std::unique_ptr(new UpdateRevisionDetails); 62 | rv->fromJson(js); 63 | return rv; 64 | } 65 | 66 | #ifdef API_QT_AUTOTEST 67 | std::unique_ptr UpdateRevisionDetails::EXAMPLE(int context_index, int parent_context_index){ 68 | Q_UNUSED(context_index); 69 | Q_UNUSED(parent_context_index); 70 | static int example_idx = 0; 71 | example_idx++; 72 | std::unique_ptr rv(new UpdateRevisionDetails); 73 | return rv; 74 | } 75 | #endif //API_QT_AUTOTEST 76 | 77 | }//revisions 78 | }//googleQt 79 | -------------------------------------------------------------------------------- /src/gmail/AUTOTEST/GmailAutotest.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include 13 | #include 14 | #include 15 | #include "GoogleClient.h" 16 | #include "gmail/GmailRoutes.h" 17 | 18 | #ifdef API_QT_AUTOTEST 19 | namespace googleQt{ 20 | 21 | class GmailAutotest { 22 | public: 23 | GmailAutotest(GoogleClient&); 24 | 25 | void generateCalls(); 26 | 27 | 28 | };//GmailAutotest 29 | 30 | }//googleQt 31 | #endif //API_QT_AUTOTEST 32 | -------------------------------------------------------------------------------- /src/gmail/GmailRoutes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "google/endpoint/ApiUtil.h" 4 | #include "google/endpoint/ApiClient.h" 5 | #include "google/endpoint/BatchRunner.h" 6 | 7 | #include "gmail/messages/MessagesRoutes.h" 8 | #include "gmail/attachments/AttachmentsRoutes.h" 9 | #include "gmail/labels/LabelsRoutes.h" 10 | #include "gmail/users/UsersRoutes.h" 11 | #include "gmail/threads/ThreadsRoutes.h" 12 | #include "gmail/history/HistoryRoutes.h" 13 | #include "gmail/drafts/DraftsRoutes.h" 14 | 15 | #include "google/endpoint/Cache.h" 16 | #include "gmail/GmailCache.h" 17 | #include "gmail/GmailCacheRoutes.h" 18 | 19 | namespace googleQt{ 20 | class Endpoint; 21 | 22 | namespace mail_cache { 23 | class MessagesReceiver; 24 | class MessageData; 25 | class GMailCacheQueryTask; 26 | class GMailCache; 27 | }; 28 | 29 | class GmailRoutes{ 30 | public: 31 | GmailRoutes(Endpoint*); 32 | 33 | messages::MessagesRoutes* getMessages(); 34 | attachments::AttachmentsRoutes* getAttachments(); 35 | labels::LabelsRoutes* getLabels(); 36 | users::UsersRoutes* getUsers(); 37 | threads::ThreadsRoutes* getThreads(); 38 | history::HistoryRoutes* getHistory(); 39 | drafts::DraftsRoutes* getDrafts(); 40 | 41 | Endpoint* endpoint() { return m_endpoint; } 42 | 43 | /// call setupCache before access any cache functions 44 | /// if contacts_db is provided, contacts tables will be used/allocated inside 45 | /// contacts_db, otherwise DB will be created/attached in dbPath 46 | googleQt::mail_cache::GmailCacheRoutes* setupCache(QString dbPath, 47 | QString downloadPath, 48 | QString contactCachePath, 49 | QString dbName = "googleqt", 50 | QString dbprefix = "api"); 51 | 52 | googleQt::mail_cache::GmailCacheRoutes* cacheRoutes(); 53 | 54 | ///if we have cache it has to be reloaded for new user that is in context 55 | void onUserReset(); 56 | 57 | public: 58 | #ifdef API_QT_AUTOTEST 59 | void autotest(); 60 | #endif 61 | 62 | protected: 63 | std::unique_ptr m_MessagesRoutes; 64 | std::unique_ptr m_AttachmentsRoutes; 65 | std::unique_ptr m_LabelsRoutes; 66 | std::unique_ptr m_UsersRoutes; 67 | std::unique_ptr m_ThreadsRoutes; 68 | std::unique_ptr m_HistoryRoutes; 69 | std::unique_ptr m_DraftsRoutes; 70 | std::unique_ptr m_CacheRoutes; 71 | Endpoint* m_endpoint; 72 | }; 73 | 74 | }; 75 | -------------------------------------------------------------------------------- /src/gmail/attachments/AttachmentsMessageAttachment.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "attachments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/attachments/AttachmentsMessageAttachment.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace attachments{ 15 | ///MessageAttachment 16 | 17 | MessageAttachment::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void MessageAttachment::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_attachmentId.isEmpty()) 27 | js["attachmentId"] = QString(m_attachmentId); 28 | js["data"] = m_data.constData(); 29 | js["size"] = QString("%1").arg(m_size); 30 | } 31 | 32 | void MessageAttachment::fromJson(const QJsonObject& js){ 33 | 34 | m_attachmentId = js["attachmentId"].toString(); 35 | m_data = js["data"].toVariant().toByteArray(); 36 | m_size = js["size"].toVariant().toString().toULongLong(); 37 | } 38 | 39 | QString MessageAttachment::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr MessageAttachment::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr MessageAttachment::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new MessageAttachment); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr MessageAttachment::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new MessageAttachment); 72 | rv->m_attachmentId = ApiAutotest::INSTANCE().getString("attachments::MessageAttachment", "m_attachmentId", QString("attachmentId_%1").arg(example_idx)); 73 | rv->m_data = ApiAutotest::INSTANCE().generateData("attachments::MessageAttachment", context_index, parent_context_index); 74 | rv->m_size = ApiAutotest::INSTANCE().getInt("attachments::MessageAttachment", "m_size", 3 + example_idx); 75 | return rv; 76 | } 77 | #endif //API_QT_AUTOTEST 78 | 79 | }//attachments 80 | }//googleQt 81 | -------------------------------------------------------------------------------- /src/gmail/attachments/AttachmentsRoutes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "attachments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/attachments/AttachmentsRoutes.h" 10 | #include "Endpoint.h" 11 | #include "gmail/GmailRoutes.h" 12 | using namespace googleQt; 13 | using namespace attachments; 14 | 15 | std::unique_ptr AttachmentsRoutes::get(const gmail::AttachmentIdArg& arg){ 16 | return get_Async(arg)->waitForResultAndRelease(); 17 | } 18 | 19 | GoogleTask* AttachmentsRoutes::get_Async(const gmail::AttachmentIdArg& arg) 20 | { 21 | GoogleTask* t = m_end_point->produceTask(); 22 | m_end_point->getStyle< 23 | MessageAttachment, 24 | MessageAttachment::factory 25 | > 26 | (m_end_point->buildGmailAttachmentUrl(arg), 27 | t); 28 | return t; 29 | } 30 | 31 | void AttachmentsRoutes::get_AsyncCB( 32 | const gmail::AttachmentIdArg& arg, 33 | std::function)> completed_callback , 34 | std::function)> failed_callback) 35 | { 36 | m_end_point->getStyle 37 | < 38 | MessageAttachment, 39 | MessageAttachment::factory 40 | > 41 | (m_end_point->buildGmailAttachmentUrl(arg), 42 | completed_callback, 43 | failed_callback); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/gmail/attachments/AttachmentsRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "attachments" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gmail/GmailRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gmail/attachments/AttachmentsMessageAttachment.h" 15 | 16 | namespace googleQt{ 17 | namespace attachments{ 18 | 19 | 20 | class AttachmentsRoutes: public GoogleRouteBase{ 21 | public: 22 | AttachmentsRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 23 | /** 24 | ApiRoute('get') 25 | 26 | 27 | Get the specified attachment 28 | 29 | */ 30 | std::unique_ptr get(const gmail::AttachmentIdArg& arg); 31 | GoogleTask* get_Async(const gmail::AttachmentIdArg& arg); 32 | void get_AsyncCB( 33 | const gmail::AttachmentIdArg&, 34 | std::function)> completed_callback = nullptr, 35 | std::function)> failed_callback = nullptr); 36 | 37 | protected: 38 | };//AttachmentsRoutes 39 | 40 | }//attachments 41 | }//googleQt 42 | -------------------------------------------------------------------------------- /src/gmail/drafts/DraftsDraftListRes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "drafts" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/drafts/DraftsDraftListRes.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace drafts{ 15 | ///DraftListRes 16 | 17 | DraftListRes::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void DraftListRes::toJson(QJsonObject& js)const{ 25 | 26 | js["drafts"] = struct_list2jsonarray(m_drafts); 27 | if(!m_nextPageToken.isEmpty()) 28 | js["nextPageToken"] = QString(m_nextPageToken); 29 | js["resultSizeEstimate"] = QString("%1").arg(m_resultSizeEstimate); 30 | } 31 | 32 | void DraftListRes::fromJson(const QJsonObject& js){ 33 | 34 | jsonarray2struct_list(js["drafts"].toArray(), m_drafts); 35 | m_nextPageToken = js["nextPageToken"].toString(); 36 | m_resultSizeEstimate = js["resultSizeEstimate"].toVariant().toString().toULongLong(); 37 | } 38 | 39 | QString DraftListRes::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr DraftListRes::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr DraftListRes::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new DraftListRes); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr DraftListRes::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new DraftListRes); 72 | std::vector list_of_drafts; 73 | for(int i = 0; i < 5; i++){ 74 | drafts::DraftResource p = *(drafts::DraftResource::EXAMPLE(i, context_index).get()); 75 | ApiAutotest::INSTANCE().prepareAutoTestObj("drafts::DraftListRes", "drafts::DraftResource", &p, i, context_index); 76 | rv->m_drafts.push_back(p); 77 | } 78 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("drafts::DraftListRes", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 79 | rv->m_resultSizeEstimate = ApiAutotest::INSTANCE().getInt("drafts::DraftListRes", "m_resultSizeEstimate", 3 + example_idx); 80 | return rv; 81 | } 82 | #endif //API_QT_AUTOTEST 83 | 84 | }//drafts 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gmail/drafts/DraftsDraftListRes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "drafts" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/drafts/DraftsDraftResource.h" 13 | 14 | namespace googleQt{ 15 | namespace drafts{ 16 | class DraftListRes{ 17 | /** 18 | field: drafts: List of drafts. 19 | field: next_page_token: Token to retrieve the next page of results 20 | in the list. 21 | field: result_size_estimate: Estimated total number of results. 22 | */ 23 | 24 | public: 25 | DraftListRes(){}; 26 | 27 | DraftListRes(const std::vector& arg){ m_drafts = arg; }; 28 | virtual ~DraftListRes(){}; 29 | 30 | public: 31 | /** 32 | List of drafts. 33 | */ 34 | const std::vector& drafts()const{return m_drafts;}; 35 | DraftListRes& setDrafts(const std::vector& arg){m_drafts=arg;return *this;}; 36 | 37 | /** 38 | Token to retrieve the next page of results in the list. 39 | */ 40 | QString nextpagetoken()const{return m_nextPageToken;}; 41 | DraftListRes& setNextpagetoken(const QString& arg){m_nextPageToken=arg;return *this;}; 42 | 43 | /** 44 | Estimated total number of results. 45 | */ 46 | quint64 resultsizeestimate()const{return m_resultSizeEstimate;}; 47 | DraftListRes& setResultsizeestimate(const quint64& arg){m_resultSizeEstimate=arg;return *this;}; 48 | 49 | public: 50 | operator QJsonObject ()const; 51 | virtual void fromJson(const QJsonObject& js); 52 | virtual void toJson(QJsonObject& js)const; 53 | virtual QString toString(bool multiline = true)const; 54 | 55 | 56 | class factory{ 57 | public: 58 | static std::unique_ptr create(const QByteArray& data); 59 | static std::unique_ptr create(const QJsonObject& js); 60 | }; 61 | 62 | 63 | #ifdef API_QT_AUTOTEST 64 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 65 | #endif //API_QT_AUTOTEST 66 | 67 | 68 | protected: 69 | /** 70 | List of drafts. 71 | */ 72 | std::vector m_drafts; 73 | 74 | /** 75 | Token to retrieve the next page of results in the list. 76 | */ 77 | QString m_nextPageToken; 78 | 79 | /** 80 | Estimated total number of results. 81 | */ 82 | quint64 m_resultSizeEstimate = {0}; 83 | 84 | };//DraftListRes 85 | 86 | }//drafts 87 | }//googleQt 88 | -------------------------------------------------------------------------------- /src/gmail/drafts/DraftsDraftResource.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "drafts" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/drafts/DraftsDraftResource.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace drafts{ 15 | ///DraftResource 16 | 17 | DraftResource::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void DraftResource::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_id.isEmpty()) 27 | js["id"] = QString(m_id); 28 | js["message"] = (QJsonObject)m_message; 29 | } 30 | 31 | void DraftResource::fromJson(const QJsonObject& js){ 32 | 33 | m_id = js["id"].toString(); 34 | m_message.fromJson(js["message"].toObject()); 35 | } 36 | 37 | QString DraftResource::toString(bool multiline)const 38 | { 39 | QJsonObject js; 40 | toJson(js); 41 | QJsonDocument doc(js); 42 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 43 | return s; 44 | } 45 | 46 | 47 | std::unique_ptr DraftResource::factory::create(const QByteArray& data) 48 | { 49 | QJsonDocument doc = QJsonDocument::fromJson(data); 50 | QJsonObject js = doc.object(); 51 | return create(js); 52 | } 53 | 54 | 55 | std::unique_ptr DraftResource::factory::create(const QJsonObject& js) 56 | { 57 | std::unique_ptr rv; 58 | rv = std::unique_ptr(new DraftResource); 59 | rv->fromJson(js); 60 | return rv; 61 | } 62 | 63 | #ifdef API_QT_AUTOTEST 64 | std::unique_ptr DraftResource::EXAMPLE(int context_index, int parent_context_index){ 65 | Q_UNUSED(context_index); 66 | Q_UNUSED(parent_context_index); 67 | static int example_idx = 0; 68 | example_idx++; 69 | std::unique_ptr rv(new DraftResource); 70 | rv->m_id = ApiAutotest::INSTANCE().getId("drafts::DraftResource", example_idx); 71 | rv->m_message = *(messages::MessageResource::EXAMPLE(0, context_index).get()); 72 | return rv; 73 | } 74 | #endif //API_QT_AUTOTEST 75 | 76 | }//drafts 77 | }//googleQt 78 | -------------------------------------------------------------------------------- /src/gmail/drafts/DraftsDraftResource.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "drafts" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/messages/MessagesMessageResource.h" 13 | 14 | namespace googleQt{ 15 | namespace drafts{ 16 | class DraftResource{ 17 | /** 18 | field: id: The immutable ID of the draft. 19 | field: message: The message content of the draft. 20 | */ 21 | 22 | public: 23 | DraftResource(){}; 24 | 25 | DraftResource(const QString& arg){ m_id = arg; }; 26 | virtual ~DraftResource(){}; 27 | 28 | public: 29 | /** 30 | The immutable ID of the draft. 31 | */ 32 | QString id()const{return m_id;}; 33 | DraftResource& setId(const QString& arg){m_id=arg;return *this;}; 34 | 35 | /** 36 | The message content of the draft. 37 | */ 38 | const messages::MessageResource& message()const{return m_message;}; 39 | DraftResource& setMessage(const messages::MessageResource& arg){m_message=arg;return *this;}; 40 | 41 | public: 42 | operator QJsonObject ()const; 43 | virtual void fromJson(const QJsonObject& js); 44 | virtual void toJson(QJsonObject& js)const; 45 | virtual QString toString(bool multiline = true)const; 46 | 47 | 48 | class factory{ 49 | public: 50 | static std::unique_ptr create(const QByteArray& data); 51 | static std::unique_ptr create(const QJsonObject& js); 52 | }; 53 | 54 | 55 | #ifdef API_QT_AUTOTEST 56 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 57 | #endif //API_QT_AUTOTEST 58 | 59 | 60 | protected: 61 | /** 62 | The immutable ID of the draft. 63 | */ 64 | QString m_id; 65 | 66 | /** 67 | The message content of the draft. 68 | */ 69 | messages::MessageResource m_message; 70 | 71 | };//DraftResource 72 | 73 | }//drafts 74 | }//googleQt 75 | -------------------------------------------------------------------------------- /src/gmail/drafts/DraftsRoutes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "drafts" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/drafts/DraftsRoutes.h" 10 | #include "Endpoint.h" 11 | #include "gmail/GmailRoutes.h" 12 | using namespace googleQt; 13 | using namespace drafts; 14 | 15 | std::unique_ptr DraftsRoutes::get(const gmail::IdArg& arg){ 16 | return get_Async(arg)->waitForResultAndRelease(); 17 | } 18 | 19 | GoogleTask* DraftsRoutes::get_Async(const gmail::IdArg& arg) 20 | { 21 | GoogleTask* t = m_end_point->produceTask(); 22 | m_end_point->getStyle< 23 | DraftResource, 24 | DraftResource::factory 25 | > 26 | (m_end_point->buildGmailUrl("drafts", arg), 27 | t); 28 | return t; 29 | } 30 | 31 | void DraftsRoutes::get_AsyncCB( 32 | const gmail::IdArg& arg, 33 | std::function)> completed_callback , 34 | std::function)> failed_callback) 35 | { 36 | m_end_point->getStyle 37 | < 38 | DraftResource, 39 | DraftResource::factory 40 | > 41 | (m_end_point->buildGmailUrl("drafts", arg), 42 | completed_callback, 43 | failed_callback); 44 | } 45 | 46 | std::unique_ptr DraftsRoutes::list(const gmail::DraftListArg& arg){ 47 | return list_Async(arg)->waitForResultAndRelease(); 48 | } 49 | 50 | GoogleTask* DraftsRoutes::list_Async(const gmail::DraftListArg& arg) 51 | { 52 | GoogleTask* t = m_end_point->produceTask(); 53 | m_end_point->getStyle< 54 | DraftListRes, 55 | DraftListRes::factory 56 | > 57 | (m_end_point->buildGmailUrl("drafts", arg), 58 | t); 59 | return t; 60 | } 61 | 62 | void DraftsRoutes::list_AsyncCB( 63 | const gmail::DraftListArg& arg, 64 | std::function)> completed_callback , 65 | std::function)> failed_callback) 66 | { 67 | m_end_point->getStyle 68 | < 69 | DraftListRes, 70 | DraftListRes::factory 71 | > 72 | (m_end_point->buildGmailUrl("drafts", arg), 73 | completed_callback, 74 | failed_callback); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /src/gmail/drafts/DraftsRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "drafts" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gmail/GmailRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gmail/drafts/DraftsDraftListRes.h" 15 | #include "gmail/drafts/DraftsDraftResource.h" 16 | 17 | namespace googleQt{ 18 | namespace drafts{ 19 | 20 | 21 | class DraftsRoutes: public GoogleRouteBase{ 22 | public: 23 | DraftsRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 24 | /** 25 | ApiRoute('get') 26 | 27 | 28 | Get the specified draft 29 | 30 | */ 31 | std::unique_ptr get(const gmail::IdArg& arg); 32 | GoogleTask* get_Async(const gmail::IdArg& arg); 33 | void get_AsyncCB( 34 | const gmail::IdArg&, 35 | std::function)> completed_callback = nullptr, 36 | std::function)> failed_callback = nullptr); 37 | 38 | /** 39 | ApiRoute('list') 40 | 41 | 42 | Get drafts list 43 | 44 | */ 45 | std::unique_ptr list(const gmail::DraftListArg& arg); 46 | GoogleTask* list_Async(const gmail::DraftListArg& arg); 47 | void list_AsyncCB( 48 | const gmail::DraftListArg&, 49 | std::function)> completed_callback = nullptr, 50 | std::function)> failed_callback = nullptr); 51 | 52 | protected: 53 | };//DraftsRoutes 54 | 55 | }//drafts 56 | }//googleQt 57 | -------------------------------------------------------------------------------- /src/gmail/errors/ErrorsErrorInfo.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "errors" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/errors/ErrorsErrorInfo.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace errors{ 15 | ///ErrorInfo 16 | 17 | ErrorInfo::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void ErrorInfo::toJson(QJsonObject& js)const{ 25 | 26 | js["errors"] = struct_list2jsonarray(m_errors); 27 | js["code"] = QString("%1").arg(m_code); 28 | if(!m_message.isEmpty()) 29 | js["message"] = QString(m_message); 30 | } 31 | 32 | void ErrorInfo::fromJson(const QJsonObject& js){ 33 | 34 | jsonarray2struct_list(js["errors"].toArray(), m_errors); 35 | m_code = js["code"].toVariant().toString().toULongLong(); 36 | m_message = js["message"].toString(); 37 | } 38 | 39 | QString ErrorInfo::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr ErrorInfo::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr ErrorInfo::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new ErrorInfo); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr ErrorInfo::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new ErrorInfo); 72 | std::vector list_of_errors; 73 | for(int i = 0; i < 5; i++){ 74 | errors::ErrorPart p = *(errors::ErrorPart::EXAMPLE(i, context_index).get()); 75 | ApiAutotest::INSTANCE().prepareAutoTestObj("errors::ErrorInfo", "errors::ErrorPart", &p, i, context_index); 76 | rv->m_errors.push_back(p); 77 | } 78 | rv->m_code = ApiAutotest::INSTANCE().getInt("errors::ErrorInfo", "m_code", 2 + example_idx); 79 | rv->m_message = ApiAutotest::INSTANCE().getString("errors::ErrorInfo", "m_message", QString("message_%1").arg(example_idx)); 80 | return rv; 81 | } 82 | #endif //API_QT_AUTOTEST 83 | 84 | }//errors 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gmail/errors/ErrorsErrorInfo.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "errors" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/errors/ErrorsErrorPart.h" 13 | 14 | namespace googleQt{ 15 | namespace errors{ 16 | class ErrorInfo{ 17 | /** 18 | field: errors: groups of error details 19 | field: code: HTTP response code 20 | field: message: Details of the error. 21 | */ 22 | 23 | public: 24 | ErrorInfo(){}; 25 | 26 | ErrorInfo(const std::vector& arg){ m_errors = arg; }; 27 | virtual ~ErrorInfo(){}; 28 | 29 | public: 30 | /** 31 | groups of error details 32 | */ 33 | const std::vector& errors()const{return m_errors;}; 34 | ErrorInfo& setErrors(const std::vector& arg){m_errors=arg;return *this;}; 35 | 36 | /** 37 | HTTP response code 38 | */ 39 | quint64 code()const{return m_code;}; 40 | ErrorInfo& setCode(const quint64& arg){m_code=arg;return *this;}; 41 | 42 | /** 43 | Details of the error. 44 | */ 45 | QString message()const{return m_message;}; 46 | ErrorInfo& setMessage(const QString& arg){m_message=arg;return *this;}; 47 | 48 | public: 49 | operator QJsonObject ()const; 50 | virtual void fromJson(const QJsonObject& js); 51 | virtual void toJson(QJsonObject& js)const; 52 | virtual QString toString(bool multiline = true)const; 53 | 54 | 55 | class factory{ 56 | public: 57 | static std::unique_ptr create(const QByteArray& data); 58 | static std::unique_ptr create(const QJsonObject& js); 59 | }; 60 | 61 | 62 | #ifdef API_QT_AUTOTEST 63 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 64 | #endif //API_QT_AUTOTEST 65 | 66 | 67 | protected: 68 | /** 69 | groups of error details 70 | */ 71 | std::vector m_errors; 72 | 73 | /** 74 | HTTP response code 75 | */ 76 | quint64 m_code = {0}; 77 | 78 | /** 79 | Details of the error. 80 | */ 81 | QString m_message; 82 | 83 | };//ErrorInfo 84 | 85 | }//errors 86 | }//googleQt 87 | -------------------------------------------------------------------------------- /src/gmail/errors/ErrorsErrorPart.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "errors" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/errors/ErrorsErrorPart.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace errors{ 15 | ///ErrorPart 16 | 17 | ErrorPart::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void ErrorPart::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_domain.isEmpty()) 27 | js["domain"] = QString(m_domain); 28 | if(!m_reason.isEmpty()) 29 | js["reason"] = QString(m_reason); 30 | if(!m_message.isEmpty()) 31 | js["message"] = QString(m_message); 32 | } 33 | 34 | void ErrorPart::fromJson(const QJsonObject& js){ 35 | 36 | m_domain = js["domain"].toString(); 37 | m_reason = js["reason"].toString(); 38 | m_message = js["message"].toString(); 39 | } 40 | 41 | QString ErrorPart::toString(bool multiline)const 42 | { 43 | QJsonObject js; 44 | toJson(js); 45 | QJsonDocument doc(js); 46 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 47 | return s; 48 | } 49 | 50 | 51 | std::unique_ptr ErrorPart::factory::create(const QByteArray& data) 52 | { 53 | QJsonDocument doc = QJsonDocument::fromJson(data); 54 | QJsonObject js = doc.object(); 55 | return create(js); 56 | } 57 | 58 | 59 | std::unique_ptr ErrorPart::factory::create(const QJsonObject& js) 60 | { 61 | std::unique_ptr rv; 62 | rv = std::unique_ptr(new ErrorPart); 63 | rv->fromJson(js); 64 | return rv; 65 | } 66 | 67 | #ifdef API_QT_AUTOTEST 68 | std::unique_ptr ErrorPart::EXAMPLE(int context_index, int parent_context_index){ 69 | Q_UNUSED(context_index); 70 | Q_UNUSED(parent_context_index); 71 | static int example_idx = 0; 72 | example_idx++; 73 | std::unique_ptr rv(new ErrorPart); 74 | rv->m_domain = ApiAutotest::INSTANCE().getString("errors::ErrorPart", "m_domain", QString("domain_%1").arg(example_idx)); 75 | rv->m_reason = ApiAutotest::INSTANCE().getString("errors::ErrorPart", "m_reason", QString("reason_%1").arg(example_idx)); 76 | rv->m_message = ApiAutotest::INSTANCE().getString("errors::ErrorPart", "m_message", QString("message_%1").arg(example_idx)); 77 | return rv; 78 | } 79 | #endif //API_QT_AUTOTEST 80 | 81 | }//errors 82 | }//googleQt 83 | -------------------------------------------------------------------------------- /src/gmail/errors/ErrorsErrorPart.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "errors" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace errors{ 15 | class ErrorPart{ 16 | /** 17 | field: domain: domain - global 18 | field: reason: reason - badRequest, authError etc. 19 | field: message: message details 20 | */ 21 | 22 | public: 23 | ErrorPart(){}; 24 | 25 | ErrorPart(const QString& arg){ m_domain = arg; }; 26 | virtual ~ErrorPart(){}; 27 | 28 | public: 29 | /** 30 | domain - global 31 | */ 32 | QString domain()const{return m_domain;}; 33 | ErrorPart& setDomain(const QString& arg){m_domain=arg;return *this;}; 34 | 35 | /** 36 | reason - badRequest, authError etc. 37 | */ 38 | QString reason()const{return m_reason;}; 39 | ErrorPart& setReason(const QString& arg){m_reason=arg;return *this;}; 40 | 41 | /** 42 | message details 43 | */ 44 | QString message()const{return m_message;}; 45 | ErrorPart& setMessage(const QString& arg){m_message=arg;return *this;}; 46 | 47 | public: 48 | operator QJsonObject ()const; 49 | virtual void fromJson(const QJsonObject& js); 50 | virtual void toJson(QJsonObject& js)const; 51 | virtual QString toString(bool multiline = true)const; 52 | 53 | 54 | class factory{ 55 | public: 56 | static std::unique_ptr create(const QByteArray& data); 57 | static std::unique_ptr create(const QJsonObject& js); 58 | }; 59 | 60 | 61 | #ifdef API_QT_AUTOTEST 62 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 63 | #endif //API_QT_AUTOTEST 64 | 65 | 66 | protected: 67 | /** 68 | domain - global 69 | */ 70 | QString m_domain; 71 | 72 | /** 73 | reason - badRequest, authError etc. 74 | */ 75 | QString m_reason; 76 | 77 | /** 78 | message details 79 | */ 80 | QString m_message; 81 | 82 | };//ErrorPart 83 | 84 | }//errors 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gmail/history/HistoryHistoryRecordList.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "history" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/history/HistoryHistoryRecordList.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace history{ 15 | ///HistoryRecordList 16 | 17 | HistoryRecordList::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void HistoryRecordList::toJson(QJsonObject& js)const{ 25 | 26 | js["history"] = struct_list2jsonarray(m_history); 27 | if(!m_nextPageToken.isEmpty()) 28 | js["nextPageToken"] = QString(m_nextPageToken); 29 | if(!m_historyId.isEmpty()) 30 | js["historyId"] = QString(m_historyId); 31 | } 32 | 33 | void HistoryRecordList::fromJson(const QJsonObject& js){ 34 | 35 | jsonarray2struct_list(js["history"].toArray(), m_history); 36 | m_nextPageToken = js["nextPageToken"].toString(); 37 | m_historyId = js["historyId"].toString(); 38 | } 39 | 40 | QString HistoryRecordList::toString(bool multiline)const 41 | { 42 | QJsonObject js; 43 | toJson(js); 44 | QJsonDocument doc(js); 45 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 46 | return s; 47 | } 48 | 49 | 50 | std::unique_ptr HistoryRecordList::factory::create(const QByteArray& data) 51 | { 52 | QJsonDocument doc = QJsonDocument::fromJson(data); 53 | QJsonObject js = doc.object(); 54 | return create(js); 55 | } 56 | 57 | 58 | std::unique_ptr HistoryRecordList::factory::create(const QJsonObject& js) 59 | { 60 | std::unique_ptr rv; 61 | rv = std::unique_ptr(new HistoryRecordList); 62 | rv->fromJson(js); 63 | return rv; 64 | } 65 | 66 | #ifdef API_QT_AUTOTEST 67 | std::unique_ptr HistoryRecordList::EXAMPLE(int context_index, int parent_context_index){ 68 | Q_UNUSED(context_index); 69 | Q_UNUSED(parent_context_index); 70 | static int example_idx = 0; 71 | example_idx++; 72 | std::unique_ptr rv(new HistoryRecordList); 73 | std::vector list_of_history; 74 | for(int i = 0; i < 5; i++){ 75 | history::HistoryRecord p = *(history::HistoryRecord::EXAMPLE(i, context_index).get()); 76 | ApiAutotest::INSTANCE().prepareAutoTestObj("history::HistoryRecordList", "history::HistoryRecord", &p, i, context_index); 77 | rv->m_history.push_back(p); 78 | } 79 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("history::HistoryRecordList", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 80 | rv->m_historyId = ApiAutotest::INSTANCE().getString("history::HistoryRecordList", "m_historyId", QString("historyId_%1").arg(example_idx)); 81 | return rv; 82 | } 83 | #endif //API_QT_AUTOTEST 84 | 85 | }//history 86 | }//googleQt 87 | -------------------------------------------------------------------------------- /src/gmail/history/HistoryLabelHistoryRecord.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "history" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/history/HistoryLabelHistoryRecord.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace history{ 15 | ///LabelHistoryRecord 16 | 17 | LabelHistoryRecord::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void LabelHistoryRecord::toJson(QJsonObject& js)const{ 25 | 26 | js["message"] = (QJsonObject)m_message; 27 | js["labelIds"] = ingrl_list2jsonarray(m_labelIds); 28 | } 29 | 30 | void LabelHistoryRecord::fromJson(const QJsonObject& js){ 31 | 32 | m_message.fromJson(js["message"].toObject()); 33 | jsonarray2ingrl_list(js["labelIds"].toArray(), m_labelIds); 34 | } 35 | 36 | QString LabelHistoryRecord::toString(bool multiline)const 37 | { 38 | QJsonObject js; 39 | toJson(js); 40 | QJsonDocument doc(js); 41 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 42 | return s; 43 | } 44 | 45 | 46 | std::unique_ptr LabelHistoryRecord::factory::create(const QByteArray& data) 47 | { 48 | QJsonDocument doc = QJsonDocument::fromJson(data); 49 | QJsonObject js = doc.object(); 50 | return create(js); 51 | } 52 | 53 | 54 | std::unique_ptr LabelHistoryRecord::factory::create(const QJsonObject& js) 55 | { 56 | std::unique_ptr rv; 57 | rv = std::unique_ptr(new LabelHistoryRecord); 58 | rv->fromJson(js); 59 | return rv; 60 | } 61 | 62 | #ifdef API_QT_AUTOTEST 63 | std::unique_ptr LabelHistoryRecord::EXAMPLE(int context_index, int parent_context_index){ 64 | Q_UNUSED(context_index); 65 | Q_UNUSED(parent_context_index); 66 | static int example_idx = 0; 67 | example_idx++; 68 | std::unique_ptr rv(new LabelHistoryRecord); 69 | rv->m_message = *(messages::MessageResource::EXAMPLE(0, context_index).get()); 70 | std::vector list_of_labelIds; 71 | for(int i = 0; i < 5; i++){ 72 | rv->m_labelIds.push_back(QString("id_%1").arg(i+1)); 73 | } 74 | QString tmp_m_labelIds = ApiAutotest::INSTANCE().getString4List("history::LabelHistoryRecord", "m_labelIds"); 75 | if(!tmp_m_labelIds.isEmpty())rv->m_labelIds.push_back(tmp_m_labelIds); 76 | return rv; 77 | } 78 | #endif //API_QT_AUTOTEST 79 | 80 | }//history 81 | }//googleQt 82 | -------------------------------------------------------------------------------- /src/gmail/history/HistoryLabelHistoryRecord.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "history" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/messages/MessagesMessageResource.h" 13 | 14 | namespace googleQt{ 15 | namespace history{ 16 | class LabelHistoryRecord{ 17 | /** 18 | field: message: Message resource 19 | field: label_ids: Labels list 20 | */ 21 | 22 | public: 23 | LabelHistoryRecord(){}; 24 | 25 | LabelHistoryRecord(const messages::MessageResource& arg){ m_message = arg; }; 26 | virtual ~LabelHistoryRecord(){}; 27 | 28 | public: 29 | /** 30 | Message resource 31 | */ 32 | const messages::MessageResource& message()const{return m_message;}; 33 | LabelHistoryRecord& setMessage(const messages::MessageResource& arg){m_message=arg;return *this;}; 34 | 35 | /** 36 | Labels list 37 | */ 38 | const std::vector& labelids()const{return m_labelIds;}; 39 | LabelHistoryRecord& setLabelids(const std::vector& arg){m_labelIds=arg;return *this;}; 40 | 41 | public: 42 | operator QJsonObject ()const; 43 | virtual void fromJson(const QJsonObject& js); 44 | virtual void toJson(QJsonObject& js)const; 45 | virtual QString toString(bool multiline = true)const; 46 | 47 | 48 | class factory{ 49 | public: 50 | static std::unique_ptr create(const QByteArray& data); 51 | static std::unique_ptr create(const QJsonObject& js); 52 | }; 53 | 54 | 55 | #ifdef API_QT_AUTOTEST 56 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 57 | #endif //API_QT_AUTOTEST 58 | 59 | 60 | protected: 61 | /** 62 | Message resource 63 | */ 64 | messages::MessageResource m_message; 65 | 66 | /** 67 | Labels list 68 | */ 69 | std::vector m_labelIds; 70 | 71 | };//LabelHistoryRecord 72 | 73 | }//history 74 | }//googleQt 75 | -------------------------------------------------------------------------------- /src/gmail/history/HistoryRoutes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "history" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/history/HistoryRoutes.h" 10 | #include "Endpoint.h" 11 | #include "gmail/GmailRoutes.h" 12 | using namespace googleQt; 13 | using namespace history; 14 | 15 | std::unique_ptr HistoryRoutes::list(const gmail::HistoryListArg& arg){ 16 | return list_Async(arg)->waitForResultAndRelease(); 17 | } 18 | 19 | GoogleTask* HistoryRoutes::list_Async(const gmail::HistoryListArg& arg) 20 | { 21 | GoogleTask* t = m_end_point->produceTask(); 22 | m_end_point->getStyle< 23 | HistoryRecordList, 24 | HistoryRecordList::factory 25 | > 26 | (m_end_point->buildGmailUrl("history", arg), 27 | t); 28 | return t; 29 | } 30 | 31 | void HistoryRoutes::list_AsyncCB( 32 | const gmail::HistoryListArg& arg, 33 | std::function)> completed_callback , 34 | std::function)> failed_callback) 35 | { 36 | m_end_point->getStyle 37 | < 38 | HistoryRecordList, 39 | HistoryRecordList::factory 40 | > 41 | (m_end_point->buildGmailUrl("history", arg), 42 | completed_callback, 43 | failed_callback); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/gmail/history/HistoryRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "history" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gmail/GmailRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gmail/history/HistoryHistoryRecordList.h" 15 | 16 | namespace googleQt{ 17 | namespace history{ 18 | 19 | 20 | class HistoryRoutes: public GoogleRouteBase{ 21 | public: 22 | HistoryRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 23 | std::unique_ptr list(const gmail::HistoryListArg& arg); 24 | GoogleTask* list_Async(const gmail::HistoryListArg& arg); 25 | void list_AsyncCB( 26 | const gmail::HistoryListArg&, 27 | std::function)> completed_callback = nullptr, 28 | std::function)> failed_callback = nullptr); 29 | 30 | protected: 31 | };//HistoryRoutes 32 | 33 | }//history 34 | }//googleQt 35 | -------------------------------------------------------------------------------- /src/gmail/labels/LabelsLabelsResultList.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "labels" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/labels/LabelsLabelsResultList.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace labels{ 15 | ///LabelsResultList 16 | 17 | LabelsResultList::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void LabelsResultList::toJson(QJsonObject& js)const{ 25 | 26 | js["labels"] = struct_list2jsonarray(m_labels); 27 | } 28 | 29 | void LabelsResultList::fromJson(const QJsonObject& js){ 30 | 31 | jsonarray2struct_list(js["labels"].toArray(), m_labels); 32 | } 33 | 34 | QString LabelsResultList::toString(bool multiline)const 35 | { 36 | QJsonObject js; 37 | toJson(js); 38 | QJsonDocument doc(js); 39 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 40 | return s; 41 | } 42 | 43 | 44 | std::unique_ptr LabelsResultList::factory::create(const QByteArray& data) 45 | { 46 | QJsonDocument doc = QJsonDocument::fromJson(data); 47 | QJsonObject js = doc.object(); 48 | return create(js); 49 | } 50 | 51 | 52 | std::unique_ptr LabelsResultList::factory::create(const QJsonObject& js) 53 | { 54 | std::unique_ptr rv; 55 | rv = std::unique_ptr(new LabelsResultList); 56 | rv->fromJson(js); 57 | return rv; 58 | } 59 | 60 | #ifdef API_QT_AUTOTEST 61 | std::unique_ptr LabelsResultList::EXAMPLE(int context_index, int parent_context_index){ 62 | Q_UNUSED(context_index); 63 | Q_UNUSED(parent_context_index); 64 | static int example_idx = 0; 65 | example_idx++; 66 | std::unique_ptr rv(new LabelsResultList); 67 | std::vector list_of_labels; 68 | for(int i = 0; i < 5; i++){ 69 | labels::LabelResource p = *(labels::LabelResource::EXAMPLE(i, context_index).get()); 70 | ApiAutotest::INSTANCE().prepareAutoTestObj("labels::LabelsResultList", "labels::LabelResource", &p, i, context_index); 71 | rv->m_labels.push_back(p); 72 | } 73 | return rv; 74 | } 75 | #endif //API_QT_AUTOTEST 76 | 77 | }//labels 78 | }//googleQt 79 | -------------------------------------------------------------------------------- /src/gmail/labels/LabelsLabelsResultList.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "labels" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/labels/LabelsLabelResource.h" 13 | 14 | namespace googleQt{ 15 | namespace labels{ 16 | class LabelsResultList{ 17 | 18 | public: 19 | LabelsResultList(){}; 20 | 21 | LabelsResultList(const std::vector& arg){ m_labels = arg; }; 22 | virtual ~LabelsResultList(){}; 23 | 24 | public: 25 | const std::vector& labels()const{return m_labels;}; 26 | 27 | public: 28 | operator QJsonObject ()const; 29 | virtual void fromJson(const QJsonObject& js); 30 | virtual void toJson(QJsonObject& js)const; 31 | virtual QString toString(bool multiline = true)const; 32 | 33 | 34 | class factory{ 35 | public: 36 | static std::unique_ptr create(const QByteArray& data); 37 | static std::unique_ptr create(const QJsonObject& js); 38 | }; 39 | 40 | 41 | #ifdef API_QT_AUTOTEST 42 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 43 | #endif //API_QT_AUTOTEST 44 | 45 | 46 | protected: 47 | std::vector m_labels; 48 | 49 | };//LabelsResultList 50 | 51 | }//labels 52 | }//googleQt 53 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesBatchDeleteBodyArg.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/messages/MessagesBatchDeleteBodyArg.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace messages{ 15 | ///BatchDeleteBodyArg 16 | 17 | BatchDeleteBodyArg::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void BatchDeleteBodyArg::toJson(QJsonObject& js)const{ 25 | 26 | js["ids"] = ingrl_list2jsonarray(m_ids); 27 | } 28 | 29 | void BatchDeleteBodyArg::fromJson(const QJsonObject& js){ 30 | 31 | jsonarray2ingrl_list(js["ids"].toArray(), m_ids); 32 | } 33 | 34 | QString BatchDeleteBodyArg::toString(bool multiline)const 35 | { 36 | QJsonObject js; 37 | toJson(js); 38 | QJsonDocument doc(js); 39 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 40 | return s; 41 | } 42 | 43 | 44 | std::unique_ptr BatchDeleteBodyArg::factory::create(const QByteArray& data) 45 | { 46 | QJsonDocument doc = QJsonDocument::fromJson(data); 47 | QJsonObject js = doc.object(); 48 | return create(js); 49 | } 50 | 51 | 52 | std::unique_ptr BatchDeleteBodyArg::factory::create(const QJsonObject& js) 53 | { 54 | std::unique_ptr rv; 55 | rv = std::unique_ptr(new BatchDeleteBodyArg); 56 | rv->fromJson(js); 57 | return rv; 58 | } 59 | 60 | #ifdef API_QT_AUTOTEST 61 | std::unique_ptr BatchDeleteBodyArg::EXAMPLE(int context_index, int parent_context_index){ 62 | Q_UNUSED(context_index); 63 | Q_UNUSED(parent_context_index); 64 | static int example_idx = 0; 65 | example_idx++; 66 | std::unique_ptr rv(new BatchDeleteBodyArg); 67 | std::vector list_of_ids; 68 | for(int i = 0; i < 5; i++){ 69 | rv->m_ids.push_back(QString("id_%1").arg(i+1)); 70 | } 71 | QString tmp_m_ids = ApiAutotest::INSTANCE().getString4List("messages::BatchDeleteBodyArg", "m_ids"); 72 | if(!tmp_m_ids.isEmpty())rv->m_ids.push_back(tmp_m_ids); 73 | return rv; 74 | } 75 | #endif //API_QT_AUTOTEST 76 | 77 | }//messages 78 | }//googleQt 79 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesBatchDeleteBodyArg.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace messages{ 15 | class BatchDeleteBodyArg{ 16 | 17 | public: 18 | BatchDeleteBodyArg(){}; 19 | 20 | BatchDeleteBodyArg(const std::vector& arg){ m_ids = arg; }; 21 | virtual ~BatchDeleteBodyArg(){}; 22 | 23 | public: 24 | const std::vector& ids()const{return m_ids;}; 25 | BatchDeleteBodyArg& setIds(const std::vector& arg){m_ids=arg;return *this;}; 26 | 27 | public: 28 | operator QJsonObject ()const; 29 | virtual void fromJson(const QJsonObject& js); 30 | virtual void toJson(QJsonObject& js)const; 31 | virtual QString toString(bool multiline = true)const; 32 | 33 | 34 | class factory{ 35 | public: 36 | static std::unique_ptr create(const QByteArray& data); 37 | static std::unique_ptr create(const QJsonObject& js); 38 | }; 39 | 40 | 41 | #ifdef API_QT_AUTOTEST 42 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 43 | #endif //API_QT_AUTOTEST 44 | 45 | 46 | protected: 47 | std::vector m_ids; 48 | 49 | };//BatchDeleteBodyArg 50 | 51 | }//messages 52 | }//googleQt 53 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesMessageListRes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/messages/MessagesMessageListRes.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace messages{ 15 | ///MessageListRes 16 | 17 | MessageListRes::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void MessageListRes::toJson(QJsonObject& js)const{ 25 | 26 | js["messages"] = struct_list2jsonarray(m_messages); 27 | if(!m_nextPageToken.isEmpty()) 28 | js["nextPageToken"] = QString(m_nextPageToken); 29 | js["resultSizeEstimate"] = QString("%1").arg(m_resultSizeEstimate); 30 | } 31 | 32 | void MessageListRes::fromJson(const QJsonObject& js){ 33 | 34 | jsonarray2struct_list(js["messages"].toArray(), m_messages); 35 | m_nextPageToken = js["nextPageToken"].toString(); 36 | m_resultSizeEstimate = js["resultSizeEstimate"].toVariant().toString().toULongLong(); 37 | } 38 | 39 | QString MessageListRes::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr MessageListRes::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr MessageListRes::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new MessageListRes); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr MessageListRes::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new MessageListRes); 72 | std::vector list_of_messages; 73 | for(int i = 0; i < 5; i++){ 74 | messages::MessageResource p = *(messages::MessageResource::EXAMPLE(i, context_index).get()); 75 | ApiAutotest::INSTANCE().prepareAutoTestObj("messages::MessageListRes", "messages::MessageResource", &p, i, context_index); 76 | rv->m_messages.push_back(p); 77 | } 78 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("messages::MessageListRes", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 79 | rv->m_resultSizeEstimate = ApiAutotest::INSTANCE().getInt("messages::MessageListRes", "m_resultSizeEstimate", 3 + example_idx); 80 | return rv; 81 | } 82 | #endif //API_QT_AUTOTEST 83 | 84 | }//messages 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesMessageListRes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/messages/MessagesMessageResource.h" 13 | 14 | namespace googleQt{ 15 | namespace messages{ 16 | class MessageListRes{ 17 | /** 18 | field: messages: List of messages. 19 | field: next_page_token: Token to retrieve the next page of results 20 | in the list. 21 | field: result_size_estimate: Estimated total number of results. 22 | */ 23 | 24 | public: 25 | MessageListRes(){}; 26 | 27 | MessageListRes(const std::vector& arg){ m_messages = arg; }; 28 | virtual ~MessageListRes(){}; 29 | 30 | public: 31 | /** 32 | List of messages. 33 | */ 34 | const std::vector& messages()const{return m_messages;}; 35 | MessageListRes& setMessages(const std::vector& arg){m_messages=arg;return *this;}; 36 | 37 | /** 38 | Token to retrieve the next page of results in the list. 39 | */ 40 | QString nextpagetoken()const{return m_nextPageToken;}; 41 | MessageListRes& setNextpagetoken(const QString& arg){m_nextPageToken=arg;return *this;}; 42 | 43 | /** 44 | Estimated total number of results. 45 | */ 46 | quint64 resultsizeestimate()const{return m_resultSizeEstimate;}; 47 | MessageListRes& setResultsizeestimate(const quint64& arg){m_resultSizeEstimate=arg;return *this;}; 48 | 49 | public: 50 | operator QJsonObject ()const; 51 | virtual void fromJson(const QJsonObject& js); 52 | virtual void toJson(QJsonObject& js)const; 53 | virtual QString toString(bool multiline = true)const; 54 | 55 | 56 | class factory{ 57 | public: 58 | static std::unique_ptr create(const QByteArray& data); 59 | static std::unique_ptr create(const QJsonObject& js); 60 | }; 61 | 62 | 63 | #ifdef API_QT_AUTOTEST 64 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 65 | #endif //API_QT_AUTOTEST 66 | 67 | 68 | protected: 69 | /** 70 | List of messages. 71 | */ 72 | std::vector m_messages; 73 | 74 | /** 75 | Token to retrieve the next page of results in the list. 76 | */ 77 | QString m_nextPageToken; 78 | 79 | /** 80 | Estimated total number of results. 81 | */ 82 | quint64 m_resultSizeEstimate = {0}; 83 | 84 | };//MessageListRes 85 | 86 | }//messages 87 | }//googleQt 88 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesMessageMimeBody.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/messages/MessagesMessageMimeBody.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace messages{ 15 | ///MessageMimeBody 16 | 17 | MessageMimeBody::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void MessageMimeBody::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_attachmentId.isEmpty()) 27 | js["attachmentId"] = QString(m_attachmentId); 28 | js["size"] = QString("%1").arg(m_size); 29 | js["data"] = m_data.constData(); 30 | } 31 | 32 | void MessageMimeBody::fromJson(const QJsonObject& js){ 33 | 34 | m_attachmentId = js["attachmentId"].toString(); 35 | m_size = js["size"].toVariant().toString().toULongLong(); 36 | m_data = js["data"].toVariant().toByteArray(); 37 | } 38 | 39 | QString MessageMimeBody::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr MessageMimeBody::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr MessageMimeBody::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new MessageMimeBody); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr MessageMimeBody::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new MessageMimeBody); 72 | rv->m_attachmentId = ApiAutotest::INSTANCE().getString("messages::MessageMimeBody", "m_attachmentId", QString("attachmentId_%1").arg(example_idx)); 73 | rv->m_size = ApiAutotest::INSTANCE().getInt("messages::MessageMimeBody", "m_size", 2 + example_idx); 74 | rv->m_data = ApiAutotest::INSTANCE().generateData("messages::MessageMimeBody", context_index, parent_context_index); 75 | return rv; 76 | } 77 | #endif //API_QT_AUTOTEST 78 | 79 | }//messages 80 | }//googleQt 81 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesMessagePartBody.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/messages/MessagesMessagePartBody.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace messages{ 15 | ///MessagePartBody 16 | 17 | MessagePartBody::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void MessagePartBody::toJson(QJsonObject& js)const{ 25 | 26 | js["size"] = QString("%1").arg(m_size); 27 | js["data"] = m_data.constData(); 28 | if(!m_attachmentId.isEmpty()) 29 | js["attachmentId"] = QString(m_attachmentId); 30 | } 31 | 32 | void MessagePartBody::fromJson(const QJsonObject& js){ 33 | 34 | m_size = js["size"].toVariant().toString().toULongLong(); 35 | m_data = js["data"].toVariant().toByteArray(); 36 | m_attachmentId = js["attachmentId"].toString(); 37 | } 38 | 39 | QString MessagePartBody::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr MessagePartBody::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr MessagePartBody::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new MessagePartBody); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr MessagePartBody::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new MessagePartBody); 72 | rv->m_size = ApiAutotest::INSTANCE().getInt("messages::MessagePartBody", "m_size", 1 + example_idx); 73 | rv->m_data = ApiAutotest::INSTANCE().generateData("messages::MessagePartBody", context_index, parent_context_index); 74 | rv->m_attachmentId = ApiAutotest::INSTANCE().getString("messages::MessagePartBody", "m_attachmentId", QString("attachmentId_%1").arg(example_idx)); 75 | return rv; 76 | } 77 | #endif //API_QT_AUTOTEST 78 | 79 | }//messages 80 | }//googleQt 81 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesMessagePayloadHeader.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/messages/MessagesMessagePayloadHeader.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace messages{ 15 | ///MessagePayloadHeader 16 | 17 | MessagePayloadHeader::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void MessagePayloadHeader::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_name.isEmpty()) 27 | js["name"] = QString(m_name); 28 | if(!m_value.isEmpty()) 29 | js["value"] = QString(m_value); 30 | } 31 | 32 | void MessagePayloadHeader::fromJson(const QJsonObject& js){ 33 | 34 | m_name = js["name"].toString(); 35 | m_value = js["value"].toString(); 36 | } 37 | 38 | QString MessagePayloadHeader::toString(bool multiline)const 39 | { 40 | QJsonObject js; 41 | toJson(js); 42 | QJsonDocument doc(js); 43 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 44 | return s; 45 | } 46 | 47 | 48 | std::unique_ptr MessagePayloadHeader::factory::create(const QByteArray& data) 49 | { 50 | QJsonDocument doc = QJsonDocument::fromJson(data); 51 | QJsonObject js = doc.object(); 52 | return create(js); 53 | } 54 | 55 | 56 | std::unique_ptr MessagePayloadHeader::factory::create(const QJsonObject& js) 57 | { 58 | std::unique_ptr rv; 59 | rv = std::unique_ptr(new MessagePayloadHeader); 60 | rv->fromJson(js); 61 | return rv; 62 | } 63 | 64 | #ifdef API_QT_AUTOTEST 65 | std::unique_ptr MessagePayloadHeader::EXAMPLE(int context_index, int parent_context_index){ 66 | Q_UNUSED(context_index); 67 | Q_UNUSED(parent_context_index); 68 | static int example_idx = 0; 69 | example_idx++; 70 | std::unique_ptr rv(new MessagePayloadHeader); 71 | rv->m_name = ApiAutotest::INSTANCE().getString("messages::MessagePayloadHeader", "m_name", QString("name_%1").arg(example_idx)); 72 | rv->m_value = ApiAutotest::INSTANCE().getString("messages::MessagePayloadHeader", "m_value", QString("value_%1").arg(example_idx)); 73 | return rv; 74 | } 75 | #endif //API_QT_AUTOTEST 76 | 77 | }//messages 78 | }//googleQt 79 | -------------------------------------------------------------------------------- /src/gmail/messages/MessagesMessagePayloadHeader.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "messages" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace messages{ 15 | class MessagePayloadHeader{ 16 | /** 17 | field: name: The name of the header before the : separator. For 18 | example, To. 19 | field: value: The value of the header after the : separator. For 20 | example, someuser@example.com. 21 | */ 22 | 23 | public: 24 | MessagePayloadHeader(){}; 25 | 26 | MessagePayloadHeader(const QString& arg){ m_name = arg; }; 27 | virtual ~MessagePayloadHeader(){}; 28 | 29 | public: 30 | /** 31 | The name of the header before the : separator. For example, To. 32 | */ 33 | QString name()const{return m_name;}; 34 | MessagePayloadHeader& setName(const QString& arg){m_name=arg;return *this;}; 35 | 36 | /** 37 | The value of the header after the : separator. For example, 38 | someuser@example.com. 39 | */ 40 | QString value()const{return m_value;}; 41 | MessagePayloadHeader& setValue(const QString& arg){m_value=arg;return *this;}; 42 | 43 | public: 44 | operator QJsonObject ()const; 45 | virtual void fromJson(const QJsonObject& js); 46 | virtual void toJson(QJsonObject& js)const; 47 | virtual QString toString(bool multiline = true)const; 48 | 49 | 50 | class factory{ 51 | public: 52 | static std::unique_ptr create(const QByteArray& data); 53 | static std::unique_ptr create(const QJsonObject& js); 54 | }; 55 | 56 | 57 | #ifdef API_QT_AUTOTEST 58 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 59 | #endif //API_QT_AUTOTEST 60 | 61 | 62 | protected: 63 | /** 64 | The name of the header before the : separator. For example, To. 65 | */ 66 | QString m_name; 67 | 68 | /** 69 | The value of the header after the : separator. For example, 70 | someuser@example.com. 71 | */ 72 | QString m_value; 73 | 74 | };//MessagePayloadHeader 75 | 76 | }//messages 77 | }//googleQt 78 | -------------------------------------------------------------------------------- /src/gmail/threads/ThreadsThreadListRes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "threads" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/threads/ThreadsThreadListRes.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace threads{ 15 | ///ThreadListRes 16 | 17 | ThreadListRes::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void ThreadListRes::toJson(QJsonObject& js)const{ 25 | 26 | js["threads"] = struct_list2jsonarray(m_threads); 27 | if(!m_nextPageToken.isEmpty()) 28 | js["nextPageToken"] = QString(m_nextPageToken); 29 | js["resultSizeEstimate"] = QString("%1").arg(m_resultSizeEstimate); 30 | } 31 | 32 | void ThreadListRes::fromJson(const QJsonObject& js){ 33 | 34 | jsonarray2struct_list(js["threads"].toArray(), m_threads); 35 | m_nextPageToken = js["nextPageToken"].toString(); 36 | m_resultSizeEstimate = js["resultSizeEstimate"].toVariant().toString().toULongLong(); 37 | } 38 | 39 | QString ThreadListRes::toString(bool multiline)const 40 | { 41 | QJsonObject js; 42 | toJson(js); 43 | QJsonDocument doc(js); 44 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 45 | return s; 46 | } 47 | 48 | 49 | std::unique_ptr ThreadListRes::factory::create(const QByteArray& data) 50 | { 51 | QJsonDocument doc = QJsonDocument::fromJson(data); 52 | QJsonObject js = doc.object(); 53 | return create(js); 54 | } 55 | 56 | 57 | std::unique_ptr ThreadListRes::factory::create(const QJsonObject& js) 58 | { 59 | std::unique_ptr rv; 60 | rv = std::unique_ptr(new ThreadListRes); 61 | rv->fromJson(js); 62 | return rv; 63 | } 64 | 65 | #ifdef API_QT_AUTOTEST 66 | std::unique_ptr ThreadListRes::EXAMPLE(int context_index, int parent_context_index){ 67 | Q_UNUSED(context_index); 68 | Q_UNUSED(parent_context_index); 69 | static int example_idx = 0; 70 | example_idx++; 71 | std::unique_ptr rv(new ThreadListRes); 72 | std::vector list_of_threads; 73 | for(int i = 0; i < 5; i++){ 74 | threads::ThreadResource p = *(threads::ThreadResource::EXAMPLE(i, context_index).get()); 75 | ApiAutotest::INSTANCE().prepareAutoTestObj("threads::ThreadListRes", "threads::ThreadResource", &p, i, context_index); 76 | rv->m_threads.push_back(p); 77 | } 78 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("threads::ThreadListRes", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 79 | rv->m_resultSizeEstimate = ApiAutotest::INSTANCE().getInt("threads::ThreadListRes", "m_resultSizeEstimate", 3 + example_idx); 80 | return rv; 81 | } 82 | #endif //API_QT_AUTOTEST 83 | 84 | }//threads 85 | }//googleQt 86 | -------------------------------------------------------------------------------- /src/gmail/threads/ThreadsThreadListRes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "threads" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/threads/ThreadsThreadResource.h" 13 | 14 | namespace googleQt{ 15 | namespace threads{ 16 | class ThreadListRes{ 17 | /** 18 | field: threads: List of threads. 19 | field: next_page_token: Token to retrieve the next page of results 20 | in the list. 21 | field: result_size_estimate: Estimated total number of results. 22 | */ 23 | 24 | public: 25 | ThreadListRes(){}; 26 | 27 | ThreadListRes(const std::vector& arg){ m_threads = arg; }; 28 | virtual ~ThreadListRes(){}; 29 | 30 | public: 31 | /** 32 | List of threads. 33 | */ 34 | const std::vector& threads()const{return m_threads;}; 35 | ThreadListRes& setThreads(const std::vector& arg){m_threads=arg;return *this;}; 36 | 37 | /** 38 | Token to retrieve the next page of results in the list. 39 | */ 40 | QString nextpagetoken()const{return m_nextPageToken;}; 41 | ThreadListRes& setNextpagetoken(const QString& arg){m_nextPageToken=arg;return *this;}; 42 | 43 | /** 44 | Estimated total number of results. 45 | */ 46 | quint64 resultsizeestimate()const{return m_resultSizeEstimate;}; 47 | ThreadListRes& setResultsizeestimate(const quint64& arg){m_resultSizeEstimate=arg;return *this;}; 48 | 49 | public: 50 | operator QJsonObject ()const; 51 | virtual void fromJson(const QJsonObject& js); 52 | virtual void toJson(QJsonObject& js)const; 53 | virtual QString toString(bool multiline = true)const; 54 | 55 | 56 | class factory{ 57 | public: 58 | static std::unique_ptr create(const QByteArray& data); 59 | static std::unique_ptr create(const QJsonObject& js); 60 | }; 61 | 62 | 63 | #ifdef API_QT_AUTOTEST 64 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 65 | #endif //API_QT_AUTOTEST 66 | 67 | 68 | protected: 69 | /** 70 | List of threads. 71 | */ 72 | std::vector m_threads; 73 | 74 | /** 75 | Token to retrieve the next page of results in the list. 76 | */ 77 | QString m_nextPageToken; 78 | 79 | /** 80 | Estimated total number of results. 81 | */ 82 | quint64 m_resultSizeEstimate = {0}; 83 | 84 | };//ThreadListRes 85 | 86 | }//threads 87 | }//googleQt 88 | -------------------------------------------------------------------------------- /src/gmail/threads/ThreadsThreadResource.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "threads" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/threads/ThreadsThreadResource.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace threads{ 15 | ///ThreadResource 16 | 17 | ThreadResource::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void ThreadResource::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_id.isEmpty()) 27 | js["id"] = QString(m_id); 28 | if(!m_snipped.isEmpty()) 29 | js["snipped"] = QString(m_snipped); 30 | js["historyId"] = QString("%1").arg(m_historyId); 31 | js["messages"] = struct_list2jsonarray(m_messages); 32 | } 33 | 34 | void ThreadResource::fromJson(const QJsonObject& js){ 35 | 36 | m_id = js["id"].toString(); 37 | m_snipped = js["snipped"].toString(); 38 | m_historyId = js["historyId"].toVariant().toString().toULongLong(); 39 | jsonarray2struct_list(js["messages"].toArray(), m_messages); 40 | } 41 | 42 | QString ThreadResource::toString(bool multiline)const 43 | { 44 | QJsonObject js; 45 | toJson(js); 46 | QJsonDocument doc(js); 47 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 48 | return s; 49 | } 50 | 51 | 52 | std::unique_ptr ThreadResource::factory::create(const QByteArray& data) 53 | { 54 | QJsonDocument doc = QJsonDocument::fromJson(data); 55 | QJsonObject js = doc.object(); 56 | return create(js); 57 | } 58 | 59 | 60 | std::unique_ptr ThreadResource::factory::create(const QJsonObject& js) 61 | { 62 | std::unique_ptr rv; 63 | rv = std::unique_ptr(new ThreadResource); 64 | rv->fromJson(js); 65 | return rv; 66 | } 67 | 68 | #ifdef API_QT_AUTOTEST 69 | std::unique_ptr ThreadResource::EXAMPLE(int context_index, int parent_context_index){ 70 | Q_UNUSED(context_index); 71 | Q_UNUSED(parent_context_index); 72 | static int example_idx = 0; 73 | example_idx++; 74 | std::unique_ptr rv(new ThreadResource); 75 | rv->m_id = ApiAutotest::INSTANCE().getId("threads::ThreadResource", example_idx); 76 | rv->m_snipped = ApiAutotest::INSTANCE().getString("threads::ThreadResource", "m_snipped", QString("snipped_%1").arg(example_idx)); 77 | rv->m_historyId = ApiAutotest::INSTANCE().getInt("threads::ThreadResource", "m_historyId", 3 + example_idx); 78 | std::vector list_of_messages; 79 | for(int i = 0; i < 5; i++){ 80 | messages::MessageResource p = *(messages::MessageResource::EXAMPLE(i, context_index).get()); 81 | ApiAutotest::INSTANCE().prepareAutoTestObj("threads::ThreadResource", "messages::MessageResource", &p, i, context_index); 82 | rv->m_messages.push_back(p); 83 | } 84 | return rv; 85 | } 86 | #endif //API_QT_AUTOTEST 87 | 88 | }//threads 89 | }//googleQt 90 | -------------------------------------------------------------------------------- /src/gmail/threads/ThreadsThreadResource.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "threads" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gmail/GmailRequestArg.h" 12 | #include "gmail/messages/MessagesMessageResource.h" 13 | 14 | namespace googleQt{ 15 | namespace threads{ 16 | class ThreadResource{ 17 | /** 18 | field: id: The unique ID of the thread. 19 | field: snipped: A short part of the message text. 20 | field: history_id: The ID of the last history record that modified 21 | this thread. 22 | */ 23 | 24 | public: 25 | ThreadResource(){}; 26 | 27 | ThreadResource(const QString& arg){ m_id = arg; }; 28 | virtual ~ThreadResource(){}; 29 | 30 | public: 31 | /** 32 | The unique ID of the thread. 33 | */ 34 | QString id()const{return m_id;}; 35 | ThreadResource& setId(const QString& arg){m_id=arg;return *this;}; 36 | 37 | /** 38 | A short part of the message text. 39 | */ 40 | QString snipped()const{return m_snipped;}; 41 | ThreadResource& setSnipped(const QString& arg){m_snipped=arg;return *this;}; 42 | 43 | /** 44 | The ID of the last history record that modified this thread. 45 | */ 46 | quint64 historyid()const{return m_historyId;}; 47 | ThreadResource& setHistoryid(const quint64& arg){m_historyId=arg;return *this;}; 48 | 49 | const std::vector& messages()const{return m_messages;}; 50 | ThreadResource& setMessages(const std::vector& arg){m_messages=arg;return *this;}; 51 | 52 | public: 53 | operator QJsonObject ()const; 54 | virtual void fromJson(const QJsonObject& js); 55 | virtual void toJson(QJsonObject& js)const; 56 | virtual QString toString(bool multiline = true)const; 57 | 58 | 59 | class factory{ 60 | public: 61 | static std::unique_ptr create(const QByteArray& data); 62 | static std::unique_ptr create(const QJsonObject& js); 63 | }; 64 | 65 | 66 | #ifdef API_QT_AUTOTEST 67 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 68 | #endif //API_QT_AUTOTEST 69 | 70 | 71 | protected: 72 | /** 73 | The unique ID of the thread. 74 | */ 75 | QString m_id; 76 | 77 | /** 78 | A short part of the message text. 79 | */ 80 | QString m_snipped; 81 | 82 | /** 83 | The ID of the last history record that modified this thread. 84 | */ 85 | quint64 m_historyId = {0}; 86 | 87 | std::vector m_messages; 88 | 89 | };//ThreadResource 90 | 91 | }//threads 92 | }//googleQt 93 | -------------------------------------------------------------------------------- /src/gmail/users/UsersGetProfileResponse.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "users" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/users/UsersGetProfileResponse.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace users{ 15 | ///GetProfileResponse 16 | 17 | GetProfileResponse::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void GetProfileResponse::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_emailAddress.isEmpty()) 27 | js["emailAddress"] = QString(m_emailAddress); 28 | js["messagesTotal"] = QString("%1").arg(m_messagesTotal); 29 | js["threadsTotal"] = QString("%1").arg(m_threadsTotal); 30 | js["historyId"] = QString("%1").arg(m_historyId); 31 | } 32 | 33 | void GetProfileResponse::fromJson(const QJsonObject& js){ 34 | 35 | m_emailAddress = js["emailAddress"].toString(); 36 | m_messagesTotal = js["messagesTotal"].toVariant().toString().toULongLong(); 37 | m_threadsTotal = js["threadsTotal"].toVariant().toString().toULongLong(); 38 | m_historyId = js["historyId"].toVariant().toString().toULongLong(); 39 | } 40 | 41 | QString GetProfileResponse::toString(bool multiline)const 42 | { 43 | QJsonObject js; 44 | toJson(js); 45 | QJsonDocument doc(js); 46 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 47 | return s; 48 | } 49 | 50 | 51 | std::unique_ptr GetProfileResponse::factory::create(const QByteArray& data) 52 | { 53 | QJsonDocument doc = QJsonDocument::fromJson(data); 54 | QJsonObject js = doc.object(); 55 | return create(js); 56 | } 57 | 58 | 59 | std::unique_ptr GetProfileResponse::factory::create(const QJsonObject& js) 60 | { 61 | std::unique_ptr rv; 62 | rv = std::unique_ptr(new GetProfileResponse); 63 | rv->fromJson(js); 64 | return rv; 65 | } 66 | 67 | #ifdef API_QT_AUTOTEST 68 | std::unique_ptr GetProfileResponse::EXAMPLE(int context_index, int parent_context_index){ 69 | Q_UNUSED(context_index); 70 | Q_UNUSED(parent_context_index); 71 | static int example_idx = 0; 72 | example_idx++; 73 | std::unique_ptr rv(new GetProfileResponse); 74 | rv->m_emailAddress = ApiAutotest::INSTANCE().getString("users::GetProfileResponse", "m_emailAddress", QString("emailAddress_%1").arg(example_idx)); 75 | rv->m_messagesTotal = ApiAutotest::INSTANCE().getInt("users::GetProfileResponse", "m_messagesTotal", 2 + example_idx); 76 | rv->m_threadsTotal = ApiAutotest::INSTANCE().getInt("users::GetProfileResponse", "m_threadsTotal", 3 + example_idx); 77 | rv->m_historyId = ApiAutotest::INSTANCE().getInt("users::GetProfileResponse", "m_historyId", 4 + example_idx); 78 | return rv; 79 | } 80 | #endif //API_QT_AUTOTEST 81 | 82 | }//users 83 | }//googleQt 84 | -------------------------------------------------------------------------------- /src/gmail/users/UsersRoutes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "users" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gmail/users/UsersRoutes.h" 10 | #include "Endpoint.h" 11 | #include "gmail/GmailRoutes.h" 12 | using namespace googleQt; 13 | using namespace users; 14 | 15 | std::unique_ptr UsersRoutes::profile(void){ 16 | return profile_Async()->waitForResultAndRelease(); 17 | } 18 | 19 | GoogleTask* UsersRoutes::profile_Async() 20 | { 21 | GoogleTask* t = m_end_point->produceTask(); 22 | m_end_point->getStyle< 23 | GetProfileResponse, 24 | GetProfileResponse::factory 25 | > 26 | (m_end_point->buildGmailUrl("users", VoidType::instance()), 27 | t); 28 | return t; 29 | } 30 | 31 | void UsersRoutes::profile_AsyncCB( 32 | std::function)> completed_callback , 33 | std::function)> failed_callback) 34 | { 35 | m_end_point->getStyle 36 | < 37 | GetProfileResponse, 38 | GetProfileResponse::factory 39 | > 40 | (m_end_point->buildGmailUrl("users", VoidType::instance()), 41 | completed_callback, 42 | failed_callback); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/gmail/users/UsersRoutes.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "users" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | 11 | #include "google/endpoint/ApiUtil.h" 12 | #include "gmail/GmailRequestArg.h" 13 | #include "GoogleRouteBase.h" 14 | #include "gmail/users/UsersGetProfileResponse.h" 15 | 16 | namespace googleQt{ 17 | namespace users{ 18 | 19 | 20 | class UsersRoutes: public GoogleRouteBase{ 21 | public: 22 | UsersRoutes(Endpoint* ep):GoogleRouteBase(ep){}; 23 | /** 24 | ApiRoute('profile') 25 | 26 | 27 | Returns user profile information. 28 | 29 | */ 30 | std::unique_ptr profile(); 31 | GoogleTask* profile_Async(); 32 | void profile_AsyncCB( 33 | std::function)> completed_callback = nullptr, 34 | std::function)> failed_callback = nullptr); 35 | 36 | protected: 37 | };//UsersRoutes 38 | 39 | }//users 40 | }//googleQt 41 | -------------------------------------------------------------------------------- /src/google/AUTOTEST/GoogleAutotest.cpp: -------------------------------------------------------------------------------- 1 | #include "GoogleAutotest.h" 2 | #include "gmail/AUTOTEST/GmailAutotest.h" 3 | #include "gtask/AUTOTEST/GtaskAutotest.h" 4 | #include "gdrive/AUTOTEST/GdriveAutotest.h" 5 | #include "gcontact/AUTOTEST/GcontactAutotest.h" 6 | 7 | using namespace googleQt; 8 | 9 | #ifdef API_QT_AUTOTEST 10 | GoogleAutotest::GoogleAutotest(GoogleClient* cl):m_cl(cl) 11 | { 12 | 13 | }; 14 | 15 | GoogleAutotest::~GoogleAutotest() 16 | { 17 | 18 | }; 19 | 20 | void GoogleAutotest::generateCalls() 21 | { 22 | if (m_cl) 23 | { 24 | #define AUTOTEST_GENERATE_CALLS(T){T a(*m_cl);a.generateCalls();} 25 | AUTOTEST_GENERATE_CALLS(GmailAutotest); 26 | AUTOTEST_GENERATE_CALLS(GtaskAutotest); 27 | AUTOTEST_GENERATE_CALLS(GdriveAutotest); 28 | AUTOTEST_GENERATE_CALLS(GcontactAutotest); 29 | #undef AUTOTEST_GENERATE_CALLS 30 | } 31 | } 32 | 33 | 34 | QString GoogleAutotest::userId()const 35 | { 36 | QString rv = ""; 37 | if (m_cl) { 38 | rv = m_cl->userId(); 39 | } 40 | return rv; 41 | } 42 | 43 | void GoogleAutotest::setClient(GoogleClient* cl) 44 | { 45 | m_cl = cl; 46 | }; 47 | 48 | #endif//#ifdef API_QT_AUTOTEST -------------------------------------------------------------------------------- /src/google/AUTOTEST/GoogleAutotest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "google/endpoint/ApiUtil.h" 4 | #include "google/endpoint/ApiAutotest.h" 5 | 6 | #ifdef API_QT_AUTOTEST 7 | namespace googleQt{ 8 | class GoogleClient; 9 | 10 | class GoogleAutotest: public ApiAutotest{ 11 | public: 12 | GoogleAutotest(GoogleClient* cl); 13 | virtual ~GoogleAutotest(); 14 | void generateCalls()override; 15 | QString userId()const override; 16 | void setClient(GoogleClient* cl); 17 | protected: 18 | GoogleClient* m_cl; 19 | }; 20 | };//googleQt 21 | 22 | #define DECLARE_AUTOTEST_INSTANCE(C, F) GoogleAutotest autotest(C); \ 23 | if (!autotest.init(F)) { \ 24 | std::cout << "Error opening autotest output file " << F << std::endl; \ 25 | std::cin.ignore(); \ 26 | return 0; \ 27 | } \ 28 | 29 | #else 30 | #define DECLARE_AUTOTEST_INSTANCE(C, F) 31 | #endif//#ifdef API_QT_AUTOTEST 32 | -------------------------------------------------------------------------------- /src/google/demo/ApiListener.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ApiListener.h" 3 | 4 | using namespace googleQt; 5 | using namespace demo; 6 | 7 | void ApiListener::transferProgress(qint64 bytesProcessed, qint64 total) 8 | { 9 | if(bytesProcessed != total && total != -1) 10 | std::cout << "progress " << bytesProcessed << " " << total << std::endl; 11 | }; 12 | -------------------------------------------------------------------------------- /src/google/demo/ApiListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace googleQt{ 6 | namespace demo{ 7 | class ApiListener: public QObject 8 | { 9 | Q_OBJECT 10 | 11 | public slots: 12 | void transferProgress(qint64 bytesProcessed, qint64 total); 13 | }; 14 | }//demo 15 | };//googleQt 16 | -------------------------------------------------------------------------------- /src/google/demo/ApiTerminal.cpp: -------------------------------------------------------------------------------- 1 | #include "ApiTerminal.h" 2 | 3 | using namespace googleQt; 4 | using namespace demo; 5 | 6 | std::ostream& operator << (std::ostream& os, const QString& s) 7 | { 8 | os << s.toStdString(); 9 | return os; 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiAppInfo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ApiAppInfo.h" 4 | #include "ApiUtil.h" 5 | 6 | using namespace googleQt; 7 | 8 | ApiAppInfo::ApiAppInfo(): 9 | m_key(""), 10 | m_secret("") 11 | { 12 | 13 | }; 14 | 15 | void ApiAppInfo::setKeySecret(QString key_val, QString secret_val) 16 | { 17 | m_key = key_val; 18 | m_secret = secret_val; 19 | }; 20 | 21 | bool ApiAppInfo::readFromFile(QString path) 22 | { 23 | QJsonObject js; 24 | if(!loadJsonFromFile(path, js)) 25 | return false; 26 | m_key = js["key"].toString(); 27 | m_secret = js["secret"].toString(); 28 | return true; 29 | }; 30 | 31 | bool ApiAppInfo::storeToFile(QString path) 32 | { 33 | QJsonObject js; 34 | js["key"] = m_key; 35 | js["secret"] = m_secret; 36 | 37 | if(!storeJsonToFile(path, js)) 38 | return false; 39 | return true; 40 | }; 41 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiAppInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace googleQt{ 6 | class ApiAppInfo 7 | { 8 | public: 9 | ApiAppInfo(); 10 | 11 | const QString& getKey()const{return m_key;} 12 | const QString& getSecret()const{return m_secret;} 13 | 14 | void setKeySecret(QString key_val, QString secret_val); 15 | bool readFromFile(QString path); 16 | bool storeToFile(QString path); 17 | 18 | protected: 19 | QString m_key; 20 | QString m_secret; 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiAuthInfo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ApiAuthInfo.h" 4 | #include "ApiUtil.h" 5 | 6 | using namespace googleQt; 7 | 8 | ApiAuthInfo::ApiAuthInfo() 9 | { 10 | #ifdef API_QT_AUTOTEST 11 | m_accessToken = "TEST-TOKEN"; 12 | #endif //API_QT_AUTOTEST 13 | }; 14 | 15 | ApiAuthInfo::ApiAuthInfo(QString token_file, int scope):m_token_file(token_file), m_token_scope(scope) 16 | { 17 | }; 18 | 19 | bool ApiAuthInfo::readFromFile(QString path) 20 | { 21 | QJsonObject js; 22 | if(!loadJsonFromFile(path, js)) 23 | return false; 24 | m_accessToken = js["access_token"].toString(); 25 | m_refreshToken = js["refresh_token"].toString(); 26 | m_type = js["token_type"].toString(); 27 | m_expires_in = js["expires_in"].toInt(); 28 | m_expire_time = js["expire_time"].toString(); 29 | m_token_scope = js["scope"].toInt(); 30 | return true; 31 | }; 32 | 33 | bool ApiAuthInfo::storeToFile(QString path)const 34 | { 35 | QJsonObject js; 36 | js["access_token"] = m_accessToken; 37 | js["refresh_token"] = m_refreshToken; 38 | js["token_type"] = m_type; 39 | js["expires_in"] = m_expires_in; 40 | js["expire_time"] = m_expire_time; 41 | js["update_time"] = QDateTime::currentDateTime().toString(Qt::ISODate); 42 | js["scope"] = m_token_scope; 43 | 44 | if(!storeJsonToFile(path, js)) 45 | return false; 46 | return true; 47 | 48 | }; 49 | 50 | bool ApiAuthInfo::reload() 51 | { 52 | if(!m_token_file.isEmpty()) 53 | { 54 | return readFromFile(m_token_file); 55 | } 56 | 57 | return false; 58 | }; 59 | 60 | bool ApiAuthInfo::updateToken(const QJsonObject& js_in) 61 | { 62 | m_accessToken = js_in["access_token"].toString(); 63 | QString refreshToken = js_in["refresh_token"].toString(); 64 | if(!refreshToken.isEmpty()) 65 | { 66 | m_refreshToken = refreshToken; 67 | } 68 | m_type = js_in["token_type"].toString(); 69 | int expires_in = js_in["expires_in"].toString().toInt(); 70 | m_expires_in = expires_in; 71 | m_expire_time = QDateTime::currentDateTime().addSecs(expires_in).toString(Qt::ISODate); 72 | //do don't update email - it will be empty on refresh 73 | //email/userid is something that is setup on client side 74 | 75 | if(!m_token_file.isEmpty()) 76 | { 77 | return storeToFile(m_token_file); 78 | } 79 | 80 | return true; 81 | }; 82 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiAuthInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace googleQt{ 5 | class ApiAuthInfo 6 | { 7 | friend class GoogleWebAuth; 8 | public: 9 | ApiAuthInfo(); 10 | ApiAuthInfo(QString token_file, int scope = 0); 11 | virtual ~ApiAuthInfo(){}; 12 | 13 | virtual bool reload(); 14 | virtual bool updateToken(const QJsonObject& js_in); 15 | void setEmail(QString email){ m_email = email; } 16 | 17 | QString getAccessToken()const {return m_accessToken;} 18 | QString getRefreshToken()const{return m_refreshToken;} 19 | QString getEmail()const{return m_email; } 20 | int getExpirationInSeconds()const{return m_expires_in;} 21 | int getScope()const { return m_token_scope; } 22 | 23 | protected: 24 | virtual bool readFromFile(QString path); 25 | virtual bool storeToFile(QString path)const; 26 | 27 | protected: 28 | QString m_token_file; 29 | QString m_accessToken; 30 | QString m_refreshToken; 31 | QString m_type; 32 | int m_expires_in; 33 | QString m_expire_time; 34 | QString m_email; 35 | int m_token_scope; 36 | }; 37 | }//dropboxQt 38 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiClient.cpp: -------------------------------------------------------------------------------- 1 | #include "ApiClient.h" 2 | 3 | using namespace googleQt; 4 | 5 | ApiClient::ApiClient(ApiAppInfo* appInfo, ApiAuthInfo* authInfo) 6 | { 7 | m_app.reset(appInfo); 8 | m_auth.reset(authInfo); 9 | }; 10 | 11 | QString ApiClient::getToken()const 12 | { 13 | return m_auth->getAccessToken(); 14 | } 15 | 16 | int ApiClient::getAccessScope()const 17 | { 18 | return m_auth->getScope(); 19 | }; 20 | 21 | QString ApiClient::getAppKey()const 22 | { 23 | return m_app->getKey(); 24 | }; 25 | 26 | QString ApiClient::userId()const 27 | { 28 | return m_auth->getEmail(); 29 | }; 30 | 31 | void ApiClient::setUserId(QString email) 32 | { 33 | m_auth->setEmail(email); 34 | }; 35 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ApiUtil.h" 3 | #include "ApiAuthInfo.h" 4 | #include "ApiAppInfo.h" 5 | 6 | class QNetworkProxy; 7 | 8 | namespace googleQt{ 9 | class ApiClient: public QObject, 10 | public std::enable_shared_from_this 11 | { 12 | Q_OBJECT 13 | public: 14 | ApiClient(ApiAppInfo* appInfo, ApiAuthInfo* authInfo); 15 | virtual ~ApiClient() {}; 16 | QString getToken()const; 17 | QString getAppKey()const; 18 | QString userId()const; 19 | virtual void setUserId(QString email); 20 | QString userAgent()const{return m_userAgent;} 21 | void setUserAgent(QString s){m_userAgent = s;} 22 | int getAccessScope()const; 23 | virtual bool refreshToken() = 0; 24 | virtual ApiEndpoint* endpoint() = 0; 25 | signals: 26 | void downloadProgress(qint64 bytesProcessed, qint64 total); 27 | void uploadProgress(qint64 bytesProcessed, qint64 total); 28 | 29 | protected: 30 | std::unique_ptr m_app; 31 | std::unique_ptr m_auth; 32 | QString m_userAgent; 33 | }; 34 | }; 35 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiException.cpp: -------------------------------------------------------------------------------- 1 | #include "ApiException.h" 2 | 3 | using namespace googleQt; 4 | 5 | std::unique_ptr GoogleException::create(const QByteArray& data, int status_code, const std::string& message) 6 | { 7 | std::string summary; 8 | if (!data.isEmpty()) 9 | { 10 | QJsonDocument doc = QJsonDocument::fromJson(data); 11 | QJsonObject js_in = doc.object(); 12 | summary = js_in["error_summary"].toString().toStdString(); 13 | } 14 | return std::unique_ptr(new GoogleException(summary, status_code, message)); 15 | }; 16 | 17 | void GoogleException::build(std::string err) 18 | { 19 | m_what = m_msg; 20 | m_what += "\n"; 21 | if (!m_error_summary.empty())m_what += "SUMMARY:" + m_error_summary; 22 | m_what += "\n"; 23 | if (!err.empty()) 24 | { 25 | m_what += "ERROR:\n"; 26 | m_what += err; 27 | } 28 | } 29 | 30 | GoogleException* GoogleException::clone()const 31 | { 32 | GoogleException* rv = new GoogleException(m_msg, m_status_code, m_error_summary); 33 | return rv; 34 | }; 35 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiException.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace googleQt{ 11 | class GoogleException: public std::exception 12 | { 13 | public: 14 | explicit GoogleException(const std::string& message) :m_msg(message), m_status_code(0){} 15 | 16 | explicit GoogleException(const std::string& message, int code): 17 | m_msg(message), 18 | m_status_code(code) 19 | {}; 20 | 21 | explicit GoogleException(const std::string& message, int code, const std::string summary) : 22 | m_msg(message), m_status_code(code), m_error_summary(summary) { 23 | build(""); 24 | }; 25 | 26 | GoogleException* clone()const; 27 | 28 | virtual const char* what() const throw (){ 29 | return m_msg.c_str(); 30 | } 31 | 32 | virtual int statusCode()const throw(){ 33 | return m_status_code; 34 | } 35 | 36 | const std::string& errSummary()const { return m_error_summary; } 37 | 38 | static std::unique_ptr create(const QByteArray& data, int status_code, const std::string& message); 39 | virtual void raise() { throw *this; } 40 | 41 | 42 | protected: 43 | void build(std::string err); 44 | 45 | protected: 46 | std::string m_msg; 47 | int m_status_code; 48 | std::string m_error_summary; 49 | std::string m_what; 50 | }; 51 | }; 52 | -------------------------------------------------------------------------------- /src/google/endpoint/ApiUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ApiBase.h" 4 | 5 | #ifdef API_QT_AUTOTEST 6 | #include "ApiAutotest.h" 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /src/google/endpoint/Cache.cpp: -------------------------------------------------------------------------------- 1 | #include "Cache.h" 2 | 3 | using namespace googleQt; 4 | 5 | ///CacheData 6 | googleQt::CacheData::CacheData(googleQt::EDataState state, QString id) 7 | :m_id(id) 8 | { 9 | m_flags.flags = 0; 10 | m_flags.agg_state = static_cast(state); 11 | }; 12 | 13 | int googleQt::CacheData::aggState()const 14 | { 15 | return m_flags.agg_state; 16 | }; 17 | 18 | bool googleQt::CacheData::isLoaded(EDataState st)const 19 | { 20 | bool rv = (m_flags.agg_state & static_cast(st)) != 0; 21 | return rv; 22 | }; 23 | 24 | bool googleQt::CacheData::hasDbRecord()const 25 | { 26 | bool rv = (m_flags.has_db_record == 1); 27 | return rv; 28 | }; 29 | 30 | void googleQt::CacheData::markDbRecord() 31 | { 32 | m_flags.has_db_record = 1; 33 | }; 34 | 35 | bool googleQt::CacheData::userFlag1()const 36 | { 37 | return (m_flags.user_flag1 == 1 ? true : false); 38 | }; 39 | 40 | void googleQt::CacheData::setUserFlag1(bool val) 41 | { 42 | m_flags.user_flag1 = val ? 1 : 0; 43 | }; 44 | 45 | uint32_t googleQt::CacheData::userData()const 46 | { 47 | return m_flags.user_data; 48 | }; 49 | 50 | void googleQt::CacheData::setUserData(uint32_t val) 51 | { 52 | m_flags.user_data = val; 53 | }; 54 | 55 | ///CacheDataWithHistory 56 | googleQt::CacheDataWithHistory::CacheDataWithHistory(QString id, quint64 hid) 57 | :CacheData(EDataState::snippet, id), 58 | m_history_id(hid) 59 | { 60 | 61 | }; 62 | -------------------------------------------------------------------------------- /src/google/endpoint/GoogleHost.cpp: -------------------------------------------------------------------------------- 1 | #include "GoogleHost.h" 2 | 3 | using namespace googleQt; 4 | 5 | GoogleHost default_gmail_host; 6 | 7 | GoogleHost::GoogleHost(): 8 | m_api("googleapis.com"), 9 | m_auth("accounts.google.com") 10 | { 11 | }; 12 | 13 | GoogleHost& GoogleHost::DEFAULT() 14 | { 15 | return default_gmail_host; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /src/google/endpoint/GoogleHost.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ApiUtil.h" 4 | 5 | namespace googleQt{ 6 | 7 | class GoogleHost 8 | { 9 | public: 10 | 11 | static GoogleHost& DEFAULT(); 12 | 13 | GoogleHost(); 14 | 15 | const QString& getApi()const{return m_api;} 16 | const QString& getAuth()const{return m_auth;} 17 | 18 | protected: 19 | QString m_api; 20 | QString m_auth; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /src/gtask/AUTOTEST/GtaskAutotest.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gtask/GtaskRequestArg.h" 12 | #include 13 | #include 14 | #include 15 | #include "GoogleClient.h" 16 | #include "gtask/GtaskRoutes.h" 17 | 18 | #ifdef API_QT_AUTOTEST 19 | namespace googleQt{ 20 | 21 | class GtaskAutotest { 22 | public: 23 | GtaskAutotest(GoogleClient&); 24 | 25 | void generateCalls(); 26 | 27 | 28 | };//GtaskAutotest 29 | 30 | }//googleQt 31 | #endif //API_QT_AUTOTEST 32 | -------------------------------------------------------------------------------- /src/gtask/GtaskRoutes.cpp: -------------------------------------------------------------------------------- 1 | #include "GtaskRoutes.h" 2 | 3 | using namespace googleQt; 4 | 5 | GtaskRoutes::GtaskRoutes(Endpoint* e):m_endpoint(e) 6 | { 7 | 8 | }; 9 | 10 | tasklists::TasklistsRoutes* GtaskRoutes::getTasklists() 11 | { 12 | if(!m_TaskLists){ 13 | m_TaskLists.reset(new tasklists::TasklistsRoutes(m_endpoint)); 14 | } 15 | return m_TaskLists.get(); 16 | }; 17 | 18 | tasks::TasksRoutes* GtaskRoutes::getTasks() 19 | { 20 | if(!m_Tasks){ 21 | m_Tasks.reset(new tasks::TasksRoutes(m_endpoint)); 22 | } 23 | return m_Tasks.get(); 24 | }; 25 | 26 | googleQt::gtask_cache::GtaskCacheRoutes* GtaskRoutes::cacheRoutes() 27 | { 28 | if(!m_CacheRoutes){ 29 | m_CacheRoutes.reset(new gtask_cache::GtaskCacheRoutes(*this)); 30 | } 31 | 32 | return m_CacheRoutes.get(); 33 | }; 34 | -------------------------------------------------------------------------------- /src/gtask/GtaskRoutes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "google/endpoint/ApiUtil.h" 3 | #include "google/endpoint/ApiClient.h" 4 | 5 | #include "gtask/tasks/TasksRoutes.h" 6 | #include "gtask/tasklists/TasklistsRoutes.h" 7 | #include "GtaskCache.h" 8 | 9 | namespace googleQt 10 | { 11 | class Endpoint; 12 | 13 | namespace gtask_cache { 14 | class GtaskCacheRoutes; 15 | }; 16 | 17 | class GtaskRoutes{ 18 | public: 19 | 20 | GtaskRoutes(Endpoint*); 21 | Endpoint* endpoint() { return m_endpoint; } 22 | 23 | tasklists::TasklistsRoutes* getTasklists(); 24 | tasks::TasksRoutes* getTasks(); 25 | googleQt::gtask_cache::GtaskCacheRoutes* cacheRoutes(); 26 | 27 | #ifdef API_QT_AUTOTEST 28 | void autotest() {}; 29 | #endif 30 | 31 | protected: 32 | Endpoint* m_endpoint; 33 | std::unique_ptr m_TaskLists; 34 | std::unique_ptr m_Tasks; 35 | std::unique_ptr m_CacheRoutes; 36 | }; 37 | };//googleQt 38 | -------------------------------------------------------------------------------- /src/gtask/tasks/TasksTaskCollectionRes.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "tasks" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gtask/tasks/TasksTaskCollectionRes.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace tasks{ 15 | ///TaskCollectionRes 16 | 17 | TaskCollectionRes::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void TaskCollectionRes::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_kind.isEmpty()) 27 | js["kind"] = QString(m_kind); 28 | if(!m_etag.isEmpty()) 29 | js["etag"] = QString(m_etag); 30 | if(!m_nextPageToken.isEmpty()) 31 | js["nextPageToken"] = QString(m_nextPageToken); 32 | js["items"] = struct_list2jsonarray(m_items); 33 | } 34 | 35 | void TaskCollectionRes::fromJson(const QJsonObject& js){ 36 | 37 | m_kind = js["kind"].toString(); 38 | m_etag = js["etag"].toString(); 39 | m_nextPageToken = js["nextPageToken"].toString(); 40 | jsonarray2struct_list(js["items"].toArray(), m_items); 41 | } 42 | 43 | QString TaskCollectionRes::toString(bool multiline)const 44 | { 45 | QJsonObject js; 46 | toJson(js); 47 | QJsonDocument doc(js); 48 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 49 | return s; 50 | } 51 | 52 | 53 | std::unique_ptr TaskCollectionRes::factory::create(const QByteArray& data) 54 | { 55 | QJsonDocument doc = QJsonDocument::fromJson(data); 56 | QJsonObject js = doc.object(); 57 | return create(js); 58 | } 59 | 60 | 61 | std::unique_ptr TaskCollectionRes::factory::create(const QJsonObject& js) 62 | { 63 | std::unique_ptr rv; 64 | rv = std::unique_ptr(new TaskCollectionRes); 65 | rv->fromJson(js); 66 | return rv; 67 | } 68 | 69 | #ifdef API_QT_AUTOTEST 70 | std::unique_ptr TaskCollectionRes::EXAMPLE(int context_index, int parent_context_index){ 71 | Q_UNUSED(context_index); 72 | Q_UNUSED(parent_context_index); 73 | static int example_idx = 0; 74 | example_idx++; 75 | std::unique_ptr rv(new TaskCollectionRes); 76 | rv->m_kind = ApiAutotest::INSTANCE().getString("tasks::TaskCollectionRes", "m_kind", QString("kind_%1").arg(example_idx)); 77 | rv->m_etag = ApiAutotest::INSTANCE().getString("tasks::TaskCollectionRes", "m_etag", QString("etag_%1").arg(example_idx)); 78 | rv->m_nextPageToken = ApiAutotest::INSTANCE().getString("tasks::TaskCollectionRes", "m_nextPageToken", QString("nextPageToken_%1").arg(example_idx)); 79 | std::vector list_of_items; 80 | for(int i = 0; i < 5; i++){ 81 | tasks::TaskResource p = *(tasks::TaskResource::EXAMPLE(i, context_index).get()); 82 | ApiAutotest::INSTANCE().prepareAutoTestObj("tasks::TaskCollectionRes", "tasks::TaskResource", &p, i, context_index); 83 | rv->m_items.push_back(p); 84 | } 85 | return rv; 86 | } 87 | #endif //API_QT_AUTOTEST 88 | 89 | }//tasks 90 | }//googleQt 91 | -------------------------------------------------------------------------------- /src/gtask/tasks/TasksTaskLink.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "tasks" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #include "gtask/tasks/TasksTaskLink.h" 10 | using namespace googleQt; 11 | 12 | namespace googleQt{ 13 | 14 | namespace tasks{ 15 | ///TaskLink 16 | 17 | TaskLink::operator QJsonObject()const{ 18 | QJsonObject js; 19 | this->toJson(js); 20 | return js; 21 | } 22 | 23 | 24 | void TaskLink::toJson(QJsonObject& js)const{ 25 | 26 | if(!m_type.isEmpty()) 27 | js["type"] = QString(m_type); 28 | if(!m_description.isEmpty()) 29 | js["description"] = QString(m_description); 30 | if(!m_link.isEmpty()) 31 | js["link"] = QString(m_link); 32 | } 33 | 34 | void TaskLink::fromJson(const QJsonObject& js){ 35 | 36 | m_type = js["type"].toString(); 37 | m_description = js["description"].toString(); 38 | m_link = js["link"].toString(); 39 | } 40 | 41 | QString TaskLink::toString(bool multiline)const 42 | { 43 | QJsonObject js; 44 | toJson(js); 45 | QJsonDocument doc(js); 46 | QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact)); 47 | return s; 48 | } 49 | 50 | 51 | std::unique_ptr TaskLink::factory::create(const QByteArray& data) 52 | { 53 | QJsonDocument doc = QJsonDocument::fromJson(data); 54 | QJsonObject js = doc.object(); 55 | return create(js); 56 | } 57 | 58 | 59 | std::unique_ptr TaskLink::factory::create(const QJsonObject& js) 60 | { 61 | std::unique_ptr rv; 62 | rv = std::unique_ptr(new TaskLink); 63 | rv->fromJson(js); 64 | return rv; 65 | } 66 | 67 | #ifdef API_QT_AUTOTEST 68 | std::unique_ptr TaskLink::EXAMPLE(int context_index, int parent_context_index){ 69 | Q_UNUSED(context_index); 70 | Q_UNUSED(parent_context_index); 71 | static int example_idx = 0; 72 | example_idx++; 73 | std::unique_ptr rv(new TaskLink); 74 | rv->m_type = ApiAutotest::INSTANCE().getString("tasks::TaskLink", "m_type", QString("type_%1").arg(example_idx)); 75 | rv->m_description = ApiAutotest::INSTANCE().getString("tasks::TaskLink", "m_description", QString("description_%1").arg(example_idx)); 76 | rv->m_link = ApiAutotest::INSTANCE().getString("tasks::TaskLink", "m_link", QString("link_%1").arg(example_idx)); 77 | return rv; 78 | } 79 | #endif //API_QT_AUTOTEST 80 | 81 | }//tasks 82 | }//googleQt 83 | -------------------------------------------------------------------------------- /src/gtask/tasks/TasksTaskLink.h: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | DO NOT EDIT 3 | This file was generated from stone specification "tasks" 4 | Part of "Ardi - the organizer" project. 5 | osoft4ardi@gmail.com 6 | www.prokarpaty.net 7 | ***********************************************************/ 8 | 9 | #pragma once 10 | #include "google/endpoint/ApiUtil.h" 11 | #include "gtask/GtaskRequestArg.h" 12 | 13 | namespace googleQt{ 14 | namespace tasks{ 15 | class TaskLink{ 16 | /** 17 | field: type: Type of the link, e.g. email. 18 | field: description: The description. In HTML speak: Everything 19 | between and . 20 | field: link: The URL. 21 | */ 22 | 23 | public: 24 | TaskLink(){}; 25 | 26 | TaskLink(const QString& arg){ m_type = arg; }; 27 | virtual ~TaskLink(){}; 28 | 29 | public: 30 | /** 31 | Type of the link, e.g. email. 32 | */ 33 | QString type()const{return m_type;}; 34 | TaskLink& setType(const QString& arg){m_type=arg;return *this;}; 35 | 36 | /** 37 | The description. In HTML speak: Everything between and . 38 | */ 39 | QString description()const{return m_description;}; 40 | TaskLink& setDescription(const QString& arg){m_description=arg;return *this;}; 41 | 42 | /** 43 | The URL. 44 | */ 45 | QString link()const{return m_link;}; 46 | TaskLink& setLink(const QString& arg){m_link=arg;return *this;}; 47 | 48 | public: 49 | operator QJsonObject ()const; 50 | virtual void fromJson(const QJsonObject& js); 51 | virtual void toJson(QJsonObject& js)const; 52 | virtual QString toString(bool multiline = true)const; 53 | 54 | 55 | class factory{ 56 | public: 57 | static std::unique_ptr create(const QByteArray& data); 58 | static std::unique_ptr create(const QJsonObject& js); 59 | }; 60 | 61 | 62 | #ifdef API_QT_AUTOTEST 63 | static std::unique_ptr EXAMPLE(int context_index, int parent_context_index); 64 | #endif //API_QT_AUTOTEST 65 | 66 | 67 | protected: 68 | /** 69 | Type of the link, e.g. email. 70 | */ 71 | QString m_type; 72 | 73 | /** 74 | The description. In HTML speak: Everything between and . 75 | */ 76 | QString m_description; 77 | 78 | /** 79 | The URL. 80 | */ 81 | QString m_link; 82 | 83 | };//TaskLink 84 | 85 | }//tasks 86 | }//googleQt 87 | --------------------------------------------------------------------------------