pax_global_header00006660000000000000000000000064144242106600014511gustar00rootroot0000000000000052 comment=2fab9dbbdeed0c9a4bf3b1dbc21b8dd482b159a0 libre-graph-api-cpp-qt-client-1.0.4/000077500000000000000000000000001442421066000171345ustar00rootroot00000000000000libre-graph-api-cpp-qt-client-1.0.4/.openapi-generator-ignore000066400000000000000000000020211442421066000240300ustar00rootroot00000000000000# OpenAPI Generator Ignore # Generated by openapi-generator https://github.com/openapitools/openapi-generator # Use this file to prevent files from being overwritten by the generator. # The patterns follow closely to .gitignore or .dockerignore. # As an example, the C# client generator defines ApiClient.cs. # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: CMakeLists.txt # You can match any string of characters against a directory, file or extension with a single asterisk (*): #foo/*/qux # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux # You can recursively match patterns against a directory, file or extension with a double asterisk (**): #foo/**/qux # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux # You can also negate patterns with an exclamation (!). # For example, you can ignore all files in a docs folder with the file extension .md: #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md libre-graph-api-cpp-qt-client-1.0.4/.openapi-generator/000077500000000000000000000000001442421066000226315ustar00rootroot00000000000000libre-graph-api-cpp-qt-client-1.0.4/.openapi-generator/FILES000066400000000000000000000112071442421066000234170ustar00rootroot00000000000000README.md client/CMakeLists.txt client/OAIAppRole.cpp client/OAIAppRole.h client/OAIAppRoleAssignment.cpp client/OAIAppRoleAssignment.h client/OAIApplication.cpp client/OAIApplication.h client/OAIApplicationsApi.cpp client/OAIApplicationsApi.h client/OAIClass_Member_Reference.cpp client/OAIClass_Member_Reference.h client/OAIClass_Reference.cpp client/OAIClass_Reference.h client/OAIClass_Teacher_Reference.cpp client/OAIClass_Teacher_Reference.h client/OAICollection_of_appRoleAssignments.cpp client/OAICollection_of_appRoleAssignments.h client/OAICollection_of_applications.cpp client/OAICollection_of_applications.h client/OAICollection_of_class.cpp client/OAICollection_of_class.h client/OAICollection_of_driveItems.cpp client/OAICollection_of_driveItems.h client/OAICollection_of_drives.cpp client/OAICollection_of_drives.h client/OAICollection_of_drives_1.cpp client/OAICollection_of_drives_1.h client/OAICollection_of_educationClass.cpp client/OAICollection_of_educationClass.h client/OAICollection_of_educationUser.cpp client/OAICollection_of_educationUser.h client/OAICollection_of_educationUser_1.cpp client/OAICollection_of_educationUser_1.h client/OAICollection_of_group.cpp client/OAICollection_of_group.h client/OAICollection_of_schools.cpp client/OAICollection_of_schools.h client/OAICollection_of_tags.cpp client/OAICollection_of_tags.h client/OAICollection_of_user.cpp client/OAICollection_of_user.h client/OAICollection_of_users.cpp client/OAICollection_of_users.h client/OAIDeleted.cpp client/OAIDeleted.h client/OAIDirectoryObject.cpp client/OAIDirectoryObject.h client/OAIDrive.cpp client/OAIDrive.h client/OAIDriveItem.cpp client/OAIDriveItem.h client/OAIDrivesApi.cpp client/OAIDrivesApi.h client/OAIDrivesGetDrivesApi.cpp client/OAIDrivesGetDrivesApi.h client/OAIDrivesRootApi.cpp client/OAIDrivesRootApi.h client/OAIEducationClass.cpp client/OAIEducationClass.h client/OAIEducationClassApi.cpp client/OAIEducationClassApi.h client/OAIEducationClassTeachersApi.cpp client/OAIEducationClassTeachersApi.h client/OAIEducationOrganization.cpp client/OAIEducationOrganization.h client/OAIEducationSchool.cpp client/OAIEducationSchool.h client/OAIEducationSchoolApi.cpp client/OAIEducationSchoolApi.h client/OAIEducationUser.cpp client/OAIEducationUser.h client/OAIEducationUserApi.cpp client/OAIEducationUserApi.h client/OAIEducationUser_Reference.cpp client/OAIEducationUser_Reference.h client/OAIEntity.cpp client/OAIEntity.h client/OAIEnum.h client/OAIExportPersonalData_request.cpp client/OAIExportPersonalData_request.h client/OAIFileSystemInfo.cpp client/OAIFileSystemInfo.h client/OAIFolder.cpp client/OAIFolder.h client/OAIFolderView.cpp client/OAIFolderView.h client/OAIGroup.cpp client/OAIGroup.h client/OAIGroupApi.cpp client/OAIGroupApi.h client/OAIGroupsApi.cpp client/OAIGroupsApi.h client/OAIHashes.cpp client/OAIHashes.h client/OAIHelpers.cpp client/OAIHelpers.h client/OAIHttpFileElement.cpp client/OAIHttpFileElement.h client/OAIHttpRequest.cpp client/OAIHttpRequest.h client/OAIIdentity.cpp client/OAIIdentity.h client/OAIIdentitySet.cpp client/OAIIdentitySet.h client/OAIImage.cpp client/OAIImage.h client/OAIItemReference.cpp client/OAIItemReference.h client/OAIMeChangepasswordApi.cpp client/OAIMeChangepasswordApi.h client/OAIMeDriveApi.cpp client/OAIMeDriveApi.h client/OAIMeDriveRootApi.cpp client/OAIMeDriveRootApi.h client/OAIMeDriveRootChildrenApi.cpp client/OAIMeDriveRootChildrenApi.h client/OAIMeDrivesApi.cpp client/OAIMeDrivesApi.h client/OAIMeUserApi.cpp client/OAIMeUserApi.h client/OAIMember_Reference.cpp client/OAIMember_Reference.h client/OAIOauth.cpp client/OAIOauth.h client/OAIObject.h client/OAIObjectIdentity.cpp client/OAIObjectIdentity.h client/OAIOdata_error.cpp client/OAIOdata_error.h client/OAIOdata_error_detail.cpp client/OAIOdata_error_detail.h client/OAIOdata_error_main.cpp client/OAIOdata_error_main.h client/OAIOpenGraphFile.cpp client/OAIOpenGraphFile.h client/OAIPasswordProfile.cpp client/OAIPasswordProfile.h client/OAIPassword_change.cpp client/OAIPassword_change.h client/OAIPermission.cpp client/OAIPermission.h client/OAIQuota.cpp client/OAIQuota.h client/OAIRemoteItem.cpp client/OAIRemoteItem.h client/OAIServerConfiguration.h client/OAIServerVariable.h client/OAIShared.cpp client/OAIShared.h client/OAISpecialFolder.cpp client/OAISpecialFolder.h client/OAITagAssignment.cpp client/OAITagAssignment.h client/OAITagUnassignment.cpp client/OAITagUnassignment.h client/OAITagsApi.cpp client/OAITagsApi.h client/OAITrash.cpp client/OAITrash.h client/OAIUser.cpp client/OAIUser.h client/OAIUserApi.cpp client/OAIUserApi.h client/OAIUserAppRoleAssignmentApi.cpp client/OAIUserAppRoleAssignmentApi.h client/OAIUsersApi.cpp client/OAIUsersApi.h client/client.pri libre-graph-api-cpp-qt-client-1.0.4/.openapi-generator/VERSION000066400000000000000000000000051442421066000236740ustar00rootroot000000000000006.2.0libre-graph-api-cpp-qt-client-1.0.4/LICENSE000066400000000000000000000261171442421066000201500ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2023 ownCloud GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. libre-graph-api-cpp-qt-client-1.0.4/README.md000066400000000000000000000070571442421066000204240ustar00rootroot00000000000000# C++ Qt API client # Libre Graph API - API version: v1.0.4 Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* ## Requirements Building the API client library requires: 1. CMake 3.2+ 2. Qt 3. C++ Compiler ## Getting Started example.h: ```c++ #include #include "../client/OAIApplicationsApi.h" using namespace test_namespace; class Example : public QObject { Q_OBJECT QString create(); public slots: void exampleFunction1(); }; ``` example.cpp: ```c++ #include "../client/OAIApplicationsApi.h" #include "example.h" #include #include QString Example::create(){ QString obj; return obj; } void Example::exampleFunction1(){ OAIApplicationsApi apiInstance; QEventLoop loop; connect(&apiInstance, &OAIApplicationsApi::getApplicationSignal, [&]() { loop.quit(); }); connect(&apiInstance, &OAIApplicationsApi::getApplicationSignalE, [&](QNetworkReply::NetworkError, QString error_str) { qDebug() << "Error happened while issuing request : " << error_str; loop.quit(); }); QString application_id = create(); // QString | key: id of application apiInstance.getApplication(application_id); QTimer::singleShot(5000, &loop, &QEventLoop::quit); loop.exec(); } ``` ## Documentation for Servers Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables: ```yaml servers: - url: http://{server}:{port}/{basePath} description: Description of the Server variables: server: enum: - 'petstore' - 'qa-petstore' - 'dev-petstore' default: 'petstore' port: enum: - '3000' - '1000' default: '3000' basePath: default: v1 ``` To change the default variable, use this function in each Api: ```c++ int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); ``` The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid. Variable is the name of the variable you wish to change and the value is the new default Value. The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found. If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function: ```c++ void setServerIndex(const QString &operation, int serverIndex); ``` Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index. Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1. ```yaml servers: - url: http://{server}:8080/ description: Description of the Server variables: server: enum: - 'petstore' - 'qa-petstore' - 'dev-petstore' default: 'petstore' - url: https://localhost:8080/v1 ``` ## Documentation for Authorization Authentication schemes defined for the API: ### bearerAuth - **Type**: HTTP Bearer Token authentication ## Author ## License Apache 2.0 for more information visit [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)libre-graph-api-cpp-qt-client-1.0.4/client/000077500000000000000000000000001442421066000204125ustar00rootroot00000000000000libre-graph-api-cpp-qt-client-1.0.4/client/CMakeLists.txt000066400000000000000000000155111442421066000231550ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.4) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]" APP_VERSION "v1.0.4") string(REGEX REPLACE " " "" TARGET_NAME "Libre Graph API") project("Libre Graph API" VERSION ${APP_VERSION} LANGUAGES CXX) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) include(GNUInstallDirs) if (MSVC) string(REGEX REPLACE "/W[1-3]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") else () set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") endif () # On Windows only static builds are supported. if (WIN32) set(BUILD_SHARED_LIBS OFF) endif () find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Network REQUIRED) find_package(ZLIB REQUIRED) add_library(client OAIAppRole.cpp OAIAppRoleAssignment.cpp OAIApplication.cpp OAIClass_Member_Reference.cpp OAIClass_Reference.cpp OAIClass_Teacher_Reference.cpp OAICollection_of_appRoleAssignments.cpp OAICollection_of_applications.cpp OAICollection_of_class.cpp OAICollection_of_driveItems.cpp OAICollection_of_drives.cpp OAICollection_of_drives_1.cpp OAICollection_of_educationClass.cpp OAICollection_of_educationUser.cpp OAICollection_of_educationUser_1.cpp OAICollection_of_group.cpp OAICollection_of_schools.cpp OAICollection_of_tags.cpp OAICollection_of_user.cpp OAICollection_of_users.cpp OAIDeleted.cpp OAIDirectoryObject.cpp OAIDrive.cpp OAIDriveItem.cpp OAIEducationClass.cpp OAIEducationOrganization.cpp OAIEducationSchool.cpp OAIEducationUser.cpp OAIEducationUser_Reference.cpp OAIEntity.cpp OAIExportPersonalData_request.cpp OAIFileSystemInfo.cpp OAIFolder.cpp OAIFolderView.cpp OAIGroup.cpp OAIHashes.cpp OAIIdentity.cpp OAIIdentitySet.cpp OAIImage.cpp OAIItemReference.cpp OAIMember_Reference.cpp OAIObjectIdentity.cpp OAIOdata_error.cpp OAIOdata_error_detail.cpp OAIOdata_error_main.cpp OAIOpenGraphFile.cpp OAIPasswordProfile.cpp OAIPassword_change.cpp OAIPermission.cpp OAIQuota.cpp OAIRemoteItem.cpp OAIShared.cpp OAISpecialFolder.cpp OAITagAssignment.cpp OAITagUnassignment.cpp OAITrash.cpp OAIUser.cpp OAIApplicationsApi.cpp OAIDrivesApi.cpp OAIDrivesGetDrivesApi.cpp OAIDrivesRootApi.cpp OAIEducationClassApi.cpp OAIEducationClassTeachersApi.cpp OAIEducationSchoolApi.cpp OAIEducationUserApi.cpp OAIGroupApi.cpp OAIGroupsApi.cpp OAIMeChangepasswordApi.cpp OAIMeDriveApi.cpp OAIMeDriveRootApi.cpp OAIMeDriveRootChildrenApi.cpp OAIMeDrivesApi.cpp OAIMeUserApi.cpp OAITagsApi.cpp OAIUserApi.cpp OAIUserAppRoleAssignmentApi.cpp OAIUsersApi.cpp OAIHelpers.cpp OAIHttpRequest.cpp OAIHttpFileElement.cpp OAIOauth.cpp ) target_include_directories(client PUBLIC $ $ ) add_library(OpenAPI::${TARGET_NAME} ALIAS client) target_link_libraries(client PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Gui ZLIB::ZLIB) set_target_properties(client PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF OUTPUT_NAME ${TARGET_NAME} EXPORT_NAME ${TARGET_NAME} VERSION ${APP_VERSION} SOVERSION 1) set(HEADER OAIAppRole.h OAIAppRoleAssignment.h OAIApplication.h OAIClass_Member_Reference.h OAIClass_Reference.h OAIClass_Teacher_Reference.h OAICollection_of_appRoleAssignments.h OAICollection_of_applications.h OAICollection_of_class.h OAICollection_of_driveItems.h OAICollection_of_drives.h OAICollection_of_drives_1.h OAICollection_of_educationClass.h OAICollection_of_educationUser.h OAICollection_of_educationUser_1.h OAICollection_of_group.h OAICollection_of_schools.h OAICollection_of_tags.h OAICollection_of_user.h OAICollection_of_users.h OAIDeleted.h OAIDirectoryObject.h OAIDrive.h OAIDriveItem.h OAIEducationClass.h OAIEducationOrganization.h OAIEducationSchool.h OAIEducationUser.h OAIEducationUser_Reference.h OAIEntity.h OAIExportPersonalData_request.h OAIFileSystemInfo.h OAIFolder.h OAIFolderView.h OAIGroup.h OAIHashes.h OAIIdentity.h OAIIdentitySet.h OAIImage.h OAIItemReference.h OAIMember_Reference.h OAIObjectIdentity.h OAIOdata_error.h OAIOdata_error_detail.h OAIOdata_error_main.h OAIOpenGraphFile.h OAIPasswordProfile.h OAIPassword_change.h OAIPermission.h OAIQuota.h OAIRemoteItem.h OAIShared.h OAISpecialFolder.h OAITagAssignment.h OAITagUnassignment.h OAITrash.h OAIUser.h OAIApplicationsApi.h OAIDrivesApi.h OAIDrivesGetDrivesApi.h OAIDrivesRootApi.h OAIEducationClassApi.h OAIEducationClassTeachersApi.h OAIEducationSchoolApi.h OAIEducationUserApi.h OAIGroupApi.h OAIGroupsApi.h OAIMeChangepasswordApi.h OAIMeDriveApi.h OAIMeDriveRootApi.h OAIMeDriveRootChildrenApi.h OAIMeDrivesApi.h OAIMeUserApi.h OAITagsApi.h OAIUserApi.h OAIUserAppRoleAssignmentApi.h OAIUsersApi.h OAIEnum.h OAIHelpers.h OAIHttpRequest.h OAIHttpFileElement.h OAIOauth.h OAIObject.h ) install(FILES ${HEADER} DESTINATION include/OpenAPI/${TARGET_NAME}) include(CMakePackageConfigHelpers) # openapi-generator-cli doesn't allow us to add extra files and the # Config.cmake it ships is not usable... file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/Config.cmake.in" "@PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Qt${QT_VERSION_MAJOR}Core) find_dependency(Qt${QT_VERSION_MAJOR}Gui) find_dependency(Qt${QT_VERSION_MAJOR}Network) include(\"\${CMAKE_CURRENT_LIST_DIR}/@TARGET_NAME@Targets.cmake\")" ) configure_package_config_file( "${CMAKE_CURRENT_BINARY_DIR}/Config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Config.cmake" INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET_NAME} ) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}ConfigVersion.cmake" VERSION ${APP_VERSION} COMPATIBILITY SameMajorVersion ) install(TARGETS client EXPORT ${TARGET_NAME}Targets RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(EXPORT ${TARGET_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET_NAME} NAMESPACE OpenAPI::) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}ConfigVersion.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET_NAME}) libre-graph-api-cpp-qt-client-1.0.4/client/OAIAppRole.cpp000066400000000000000000000153711442421066000230200ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIAppRole.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIAppRolePrivate { friend class OAIAppRole; QList allowed_member_types; bool allowed_member_types_isSet; bool allowed_member_types_isValid; QString description; bool description_isSet; bool description_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; QString id; bool id_isSet; bool id_isValid; }; OAIAppRole::OAIAppRole() : d_ptr() { } OAIAppRole::OAIAppRole(const OAIAppRole& other) : d_ptr(other.d_ptr) { } OAIAppRole::OAIAppRole(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIAppRole::~OAIAppRole() = default; void OAIAppRole::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIAppRolePrivate{}); Q_D(OAIAppRole); d->allowed_member_types_isSet = false; d->allowed_member_types_isValid = false; d->description_isSet = false; d->description_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; d->id_isSet = false; d->id_isValid = false; } } void OAIAppRole::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIAppRole::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIAppRole); d->allowed_member_types_isValid = ::OpenAPI::fromJsonValue(d->allowed_member_types, json[QString("allowedMemberTypes")]); d->allowed_member_types_isSet = !json[QString("allowedMemberTypes")].isNull() && d->allowed_member_types_isValid; d->description_isValid = ::OpenAPI::fromJsonValue(d->description, json[QString("description")]); d->description_isSet = !json[QString("description")].isNull() && d->description_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; } QString OAIAppRole::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIAppRole::asJsonObject() const { Q_D(const OAIAppRole); if(!d){ return {}; } QJsonObject obj; if (d->allowed_member_types.size() > 0) { obj.insert(QString("allowedMemberTypes"), ::OpenAPI::toJsonValue(d->allowed_member_types)); } if (d->description_isSet) { obj.insert(QString("description"), ::OpenAPI::toJsonValue(d->description)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } return obj; } QList OAIAppRole::getAllowedMemberTypes() const { Q_D(const OAIAppRole); if(!d){ return {}; } return d->allowed_member_types; } void OAIAppRole::setAllowedMemberTypes(const QList &allowed_member_types) { Q_D(OAIAppRole); Q_ASSERT(d); d->allowed_member_types = allowed_member_types; d->allowed_member_types_isSet = true; } bool OAIAppRole::is_allowed_member_types_Set() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->allowed_member_types_isSet; } bool OAIAppRole::is_allowed_member_types_Valid() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->allowed_member_types_isValid; } QString OAIAppRole::getDescription() const { Q_D(const OAIAppRole); if(!d){ return {}; } return d->description; } void OAIAppRole::setDescription(const QString &description) { Q_D(OAIAppRole); Q_ASSERT(d); d->description = description; d->description_isSet = true; } bool OAIAppRole::is_description_Set() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->description_isSet; } bool OAIAppRole::is_description_Valid() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->description_isValid; } QString OAIAppRole::getDisplayName() const { Q_D(const OAIAppRole); if(!d){ return {}; } return d->display_name; } void OAIAppRole::setDisplayName(const QString &display_name) { Q_D(OAIAppRole); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIAppRole::is_display_name_Set() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->display_name_isSet; } bool OAIAppRole::is_display_name_Valid() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->display_name_isValid; } QString OAIAppRole::getId() const { Q_D(const OAIAppRole); if(!d){ return {}; } return d->id; } void OAIAppRole::setId(const QString &id) { Q_D(OAIAppRole); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIAppRole::is_id_Set() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->id_isSet; } bool OAIAppRole::is_id_Valid() const{ Q_D(const OAIAppRole); if(!d){ return false; } return d->id_isValid; } bool OAIAppRole::isSet() const { Q_D(const OAIAppRole); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->allowed_member_types.size() > 0) { isObjectUpdated = true; break; } if (d->description_isSet) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIAppRole::isValid() const { Q_D(const OAIAppRole); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->id_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIAppRole.h000066400000000000000000000036041442421066000224610ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIAppRole.h * * */ #ifndef OAIAppRole_H #define OAIAppRole_H #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIAppRolePrivate; class OAIAppRole : public OAIObject { public: OAIAppRole(); OAIAppRole(const OAIAppRole &other); OAIAppRole(QString json); ~OAIAppRole() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getAllowedMemberTypes() const; void setAllowedMemberTypes(const QList &allowed_member_types); bool is_allowed_member_types_Set() const; bool is_allowed_member_types_Valid() const; QString getDescription() const; void setDescription(const QString &description); bool is_description_Set() const; bool is_description_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIAppRole) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIAppRole) #endif // OAIAppRole_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIAppRoleAssignment.cpp000066400000000000000000000343211442421066000250450ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIAppRoleAssignment.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIAppRoleAssignmentPrivate { friend class OAIAppRoleAssignment; QString id; bool id_isSet; bool id_isValid; QDateTime deleted_date_time; bool deleted_date_time_isSet; bool deleted_date_time_isValid; QString app_role_id; bool app_role_id_isSet; bool app_role_id_isValid; QDateTime created_date_time; bool created_date_time_isSet; bool created_date_time_isValid; QString principal_display_name; bool principal_display_name_isSet; bool principal_display_name_isValid; QString principal_id; bool principal_id_isSet; bool principal_id_isValid; QString principal_type; bool principal_type_isSet; bool principal_type_isValid; QString resource_display_name; bool resource_display_name_isSet; bool resource_display_name_isValid; QString resource_id; bool resource_id_isSet; bool resource_id_isValid; }; OAIAppRoleAssignment::OAIAppRoleAssignment() : d_ptr() { } OAIAppRoleAssignment::OAIAppRoleAssignment(const OAIAppRoleAssignment& other) : d_ptr(other.d_ptr) { } OAIAppRoleAssignment::OAIAppRoleAssignment(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIAppRoleAssignment::~OAIAppRoleAssignment() = default; void OAIAppRoleAssignment::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIAppRoleAssignmentPrivate{}); Q_D(OAIAppRoleAssignment); d->id_isSet = false; d->id_isValid = false; d->deleted_date_time_isSet = false; d->deleted_date_time_isValid = false; d->app_role_id_isSet = false; d->app_role_id_isValid = false; d->created_date_time_isSet = false; d->created_date_time_isValid = false; d->principal_display_name_isSet = false; d->principal_display_name_isValid = false; d->principal_id_isSet = false; d->principal_id_isValid = false; d->principal_type_isSet = false; d->principal_type_isValid = false; d->resource_display_name_isSet = false; d->resource_display_name_isValid = false; d->resource_id_isSet = false; d->resource_id_isValid = false; } } void OAIAppRoleAssignment::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIAppRoleAssignment::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIAppRoleAssignment); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->deleted_date_time_isValid = ::OpenAPI::fromJsonValue(d->deleted_date_time, json[QString("deletedDateTime")]); d->deleted_date_time_isSet = !json[QString("deletedDateTime")].isNull() && d->deleted_date_time_isValid; d->app_role_id_isValid = ::OpenAPI::fromJsonValue(d->app_role_id, json[QString("appRoleId")]); d->app_role_id_isSet = !json[QString("appRoleId")].isNull() && d->app_role_id_isValid; d->created_date_time_isValid = ::OpenAPI::fromJsonValue(d->created_date_time, json[QString("createdDateTime")]); d->created_date_time_isSet = !json[QString("createdDateTime")].isNull() && d->created_date_time_isValid; d->principal_display_name_isValid = ::OpenAPI::fromJsonValue(d->principal_display_name, json[QString("principalDisplayName")]); d->principal_display_name_isSet = !json[QString("principalDisplayName")].isNull() && d->principal_display_name_isValid; d->principal_id_isValid = ::OpenAPI::fromJsonValue(d->principal_id, json[QString("principalId")]); d->principal_id_isSet = !json[QString("principalId")].isNull() && d->principal_id_isValid; d->principal_type_isValid = ::OpenAPI::fromJsonValue(d->principal_type, json[QString("principalType")]); d->principal_type_isSet = !json[QString("principalType")].isNull() && d->principal_type_isValid; d->resource_display_name_isValid = ::OpenAPI::fromJsonValue(d->resource_display_name, json[QString("resourceDisplayName")]); d->resource_display_name_isSet = !json[QString("resourceDisplayName")].isNull() && d->resource_display_name_isValid; d->resource_id_isValid = ::OpenAPI::fromJsonValue(d->resource_id, json[QString("resourceId")]); d->resource_id_isSet = !json[QString("resourceId")].isNull() && d->resource_id_isValid; } QString OAIAppRoleAssignment::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIAppRoleAssignment::asJsonObject() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->deleted_date_time_isSet) { obj.insert(QString("deletedDateTime"), ::OpenAPI::toJsonValue(d->deleted_date_time)); } if (d->app_role_id_isSet) { obj.insert(QString("appRoleId"), ::OpenAPI::toJsonValue(d->app_role_id)); } if (d->created_date_time_isSet) { obj.insert(QString("createdDateTime"), ::OpenAPI::toJsonValue(d->created_date_time)); } if (d->principal_display_name_isSet) { obj.insert(QString("principalDisplayName"), ::OpenAPI::toJsonValue(d->principal_display_name)); } if (d->principal_id_isSet) { obj.insert(QString("principalId"), ::OpenAPI::toJsonValue(d->principal_id)); } if (d->principal_type_isSet) { obj.insert(QString("principalType"), ::OpenAPI::toJsonValue(d->principal_type)); } if (d->resource_display_name_isSet) { obj.insert(QString("resourceDisplayName"), ::OpenAPI::toJsonValue(d->resource_display_name)); } if (d->resource_id_isSet) { obj.insert(QString("resourceId"), ::OpenAPI::toJsonValue(d->resource_id)); } return obj; } QString OAIAppRoleAssignment::getId() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->id; } void OAIAppRoleAssignment::setId(const QString &id) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIAppRoleAssignment::is_id_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->id_isSet; } bool OAIAppRoleAssignment::is_id_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->id_isValid; } QDateTime OAIAppRoleAssignment::getDeletedDateTime() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->deleted_date_time; } void OAIAppRoleAssignment::setDeletedDateTime(const QDateTime &deleted_date_time) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->deleted_date_time = deleted_date_time; d->deleted_date_time_isSet = true; } bool OAIAppRoleAssignment::is_deleted_date_time_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->deleted_date_time_isSet; } bool OAIAppRoleAssignment::is_deleted_date_time_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->deleted_date_time_isValid; } QString OAIAppRoleAssignment::getAppRoleId() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->app_role_id; } void OAIAppRoleAssignment::setAppRoleId(const QString &app_role_id) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->app_role_id = app_role_id; d->app_role_id_isSet = true; } bool OAIAppRoleAssignment::is_app_role_id_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->app_role_id_isSet; } bool OAIAppRoleAssignment::is_app_role_id_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->app_role_id_isValid; } QDateTime OAIAppRoleAssignment::getCreatedDateTime() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->created_date_time; } void OAIAppRoleAssignment::setCreatedDateTime(const QDateTime &created_date_time) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->created_date_time = created_date_time; d->created_date_time_isSet = true; } bool OAIAppRoleAssignment::is_created_date_time_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->created_date_time_isSet; } bool OAIAppRoleAssignment::is_created_date_time_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->created_date_time_isValid; } QString OAIAppRoleAssignment::getPrincipalDisplayName() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->principal_display_name; } void OAIAppRoleAssignment::setPrincipalDisplayName(const QString &principal_display_name) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->principal_display_name = principal_display_name; d->principal_display_name_isSet = true; } bool OAIAppRoleAssignment::is_principal_display_name_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->principal_display_name_isSet; } bool OAIAppRoleAssignment::is_principal_display_name_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->principal_display_name_isValid; } QString OAIAppRoleAssignment::getPrincipalId() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->principal_id; } void OAIAppRoleAssignment::setPrincipalId(const QString &principal_id) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->principal_id = principal_id; d->principal_id_isSet = true; } bool OAIAppRoleAssignment::is_principal_id_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->principal_id_isSet; } bool OAIAppRoleAssignment::is_principal_id_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->principal_id_isValid; } QString OAIAppRoleAssignment::getPrincipalType() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->principal_type; } void OAIAppRoleAssignment::setPrincipalType(const QString &principal_type) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->principal_type = principal_type; d->principal_type_isSet = true; } bool OAIAppRoleAssignment::is_principal_type_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->principal_type_isSet; } bool OAIAppRoleAssignment::is_principal_type_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->principal_type_isValid; } QString OAIAppRoleAssignment::getResourceDisplayName() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->resource_display_name; } void OAIAppRoleAssignment::setResourceDisplayName(const QString &resource_display_name) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->resource_display_name = resource_display_name; d->resource_display_name_isSet = true; } bool OAIAppRoleAssignment::is_resource_display_name_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->resource_display_name_isSet; } bool OAIAppRoleAssignment::is_resource_display_name_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->resource_display_name_isValid; } QString OAIAppRoleAssignment::getResourceId() const { Q_D(const OAIAppRoleAssignment); if(!d){ return {}; } return d->resource_id; } void OAIAppRoleAssignment::setResourceId(const QString &resource_id) { Q_D(OAIAppRoleAssignment); Q_ASSERT(d); d->resource_id = resource_id; d->resource_id_isSet = true; } bool OAIAppRoleAssignment::is_resource_id_Set() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->resource_id_isSet; } bool OAIAppRoleAssignment::is_resource_id_Valid() const{ Q_D(const OAIAppRoleAssignment); if(!d){ return false; } return d->resource_id_isValid; } bool OAIAppRoleAssignment::isSet() const { Q_D(const OAIAppRoleAssignment); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->deleted_date_time_isSet) { isObjectUpdated = true; break; } if (d->app_role_id_isSet) { isObjectUpdated = true; break; } if (d->created_date_time_isSet) { isObjectUpdated = true; break; } if (d->principal_display_name_isSet) { isObjectUpdated = true; break; } if (d->principal_id_isSet) { isObjectUpdated = true; break; } if (d->principal_type_isSet) { isObjectUpdated = true; break; } if (d->resource_display_name_isSet) { isObjectUpdated = true; break; } if (d->resource_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIAppRoleAssignment::isValid() const { Q_D(const OAIAppRoleAssignment); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->app_role_id_isValid && d->principal_id_isValid && d->resource_id_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIAppRoleAssignment.h000066400000000000000000000056771442421066000245260ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIAppRoleAssignment.h * * */ #ifndef OAIAppRoleAssignment_H #define OAIAppRoleAssignment_H #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIAppRoleAssignmentPrivate; class OAIAppRoleAssignment : public OAIObject { public: OAIAppRoleAssignment(); OAIAppRoleAssignment(const OAIAppRoleAssignment &other); OAIAppRoleAssignment(QString json); ~OAIAppRoleAssignment() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QDateTime getDeletedDateTime() const; void setDeletedDateTime(const QDateTime &deleted_date_time); bool is_deleted_date_time_Set() const; bool is_deleted_date_time_Valid() const; QString getAppRoleId() const; void setAppRoleId(const QString &app_role_id); bool is_app_role_id_Set() const; bool is_app_role_id_Valid() const; QDateTime getCreatedDateTime() const; void setCreatedDateTime(const QDateTime &created_date_time); bool is_created_date_time_Set() const; bool is_created_date_time_Valid() const; QString getPrincipalDisplayName() const; void setPrincipalDisplayName(const QString &principal_display_name); bool is_principal_display_name_Set() const; bool is_principal_display_name_Valid() const; QString getPrincipalId() const; void setPrincipalId(const QString &principal_id); bool is_principal_id_Set() const; bool is_principal_id_Valid() const; QString getPrincipalType() const; void setPrincipalType(const QString &principal_type); bool is_principal_type_Set() const; bool is_principal_type_Valid() const; QString getResourceDisplayName() const; void setResourceDisplayName(const QString &resource_display_name); bool is_resource_display_name_Set() const; bool is_resource_display_name_Valid() const; QString getResourceId() const; void setResourceId(const QString &resource_id); bool is_resource_id_Set() const; bool is_resource_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIAppRoleAssignment) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIAppRoleAssignment) #endif // OAIAppRoleAssignment_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIApplication.cpp000066400000000000000000000130021442421066000237060ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIApplication.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIApplicationPrivate { friend class OAIApplication; QString id; bool id_isSet; bool id_isValid; QList app_roles; bool app_roles_isSet; bool app_roles_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; }; OAIApplication::OAIApplication() : d_ptr() { } OAIApplication::OAIApplication(const OAIApplication& other) : d_ptr(other.d_ptr) { } OAIApplication::OAIApplication(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIApplication::~OAIApplication() = default; void OAIApplication::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIApplicationPrivate{}); Q_D(OAIApplication); d->id_isSet = false; d->id_isValid = false; d->app_roles_isSet = false; d->app_roles_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; } } void OAIApplication::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIApplication::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIApplication); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->app_roles_isValid = ::OpenAPI::fromJsonValue(d->app_roles, json[QString("appRoles")]); d->app_roles_isSet = !json[QString("appRoles")].isNull() && d->app_roles_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; } QString OAIApplication::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIApplication::asJsonObject() const { Q_D(const OAIApplication); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->app_roles.size() > 0) { obj.insert(QString("appRoles"), ::OpenAPI::toJsonValue(d->app_roles)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } return obj; } QString OAIApplication::getId() const { Q_D(const OAIApplication); if(!d){ return {}; } return d->id; } void OAIApplication::setId(const QString &id) { Q_D(OAIApplication); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIApplication::is_id_Set() const{ Q_D(const OAIApplication); if(!d){ return false; } return d->id_isSet; } bool OAIApplication::is_id_Valid() const{ Q_D(const OAIApplication); if(!d){ return false; } return d->id_isValid; } QList OAIApplication::getAppRoles() const { Q_D(const OAIApplication); if(!d){ return {}; } return d->app_roles; } void OAIApplication::setAppRoles(const QList &app_roles) { Q_D(OAIApplication); Q_ASSERT(d); d->app_roles = app_roles; d->app_roles_isSet = true; } bool OAIApplication::is_app_roles_Set() const{ Q_D(const OAIApplication); if(!d){ return false; } return d->app_roles_isSet; } bool OAIApplication::is_app_roles_Valid() const{ Q_D(const OAIApplication); if(!d){ return false; } return d->app_roles_isValid; } QString OAIApplication::getDisplayName() const { Q_D(const OAIApplication); if(!d){ return {}; } return d->display_name; } void OAIApplication::setDisplayName(const QString &display_name) { Q_D(OAIApplication); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIApplication::is_display_name_Set() const{ Q_D(const OAIApplication); if(!d){ return false; } return d->display_name_isSet; } bool OAIApplication::is_display_name_Valid() const{ Q_D(const OAIApplication); if(!d){ return false; } return d->display_name_isValid; } bool OAIApplication::isSet() const { Q_D(const OAIApplication); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->app_roles.size() > 0) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIApplication::isValid() const { Q_D(const OAIApplication); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->id_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIApplication.h000066400000000000000000000034211442421066000233570ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIApplication.h * * */ #ifndef OAIApplication_H #define OAIApplication_H #include #include "OAIAppRole.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIAppRole; class OAIApplicationPrivate; class OAIApplication : public OAIObject { public: OAIApplication(); OAIApplication(const OAIApplication &other); OAIApplication(QString json); ~OAIApplication() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QList getAppRoles() const; void setAppRoles(const QList &app_roles); bool is_app_roles_Set() const; bool is_app_roles_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIApplication) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIApplication) #endif // OAIApplication_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIApplicationsApi.cpp000066400000000000000000000336441442421066000245410ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIApplicationsApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIApplicationsApi::OAIApplicationsApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIApplicationsApi::~OAIApplicationsApi() { } void OAIApplicationsApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("getApplication", defaultConf); _serverIndices.insert("getApplication", 0); _serverConfigs.insert("listApplications", defaultConf); _serverIndices.insert("listApplications", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIApplicationsApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIApplicationsApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIApplicationsApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIApplicationsApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIApplicationsApi::setUsername(const QString &username) { _username = username; } void OAIApplicationsApi::setPassword(const QString &password) { _password = password; } void OAIApplicationsApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIApplicationsApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIApplicationsApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIApplicationsApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIApplicationsApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIApplicationsApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIApplicationsApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIApplicationsApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIApplicationsApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIApplicationsApi::abortRequests() { emit abortRequestsSignal(); } QString OAIApplicationsApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIApplicationsApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIApplicationsApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIApplicationsApi::getApplication(const QString &application_id) { QString fullPath = QString(_serverConfigs["getApplication"][_serverIndices.value("getApplication")].URL()+"/applications/{application-id}"); { QString application_idPathParam("{"); application_idPathParam.append("application-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "application-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"application-id"+pathSuffix : pathPrefix; fullPath.replace(application_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(application_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIApplicationsApi::getApplicationCallback); connect(this, &OAIApplicationsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIApplicationsApi::getApplicationCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIApplication output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getApplicationSignal(output); emit getApplicationSignalFull(worker, output); } else { emit getApplicationSignalE(output, error_type, error_str); emit getApplicationSignalEFull(worker, error_type, error_str); } } void OAIApplicationsApi::listApplications() { QString fullPath = QString(_serverConfigs["listApplications"][_serverIndices.value("listApplications")].URL()+"/applications"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIApplicationsApi::listApplicationsCallback); connect(this, &OAIApplicationsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIApplicationsApi::listApplicationsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_applications output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listApplicationsSignal(output); emit listApplicationsSignalFull(worker, output); } else { emit listApplicationsSignalE(output, error_type, error_str); emit listApplicationsSignalEFull(worker, error_type, error_str); } } void OAIApplicationsApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIApplicationsApi.h000066400000000000000000000105251442421066000241770ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIApplicationsApi_H #define OAI_OAIApplicationsApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIApplication.h" #include "OAICollection_of_applications.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIApplicationsApi : public QObject { Q_OBJECT public: OAIApplicationsApi(const int timeOut = 0); ~OAIApplicationsApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] application_id QString [required] */ void getApplication(const QString &application_id); void listApplications(); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void getApplicationCallback(OAIHttpRequestWorker *worker); void listApplicationsCallback(OAIHttpRequestWorker *worker); signals: void getApplicationSignal(OAIApplication summary); void listApplicationsSignal(OAICollection_of_applications summary); void getApplicationSignalFull(OAIHttpRequestWorker *worker, OAIApplication summary); void listApplicationsSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_applications summary); void getApplicationSignalE(OAIApplication summary, QNetworkReply::NetworkError error_type, QString error_str); void listApplicationsSignalE(OAICollection_of_applications summary, QNetworkReply::NetworkError error_type, QString error_str); void getApplicationSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listApplicationsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIClass_Member_Reference.cpp000066400000000000000000000071371442421066000257710ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIClass_Member_Reference.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIClass_Member_ReferencePrivate { friend class OAIClass_Member_Reference; QString odata_id; bool odata_id_isSet; bool odata_id_isValid; }; OAIClass_Member_Reference::OAIClass_Member_Reference() : d_ptr() { } OAIClass_Member_Reference::OAIClass_Member_Reference(const OAIClass_Member_Reference& other) : d_ptr(other.d_ptr) { } OAIClass_Member_Reference::OAIClass_Member_Reference(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIClass_Member_Reference::~OAIClass_Member_Reference() = default; void OAIClass_Member_Reference::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIClass_Member_ReferencePrivate{}); Q_D(OAIClass_Member_Reference); d->odata_id_isSet = false; d->odata_id_isValid = false; } } void OAIClass_Member_Reference::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIClass_Member_Reference::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIClass_Member_Reference); d->odata_id_isValid = ::OpenAPI::fromJsonValue(d->odata_id, json[QString("@odata.id")]); d->odata_id_isSet = !json[QString("@odata.id")].isNull() && d->odata_id_isValid; } QString OAIClass_Member_Reference::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIClass_Member_Reference::asJsonObject() const { Q_D(const OAIClass_Member_Reference); if(!d){ return {}; } QJsonObject obj; if (d->odata_id_isSet) { obj.insert(QString("@odata.id"), ::OpenAPI::toJsonValue(d->odata_id)); } return obj; } QString OAIClass_Member_Reference::getOdataId() const { Q_D(const OAIClass_Member_Reference); if(!d){ return {}; } return d->odata_id; } void OAIClass_Member_Reference::setOdataId(const QString &odata_id) { Q_D(OAIClass_Member_Reference); Q_ASSERT(d); d->odata_id = odata_id; d->odata_id_isSet = true; } bool OAIClass_Member_Reference::is_odata_id_Set() const{ Q_D(const OAIClass_Member_Reference); if(!d){ return false; } return d->odata_id_isSet; } bool OAIClass_Member_Reference::is_odata_id_Valid() const{ Q_D(const OAIClass_Member_Reference); if(!d){ return false; } return d->odata_id_isValid; } bool OAIClass_Member_Reference::isSet() const { Q_D(const OAIClass_Member_Reference); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->odata_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIClass_Member_Reference::isValid() const { Q_D(const OAIClass_Member_Reference); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIClass_Member_Reference.h000066400000000000000000000030651442421066000254320ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIClass_Member_Reference.h * * */ #ifndef OAIClass_Member_Reference_H #define OAIClass_Member_Reference_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIClass_Member_ReferencePrivate; class OAIClass_Member_Reference : public OAIObject { public: OAIClass_Member_Reference(); OAIClass_Member_Reference(const OAIClass_Member_Reference &other); OAIClass_Member_Reference(QString json); ~OAIClass_Member_Reference() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getOdataId() const; void setOdataId(const QString &odata_id); bool is_odata_id_Set() const; bool is_odata_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIClass_Member_Reference) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIClass_Member_Reference) #endif // OAIClass_Member_Reference_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIClass_Reference.cpp000066400000000000000000000065701442421066000245020ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIClass_Reference.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIClass_ReferencePrivate { friend class OAIClass_Reference; QString odata_id; bool odata_id_isSet; bool odata_id_isValid; }; OAIClass_Reference::OAIClass_Reference() : d_ptr() { } OAIClass_Reference::OAIClass_Reference(const OAIClass_Reference& other) : d_ptr(other.d_ptr) { } OAIClass_Reference::OAIClass_Reference(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIClass_Reference::~OAIClass_Reference() = default; void OAIClass_Reference::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIClass_ReferencePrivate{}); Q_D(OAIClass_Reference); d->odata_id_isSet = false; d->odata_id_isValid = false; } } void OAIClass_Reference::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIClass_Reference::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIClass_Reference); d->odata_id_isValid = ::OpenAPI::fromJsonValue(d->odata_id, json[QString("@odata.id")]); d->odata_id_isSet = !json[QString("@odata.id")].isNull() && d->odata_id_isValid; } QString OAIClass_Reference::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIClass_Reference::asJsonObject() const { Q_D(const OAIClass_Reference); if(!d){ return {}; } QJsonObject obj; if (d->odata_id_isSet) { obj.insert(QString("@odata.id"), ::OpenAPI::toJsonValue(d->odata_id)); } return obj; } QString OAIClass_Reference::getOdataId() const { Q_D(const OAIClass_Reference); if(!d){ return {}; } return d->odata_id; } void OAIClass_Reference::setOdataId(const QString &odata_id) { Q_D(OAIClass_Reference); Q_ASSERT(d); d->odata_id = odata_id; d->odata_id_isSet = true; } bool OAIClass_Reference::is_odata_id_Set() const{ Q_D(const OAIClass_Reference); if(!d){ return false; } return d->odata_id_isSet; } bool OAIClass_Reference::is_odata_id_Valid() const{ Q_D(const OAIClass_Reference); if(!d){ return false; } return d->odata_id_isValid; } bool OAIClass_Reference::isSet() const { Q_D(const OAIClass_Reference); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->odata_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIClass_Reference::isValid() const { Q_D(const OAIClass_Reference); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIClass_Reference.h000066400000000000000000000027231442421066000241430ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIClass_Reference.h * * */ #ifndef OAIClass_Reference_H #define OAIClass_Reference_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIClass_ReferencePrivate; class OAIClass_Reference : public OAIObject { public: OAIClass_Reference(); OAIClass_Reference(const OAIClass_Reference &other); OAIClass_Reference(QString json); ~OAIClass_Reference() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getOdataId() const; void setOdataId(const QString &odata_id); bool is_odata_id_Set() const; bool is_odata_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIClass_Reference) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIClass_Reference) #endif // OAIClass_Reference_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIClass_Teacher_Reference.cpp000066400000000000000000000072001442421066000261240ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIClass_Teacher_Reference.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIClass_Teacher_ReferencePrivate { friend class OAIClass_Teacher_Reference; QString odata_id; bool odata_id_isSet; bool odata_id_isValid; }; OAIClass_Teacher_Reference::OAIClass_Teacher_Reference() : d_ptr() { } OAIClass_Teacher_Reference::OAIClass_Teacher_Reference(const OAIClass_Teacher_Reference& other) : d_ptr(other.d_ptr) { } OAIClass_Teacher_Reference::OAIClass_Teacher_Reference(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIClass_Teacher_Reference::~OAIClass_Teacher_Reference() = default; void OAIClass_Teacher_Reference::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIClass_Teacher_ReferencePrivate{}); Q_D(OAIClass_Teacher_Reference); d->odata_id_isSet = false; d->odata_id_isValid = false; } } void OAIClass_Teacher_Reference::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIClass_Teacher_Reference::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIClass_Teacher_Reference); d->odata_id_isValid = ::OpenAPI::fromJsonValue(d->odata_id, json[QString("@odata.id")]); d->odata_id_isSet = !json[QString("@odata.id")].isNull() && d->odata_id_isValid; } QString OAIClass_Teacher_Reference::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIClass_Teacher_Reference::asJsonObject() const { Q_D(const OAIClass_Teacher_Reference); if(!d){ return {}; } QJsonObject obj; if (d->odata_id_isSet) { obj.insert(QString("@odata.id"), ::OpenAPI::toJsonValue(d->odata_id)); } return obj; } QString OAIClass_Teacher_Reference::getOdataId() const { Q_D(const OAIClass_Teacher_Reference); if(!d){ return {}; } return d->odata_id; } void OAIClass_Teacher_Reference::setOdataId(const QString &odata_id) { Q_D(OAIClass_Teacher_Reference); Q_ASSERT(d); d->odata_id = odata_id; d->odata_id_isSet = true; } bool OAIClass_Teacher_Reference::is_odata_id_Set() const{ Q_D(const OAIClass_Teacher_Reference); if(!d){ return false; } return d->odata_id_isSet; } bool OAIClass_Teacher_Reference::is_odata_id_Valid() const{ Q_D(const OAIClass_Teacher_Reference); if(!d){ return false; } return d->odata_id_isValid; } bool OAIClass_Teacher_Reference::isSet() const { Q_D(const OAIClass_Teacher_Reference); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->odata_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIClass_Teacher_Reference::isValid() const { Q_D(const OAIClass_Teacher_Reference); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIClass_Teacher_Reference.h000066400000000000000000000031031442421066000255670ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIClass_Teacher_Reference.h * * */ #ifndef OAIClass_Teacher_Reference_H #define OAIClass_Teacher_Reference_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIClass_Teacher_ReferencePrivate; class OAIClass_Teacher_Reference : public OAIObject { public: OAIClass_Teacher_Reference(); OAIClass_Teacher_Reference(const OAIClass_Teacher_Reference &other); OAIClass_Teacher_Reference(QString json); ~OAIClass_Teacher_Reference() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getOdataId() const; void setOdataId(const QString &odata_id); bool is_odata_id_Set() const; bool is_odata_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIClass_Teacher_Reference) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIClass_Teacher_Reference) #endif // OAIClass_Teacher_Reference_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_appRoleAssignments.cpp000066400000000000000000000125671442421066000301370ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_appRoleAssignments.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_appRoleAssignmentsPrivate { friend class OAICollection_of_appRoleAssignments; QList value; bool value_isSet; bool value_isValid; QString odata_next_link; bool odata_next_link_isSet; bool odata_next_link_isValid; }; OAICollection_of_appRoleAssignments::OAICollection_of_appRoleAssignments() : d_ptr() { } OAICollection_of_appRoleAssignments::OAICollection_of_appRoleAssignments(const OAICollection_of_appRoleAssignments& other) : d_ptr(other.d_ptr) { } OAICollection_of_appRoleAssignments::OAICollection_of_appRoleAssignments(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_appRoleAssignments::~OAICollection_of_appRoleAssignments() = default; void OAICollection_of_appRoleAssignments::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_appRoleAssignmentsPrivate{}); Q_D(OAICollection_of_appRoleAssignments); d->value_isSet = false; d->value_isValid = false; d->odata_next_link_isSet = false; d->odata_next_link_isValid = false; } } void OAICollection_of_appRoleAssignments::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_appRoleAssignments::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_appRoleAssignments); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; d->odata_next_link_isValid = ::OpenAPI::fromJsonValue(d->odata_next_link, json[QString("@odata.nextLink")]); d->odata_next_link_isSet = !json[QString("@odata.nextLink")].isNull() && d->odata_next_link_isValid; } QString OAICollection_of_appRoleAssignments::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_appRoleAssignments::asJsonObject() const { Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } if (d->odata_next_link_isSet) { obj.insert(QString("@odata.nextLink"), ::OpenAPI::toJsonValue(d->odata_next_link)); } return obj; } QList OAICollection_of_appRoleAssignments::getValue() const { Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return {}; } return d->value; } void OAICollection_of_appRoleAssignments::setValue(const QList &value) { Q_D(OAICollection_of_appRoleAssignments); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_appRoleAssignments::is_value_Set() const{ Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_appRoleAssignments::is_value_Valid() const{ Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return false; } return d->value_isValid; } QString OAICollection_of_appRoleAssignments::getOdataNextLink() const { Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return {}; } return d->odata_next_link; } void OAICollection_of_appRoleAssignments::setOdataNextLink(const QString &odata_next_link) { Q_D(OAICollection_of_appRoleAssignments); Q_ASSERT(d); d->odata_next_link = odata_next_link; d->odata_next_link_isSet = true; } bool OAICollection_of_appRoleAssignments::is_odata_next_link_Set() const{ Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return false; } return d->odata_next_link_isSet; } bool OAICollection_of_appRoleAssignments::is_odata_next_link_Valid() const{ Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return false; } return d->odata_next_link_isValid; } bool OAICollection_of_appRoleAssignments::isSet() const { Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } if (d->odata_next_link_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_appRoleAssignments::isValid() const { Q_D(const OAICollection_of_appRoleAssignments); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_appRoleAssignments.h000066400000000000000000000037411442421066000275760ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_appRoleAssignments.h * * */ #ifndef OAICollection_of_appRoleAssignments_H #define OAICollection_of_appRoleAssignments_H #include #include "OAIAppRoleAssignment.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIAppRoleAssignment; class OAICollection_of_appRoleAssignmentsPrivate; class OAICollection_of_appRoleAssignments : public OAIObject { public: OAICollection_of_appRoleAssignments(); OAICollection_of_appRoleAssignments(const OAICollection_of_appRoleAssignments &other); OAICollection_of_appRoleAssignments(QString json); ~OAICollection_of_appRoleAssignments() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; QString getOdataNextLink() const; void setOdataNextLink(const QString &odata_next_link); bool is_odata_next_link_Set() const; bool is_odata_next_link_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_appRoleAssignments) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_appRoleAssignments) #endif // OAICollection_of_appRoleAssignments_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_applications.cpp000066400000000000000000000073101442421066000267750ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_applications.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_applicationsPrivate { friend class OAICollection_of_applications; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_applications::OAICollection_of_applications() : d_ptr() { } OAICollection_of_applications::OAICollection_of_applications(const OAICollection_of_applications& other) : d_ptr(other.d_ptr) { } OAICollection_of_applications::OAICollection_of_applications(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_applications::~OAICollection_of_applications() = default; void OAICollection_of_applications::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_applicationsPrivate{}); Q_D(OAICollection_of_applications); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_applications::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_applications::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_applications); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_applications::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_applications::asJsonObject() const { Q_D(const OAICollection_of_applications); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_applications::getValue() const { Q_D(const OAICollection_of_applications); if(!d){ return {}; } return d->value; } void OAICollection_of_applications::setValue(const QList &value) { Q_D(OAICollection_of_applications); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_applications::is_value_Set() const{ Q_D(const OAICollection_of_applications); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_applications::is_value_Valid() const{ Q_D(const OAICollection_of_applications); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_applications::isSet() const { Q_D(const OAICollection_of_applications); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_applications::isValid() const { Q_D(const OAICollection_of_applications); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_applications.h000066400000000000000000000032541442421066000264450ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_applications.h * * */ #ifndef OAICollection_of_applications_H #define OAICollection_of_applications_H #include #include "OAIApplication.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIApplication; class OAICollection_of_applicationsPrivate; class OAICollection_of_applications : public OAIObject { public: OAICollection_of_applications(); OAICollection_of_applications(const OAICollection_of_applications &other); OAICollection_of_applications(QString json); ~OAICollection_of_applications() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_applications) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_applications) #endif // OAICollection_of_applications_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_class.cpp000066400000000000000000000067521442421066000254250ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_class.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_classPrivate { friend class OAICollection_of_class; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_class::OAICollection_of_class() : d_ptr() { } OAICollection_of_class::OAICollection_of_class(const OAICollection_of_class& other) : d_ptr(other.d_ptr) { } OAICollection_of_class::OAICollection_of_class(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_class::~OAICollection_of_class() = default; void OAICollection_of_class::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_classPrivate{}); Q_D(OAICollection_of_class); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_class::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_class::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_class); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_class::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_class::asJsonObject() const { Q_D(const OAICollection_of_class); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_class::getValue() const { Q_D(const OAICollection_of_class); if(!d){ return {}; } return d->value; } void OAICollection_of_class::setValue(const QList &value) { Q_D(OAICollection_of_class); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_class::is_value_Set() const{ Q_D(const OAICollection_of_class); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_class::is_value_Valid() const{ Q_D(const OAICollection_of_class); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_class::isSet() const { Q_D(const OAICollection_of_class); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_class::isValid() const { Q_D(const OAICollection_of_class); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_class.h000066400000000000000000000031261442421066000250620ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_class.h * * */ #ifndef OAICollection_of_class_H #define OAICollection_of_class_H #include #include "OAIEducationClass.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationClass; class OAICollection_of_classPrivate; class OAICollection_of_class : public OAIObject { public: OAICollection_of_class(); OAICollection_of_class(const OAICollection_of_class &other); OAICollection_of_class(QString json); ~OAICollection_of_class() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_class) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_class) #endif // OAICollection_of_class_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_driveItems.cpp000066400000000000000000000120271442421066000264230ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_driveItems.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_driveItemsPrivate { friend class OAICollection_of_driveItems; QList value; bool value_isSet; bool value_isValid; QString odata_next_link; bool odata_next_link_isSet; bool odata_next_link_isValid; }; OAICollection_of_driveItems::OAICollection_of_driveItems() : d_ptr() { } OAICollection_of_driveItems::OAICollection_of_driveItems(const OAICollection_of_driveItems& other) : d_ptr(other.d_ptr) { } OAICollection_of_driveItems::OAICollection_of_driveItems(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_driveItems::~OAICollection_of_driveItems() = default; void OAICollection_of_driveItems::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_driveItemsPrivate{}); Q_D(OAICollection_of_driveItems); d->value_isSet = false; d->value_isValid = false; d->odata_next_link_isSet = false; d->odata_next_link_isValid = false; } } void OAICollection_of_driveItems::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_driveItems::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_driveItems); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; d->odata_next_link_isValid = ::OpenAPI::fromJsonValue(d->odata_next_link, json[QString("@odata.nextLink")]); d->odata_next_link_isSet = !json[QString("@odata.nextLink")].isNull() && d->odata_next_link_isValid; } QString OAICollection_of_driveItems::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_driveItems::asJsonObject() const { Q_D(const OAICollection_of_driveItems); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } if (d->odata_next_link_isSet) { obj.insert(QString("@odata.nextLink"), ::OpenAPI::toJsonValue(d->odata_next_link)); } return obj; } QList OAICollection_of_driveItems::getValue() const { Q_D(const OAICollection_of_driveItems); if(!d){ return {}; } return d->value; } void OAICollection_of_driveItems::setValue(const QList &value) { Q_D(OAICollection_of_driveItems); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_driveItems::is_value_Set() const{ Q_D(const OAICollection_of_driveItems); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_driveItems::is_value_Valid() const{ Q_D(const OAICollection_of_driveItems); if(!d){ return false; } return d->value_isValid; } QString OAICollection_of_driveItems::getOdataNextLink() const { Q_D(const OAICollection_of_driveItems); if(!d){ return {}; } return d->odata_next_link; } void OAICollection_of_driveItems::setOdataNextLink(const QString &odata_next_link) { Q_D(OAICollection_of_driveItems); Q_ASSERT(d); d->odata_next_link = odata_next_link; d->odata_next_link_isSet = true; } bool OAICollection_of_driveItems::is_odata_next_link_Set() const{ Q_D(const OAICollection_of_driveItems); if(!d){ return false; } return d->odata_next_link_isSet; } bool OAICollection_of_driveItems::is_odata_next_link_Valid() const{ Q_D(const OAICollection_of_driveItems); if(!d){ return false; } return d->odata_next_link_isValid; } bool OAICollection_of_driveItems::isSet() const { Q_D(const OAICollection_of_driveItems); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } if (d->odata_next_link_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_driveItems::isValid() const { Q_D(const OAICollection_of_driveItems); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_driveItems.h000066400000000000000000000035211442421066000260670ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_driveItems.h * * */ #ifndef OAICollection_of_driveItems_H #define OAICollection_of_driveItems_H #include #include "OAIDriveItem.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIDriveItem; class OAICollection_of_driveItemsPrivate; class OAICollection_of_driveItems : public OAIObject { public: OAICollection_of_driveItems(); OAICollection_of_driveItems(const OAICollection_of_driveItems &other); OAICollection_of_driveItems(QString json); ~OAICollection_of_driveItems() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; QString getOdataNextLink() const; void setOdataNextLink(const QString &odata_next_link); bool is_odata_next_link_Set() const; bool is_odata_next_link_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_driveItems) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_driveItems) #endif // OAICollection_of_driveItems_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_drives.cpp000066400000000000000000000115471442421066000256120ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_drives.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_drivesPrivate { friend class OAICollection_of_drives; QList value; bool value_isSet; bool value_isValid; QString odata_next_link; bool odata_next_link_isSet; bool odata_next_link_isValid; }; OAICollection_of_drives::OAICollection_of_drives() : d_ptr() { } OAICollection_of_drives::OAICollection_of_drives(const OAICollection_of_drives& other) : d_ptr(other.d_ptr) { } OAICollection_of_drives::OAICollection_of_drives(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_drives::~OAICollection_of_drives() = default; void OAICollection_of_drives::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_drivesPrivate{}); Q_D(OAICollection_of_drives); d->value_isSet = false; d->value_isValid = false; d->odata_next_link_isSet = false; d->odata_next_link_isValid = false; } } void OAICollection_of_drives::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_drives::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_drives); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; d->odata_next_link_isValid = ::OpenAPI::fromJsonValue(d->odata_next_link, json[QString("@odata.nextLink")]); d->odata_next_link_isSet = !json[QString("@odata.nextLink")].isNull() && d->odata_next_link_isValid; } QString OAICollection_of_drives::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_drives::asJsonObject() const { Q_D(const OAICollection_of_drives); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } if (d->odata_next_link_isSet) { obj.insert(QString("@odata.nextLink"), ::OpenAPI::toJsonValue(d->odata_next_link)); } return obj; } QList OAICollection_of_drives::getValue() const { Q_D(const OAICollection_of_drives); if(!d){ return {}; } return d->value; } void OAICollection_of_drives::setValue(const QList &value) { Q_D(OAICollection_of_drives); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_drives::is_value_Set() const{ Q_D(const OAICollection_of_drives); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_drives::is_value_Valid() const{ Q_D(const OAICollection_of_drives); if(!d){ return false; } return d->value_isValid; } QString OAICollection_of_drives::getOdataNextLink() const { Q_D(const OAICollection_of_drives); if(!d){ return {}; } return d->odata_next_link; } void OAICollection_of_drives::setOdataNextLink(const QString &odata_next_link) { Q_D(OAICollection_of_drives); Q_ASSERT(d); d->odata_next_link = odata_next_link; d->odata_next_link_isSet = true; } bool OAICollection_of_drives::is_odata_next_link_Set() const{ Q_D(const OAICollection_of_drives); if(!d){ return false; } return d->odata_next_link_isSet; } bool OAICollection_of_drives::is_odata_next_link_Valid() const{ Q_D(const OAICollection_of_drives); if(!d){ return false; } return d->odata_next_link_isValid; } bool OAICollection_of_drives::isSet() const { Q_D(const OAICollection_of_drives); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } if (d->odata_next_link_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_drives::isValid() const { Q_D(const OAICollection_of_drives); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_drives.h000066400000000000000000000034111442421066000252460ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_drives.h * * */ #ifndef OAICollection_of_drives_H #define OAICollection_of_drives_H #include #include "OAIDrive.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIDrive; class OAICollection_of_drivesPrivate; class OAICollection_of_drives : public OAIObject { public: OAICollection_of_drives(); OAICollection_of_drives(const OAICollection_of_drives &other); OAICollection_of_drives(QString json); ~OAICollection_of_drives() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; QString getOdataNextLink() const; void setOdataNextLink(const QString &odata_next_link); bool is_odata_next_link_Set() const; bool is_odata_next_link_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_drives) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_drives) #endif // OAICollection_of_drives_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_drives_1.cpp000066400000000000000000000070621442421066000260270ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_drives_1.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_drives_1Private { friend class OAICollection_of_drives_1; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_drives_1::OAICollection_of_drives_1() : d_ptr() { } OAICollection_of_drives_1::OAICollection_of_drives_1(const OAICollection_of_drives_1& other) : d_ptr(other.d_ptr) { } OAICollection_of_drives_1::OAICollection_of_drives_1(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_drives_1::~OAICollection_of_drives_1() = default; void OAICollection_of_drives_1::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_drives_1Private{}); Q_D(OAICollection_of_drives_1); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_drives_1::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_drives_1::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_drives_1); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_drives_1::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_drives_1::asJsonObject() const { Q_D(const OAICollection_of_drives_1); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_drives_1::getValue() const { Q_D(const OAICollection_of_drives_1); if(!d){ return {}; } return d->value; } void OAICollection_of_drives_1::setValue(const QList &value) { Q_D(OAICollection_of_drives_1); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_drives_1::is_value_Set() const{ Q_D(const OAICollection_of_drives_1); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_drives_1::is_value_Valid() const{ Q_D(const OAICollection_of_drives_1); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_drives_1::isSet() const { Q_D(const OAICollection_of_drives_1); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_drives_1::isValid() const { Q_D(const OAICollection_of_drives_1); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_drives_1.h000066400000000000000000000031341442421066000254700ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_drives_1.h * * */ #ifndef OAICollection_of_drives_1_H #define OAICollection_of_drives_1_H #include #include "OAIDrive.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIDrive; class OAICollection_of_drives_1Private; class OAICollection_of_drives_1 : public OAIObject { public: OAICollection_of_drives_1(); OAICollection_of_drives_1(const OAICollection_of_drives_1 &other); OAICollection_of_drives_1(QString json); ~OAICollection_of_drives_1() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_drives_1) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_drives_1) #endif // OAICollection_of_drives_1_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_educationClass.cpp000066400000000000000000000074231442421066000272550ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_educationClass.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_educationClassPrivate { friend class OAICollection_of_educationClass; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_educationClass::OAICollection_of_educationClass() : d_ptr() { } OAICollection_of_educationClass::OAICollection_of_educationClass(const OAICollection_of_educationClass& other) : d_ptr(other.d_ptr) { } OAICollection_of_educationClass::OAICollection_of_educationClass(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_educationClass::~OAICollection_of_educationClass() = default; void OAICollection_of_educationClass::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_educationClassPrivate{}); Q_D(OAICollection_of_educationClass); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_educationClass::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_educationClass::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_educationClass); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_educationClass::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_educationClass::asJsonObject() const { Q_D(const OAICollection_of_educationClass); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_educationClass::getValue() const { Q_D(const OAICollection_of_educationClass); if(!d){ return {}; } return d->value; } void OAICollection_of_educationClass::setValue(const QList &value) { Q_D(OAICollection_of_educationClass); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_educationClass::is_value_Set() const{ Q_D(const OAICollection_of_educationClass); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_educationClass::is_value_Valid() const{ Q_D(const OAICollection_of_educationClass); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_educationClass::isSet() const { Q_D(const OAICollection_of_educationClass); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_educationClass::isValid() const { Q_D(const OAICollection_of_educationClass); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_educationClass.h000066400000000000000000000033241442421066000267160ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_educationClass.h * * */ #ifndef OAICollection_of_educationClass_H #define OAICollection_of_educationClass_H #include #include "OAIEducationClass.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationClass; class OAICollection_of_educationClassPrivate; class OAICollection_of_educationClass : public OAIObject { public: OAICollection_of_educationClass(); OAICollection_of_educationClass(const OAICollection_of_educationClass &other); OAICollection_of_educationClass(QString json); ~OAICollection_of_educationClass() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_educationClass) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_educationClass) #endif // OAICollection_of_educationClass_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_educationUser.cpp000066400000000000000000000073571442421066000271340ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_educationUser.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_educationUserPrivate { friend class OAICollection_of_educationUser; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_educationUser::OAICollection_of_educationUser() : d_ptr() { } OAICollection_of_educationUser::OAICollection_of_educationUser(const OAICollection_of_educationUser& other) : d_ptr(other.d_ptr) { } OAICollection_of_educationUser::OAICollection_of_educationUser(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_educationUser::~OAICollection_of_educationUser() = default; void OAICollection_of_educationUser::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_educationUserPrivate{}); Q_D(OAICollection_of_educationUser); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_educationUser::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_educationUser::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_educationUser); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_educationUser::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_educationUser::asJsonObject() const { Q_D(const OAICollection_of_educationUser); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_educationUser::getValue() const { Q_D(const OAICollection_of_educationUser); if(!d){ return {}; } return d->value; } void OAICollection_of_educationUser::setValue(const QList &value) { Q_D(OAICollection_of_educationUser); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_educationUser::is_value_Set() const{ Q_D(const OAICollection_of_educationUser); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_educationUser::is_value_Valid() const{ Q_D(const OAICollection_of_educationUser); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_educationUser::isSet() const { Q_D(const OAICollection_of_educationUser); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_educationUser::isValid() const { Q_D(const OAICollection_of_educationUser); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_educationUser.h000066400000000000000000000033021442421066000265630ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_educationUser.h * * */ #ifndef OAICollection_of_educationUser_H #define OAICollection_of_educationUser_H #include #include "OAIEducationUser.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationUser; class OAICollection_of_educationUserPrivate; class OAICollection_of_educationUser : public OAIObject { public: OAICollection_of_educationUser(); OAICollection_of_educationUser(const OAICollection_of_educationUser &other); OAICollection_of_educationUser(QString json); ~OAICollection_of_educationUser() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_educationUser) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_educationUser) #endif // OAICollection_of_educationUser_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_educationUser_1.cpp000066400000000000000000000074641442421066000273530ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_educationUser_1.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_educationUser_1Private { friend class OAICollection_of_educationUser_1; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_educationUser_1::OAICollection_of_educationUser_1() : d_ptr() { } OAICollection_of_educationUser_1::OAICollection_of_educationUser_1(const OAICollection_of_educationUser_1& other) : d_ptr(other.d_ptr) { } OAICollection_of_educationUser_1::OAICollection_of_educationUser_1(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_educationUser_1::~OAICollection_of_educationUser_1() = default; void OAICollection_of_educationUser_1::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_educationUser_1Private{}); Q_D(OAICollection_of_educationUser_1); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_educationUser_1::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_educationUser_1::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_educationUser_1); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_educationUser_1::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_educationUser_1::asJsonObject() const { Q_D(const OAICollection_of_educationUser_1); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_educationUser_1::getValue() const { Q_D(const OAICollection_of_educationUser_1); if(!d){ return {}; } return d->value; } void OAICollection_of_educationUser_1::setValue(const QList &value) { Q_D(OAICollection_of_educationUser_1); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_educationUser_1::is_value_Set() const{ Q_D(const OAICollection_of_educationUser_1); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_educationUser_1::is_value_Valid() const{ Q_D(const OAICollection_of_educationUser_1); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_educationUser_1::isSet() const { Q_D(const OAICollection_of_educationUser_1); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_educationUser_1::isValid() const { Q_D(const OAICollection_of_educationUser_1); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_educationUser_1.h000066400000000000000000000033421442421066000270070ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_educationUser_1.h * * */ #ifndef OAICollection_of_educationUser_1_H #define OAICollection_of_educationUser_1_H #include #include "OAIEducationClass.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationClass; class OAICollection_of_educationUser_1Private; class OAICollection_of_educationUser_1 : public OAIObject { public: OAICollection_of_educationUser_1(); OAICollection_of_educationUser_1(const OAICollection_of_educationUser_1 &other); OAICollection_of_educationUser_1(QString json); ~OAICollection_of_educationUser_1() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_educationUser_1) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_educationUser_1) #endif // OAICollection_of_educationUser_1_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_group.cpp000066400000000000000000000114761442421066000254530ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_group.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_groupPrivate { friend class OAICollection_of_group; QList value; bool value_isSet; bool value_isValid; QString odata_next_link; bool odata_next_link_isSet; bool odata_next_link_isValid; }; OAICollection_of_group::OAICollection_of_group() : d_ptr() { } OAICollection_of_group::OAICollection_of_group(const OAICollection_of_group& other) : d_ptr(other.d_ptr) { } OAICollection_of_group::OAICollection_of_group(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_group::~OAICollection_of_group() = default; void OAICollection_of_group::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_groupPrivate{}); Q_D(OAICollection_of_group); d->value_isSet = false; d->value_isValid = false; d->odata_next_link_isSet = false; d->odata_next_link_isValid = false; } } void OAICollection_of_group::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_group::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_group); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; d->odata_next_link_isValid = ::OpenAPI::fromJsonValue(d->odata_next_link, json[QString("@odata.nextLink")]); d->odata_next_link_isSet = !json[QString("@odata.nextLink")].isNull() && d->odata_next_link_isValid; } QString OAICollection_of_group::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_group::asJsonObject() const { Q_D(const OAICollection_of_group); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } if (d->odata_next_link_isSet) { obj.insert(QString("@odata.nextLink"), ::OpenAPI::toJsonValue(d->odata_next_link)); } return obj; } QList OAICollection_of_group::getValue() const { Q_D(const OAICollection_of_group); if(!d){ return {}; } return d->value; } void OAICollection_of_group::setValue(const QList &value) { Q_D(OAICollection_of_group); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_group::is_value_Set() const{ Q_D(const OAICollection_of_group); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_group::is_value_Valid() const{ Q_D(const OAICollection_of_group); if(!d){ return false; } return d->value_isValid; } QString OAICollection_of_group::getOdataNextLink() const { Q_D(const OAICollection_of_group); if(!d){ return {}; } return d->odata_next_link; } void OAICollection_of_group::setOdataNextLink(const QString &odata_next_link) { Q_D(OAICollection_of_group); Q_ASSERT(d); d->odata_next_link = odata_next_link; d->odata_next_link_isSet = true; } bool OAICollection_of_group::is_odata_next_link_Set() const{ Q_D(const OAICollection_of_group); if(!d){ return false; } return d->odata_next_link_isSet; } bool OAICollection_of_group::is_odata_next_link_Valid() const{ Q_D(const OAICollection_of_group); if(!d){ return false; } return d->odata_next_link_isValid; } bool OAICollection_of_group::isSet() const { Q_D(const OAICollection_of_group); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } if (d->odata_next_link_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_group::isValid() const { Q_D(const OAICollection_of_group); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_group.h000066400000000000000000000033731442421066000251150ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_group.h * * */ #ifndef OAICollection_of_group_H #define OAICollection_of_group_H #include #include "OAIGroup.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIGroup; class OAICollection_of_groupPrivate; class OAICollection_of_group : public OAIObject { public: OAICollection_of_group(); OAICollection_of_group(const OAICollection_of_group &other); OAICollection_of_group(QString json); ~OAICollection_of_group() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; QString getOdataNextLink() const; void setOdataNextLink(const QString &odata_next_link); bool is_odata_next_link_Set() const; bool is_odata_next_link_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_group) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_group) #endif // OAICollection_of_group_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_schools.cpp000066400000000000000000000070571442421066000257710ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_schools.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_schoolsPrivate { friend class OAICollection_of_schools; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_schools::OAICollection_of_schools() : d_ptr() { } OAICollection_of_schools::OAICollection_of_schools(const OAICollection_of_schools& other) : d_ptr(other.d_ptr) { } OAICollection_of_schools::OAICollection_of_schools(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_schools::~OAICollection_of_schools() = default; void OAICollection_of_schools::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_schoolsPrivate{}); Q_D(OAICollection_of_schools); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_schools::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_schools::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_schools); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_schools::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_schools::asJsonObject() const { Q_D(const OAICollection_of_schools); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_schools::getValue() const { Q_D(const OAICollection_of_schools); if(!d){ return {}; } return d->value; } void OAICollection_of_schools::setValue(const QList &value) { Q_D(OAICollection_of_schools); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_schools::is_value_Set() const{ Q_D(const OAICollection_of_schools); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_schools::is_value_Valid() const{ Q_D(const OAICollection_of_schools); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_schools::isSet() const { Q_D(const OAICollection_of_schools); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_schools::isValid() const { Q_D(const OAICollection_of_schools); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_schools.h000066400000000000000000000031661442421066000254330ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_schools.h * * */ #ifndef OAICollection_of_schools_H #define OAICollection_of_schools_H #include #include "OAIEducationSchool.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationSchool; class OAICollection_of_schoolsPrivate; class OAICollection_of_schools : public OAIObject { public: OAICollection_of_schools(); OAICollection_of_schools(const OAICollection_of_schools &other); OAICollection_of_schools(QString json); ~OAICollection_of_schools() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_schools) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_schools) #endif // OAICollection_of_schools_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_tags.cpp000066400000000000000000000066531442421066000252560ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_tags.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_tagsPrivate { friend class OAICollection_of_tags; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_tags::OAICollection_of_tags() : d_ptr() { } OAICollection_of_tags::OAICollection_of_tags(const OAICollection_of_tags& other) : d_ptr(other.d_ptr) { } OAICollection_of_tags::OAICollection_of_tags(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_tags::~OAICollection_of_tags() = default; void OAICollection_of_tags::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_tagsPrivate{}); Q_D(OAICollection_of_tags); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_tags::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_tags::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_tags); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_tags::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_tags::asJsonObject() const { Q_D(const OAICollection_of_tags); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_tags::getValue() const { Q_D(const OAICollection_of_tags); if(!d){ return {}; } return d->value; } void OAICollection_of_tags::setValue(const QList &value) { Q_D(OAICollection_of_tags); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_tags::is_value_Set() const{ Q_D(const OAICollection_of_tags); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_tags::is_value_Valid() const{ Q_D(const OAICollection_of_tags); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_tags::isSet() const { Q_D(const OAICollection_of_tags); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_tags::isValid() const { Q_D(const OAICollection_of_tags); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_tags.h000066400000000000000000000030171442421066000247120ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_tags.h * * */ #ifndef OAICollection_of_tags_H #define OAICollection_of_tags_H #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAICollection_of_tagsPrivate; class OAICollection_of_tags : public OAIObject { public: OAICollection_of_tags(); OAICollection_of_tags(const OAICollection_of_tags &other); OAICollection_of_tags(QString json); ~OAICollection_of_tags() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_tags) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_tags) #endif // OAICollection_of_tags_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_user.cpp000066400000000000000000000114221442421066000252640ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_user.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_userPrivate { friend class OAICollection_of_user; QList value; bool value_isSet; bool value_isValid; QString odata_next_link; bool odata_next_link_isSet; bool odata_next_link_isValid; }; OAICollection_of_user::OAICollection_of_user() : d_ptr() { } OAICollection_of_user::OAICollection_of_user(const OAICollection_of_user& other) : d_ptr(other.d_ptr) { } OAICollection_of_user::OAICollection_of_user(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_user::~OAICollection_of_user() = default; void OAICollection_of_user::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_userPrivate{}); Q_D(OAICollection_of_user); d->value_isSet = false; d->value_isValid = false; d->odata_next_link_isSet = false; d->odata_next_link_isValid = false; } } void OAICollection_of_user::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_user::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_user); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; d->odata_next_link_isValid = ::OpenAPI::fromJsonValue(d->odata_next_link, json[QString("@odata.nextLink")]); d->odata_next_link_isSet = !json[QString("@odata.nextLink")].isNull() && d->odata_next_link_isValid; } QString OAICollection_of_user::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_user::asJsonObject() const { Q_D(const OAICollection_of_user); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } if (d->odata_next_link_isSet) { obj.insert(QString("@odata.nextLink"), ::OpenAPI::toJsonValue(d->odata_next_link)); } return obj; } QList OAICollection_of_user::getValue() const { Q_D(const OAICollection_of_user); if(!d){ return {}; } return d->value; } void OAICollection_of_user::setValue(const QList &value) { Q_D(OAICollection_of_user); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_user::is_value_Set() const{ Q_D(const OAICollection_of_user); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_user::is_value_Valid() const{ Q_D(const OAICollection_of_user); if(!d){ return false; } return d->value_isValid; } QString OAICollection_of_user::getOdataNextLink() const { Q_D(const OAICollection_of_user); if(!d){ return {}; } return d->odata_next_link; } void OAICollection_of_user::setOdataNextLink(const QString &odata_next_link) { Q_D(OAICollection_of_user); Q_ASSERT(d); d->odata_next_link = odata_next_link; d->odata_next_link_isSet = true; } bool OAICollection_of_user::is_odata_next_link_Set() const{ Q_D(const OAICollection_of_user); if(!d){ return false; } return d->odata_next_link_isSet; } bool OAICollection_of_user::is_odata_next_link_Valid() const{ Q_D(const OAICollection_of_user); if(!d){ return false; } return d->odata_next_link_isValid; } bool OAICollection_of_user::isSet() const { Q_D(const OAICollection_of_user); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } if (d->odata_next_link_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_user::isValid() const { Q_D(const OAICollection_of_user); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_user.h000066400000000000000000000033511442421066000247330ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_user.h * * */ #ifndef OAICollection_of_user_H #define OAICollection_of_user_H #include #include "OAIUser.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIUser; class OAICollection_of_userPrivate; class OAICollection_of_user : public OAIObject { public: OAICollection_of_user(); OAICollection_of_user(const OAICollection_of_user &other); OAICollection_of_user(QString json); ~OAICollection_of_user() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; QString getOdataNextLink() const; void setOdataNextLink(const QString &odata_next_link); bool is_odata_next_link_Set() const; bool is_odata_next_link_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_user) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_user) #endif // OAICollection_of_user_H libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_users.cpp000066400000000000000000000067141442421066000254570ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAICollection_of_users.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAICollection_of_usersPrivate { friend class OAICollection_of_users; QList value; bool value_isSet; bool value_isValid; }; OAICollection_of_users::OAICollection_of_users() : d_ptr() { } OAICollection_of_users::OAICollection_of_users(const OAICollection_of_users& other) : d_ptr(other.d_ptr) { } OAICollection_of_users::OAICollection_of_users(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAICollection_of_users::~OAICollection_of_users() = default; void OAICollection_of_users::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAICollection_of_usersPrivate{}); Q_D(OAICollection_of_users); d->value_isSet = false; d->value_isValid = false; } } void OAICollection_of_users::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAICollection_of_users::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAICollection_of_users); d->value_isValid = ::OpenAPI::fromJsonValue(d->value, json[QString("value")]); d->value_isSet = !json[QString("value")].isNull() && d->value_isValid; } QString OAICollection_of_users::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAICollection_of_users::asJsonObject() const { Q_D(const OAICollection_of_users); if(!d){ return {}; } QJsonObject obj; if (d->value.size() > 0) { obj.insert(QString("value"), ::OpenAPI::toJsonValue(d->value)); } return obj; } QList OAICollection_of_users::getValue() const { Q_D(const OAICollection_of_users); if(!d){ return {}; } return d->value; } void OAICollection_of_users::setValue(const QList &value) { Q_D(OAICollection_of_users); Q_ASSERT(d); d->value = value; d->value_isSet = true; } bool OAICollection_of_users::is_value_Set() const{ Q_D(const OAICollection_of_users); if(!d){ return false; } return d->value_isSet; } bool OAICollection_of_users::is_value_Valid() const{ Q_D(const OAICollection_of_users); if(!d){ return false; } return d->value_isValid; } bool OAICollection_of_users::isSet() const { Q_D(const OAICollection_of_users); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->value.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAICollection_of_users::isValid() const { Q_D(const OAICollection_of_users); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAICollection_of_users.h000066400000000000000000000030561442421066000251200ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAICollection_of_users.h * * */ #ifndef OAICollection_of_users_H #define OAICollection_of_users_H #include #include "OAIUser.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIUser; class OAICollection_of_usersPrivate; class OAICollection_of_users : public OAIObject { public: OAICollection_of_users(); OAICollection_of_users(const OAICollection_of_users &other); OAICollection_of_users(QString json); ~OAICollection_of_users() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QList getValue() const; void setValue(const QList &value); bool is_value_Set() const; bool is_value_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAICollection_of_users) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAICollection_of_users) #endif // OAICollection_of_users_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIDeleted.cpp000066400000000000000000000060411442421066000230160ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDeleted.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIDeletedPrivate { friend class OAIDeleted; QString state; bool state_isSet; bool state_isValid; }; OAIDeleted::OAIDeleted() : d_ptr() { } OAIDeleted::OAIDeleted(const OAIDeleted& other) : d_ptr(other.d_ptr) { } OAIDeleted::OAIDeleted(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIDeleted::~OAIDeleted() = default; void OAIDeleted::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIDeletedPrivate{}); Q_D(OAIDeleted); d->state_isSet = false; d->state_isValid = false; } } void OAIDeleted::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIDeleted::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIDeleted); d->state_isValid = ::OpenAPI::fromJsonValue(d->state, json[QString("state")]); d->state_isSet = !json[QString("state")].isNull() && d->state_isValid; } QString OAIDeleted::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIDeleted::asJsonObject() const { Q_D(const OAIDeleted); if(!d){ return {}; } QJsonObject obj; if (d->state_isSet) { obj.insert(QString("state"), ::OpenAPI::toJsonValue(d->state)); } return obj; } QString OAIDeleted::getState() const { Q_D(const OAIDeleted); if(!d){ return {}; } return d->state; } void OAIDeleted::setState(const QString &state) { Q_D(OAIDeleted); Q_ASSERT(d); d->state = state; d->state_isSet = true; } bool OAIDeleted::is_state_Set() const{ Q_D(const OAIDeleted); if(!d){ return false; } return d->state_isSet; } bool OAIDeleted::is_state_Valid() const{ Q_D(const OAIDeleted); if(!d){ return false; } return d->state_isValid; } bool OAIDeleted::isSet() const { Q_D(const OAIDeleted); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->state_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIDeleted::isValid() const { Q_D(const OAIDeleted); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDeleted.h000066400000000000000000000026211442421066000224630ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIDeleted.h * * Information about the deleted state of the item. Read-only. */ #ifndef OAIDeleted_H #define OAIDeleted_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIDeletedPrivate; class OAIDeleted : public OAIObject { public: OAIDeleted(); OAIDeleted(const OAIDeleted &other); OAIDeleted(QString json); ~OAIDeleted() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getState() const; void setState(const QString &state); bool is_state_Set() const; bool is_state_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIDeleted) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIDeleted) #endif // OAIDeleted_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIDirectoryObject.cpp000066400000000000000000000111361442421066000245440ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDirectoryObject.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIDirectoryObjectPrivate { friend class OAIDirectoryObject; QString id; bool id_isSet; bool id_isValid; QDateTime deleted_date_time; bool deleted_date_time_isSet; bool deleted_date_time_isValid; }; OAIDirectoryObject::OAIDirectoryObject() : d_ptr() { } OAIDirectoryObject::OAIDirectoryObject(const OAIDirectoryObject& other) : d_ptr(other.d_ptr) { } OAIDirectoryObject::OAIDirectoryObject(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIDirectoryObject::~OAIDirectoryObject() = default; void OAIDirectoryObject::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIDirectoryObjectPrivate{}); Q_D(OAIDirectoryObject); d->id_isSet = false; d->id_isValid = false; d->deleted_date_time_isSet = false; d->deleted_date_time_isValid = false; } } void OAIDirectoryObject::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIDirectoryObject::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIDirectoryObject); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->deleted_date_time_isValid = ::OpenAPI::fromJsonValue(d->deleted_date_time, json[QString("deletedDateTime")]); d->deleted_date_time_isSet = !json[QString("deletedDateTime")].isNull() && d->deleted_date_time_isValid; } QString OAIDirectoryObject::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIDirectoryObject::asJsonObject() const { Q_D(const OAIDirectoryObject); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->deleted_date_time_isSet) { obj.insert(QString("deletedDateTime"), ::OpenAPI::toJsonValue(d->deleted_date_time)); } return obj; } QString OAIDirectoryObject::getId() const { Q_D(const OAIDirectoryObject); if(!d){ return {}; } return d->id; } void OAIDirectoryObject::setId(const QString &id) { Q_D(OAIDirectoryObject); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIDirectoryObject::is_id_Set() const{ Q_D(const OAIDirectoryObject); if(!d){ return false; } return d->id_isSet; } bool OAIDirectoryObject::is_id_Valid() const{ Q_D(const OAIDirectoryObject); if(!d){ return false; } return d->id_isValid; } QDateTime OAIDirectoryObject::getDeletedDateTime() const { Q_D(const OAIDirectoryObject); if(!d){ return {}; } return d->deleted_date_time; } void OAIDirectoryObject::setDeletedDateTime(const QDateTime &deleted_date_time) { Q_D(OAIDirectoryObject); Q_ASSERT(d); d->deleted_date_time = deleted_date_time; d->deleted_date_time_isSet = true; } bool OAIDirectoryObject::is_deleted_date_time_Set() const{ Q_D(const OAIDirectoryObject); if(!d){ return false; } return d->deleted_date_time_isSet; } bool OAIDirectoryObject::is_deleted_date_time_Valid() const{ Q_D(const OAIDirectoryObject); if(!d){ return false; } return d->deleted_date_time_isValid; } bool OAIDirectoryObject::isSet() const { Q_D(const OAIDirectoryObject); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->deleted_date_time_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIDirectoryObject::isValid() const { Q_D(const OAIDirectoryObject); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDirectoryObject.h000066400000000000000000000032711442421066000242120ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIDirectoryObject.h * * Represents a Directory object. Read-only. */ #ifndef OAIDirectoryObject_H #define OAIDirectoryObject_H #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIDirectoryObjectPrivate; class OAIDirectoryObject : public OAIObject { public: OAIDirectoryObject(); OAIDirectoryObject(const OAIDirectoryObject &other); OAIDirectoryObject(QString json); ~OAIDirectoryObject() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QDateTime getDeletedDateTime() const; void setDeletedDateTime(const QDateTime &deleted_date_time); bool is_deleted_date_time_Set() const; bool is_deleted_date_time_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIDirectoryObject) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIDirectoryObject) #endif // OAIDirectoryObject_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrive.cpp000066400000000000000000000517671442421066000225400ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDrive.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIDrivePrivate { friend class OAIDrive; QString id; bool id_isSet; bool id_isValid; OAIIdentitySet created_by; bool created_by_isSet; bool created_by_isValid; QDateTime created_date_time; bool created_date_time_isSet; bool created_date_time_isValid; QString description; bool description_isSet; bool description_isValid; QString e_tag; bool e_tag_isSet; bool e_tag_isValid; OAIIdentitySet last_modified_by; bool last_modified_by_isSet; bool last_modified_by_isValid; QDateTime last_modified_date_time; bool last_modified_date_time_isSet; bool last_modified_date_time_isValid; QString name; bool name_isSet; bool name_isValid; OAIItemReference parent_reference; bool parent_reference_isSet; bool parent_reference_isValid; QString web_url; bool web_url_isSet; bool web_url_isValid; QString drive_type; bool drive_type_isSet; bool drive_type_isValid; QString drive_alias; bool drive_alias_isSet; bool drive_alias_isValid; OAIIdentitySet owner; bool owner_isSet; bool owner_isValid; OAIQuota quota; bool quota_isSet; bool quota_isValid; QList items; bool items_isSet; bool items_isValid; OAIDriveItem root; bool root_isSet; bool root_isValid; QList special; bool special_isSet; bool special_isValid; }; OAIDrive::OAIDrive() : d_ptr() { } OAIDrive::OAIDrive(const OAIDrive& other) : d_ptr(other.d_ptr) { } OAIDrive::OAIDrive(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIDrive::~OAIDrive() = default; void OAIDrive::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIDrivePrivate{}); Q_D(OAIDrive); d->id_isSet = false; d->id_isValid = false; d->created_by_isSet = false; d->created_by_isValid = false; d->created_date_time_isSet = false; d->created_date_time_isValid = false; d->description_isSet = false; d->description_isValid = false; d->e_tag_isSet = false; d->e_tag_isValid = false; d->last_modified_by_isSet = false; d->last_modified_by_isValid = false; d->last_modified_date_time_isSet = false; d->last_modified_date_time_isValid = false; d->name_isSet = false; d->name_isValid = false; d->parent_reference_isSet = false; d->parent_reference_isValid = false; d->web_url_isSet = false; d->web_url_isValid = false; d->drive_type_isSet = false; d->drive_type_isValid = false; d->drive_alias_isSet = false; d->drive_alias_isValid = false; d->owner_isSet = false; d->owner_isValid = false; d->quota_isSet = false; d->quota_isValid = false; d->items_isSet = false; d->items_isValid = false; d->root_isSet = false; d->root_isValid = false; d->special_isSet = false; d->special_isValid = false; } } void OAIDrive::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIDrive::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIDrive); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->created_by_isValid = ::OpenAPI::fromJsonValue(d->created_by, json[QString("createdBy")]); d->created_by_isSet = !json[QString("createdBy")].isNull() && d->created_by_isValid; d->created_date_time_isValid = ::OpenAPI::fromJsonValue(d->created_date_time, json[QString("createdDateTime")]); d->created_date_time_isSet = !json[QString("createdDateTime")].isNull() && d->created_date_time_isValid; d->description_isValid = ::OpenAPI::fromJsonValue(d->description, json[QString("description")]); d->description_isSet = !json[QString("description")].isNull() && d->description_isValid; d->e_tag_isValid = ::OpenAPI::fromJsonValue(d->e_tag, json[QString("eTag")]); d->e_tag_isSet = !json[QString("eTag")].isNull() && d->e_tag_isValid; d->last_modified_by_isValid = ::OpenAPI::fromJsonValue(d->last_modified_by, json[QString("lastModifiedBy")]); d->last_modified_by_isSet = !json[QString("lastModifiedBy")].isNull() && d->last_modified_by_isValid; d->last_modified_date_time_isValid = ::OpenAPI::fromJsonValue(d->last_modified_date_time, json[QString("lastModifiedDateTime")]); d->last_modified_date_time_isSet = !json[QString("lastModifiedDateTime")].isNull() && d->last_modified_date_time_isValid; d->name_isValid = ::OpenAPI::fromJsonValue(d->name, json[QString("name")]); d->name_isSet = !json[QString("name")].isNull() && d->name_isValid; d->parent_reference_isValid = ::OpenAPI::fromJsonValue(d->parent_reference, json[QString("parentReference")]); d->parent_reference_isSet = !json[QString("parentReference")].isNull() && d->parent_reference_isValid; d->web_url_isValid = ::OpenAPI::fromJsonValue(d->web_url, json[QString("webUrl")]); d->web_url_isSet = !json[QString("webUrl")].isNull() && d->web_url_isValid; d->drive_type_isValid = ::OpenAPI::fromJsonValue(d->drive_type, json[QString("driveType")]); d->drive_type_isSet = !json[QString("driveType")].isNull() && d->drive_type_isValid; d->drive_alias_isValid = ::OpenAPI::fromJsonValue(d->drive_alias, json[QString("driveAlias")]); d->drive_alias_isSet = !json[QString("driveAlias")].isNull() && d->drive_alias_isValid; d->owner_isValid = ::OpenAPI::fromJsonValue(d->owner, json[QString("owner")]); d->owner_isSet = !json[QString("owner")].isNull() && d->owner_isValid; d->quota_isValid = ::OpenAPI::fromJsonValue(d->quota, json[QString("quota")]); d->quota_isSet = !json[QString("quota")].isNull() && d->quota_isValid; d->items_isValid = ::OpenAPI::fromJsonValue(d->items, json[QString("items")]); d->items_isSet = !json[QString("items")].isNull() && d->items_isValid; d->root_isValid = ::OpenAPI::fromJsonValue(d->root, json[QString("root")]); d->root_isSet = !json[QString("root")].isNull() && d->root_isValid; d->special_isValid = ::OpenAPI::fromJsonValue(d->special, json[QString("special")]); d->special_isSet = !json[QString("special")].isNull() && d->special_isValid; } QString OAIDrive::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIDrive::asJsonObject() const { Q_D(const OAIDrive); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->created_by.isSet()) { obj.insert(QString("createdBy"), ::OpenAPI::toJsonValue(d->created_by)); } if (d->created_date_time_isSet) { obj.insert(QString("createdDateTime"), ::OpenAPI::toJsonValue(d->created_date_time)); } if (d->description_isSet) { obj.insert(QString("description"), ::OpenAPI::toJsonValue(d->description)); } if (d->e_tag_isSet) { obj.insert(QString("eTag"), ::OpenAPI::toJsonValue(d->e_tag)); } if (d->last_modified_by.isSet()) { obj.insert(QString("lastModifiedBy"), ::OpenAPI::toJsonValue(d->last_modified_by)); } if (d->last_modified_date_time_isSet) { obj.insert(QString("lastModifiedDateTime"), ::OpenAPI::toJsonValue(d->last_modified_date_time)); } if (d->name_isSet) { obj.insert(QString("name"), ::OpenAPI::toJsonValue(d->name)); } if (d->parent_reference.isSet()) { obj.insert(QString("parentReference"), ::OpenAPI::toJsonValue(d->parent_reference)); } if (d->web_url_isSet) { obj.insert(QString("webUrl"), ::OpenAPI::toJsonValue(d->web_url)); } if (d->drive_type_isSet) { obj.insert(QString("driveType"), ::OpenAPI::toJsonValue(d->drive_type)); } if (d->drive_alias_isSet) { obj.insert(QString("driveAlias"), ::OpenAPI::toJsonValue(d->drive_alias)); } if (d->owner.isSet()) { obj.insert(QString("owner"), ::OpenAPI::toJsonValue(d->owner)); } if (d->quota.isSet()) { obj.insert(QString("quota"), ::OpenAPI::toJsonValue(d->quota)); } if (d->items.size() > 0) { obj.insert(QString("items"), ::OpenAPI::toJsonValue(d->items)); } if (d->root.isSet()) { obj.insert(QString("root"), ::OpenAPI::toJsonValue(d->root)); } if (d->special.size() > 0) { obj.insert(QString("special"), ::OpenAPI::toJsonValue(d->special)); } return obj; } QString OAIDrive::getId() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->id; } void OAIDrive::setId(const QString &id) { Q_D(OAIDrive); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIDrive::is_id_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->id_isSet; } bool OAIDrive::is_id_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->id_isValid; } OAIIdentitySet OAIDrive::getCreatedBy() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->created_by; } void OAIDrive::setCreatedBy(const OAIIdentitySet &created_by) { Q_D(OAIDrive); Q_ASSERT(d); d->created_by = created_by; d->created_by_isSet = true; } bool OAIDrive::is_created_by_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->created_by_isSet; } bool OAIDrive::is_created_by_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->created_by_isValid; } QDateTime OAIDrive::getCreatedDateTime() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->created_date_time; } void OAIDrive::setCreatedDateTime(const QDateTime &created_date_time) { Q_D(OAIDrive); Q_ASSERT(d); d->created_date_time = created_date_time; d->created_date_time_isSet = true; } bool OAIDrive::is_created_date_time_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->created_date_time_isSet; } bool OAIDrive::is_created_date_time_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->created_date_time_isValid; } QString OAIDrive::getDescription() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->description; } void OAIDrive::setDescription(const QString &description) { Q_D(OAIDrive); Q_ASSERT(d); d->description = description; d->description_isSet = true; } bool OAIDrive::is_description_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->description_isSet; } bool OAIDrive::is_description_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->description_isValid; } QString OAIDrive::getETag() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->e_tag; } void OAIDrive::setETag(const QString &e_tag) { Q_D(OAIDrive); Q_ASSERT(d); d->e_tag = e_tag; d->e_tag_isSet = true; } bool OAIDrive::is_e_tag_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->e_tag_isSet; } bool OAIDrive::is_e_tag_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->e_tag_isValid; } OAIIdentitySet OAIDrive::getLastModifiedBy() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->last_modified_by; } void OAIDrive::setLastModifiedBy(const OAIIdentitySet &last_modified_by) { Q_D(OAIDrive); Q_ASSERT(d); d->last_modified_by = last_modified_by; d->last_modified_by_isSet = true; } bool OAIDrive::is_last_modified_by_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->last_modified_by_isSet; } bool OAIDrive::is_last_modified_by_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->last_modified_by_isValid; } QDateTime OAIDrive::getLastModifiedDateTime() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->last_modified_date_time; } void OAIDrive::setLastModifiedDateTime(const QDateTime &last_modified_date_time) { Q_D(OAIDrive); Q_ASSERT(d); d->last_modified_date_time = last_modified_date_time; d->last_modified_date_time_isSet = true; } bool OAIDrive::is_last_modified_date_time_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->last_modified_date_time_isSet; } bool OAIDrive::is_last_modified_date_time_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->last_modified_date_time_isValid; } QString OAIDrive::getName() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->name; } void OAIDrive::setName(const QString &name) { Q_D(OAIDrive); Q_ASSERT(d); d->name = name; d->name_isSet = true; } bool OAIDrive::is_name_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->name_isSet; } bool OAIDrive::is_name_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->name_isValid; } OAIItemReference OAIDrive::getParentReference() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->parent_reference; } void OAIDrive::setParentReference(const OAIItemReference &parent_reference) { Q_D(OAIDrive); Q_ASSERT(d); d->parent_reference = parent_reference; d->parent_reference_isSet = true; } bool OAIDrive::is_parent_reference_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->parent_reference_isSet; } bool OAIDrive::is_parent_reference_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->parent_reference_isValid; } QString OAIDrive::getWebUrl() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->web_url; } void OAIDrive::setWebUrl(const QString &web_url) { Q_D(OAIDrive); Q_ASSERT(d); d->web_url = web_url; d->web_url_isSet = true; } bool OAIDrive::is_web_url_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->web_url_isSet; } bool OAIDrive::is_web_url_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->web_url_isValid; } QString OAIDrive::getDriveType() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->drive_type; } void OAIDrive::setDriveType(const QString &drive_type) { Q_D(OAIDrive); Q_ASSERT(d); d->drive_type = drive_type; d->drive_type_isSet = true; } bool OAIDrive::is_drive_type_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->drive_type_isSet; } bool OAIDrive::is_drive_type_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->drive_type_isValid; } QString OAIDrive::getDriveAlias() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->drive_alias; } void OAIDrive::setDriveAlias(const QString &drive_alias) { Q_D(OAIDrive); Q_ASSERT(d); d->drive_alias = drive_alias; d->drive_alias_isSet = true; } bool OAIDrive::is_drive_alias_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->drive_alias_isSet; } bool OAIDrive::is_drive_alias_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->drive_alias_isValid; } OAIIdentitySet OAIDrive::getOwner() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->owner; } void OAIDrive::setOwner(const OAIIdentitySet &owner) { Q_D(OAIDrive); Q_ASSERT(d); d->owner = owner; d->owner_isSet = true; } bool OAIDrive::is_owner_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->owner_isSet; } bool OAIDrive::is_owner_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->owner_isValid; } OAIQuota OAIDrive::getQuota() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->quota; } void OAIDrive::setQuota(const OAIQuota "a) { Q_D(OAIDrive); Q_ASSERT(d); d->quota = quota; d->quota_isSet = true; } bool OAIDrive::is_quota_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->quota_isSet; } bool OAIDrive::is_quota_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->quota_isValid; } QList OAIDrive::getItems() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->items; } void OAIDrive::setItems(const QList &items) { Q_D(OAIDrive); Q_ASSERT(d); d->items = items; d->items_isSet = true; } bool OAIDrive::is_items_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->items_isSet; } bool OAIDrive::is_items_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->items_isValid; } OAIDriveItem OAIDrive::getRoot() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->root; } void OAIDrive::setRoot(const OAIDriveItem &root) { Q_D(OAIDrive); Q_ASSERT(d); d->root = root; d->root_isSet = true; } bool OAIDrive::is_root_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->root_isSet; } bool OAIDrive::is_root_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->root_isValid; } QList OAIDrive::getSpecial() const { Q_D(const OAIDrive); if(!d){ return {}; } return d->special; } void OAIDrive::setSpecial(const QList &special) { Q_D(OAIDrive); Q_ASSERT(d); d->special = special; d->special_isSet = true; } bool OAIDrive::is_special_Set() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->special_isSet; } bool OAIDrive::is_special_Valid() const{ Q_D(const OAIDrive); if(!d){ return false; } return d->special_isValid; } bool OAIDrive::isSet() const { Q_D(const OAIDrive); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->created_by.isSet()) { isObjectUpdated = true; break; } if (d->created_date_time_isSet) { isObjectUpdated = true; break; } if (d->description_isSet) { isObjectUpdated = true; break; } if (d->e_tag_isSet) { isObjectUpdated = true; break; } if (d->last_modified_by.isSet()) { isObjectUpdated = true; break; } if (d->last_modified_date_time_isSet) { isObjectUpdated = true; break; } if (d->name_isSet) { isObjectUpdated = true; break; } if (d->parent_reference.isSet()) { isObjectUpdated = true; break; } if (d->web_url_isSet) { isObjectUpdated = true; break; } if (d->drive_type_isSet) { isObjectUpdated = true; break; } if (d->drive_alias_isSet) { isObjectUpdated = true; break; } if (d->owner.isSet()) { isObjectUpdated = true; break; } if (d->quota.isSet()) { isObjectUpdated = true; break; } if (d->items.size() > 0) { isObjectUpdated = true; break; } if (d->root.isSet()) { isObjectUpdated = true; break; } if (d->special.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIDrive::isValid() const { Q_D(const OAIDrive); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->name_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrive.h000066400000000000000000000102331442421066000221640ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIDrive.h * * The drive represents a space on the storage. */ #ifndef OAIDrive_H #define OAIDrive_H #include #include "OAIDriveItem.h" #include "OAIIdentitySet.h" #include "OAIItemReference.h" #include "OAIQuota.h" #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentitySet; class OAIItemReference; class OAIQuota; class OAIDriveItem; class OAIDrivePrivate; class OAIDrive : public OAIObject { public: OAIDrive(); OAIDrive(const OAIDrive &other); OAIDrive(QString json); ~OAIDrive() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; OAIIdentitySet getCreatedBy() const; void setCreatedBy(const OAIIdentitySet &created_by); bool is_created_by_Set() const; bool is_created_by_Valid() const; QDateTime getCreatedDateTime() const; void setCreatedDateTime(const QDateTime &created_date_time); bool is_created_date_time_Set() const; bool is_created_date_time_Valid() const; QString getDescription() const; void setDescription(const QString &description); bool is_description_Set() const; bool is_description_Valid() const; QString getETag() const; void setETag(const QString &e_tag); bool is_e_tag_Set() const; bool is_e_tag_Valid() const; OAIIdentitySet getLastModifiedBy() const; void setLastModifiedBy(const OAIIdentitySet &last_modified_by); bool is_last_modified_by_Set() const; bool is_last_modified_by_Valid() const; QDateTime getLastModifiedDateTime() const; void setLastModifiedDateTime(const QDateTime &last_modified_date_time); bool is_last_modified_date_time_Set() const; bool is_last_modified_date_time_Valid() const; QString getName() const; void setName(const QString &name); bool is_name_Set() const; bool is_name_Valid() const; OAIItemReference getParentReference() const; void setParentReference(const OAIItemReference &parent_reference); bool is_parent_reference_Set() const; bool is_parent_reference_Valid() const; QString getWebUrl() const; void setWebUrl(const QString &web_url); bool is_web_url_Set() const; bool is_web_url_Valid() const; QString getDriveType() const; void setDriveType(const QString &drive_type); bool is_drive_type_Set() const; bool is_drive_type_Valid() const; QString getDriveAlias() const; void setDriveAlias(const QString &drive_alias); bool is_drive_alias_Set() const; bool is_drive_alias_Valid() const; OAIIdentitySet getOwner() const; void setOwner(const OAIIdentitySet &owner); bool is_owner_Set() const; bool is_owner_Valid() const; OAIQuota getQuota() const; void setQuota(const OAIQuota "a); bool is_quota_Set() const; bool is_quota_Valid() const; QList getItems() const; void setItems(const QList &items); bool is_items_Set() const; bool is_items_Valid() const; OAIDriveItem getRoot() const; void setRoot(const OAIDriveItem &root); bool is_root_Set() const; bool is_root_Valid() const; QList getSpecial() const; void setSpecial(const QList &special); bool is_special_Set() const; bool is_special_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIDrive) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIDrive) #endif // OAIDrive_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIDriveItem.cpp000066400000000000000000000753331442421066000233520ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDriveItem.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIDriveItemPrivate { friend class OAIDriveItem; QString id; bool id_isSet; bool id_isValid; OAIIdentitySet created_by; bool created_by_isSet; bool created_by_isValid; QDateTime created_date_time; bool created_date_time_isSet; bool created_date_time_isValid; QString description; bool description_isSet; bool description_isValid; QString e_tag; bool e_tag_isSet; bool e_tag_isValid; OAIIdentitySet last_modified_by; bool last_modified_by_isSet; bool last_modified_by_isValid; QDateTime last_modified_date_time; bool last_modified_date_time_isSet; bool last_modified_date_time_isValid; QString name; bool name_isSet; bool name_isValid; OAIItemReference parent_reference; bool parent_reference_isSet; bool parent_reference_isValid; QString web_url; bool web_url_isSet; bool web_url_isValid; QString content; bool content_isSet; bool content_isValid; QString c_tag; bool c_tag_isSet; bool c_tag_isValid; OAIDeleted deleted; bool deleted_isSet; bool deleted_isValid; OAIOpenGraphFile file; bool file_isSet; bool file_isValid; OAIFileSystemInfo file_system_info; bool file_system_info_isSet; bool file_system_info_isValid; OAIFolder folder; bool folder_isSet; bool folder_isValid; OAIImage image; bool image_isSet; bool image_isValid; OAIObject root; bool root_isSet; bool root_isValid; OAITrash trash; bool trash_isSet; bool trash_isValid; OAISpecialFolder special_folder; bool special_folder_isSet; bool special_folder_isValid; OAIRemoteItem remote_item; bool remote_item_isSet; bool remote_item_isValid; qint64 size; bool size_isSet; bool size_isValid; QString web_dav_url; bool web_dav_url_isSet; bool web_dav_url_isValid; QList children; bool children_isSet; bool children_isValid; QList permissions; bool permissions_isSet; bool permissions_isValid; }; OAIDriveItem::OAIDriveItem() : d_ptr() { } OAIDriveItem::OAIDriveItem(const OAIDriveItem& other) : d_ptr(other.d_ptr) { } OAIDriveItem::OAIDriveItem(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIDriveItem::~OAIDriveItem() = default; void OAIDriveItem::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIDriveItemPrivate{}); Q_D(OAIDriveItem); d->id_isSet = false; d->id_isValid = false; d->created_by_isSet = false; d->created_by_isValid = false; d->created_date_time_isSet = false; d->created_date_time_isValid = false; d->description_isSet = false; d->description_isValid = false; d->e_tag_isSet = false; d->e_tag_isValid = false; d->last_modified_by_isSet = false; d->last_modified_by_isValid = false; d->last_modified_date_time_isSet = false; d->last_modified_date_time_isValid = false; d->name_isSet = false; d->name_isValid = false; d->parent_reference_isSet = false; d->parent_reference_isValid = false; d->web_url_isSet = false; d->web_url_isValid = false; d->content_isSet = false; d->content_isValid = false; d->c_tag_isSet = false; d->c_tag_isValid = false; d->deleted_isSet = false; d->deleted_isValid = false; d->file_isSet = false; d->file_isValid = false; d->file_system_info_isSet = false; d->file_system_info_isValid = false; d->folder_isSet = false; d->folder_isValid = false; d->image_isSet = false; d->image_isValid = false; d->root_isSet = false; d->root_isValid = false; d->trash_isSet = false; d->trash_isValid = false; d->special_folder_isSet = false; d->special_folder_isValid = false; d->remote_item_isSet = false; d->remote_item_isValid = false; d->size_isSet = false; d->size_isValid = false; d->web_dav_url_isSet = false; d->web_dav_url_isValid = false; d->children_isSet = false; d->children_isValid = false; d->permissions_isSet = false; d->permissions_isValid = false; } } void OAIDriveItem::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIDriveItem::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIDriveItem); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->created_by_isValid = ::OpenAPI::fromJsonValue(d->created_by, json[QString("createdBy")]); d->created_by_isSet = !json[QString("createdBy")].isNull() && d->created_by_isValid; d->created_date_time_isValid = ::OpenAPI::fromJsonValue(d->created_date_time, json[QString("createdDateTime")]); d->created_date_time_isSet = !json[QString("createdDateTime")].isNull() && d->created_date_time_isValid; d->description_isValid = ::OpenAPI::fromJsonValue(d->description, json[QString("description")]); d->description_isSet = !json[QString("description")].isNull() && d->description_isValid; d->e_tag_isValid = ::OpenAPI::fromJsonValue(d->e_tag, json[QString("eTag")]); d->e_tag_isSet = !json[QString("eTag")].isNull() && d->e_tag_isValid; d->last_modified_by_isValid = ::OpenAPI::fromJsonValue(d->last_modified_by, json[QString("lastModifiedBy")]); d->last_modified_by_isSet = !json[QString("lastModifiedBy")].isNull() && d->last_modified_by_isValid; d->last_modified_date_time_isValid = ::OpenAPI::fromJsonValue(d->last_modified_date_time, json[QString("lastModifiedDateTime")]); d->last_modified_date_time_isSet = !json[QString("lastModifiedDateTime")].isNull() && d->last_modified_date_time_isValid; d->name_isValid = ::OpenAPI::fromJsonValue(d->name, json[QString("name")]); d->name_isSet = !json[QString("name")].isNull() && d->name_isValid; d->parent_reference_isValid = ::OpenAPI::fromJsonValue(d->parent_reference, json[QString("parentReference")]); d->parent_reference_isSet = !json[QString("parentReference")].isNull() && d->parent_reference_isValid; d->web_url_isValid = ::OpenAPI::fromJsonValue(d->web_url, json[QString("webUrl")]); d->web_url_isSet = !json[QString("webUrl")].isNull() && d->web_url_isValid; d->content_isValid = ::OpenAPI::fromJsonValue(d->content, json[QString("content")]); d->content_isSet = !json[QString("content")].isNull() && d->content_isValid; d->c_tag_isValid = ::OpenAPI::fromJsonValue(d->c_tag, json[QString("cTag")]); d->c_tag_isSet = !json[QString("cTag")].isNull() && d->c_tag_isValid; d->deleted_isValid = ::OpenAPI::fromJsonValue(d->deleted, json[QString("deleted")]); d->deleted_isSet = !json[QString("deleted")].isNull() && d->deleted_isValid; d->file_isValid = ::OpenAPI::fromJsonValue(d->file, json[QString("file")]); d->file_isSet = !json[QString("file")].isNull() && d->file_isValid; d->file_system_info_isValid = ::OpenAPI::fromJsonValue(d->file_system_info, json[QString("fileSystemInfo")]); d->file_system_info_isSet = !json[QString("fileSystemInfo")].isNull() && d->file_system_info_isValid; d->folder_isValid = ::OpenAPI::fromJsonValue(d->folder, json[QString("folder")]); d->folder_isSet = !json[QString("folder")].isNull() && d->folder_isValid; d->image_isValid = ::OpenAPI::fromJsonValue(d->image, json[QString("image")]); d->image_isSet = !json[QString("image")].isNull() && d->image_isValid; d->root_isValid = ::OpenAPI::fromJsonValue(d->root, json[QString("root")]); d->root_isSet = !json[QString("root")].isNull() && d->root_isValid; d->trash_isValid = ::OpenAPI::fromJsonValue(d->trash, json[QString("trash")]); d->trash_isSet = !json[QString("trash")].isNull() && d->trash_isValid; d->special_folder_isValid = ::OpenAPI::fromJsonValue(d->special_folder, json[QString("specialFolder")]); d->special_folder_isSet = !json[QString("specialFolder")].isNull() && d->special_folder_isValid; d->remote_item_isValid = ::OpenAPI::fromJsonValue(d->remote_item, json[QString("remoteItem")]); d->remote_item_isSet = !json[QString("remoteItem")].isNull() && d->remote_item_isValid; d->size_isValid = ::OpenAPI::fromJsonValue(d->size, json[QString("size")]); d->size_isSet = !json[QString("size")].isNull() && d->size_isValid; d->web_dav_url_isValid = ::OpenAPI::fromJsonValue(d->web_dav_url, json[QString("webDavUrl")]); d->web_dav_url_isSet = !json[QString("webDavUrl")].isNull() && d->web_dav_url_isValid; d->children_isValid = ::OpenAPI::fromJsonValue(d->children, json[QString("children")]); d->children_isSet = !json[QString("children")].isNull() && d->children_isValid; d->permissions_isValid = ::OpenAPI::fromJsonValue(d->permissions, json[QString("permissions")]); d->permissions_isSet = !json[QString("permissions")].isNull() && d->permissions_isValid; } QString OAIDriveItem::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIDriveItem::asJsonObject() const { Q_D(const OAIDriveItem); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->created_by.isSet()) { obj.insert(QString("createdBy"), ::OpenAPI::toJsonValue(d->created_by)); } if (d->created_date_time_isSet) { obj.insert(QString("createdDateTime"), ::OpenAPI::toJsonValue(d->created_date_time)); } if (d->description_isSet) { obj.insert(QString("description"), ::OpenAPI::toJsonValue(d->description)); } if (d->e_tag_isSet) { obj.insert(QString("eTag"), ::OpenAPI::toJsonValue(d->e_tag)); } if (d->last_modified_by.isSet()) { obj.insert(QString("lastModifiedBy"), ::OpenAPI::toJsonValue(d->last_modified_by)); } if (d->last_modified_date_time_isSet) { obj.insert(QString("lastModifiedDateTime"), ::OpenAPI::toJsonValue(d->last_modified_date_time)); } if (d->name_isSet) { obj.insert(QString("name"), ::OpenAPI::toJsonValue(d->name)); } if (d->parent_reference.isSet()) { obj.insert(QString("parentReference"), ::OpenAPI::toJsonValue(d->parent_reference)); } if (d->web_url_isSet) { obj.insert(QString("webUrl"), ::OpenAPI::toJsonValue(d->web_url)); } if (d->content_isSet) { obj.insert(QString("content"), ::OpenAPI::toJsonValue(d->content)); } if (d->c_tag_isSet) { obj.insert(QString("cTag"), ::OpenAPI::toJsonValue(d->c_tag)); } if (d->deleted.isSet()) { obj.insert(QString("deleted"), ::OpenAPI::toJsonValue(d->deleted)); } if (d->file.isSet()) { obj.insert(QString("file"), ::OpenAPI::toJsonValue(d->file)); } if (d->file_system_info.isSet()) { obj.insert(QString("fileSystemInfo"), ::OpenAPI::toJsonValue(d->file_system_info)); } if (d->folder.isSet()) { obj.insert(QString("folder"), ::OpenAPI::toJsonValue(d->folder)); } if (d->image.isSet()) { obj.insert(QString("image"), ::OpenAPI::toJsonValue(d->image)); } if (d->root_isSet) { obj.insert(QString("root"), ::OpenAPI::toJsonValue(d->root)); } if (d->trash.isSet()) { obj.insert(QString("trash"), ::OpenAPI::toJsonValue(d->trash)); } if (d->special_folder.isSet()) { obj.insert(QString("specialFolder"), ::OpenAPI::toJsonValue(d->special_folder)); } if (d->remote_item.isSet()) { obj.insert(QString("remoteItem"), ::OpenAPI::toJsonValue(d->remote_item)); } if (d->size_isSet) { obj.insert(QString("size"), ::OpenAPI::toJsonValue(d->size)); } if (d->web_dav_url_isSet) { obj.insert(QString("webDavUrl"), ::OpenAPI::toJsonValue(d->web_dav_url)); } if (d->children.size() > 0) { obj.insert(QString("children"), ::OpenAPI::toJsonValue(d->children)); } if (d->permissions.size() > 0) { obj.insert(QString("permissions"), ::OpenAPI::toJsonValue(d->permissions)); } return obj; } QString OAIDriveItem::getId() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->id; } void OAIDriveItem::setId(const QString &id) { Q_D(OAIDriveItem); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIDriveItem::is_id_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->id_isSet; } bool OAIDriveItem::is_id_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->id_isValid; } OAIIdentitySet OAIDriveItem::getCreatedBy() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->created_by; } void OAIDriveItem::setCreatedBy(const OAIIdentitySet &created_by) { Q_D(OAIDriveItem); Q_ASSERT(d); d->created_by = created_by; d->created_by_isSet = true; } bool OAIDriveItem::is_created_by_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->created_by_isSet; } bool OAIDriveItem::is_created_by_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->created_by_isValid; } QDateTime OAIDriveItem::getCreatedDateTime() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->created_date_time; } void OAIDriveItem::setCreatedDateTime(const QDateTime &created_date_time) { Q_D(OAIDriveItem); Q_ASSERT(d); d->created_date_time = created_date_time; d->created_date_time_isSet = true; } bool OAIDriveItem::is_created_date_time_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->created_date_time_isSet; } bool OAIDriveItem::is_created_date_time_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->created_date_time_isValid; } QString OAIDriveItem::getDescription() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->description; } void OAIDriveItem::setDescription(const QString &description) { Q_D(OAIDriveItem); Q_ASSERT(d); d->description = description; d->description_isSet = true; } bool OAIDriveItem::is_description_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->description_isSet; } bool OAIDriveItem::is_description_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->description_isValid; } QString OAIDriveItem::getETag() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->e_tag; } void OAIDriveItem::setETag(const QString &e_tag) { Q_D(OAIDriveItem); Q_ASSERT(d); d->e_tag = e_tag; d->e_tag_isSet = true; } bool OAIDriveItem::is_e_tag_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->e_tag_isSet; } bool OAIDriveItem::is_e_tag_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->e_tag_isValid; } OAIIdentitySet OAIDriveItem::getLastModifiedBy() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->last_modified_by; } void OAIDriveItem::setLastModifiedBy(const OAIIdentitySet &last_modified_by) { Q_D(OAIDriveItem); Q_ASSERT(d); d->last_modified_by = last_modified_by; d->last_modified_by_isSet = true; } bool OAIDriveItem::is_last_modified_by_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->last_modified_by_isSet; } bool OAIDriveItem::is_last_modified_by_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->last_modified_by_isValid; } QDateTime OAIDriveItem::getLastModifiedDateTime() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->last_modified_date_time; } void OAIDriveItem::setLastModifiedDateTime(const QDateTime &last_modified_date_time) { Q_D(OAIDriveItem); Q_ASSERT(d); d->last_modified_date_time = last_modified_date_time; d->last_modified_date_time_isSet = true; } bool OAIDriveItem::is_last_modified_date_time_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->last_modified_date_time_isSet; } bool OAIDriveItem::is_last_modified_date_time_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->last_modified_date_time_isValid; } QString OAIDriveItem::getName() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->name; } void OAIDriveItem::setName(const QString &name) { Q_D(OAIDriveItem); Q_ASSERT(d); d->name = name; d->name_isSet = true; } bool OAIDriveItem::is_name_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->name_isSet; } bool OAIDriveItem::is_name_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->name_isValid; } OAIItemReference OAIDriveItem::getParentReference() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->parent_reference; } void OAIDriveItem::setParentReference(const OAIItemReference &parent_reference) { Q_D(OAIDriveItem); Q_ASSERT(d); d->parent_reference = parent_reference; d->parent_reference_isSet = true; } bool OAIDriveItem::is_parent_reference_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->parent_reference_isSet; } bool OAIDriveItem::is_parent_reference_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->parent_reference_isValid; } QString OAIDriveItem::getWebUrl() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->web_url; } void OAIDriveItem::setWebUrl(const QString &web_url) { Q_D(OAIDriveItem); Q_ASSERT(d); d->web_url = web_url; d->web_url_isSet = true; } bool OAIDriveItem::is_web_url_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->web_url_isSet; } bool OAIDriveItem::is_web_url_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->web_url_isValid; } QString OAIDriveItem::getContent() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->content; } void OAIDriveItem::setContent(const QString &content) { Q_D(OAIDriveItem); Q_ASSERT(d); d->content = content; d->content_isSet = true; } bool OAIDriveItem::is_content_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->content_isSet; } bool OAIDriveItem::is_content_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->content_isValid; } QString OAIDriveItem::getCTag() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->c_tag; } void OAIDriveItem::setCTag(const QString &c_tag) { Q_D(OAIDriveItem); Q_ASSERT(d); d->c_tag = c_tag; d->c_tag_isSet = true; } bool OAIDriveItem::is_c_tag_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->c_tag_isSet; } bool OAIDriveItem::is_c_tag_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->c_tag_isValid; } OAIDeleted OAIDriveItem::getDeleted() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->deleted; } void OAIDriveItem::setDeleted(const OAIDeleted &deleted) { Q_D(OAIDriveItem); Q_ASSERT(d); d->deleted = deleted; d->deleted_isSet = true; } bool OAIDriveItem::is_deleted_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->deleted_isSet; } bool OAIDriveItem::is_deleted_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->deleted_isValid; } OAIOpenGraphFile OAIDriveItem::getFile() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->file; } void OAIDriveItem::setFile(const OAIOpenGraphFile &file) { Q_D(OAIDriveItem); Q_ASSERT(d); d->file = file; d->file_isSet = true; } bool OAIDriveItem::is_file_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->file_isSet; } bool OAIDriveItem::is_file_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->file_isValid; } OAIFileSystemInfo OAIDriveItem::getFileSystemInfo() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->file_system_info; } void OAIDriveItem::setFileSystemInfo(const OAIFileSystemInfo &file_system_info) { Q_D(OAIDriveItem); Q_ASSERT(d); d->file_system_info = file_system_info; d->file_system_info_isSet = true; } bool OAIDriveItem::is_file_system_info_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->file_system_info_isSet; } bool OAIDriveItem::is_file_system_info_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->file_system_info_isValid; } OAIFolder OAIDriveItem::getFolder() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->folder; } void OAIDriveItem::setFolder(const OAIFolder &folder) { Q_D(OAIDriveItem); Q_ASSERT(d); d->folder = folder; d->folder_isSet = true; } bool OAIDriveItem::is_folder_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->folder_isSet; } bool OAIDriveItem::is_folder_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->folder_isValid; } OAIImage OAIDriveItem::getImage() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->image; } void OAIDriveItem::setImage(const OAIImage &image) { Q_D(OAIDriveItem); Q_ASSERT(d); d->image = image; d->image_isSet = true; } bool OAIDriveItem::is_image_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->image_isSet; } bool OAIDriveItem::is_image_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->image_isValid; } OAIObject OAIDriveItem::getRoot() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->root; } void OAIDriveItem::setRoot(const OAIObject &root) { Q_D(OAIDriveItem); Q_ASSERT(d); d->root = root; d->root_isSet = true; } bool OAIDriveItem::is_root_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->root_isSet; } bool OAIDriveItem::is_root_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->root_isValid; } OAITrash OAIDriveItem::getTrash() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->trash; } void OAIDriveItem::setTrash(const OAITrash &trash) { Q_D(OAIDriveItem); Q_ASSERT(d); d->trash = trash; d->trash_isSet = true; } bool OAIDriveItem::is_trash_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->trash_isSet; } bool OAIDriveItem::is_trash_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->trash_isValid; } OAISpecialFolder OAIDriveItem::getSpecialFolder() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->special_folder; } void OAIDriveItem::setSpecialFolder(const OAISpecialFolder &special_folder) { Q_D(OAIDriveItem); Q_ASSERT(d); d->special_folder = special_folder; d->special_folder_isSet = true; } bool OAIDriveItem::is_special_folder_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->special_folder_isSet; } bool OAIDriveItem::is_special_folder_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->special_folder_isValid; } OAIRemoteItem OAIDriveItem::getRemoteItem() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->remote_item; } void OAIDriveItem::setRemoteItem(const OAIRemoteItem &remote_item) { Q_D(OAIDriveItem); Q_ASSERT(d); d->remote_item = remote_item; d->remote_item_isSet = true; } bool OAIDriveItem::is_remote_item_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->remote_item_isSet; } bool OAIDriveItem::is_remote_item_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->remote_item_isValid; } qint64 OAIDriveItem::getSize() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->size; } void OAIDriveItem::setSize(const qint64 &size) { Q_D(OAIDriveItem); Q_ASSERT(d); d->size = size; d->size_isSet = true; } bool OAIDriveItem::is_size_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->size_isSet; } bool OAIDriveItem::is_size_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->size_isValid; } QString OAIDriveItem::getWebDavUrl() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->web_dav_url; } void OAIDriveItem::setWebDavUrl(const QString &web_dav_url) { Q_D(OAIDriveItem); Q_ASSERT(d); d->web_dav_url = web_dav_url; d->web_dav_url_isSet = true; } bool OAIDriveItem::is_web_dav_url_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->web_dav_url_isSet; } bool OAIDriveItem::is_web_dav_url_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->web_dav_url_isValid; } QList OAIDriveItem::getChildren() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->children; } void OAIDriveItem::setChildren(const QList &children) { Q_D(OAIDriveItem); Q_ASSERT(d); d->children = children; d->children_isSet = true; } bool OAIDriveItem::is_children_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->children_isSet; } bool OAIDriveItem::is_children_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->children_isValid; } QList OAIDriveItem::getPermissions() const { Q_D(const OAIDriveItem); if(!d){ return {}; } return d->permissions; } void OAIDriveItem::setPermissions(const QList &permissions) { Q_D(OAIDriveItem); Q_ASSERT(d); d->permissions = permissions; d->permissions_isSet = true; } bool OAIDriveItem::is_permissions_Set() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->permissions_isSet; } bool OAIDriveItem::is_permissions_Valid() const{ Q_D(const OAIDriveItem); if(!d){ return false; } return d->permissions_isValid; } bool OAIDriveItem::isSet() const { Q_D(const OAIDriveItem); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->created_by.isSet()) { isObjectUpdated = true; break; } if (d->created_date_time_isSet) { isObjectUpdated = true; break; } if (d->description_isSet) { isObjectUpdated = true; break; } if (d->e_tag_isSet) { isObjectUpdated = true; break; } if (d->last_modified_by.isSet()) { isObjectUpdated = true; break; } if (d->last_modified_date_time_isSet) { isObjectUpdated = true; break; } if (d->name_isSet) { isObjectUpdated = true; break; } if (d->parent_reference.isSet()) { isObjectUpdated = true; break; } if (d->web_url_isSet) { isObjectUpdated = true; break; } if (d->content_isSet) { isObjectUpdated = true; break; } if (d->c_tag_isSet) { isObjectUpdated = true; break; } if (d->deleted.isSet()) { isObjectUpdated = true; break; } if (d->file.isSet()) { isObjectUpdated = true; break; } if (d->file_system_info.isSet()) { isObjectUpdated = true; break; } if (d->folder.isSet()) { isObjectUpdated = true; break; } if (d->image.isSet()) { isObjectUpdated = true; break; } if (d->root_isSet) { isObjectUpdated = true; break; } if (d->trash.isSet()) { isObjectUpdated = true; break; } if (d->special_folder.isSet()) { isObjectUpdated = true; break; } if (d->remote_item.isSet()) { isObjectUpdated = true; break; } if (d->size_isSet) { isObjectUpdated = true; break; } if (d->web_dav_url_isSet) { isObjectUpdated = true; break; } if (d->children.size() > 0) { isObjectUpdated = true; break; } if (d->permissions.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIDriveItem::isValid() const { Q_D(const OAIDriveItem); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDriveItem.h000066400000000000000000000135121442421066000230060ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIDriveItem.h * * Reprensents a resource inside a drive. Read-only. */ #ifndef OAIDriveItem_H #define OAIDriveItem_H #include #include "OAIDeleted.h" #include "OAIFileSystemInfo.h" #include "OAIFolder.h" #include "OAIIdentitySet.h" #include "OAIImage.h" #include "OAIItemReference.h" #include "OAIObject.h" #include "OAIOpenGraphFile.h" #include "OAIPermission.h" #include "OAIRemoteItem.h" #include "OAISpecialFolder.h" #include "OAITrash.h" #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentitySet; class OAIItemReference; class OAIDeleted; class OAIOpenGraphFile; class OAIFileSystemInfo; class OAIFolder; class OAIImage; class OAITrash; class OAISpecialFolder; class OAIRemoteItem; class OAIPermission; class OAIDriveItemPrivate; class OAIDriveItem : public OAIObject { public: OAIDriveItem(); OAIDriveItem(const OAIDriveItem &other); OAIDriveItem(QString json); ~OAIDriveItem() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; OAIIdentitySet getCreatedBy() const; void setCreatedBy(const OAIIdentitySet &created_by); bool is_created_by_Set() const; bool is_created_by_Valid() const; QDateTime getCreatedDateTime() const; void setCreatedDateTime(const QDateTime &created_date_time); bool is_created_date_time_Set() const; bool is_created_date_time_Valid() const; QString getDescription() const; void setDescription(const QString &description); bool is_description_Set() const; bool is_description_Valid() const; QString getETag() const; void setETag(const QString &e_tag); bool is_e_tag_Set() const; bool is_e_tag_Valid() const; OAIIdentitySet getLastModifiedBy() const; void setLastModifiedBy(const OAIIdentitySet &last_modified_by); bool is_last_modified_by_Set() const; bool is_last_modified_by_Valid() const; QDateTime getLastModifiedDateTime() const; void setLastModifiedDateTime(const QDateTime &last_modified_date_time); bool is_last_modified_date_time_Set() const; bool is_last_modified_date_time_Valid() const; QString getName() const; void setName(const QString &name); bool is_name_Set() const; bool is_name_Valid() const; OAIItemReference getParentReference() const; void setParentReference(const OAIItemReference &parent_reference); bool is_parent_reference_Set() const; bool is_parent_reference_Valid() const; QString getWebUrl() const; void setWebUrl(const QString &web_url); bool is_web_url_Set() const; bool is_web_url_Valid() const; QString getContent() const; void setContent(const QString &content); bool is_content_Set() const; bool is_content_Valid() const; QString getCTag() const; void setCTag(const QString &c_tag); bool is_c_tag_Set() const; bool is_c_tag_Valid() const; OAIDeleted getDeleted() const; void setDeleted(const OAIDeleted &deleted); bool is_deleted_Set() const; bool is_deleted_Valid() const; OAIOpenGraphFile getFile() const; void setFile(const OAIOpenGraphFile &file); bool is_file_Set() const; bool is_file_Valid() const; OAIFileSystemInfo getFileSystemInfo() const; void setFileSystemInfo(const OAIFileSystemInfo &file_system_info); bool is_file_system_info_Set() const; bool is_file_system_info_Valid() const; OAIFolder getFolder() const; void setFolder(const OAIFolder &folder); bool is_folder_Set() const; bool is_folder_Valid() const; OAIImage getImage() const; void setImage(const OAIImage &image); bool is_image_Set() const; bool is_image_Valid() const; OAIObject getRoot() const; void setRoot(const OAIObject &root); bool is_root_Set() const; bool is_root_Valid() const; OAITrash getTrash() const; void setTrash(const OAITrash &trash); bool is_trash_Set() const; bool is_trash_Valid() const; OAISpecialFolder getSpecialFolder() const; void setSpecialFolder(const OAISpecialFolder &special_folder); bool is_special_folder_Set() const; bool is_special_folder_Valid() const; OAIRemoteItem getRemoteItem() const; void setRemoteItem(const OAIRemoteItem &remote_item); bool is_remote_item_Set() const; bool is_remote_item_Valid() const; qint64 getSize() const; void setSize(const qint64 &size); bool is_size_Set() const; bool is_size_Valid() const; QString getWebDavUrl() const; void setWebDavUrl(const QString &web_dav_url); bool is_web_dav_url_Set() const; bool is_web_dav_url_Valid() const; QList getChildren() const; void setChildren(const QList &children); bool is_children_Set() const; bool is_children_Valid() const; QList getPermissions() const; void setPermissions(const QList &permissions); bool is_permissions_Set() const; bool is_permissions_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIDriveItem) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIDriveItem) #endif // OAIDriveItem_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrivesApi.cpp000066400000000000000000000462731442421066000233510ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDrivesApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIDrivesApi::OAIDrivesApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIDrivesApi::~OAIDrivesApi() { } void OAIDrivesApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("createDrive", defaultConf); _serverIndices.insert("createDrive", 0); _serverConfigs.insert("deleteDrive", defaultConf); _serverIndices.insert("deleteDrive", 0); _serverConfigs.insert("getDrive", defaultConf); _serverIndices.insert("getDrive", 0); _serverConfigs.insert("updateDrive", defaultConf); _serverIndices.insert("updateDrive", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIDrivesApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIDrivesApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIDrivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIDrivesApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIDrivesApi::setUsername(const QString &username) { _username = username; } void OAIDrivesApi::setPassword(const QString &password) { _password = password; } void OAIDrivesApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIDrivesApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIDrivesApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIDrivesApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIDrivesApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIDrivesApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIDrivesApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIDrivesApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIDrivesApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIDrivesApi::abortRequests() { emit abortRequestsSignal(); } QString OAIDrivesApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIDrivesApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIDrivesApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIDrivesApi::createDrive(const OAIDrive &oai_drive) { QString fullPath = QString(_serverConfigs["createDrive"][_serverIndices.value("createDrive")].URL()+"/drives"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_drive.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDrivesApi::createDriveCallback); connect(this, &OAIDrivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIDrivesApi::createDriveCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIDrive output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit createDriveSignal(output); emit createDriveSignalFull(worker, output); } else { emit createDriveSignalE(output, error_type, error_str); emit createDriveSignalEFull(worker, error_type, error_str); } } void OAIDrivesApi::deleteDrive(const QString &drive_id, const ::OpenAPI::OptionalParam &if_match) { QString fullPath = QString(_serverConfigs["deleteDrive"][_serverIndices.value("deleteDrive")].URL()+"/drives/{drive-id}"); { QString drive_idPathParam("{"); drive_idPathParam.append("drive-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "drive-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"drive-id"+pathSuffix : pathPrefix; fullPath.replace(drive_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(drive_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); if (if_match.hasValue()) { if (!::OpenAPI::toStringValue(if_match.value()).isEmpty()) { input.headers.insert("If-Match", ::OpenAPI::toStringValue(if_match.value())); } } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDrivesApi::deleteDriveCallback); connect(this, &OAIDrivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIDrivesApi::deleteDriveCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteDriveSignal(); emit deleteDriveSignalFull(worker); } else { emit deleteDriveSignalE(error_type, error_str); emit deleteDriveSignalEFull(worker, error_type, error_str); } } void OAIDrivesApi::getDrive(const QString &drive_id) { QString fullPath = QString(_serverConfigs["getDrive"][_serverIndices.value("getDrive")].URL()+"/drives/{drive-id}"); { QString drive_idPathParam("{"); drive_idPathParam.append("drive-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "drive-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"drive-id"+pathSuffix : pathPrefix; fullPath.replace(drive_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(drive_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDrivesApi::getDriveCallback); connect(this, &OAIDrivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIDrivesApi::getDriveCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIDrive output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getDriveSignal(output); emit getDriveSignalFull(worker, output); } else { emit getDriveSignalE(output, error_type, error_str); emit getDriveSignalEFull(worker, error_type, error_str); } } void OAIDrivesApi::updateDrive(const QString &drive_id, const OAIDrive &oai_drive) { QString fullPath = QString(_serverConfigs["updateDrive"][_serverIndices.value("updateDrive")].URL()+"/drives/{drive-id}"); { QString drive_idPathParam("{"); drive_idPathParam.append("drive-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "drive-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"drive-id"+pathSuffix : pathPrefix; fullPath.replace(drive_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(drive_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PATCH"); { QByteArray output = oai_drive.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDrivesApi::updateDriveCallback); connect(this, &OAIDrivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIDrivesApi::updateDriveCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIDrive output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit updateDriveSignal(output); emit updateDriveSignalFull(worker, output); } else { emit updateDriveSignalE(output, error_type, error_str); emit updateDriveSignalEFull(worker, error_type, error_str); } } void OAIDrivesApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrivesApi.h000066400000000000000000000125621442421066000230100ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIDrivesApi_H #define OAI_OAIDrivesApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIDrive.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIDrivesApi : public QObject { Q_OBJECT public: OAIDrivesApi(const int timeOut = 0); ~OAIDrivesApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] oai_drive OAIDrive [required] */ void createDrive(const OAIDrive &oai_drive); /** * @param[in] drive_id QString [required] * @param[in] if_match QString [optional] */ void deleteDrive(const QString &drive_id, const ::OpenAPI::OptionalParam &if_match = ::OpenAPI::OptionalParam()); /** * @param[in] drive_id QString [required] */ void getDrive(const QString &drive_id); /** * @param[in] drive_id QString [required] * @param[in] oai_drive OAIDrive [required] */ void updateDrive(const QString &drive_id, const OAIDrive &oai_drive); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void createDriveCallback(OAIHttpRequestWorker *worker); void deleteDriveCallback(OAIHttpRequestWorker *worker); void getDriveCallback(OAIHttpRequestWorker *worker); void updateDriveCallback(OAIHttpRequestWorker *worker); signals: void createDriveSignal(OAIDrive summary); void deleteDriveSignal(); void getDriveSignal(OAIDrive summary); void updateDriveSignal(OAIDrive summary); void createDriveSignalFull(OAIHttpRequestWorker *worker, OAIDrive summary); void deleteDriveSignalFull(OAIHttpRequestWorker *worker); void getDriveSignalFull(OAIHttpRequestWorker *worker, OAIDrive summary); void updateDriveSignalFull(OAIHttpRequestWorker *worker, OAIDrive summary); void createDriveSignalE(OAIDrive summary, QNetworkReply::NetworkError error_type, QString error_str); void deleteDriveSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getDriveSignalE(OAIDrive summary, QNetworkReply::NetworkError error_type, QString error_str); void updateDriveSignalE(OAIDrive summary, QNetworkReply::NetworkError error_type, QString error_str); void createDriveSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteDriveSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getDriveSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void updateDriveSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrivesGetDrivesApi.cpp000066400000000000000000000311071442421066000251540ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDrivesGetDrivesApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIDrivesGetDrivesApi::OAIDrivesGetDrivesApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIDrivesGetDrivesApi::~OAIDrivesGetDrivesApi() { } void OAIDrivesGetDrivesApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("listAllDrives", defaultConf); _serverIndices.insert("listAllDrives", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIDrivesGetDrivesApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIDrivesGetDrivesApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIDrivesGetDrivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIDrivesGetDrivesApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIDrivesGetDrivesApi::setUsername(const QString &username) { _username = username; } void OAIDrivesGetDrivesApi::setPassword(const QString &password) { _password = password; } void OAIDrivesGetDrivesApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIDrivesGetDrivesApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIDrivesGetDrivesApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIDrivesGetDrivesApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIDrivesGetDrivesApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIDrivesGetDrivesApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIDrivesGetDrivesApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIDrivesGetDrivesApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIDrivesGetDrivesApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIDrivesGetDrivesApi::abortRequests() { emit abortRequestsSignal(); } QString OAIDrivesGetDrivesApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIDrivesGetDrivesApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIDrivesGetDrivesApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIDrivesGetDrivesApi::listAllDrives(const ::OpenAPI::OptionalParam &orderby, const ::OpenAPI::OptionalParam &filter) { QString fullPath = QString(_serverConfigs["listAllDrives"][_serverIndices.value("listAllDrives")].URL()+"/drives"); QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (orderby.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$orderby", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$orderby")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(orderby.value()))); } if (filter.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$filter", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$filter")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(filter.value()))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDrivesGetDrivesApi::listAllDrivesCallback); connect(this, &OAIDrivesGetDrivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIDrivesGetDrivesApi::listAllDrivesCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_drives_1 output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listAllDrivesSignal(output); emit listAllDrivesSignalFull(worker, output); } else { emit listAllDrivesSignalE(output, error_type, error_str); emit listAllDrivesSignalEFull(worker, error_type, error_str); } } void OAIDrivesGetDrivesApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrivesGetDrivesApi.h000066400000000000000000000077771442421066000246410ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIDrivesGetDrivesApi_H #define OAI_OAIDrivesGetDrivesApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_drives_1.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIDrivesGetDrivesApi : public QObject { Q_OBJECT public: OAIDrivesGetDrivesApi(const int timeOut = 0); ~OAIDrivesGetDrivesApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] orderby QString [optional] * @param[in] filter QString [optional] */ void listAllDrives(const ::OpenAPI::OptionalParam &orderby = ::OpenAPI::OptionalParam(), const ::OpenAPI::OptionalParam &filter = ::OpenAPI::OptionalParam()); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void listAllDrivesCallback(OAIHttpRequestWorker *worker); signals: void listAllDrivesSignal(OAICollection_of_drives_1 summary); void listAllDrivesSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_drives_1 summary); void listAllDrivesSignalE(OAICollection_of_drives_1 summary, QNetworkReply::NetworkError error_type, QString error_str); void listAllDrivesSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrivesRootApi.cpp000066400000000000000000000273201442421066000242050ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDrivesRootApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIDrivesRootApi::OAIDrivesRootApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIDrivesRootApi::~OAIDrivesRootApi() { } void OAIDrivesRootApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("getRoot", defaultConf); _serverIndices.insert("getRoot", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIDrivesRootApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIDrivesRootApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIDrivesRootApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIDrivesRootApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIDrivesRootApi::setUsername(const QString &username) { _username = username; } void OAIDrivesRootApi::setPassword(const QString &password) { _password = password; } void OAIDrivesRootApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIDrivesRootApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIDrivesRootApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIDrivesRootApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIDrivesRootApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIDrivesRootApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIDrivesRootApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIDrivesRootApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIDrivesRootApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIDrivesRootApi::abortRequests() { emit abortRequestsSignal(); } QString OAIDrivesRootApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIDrivesRootApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIDrivesRootApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIDrivesRootApi::getRoot(const QString &drive_id) { QString fullPath = QString(_serverConfigs["getRoot"][_serverIndices.value("getRoot")].URL()+"/drives/{drive-id}/root"); { QString drive_idPathParam("{"); drive_idPathParam.append("drive-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "drive-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"drive-id"+pathSuffix : pathPrefix; fullPath.replace(drive_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(drive_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDrivesRootApi::getRootCallback); connect(this, &OAIDrivesRootApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIDrivesRootApi::getRootCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIDriveItem output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getRootSignal(output); emit getRootSignalFull(worker, output); } else { emit getRootSignalE(output, error_type, error_str); emit getRootSignalEFull(worker, error_type, error_str); } } void OAIDrivesRootApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIDrivesRootApi.h000066400000000000000000000073151442421066000236540ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIDrivesRootApi_H #define OAI_OAIDrivesRootApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIDriveItem.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIDrivesRootApi : public QObject { Q_OBJECT public: OAIDrivesRootApi(const int timeOut = 0); ~OAIDrivesRootApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] drive_id QString [required] */ void getRoot(const QString &drive_id); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void getRootCallback(OAIHttpRequestWorker *worker); signals: void getRootSignal(OAIDriveItem summary); void getRootSignalFull(OAIHttpRequestWorker *worker, OAIDriveItem summary); void getRootSignalE(OAIDriveItem summary, QNetworkReply::NetworkError error_type, QString error_str); void getRootSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationClass.cpp000066400000000000000000000254221442421066000243550ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationClass.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIEducationClassPrivate { friend class OAIEducationClass; QString id; bool id_isSet; bool id_isValid; QString description; bool description_isSet; bool description_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; QList members; bool members_isSet; bool members_isValid; QSet membersodata_bind; bool membersodata_bind_isSet; bool membersodata_bind_isValid; QString classification; bool classification_isSet; bool classification_isValid; QString external_id; bool external_id_isSet; bool external_id_isValid; }; OAIEducationClass::OAIEducationClass() : d_ptr() { } OAIEducationClass::OAIEducationClass(const OAIEducationClass& other) : d_ptr(other.d_ptr) { } OAIEducationClass::OAIEducationClass(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIEducationClass::~OAIEducationClass() = default; void OAIEducationClass::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIEducationClassPrivate{}); Q_D(OAIEducationClass); d->id_isSet = false; d->id_isValid = false; d->description_isSet = false; d->description_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; d->members_isSet = false; d->members_isValid = false; d->membersodata_bind_isSet = false; d->membersodata_bind_isValid = false; d->classification_isSet = false; d->classification_isValid = false; d->external_id_isSet = false; d->external_id_isValid = false; } } void OAIEducationClass::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEducationClass::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIEducationClass); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->description_isValid = ::OpenAPI::fromJsonValue(d->description, json[QString("description")]); d->description_isSet = !json[QString("description")].isNull() && d->description_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->members_isValid = ::OpenAPI::fromJsonValue(d->members, json[QString("members")]); d->members_isSet = !json[QString("members")].isNull() && d->members_isValid; d->membersodata_bind_isValid = ::OpenAPI::fromJsonValue(d->membersodata_bind, json[QString("members@odata.bind")]); d->membersodata_bind_isSet = !json[QString("members@odata.bind")].isNull() && d->membersodata_bind_isValid; d->classification_isValid = ::OpenAPI::fromJsonValue(d->classification, json[QString("classification")]); d->classification_isSet = !json[QString("classification")].isNull() && d->classification_isValid; d->external_id_isValid = ::OpenAPI::fromJsonValue(d->external_id, json[QString("externalId")]); d->external_id_isSet = !json[QString("externalId")].isNull() && d->external_id_isValid; } QString OAIEducationClass::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEducationClass::asJsonObject() const { Q_D(const OAIEducationClass); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->description_isSet) { obj.insert(QString("description"), ::OpenAPI::toJsonValue(d->description)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->members.size() > 0) { obj.insert(QString("members"), ::OpenAPI::toJsonValue(d->members)); } if (d->membersodata_bind.size() > 0) { obj.insert(QString("members@odata.bind"), ::OpenAPI::toJsonValue(d->membersodata_bind)); } if (d->classification_isSet) { obj.insert(QString("classification"), ::OpenAPI::toJsonValue(d->classification)); } if (d->external_id_isSet) { obj.insert(QString("externalId"), ::OpenAPI::toJsonValue(d->external_id)); } return obj; } QString OAIEducationClass::getId() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->id; } void OAIEducationClass::setId(const QString &id) { Q_D(OAIEducationClass); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIEducationClass::is_id_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->id_isSet; } bool OAIEducationClass::is_id_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->id_isValid; } QString OAIEducationClass::getDescription() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->description; } void OAIEducationClass::setDescription(const QString &description) { Q_D(OAIEducationClass); Q_ASSERT(d); d->description = description; d->description_isSet = true; } bool OAIEducationClass::is_description_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->description_isSet; } bool OAIEducationClass::is_description_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->description_isValid; } QString OAIEducationClass::getDisplayName() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->display_name; } void OAIEducationClass::setDisplayName(const QString &display_name) { Q_D(OAIEducationClass); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIEducationClass::is_display_name_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->display_name_isSet; } bool OAIEducationClass::is_display_name_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->display_name_isValid; } QList OAIEducationClass::getMembers() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->members; } void OAIEducationClass::setMembers(const QList &members) { Q_D(OAIEducationClass); Q_ASSERT(d); d->members = members; d->members_isSet = true; } bool OAIEducationClass::is_members_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->members_isSet; } bool OAIEducationClass::is_members_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->members_isValid; } QSet OAIEducationClass::getMembersodataBind() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->membersodata_bind; } void OAIEducationClass::setMembersodataBind(const QSet &membersodata_bind) { Q_D(OAIEducationClass); Q_ASSERT(d); d->membersodata_bind = membersodata_bind; d->membersodata_bind_isSet = true; } bool OAIEducationClass::is_membersodata_bind_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->membersodata_bind_isSet; } bool OAIEducationClass::is_membersodata_bind_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->membersodata_bind_isValid; } QString OAIEducationClass::getClassification() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->classification; } void OAIEducationClass::setClassification(const QString &classification) { Q_D(OAIEducationClass); Q_ASSERT(d); d->classification = classification; d->classification_isSet = true; } bool OAIEducationClass::is_classification_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->classification_isSet; } bool OAIEducationClass::is_classification_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->classification_isValid; } QString OAIEducationClass::getExternalId() const { Q_D(const OAIEducationClass); if(!d){ return {}; } return d->external_id; } void OAIEducationClass::setExternalId(const QString &external_id) { Q_D(OAIEducationClass); Q_ASSERT(d); d->external_id = external_id; d->external_id_isSet = true; } bool OAIEducationClass::is_external_id_Set() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->external_id_isSet; } bool OAIEducationClass::is_external_id_Valid() const{ Q_D(const OAIEducationClass); if(!d){ return false; } return d->external_id_isValid; } bool OAIEducationClass::isSet() const { Q_D(const OAIEducationClass); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->description_isSet) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->members.size() > 0) { isObjectUpdated = true; break; } if (d->membersodata_bind.size() > 0) { isObjectUpdated = true; break; } if (d->classification_isSet) { isObjectUpdated = true; break; } if (d->external_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEducationClass::isValid() const { Q_D(const OAIEducationClass); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->display_name_isValid && d->classification_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationClass.h000066400000000000000000000050711442421066000240200ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIEducationClass.h * * And extension of group representing a class or course */ #ifndef OAIEducationClass_H #define OAIEducationClass_H #include #include "OAIUser.h" #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIUser; class OAIEducationClassPrivate; class OAIEducationClass : public OAIObject { public: OAIEducationClass(); OAIEducationClass(const OAIEducationClass &other); OAIEducationClass(QString json); ~OAIEducationClass() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QString getDescription() const; void setDescription(const QString &description); bool is_description_Set() const; bool is_description_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QList getMembers() const; void setMembers(const QList &members); bool is_members_Set() const; bool is_members_Valid() const; QSet getMembersodataBind() const; void setMembersodataBind(const QSet &membersodata_bind); bool is_membersodata_bind_Set() const; bool is_membersodata_bind_Valid() const; QString getClassification() const; void setClassification(const QString &classification); bool is_classification_Set() const; bool is_classification_Valid() const; QString getExternalId() const; void setExternalId(const QString &external_id); bool is_external_id_Set() const; bool is_external_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIEducationClass) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEducationClass) #endif // OAIEducationClass_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationClassApi.cpp000066400000000000000000000760641442421066000250170ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationClassApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIEducationClassApi::OAIEducationClassApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIEducationClassApi::~OAIEducationClassApi() { } void OAIEducationClassApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("addUserToClass", defaultConf); _serverIndices.insert("addUserToClass", 0); _serverConfigs.insert("createClass", defaultConf); _serverIndices.insert("createClass", 0); _serverConfigs.insert("deleteClass", defaultConf); _serverIndices.insert("deleteClass", 0); _serverConfigs.insert("deleteUserFromClass", defaultConf); _serverIndices.insert("deleteUserFromClass", 0); _serverConfigs.insert("getClass", defaultConf); _serverIndices.insert("getClass", 0); _serverConfigs.insert("listClassMembers", defaultConf); _serverIndices.insert("listClassMembers", 0); _serverConfigs.insert("listClasses", defaultConf); _serverIndices.insert("listClasses", 0); _serverConfigs.insert("updateClass", defaultConf); _serverIndices.insert("updateClass", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIEducationClassApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIEducationClassApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIEducationClassApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIEducationClassApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIEducationClassApi::setUsername(const QString &username) { _username = username; } void OAIEducationClassApi::setPassword(const QString &password) { _password = password; } void OAIEducationClassApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIEducationClassApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIEducationClassApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIEducationClassApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationClassApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationClassApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIEducationClassApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIEducationClassApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIEducationClassApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIEducationClassApi::abortRequests() { emit abortRequestsSignal(); } QString OAIEducationClassApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIEducationClassApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIEducationClassApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIEducationClassApi::addUserToClass(const QString &class_id, const OAIClass_Member_Reference &oai_class_member_reference) { QString fullPath = QString(_serverConfigs["addUserToClass"][_serverIndices.value("addUserToClass")].URL()+"/education/classes/{class-id}/members/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_class_member_reference.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::addUserToClassCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::addUserToClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit addUserToClassSignal(); emit addUserToClassSignalFull(worker); } else { emit addUserToClassSignalE(error_type, error_str); emit addUserToClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::createClass(const OAIEducationClass &oai_education_class) { QString fullPath = QString(_serverConfigs["createClass"][_serverIndices.value("createClass")].URL()+"/education/classes"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_education_class.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::createClassCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::createClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationClass output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit createClassSignal(output); emit createClassSignalFull(worker, output); } else { emit createClassSignalE(output, error_type, error_str); emit createClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::deleteClass(const QString &class_id) { QString fullPath = QString(_serverConfigs["deleteClass"][_serverIndices.value("deleteClass")].URL()+"/education/classes/{class-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::deleteClassCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::deleteClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteClassSignal(); emit deleteClassSignalFull(worker); } else { emit deleteClassSignalE(error_type, error_str); emit deleteClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::deleteUserFromClass(const QString &class_id, const QString &user_id) { QString fullPath = QString(_serverConfigs["deleteUserFromClass"][_serverIndices.value("deleteUserFromClass")].URL()+"/education/classes/{class-id}/members/{user-id}/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::deleteUserFromClassCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::deleteUserFromClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteUserFromClassSignal(); emit deleteUserFromClassSignalFull(worker); } else { emit deleteUserFromClassSignalE(error_type, error_str); emit deleteUserFromClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::getClass(const QString &class_id) { QString fullPath = QString(_serverConfigs["getClass"][_serverIndices.value("getClass")].URL()+"/education/classes/{class-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::getClassCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::getClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationClass output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getClassSignal(output); emit getClassSignalFull(worker, output); } else { emit getClassSignalE(output, error_type, error_str); emit getClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::listClassMembers(const QString &class_id) { QString fullPath = QString(_serverConfigs["listClassMembers"][_serverIndices.value("listClassMembers")].URL()+"/education/classes/{class-id}/members"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::listClassMembersCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::listClassMembersCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_educationUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listClassMembersSignal(output); emit listClassMembersSignalFull(worker, output); } else { emit listClassMembersSignalE(output, error_type, error_str); emit listClassMembersSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::listClasses() { QString fullPath = QString(_serverConfigs["listClasses"][_serverIndices.value("listClasses")].URL()+"/education/classes"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::listClassesCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::listClassesCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_class output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listClassesSignal(output); emit listClassesSignalFull(worker, output); } else { emit listClassesSignalE(output, error_type, error_str); emit listClassesSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::updateClass(const QString &class_id, const OAIEducationClass &oai_education_class) { QString fullPath = QString(_serverConfigs["updateClass"][_serverIndices.value("updateClass")].URL()+"/education/classes/{class-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PATCH"); { QByteArray output = oai_education_class.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassApi::updateClassCallback); connect(this, &OAIEducationClassApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassApi::updateClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationClass output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit updateClassSignal(output); emit updateClassSignalFull(worker, output); } else { emit updateClassSignalE(output, error_type, error_str); emit updateClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationClassApi.h000066400000000000000000000175011442421066000244530ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIEducationClassApi_H #define OAI_OAIEducationClassApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIClass_Member_Reference.h" #include "OAICollection_of_class.h" #include "OAICollection_of_educationUser.h" #include "OAIEducationClass.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIEducationClassApi : public QObject { Q_OBJECT public: OAIEducationClassApi(const int timeOut = 0); ~OAIEducationClassApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] class_id QString [required] * @param[in] oai_class_member_reference OAIClass_Member_Reference [required] */ void addUserToClass(const QString &class_id, const OAIClass_Member_Reference &oai_class_member_reference); /** * @param[in] oai_education_class OAIEducationClass [required] */ void createClass(const OAIEducationClass &oai_education_class); /** * @param[in] class_id QString [required] */ void deleteClass(const QString &class_id); /** * @param[in] class_id QString [required] * @param[in] user_id QString [required] */ void deleteUserFromClass(const QString &class_id, const QString &user_id); /** * @param[in] class_id QString [required] */ void getClass(const QString &class_id); /** * @param[in] class_id QString [required] */ void listClassMembers(const QString &class_id); void listClasses(); /** * @param[in] class_id QString [required] * @param[in] oai_education_class OAIEducationClass [required] */ void updateClass(const QString &class_id, const OAIEducationClass &oai_education_class); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void addUserToClassCallback(OAIHttpRequestWorker *worker); void createClassCallback(OAIHttpRequestWorker *worker); void deleteClassCallback(OAIHttpRequestWorker *worker); void deleteUserFromClassCallback(OAIHttpRequestWorker *worker); void getClassCallback(OAIHttpRequestWorker *worker); void listClassMembersCallback(OAIHttpRequestWorker *worker); void listClassesCallback(OAIHttpRequestWorker *worker); void updateClassCallback(OAIHttpRequestWorker *worker); signals: void addUserToClassSignal(); void createClassSignal(OAIEducationClass summary); void deleteClassSignal(); void deleteUserFromClassSignal(); void getClassSignal(OAIEducationClass summary); void listClassMembersSignal(OAICollection_of_educationUser summary); void listClassesSignal(OAICollection_of_class summary); void updateClassSignal(OAIEducationClass summary); void addUserToClassSignalFull(OAIHttpRequestWorker *worker); void createClassSignalFull(OAIHttpRequestWorker *worker, OAIEducationClass summary); void deleteClassSignalFull(OAIHttpRequestWorker *worker); void deleteUserFromClassSignalFull(OAIHttpRequestWorker *worker); void getClassSignalFull(OAIHttpRequestWorker *worker, OAIEducationClass summary); void listClassMembersSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_educationUser summary); void listClassesSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_class summary); void updateClassSignalFull(OAIHttpRequestWorker *worker, OAIEducationClass summary); void addUserToClassSignalE(QNetworkReply::NetworkError error_type, QString error_str); void createClassSignalE(OAIEducationClass summary, QNetworkReply::NetworkError error_type, QString error_str); void deleteClassSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteUserFromClassSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getClassSignalE(OAIEducationClass summary, QNetworkReply::NetworkError error_type, QString error_str); void listClassMembersSignalE(OAICollection_of_educationUser summary, QNetworkReply::NetworkError error_type, QString error_str); void listClassesSignalE(OAICollection_of_class summary, QNetworkReply::NetworkError error_type, QString error_str); void updateClassSignalE(OAIEducationClass summary, QNetworkReply::NetworkError error_type, QString error_str); void addUserToClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void createClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteUserFromClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listClassMembersSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listClassesSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void updateClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationClassTeachersApi.cpp000066400000000000000000000453651442421066000264760ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationClassTeachersApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIEducationClassTeachersApi::OAIEducationClassTeachersApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIEducationClassTeachersApi::~OAIEducationClassTeachersApi() { } void OAIEducationClassTeachersApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("addTeacherToClass", defaultConf); _serverIndices.insert("addTeacherToClass", 0); _serverConfigs.insert("deleteTeacherFromClass", defaultConf); _serverIndices.insert("deleteTeacherFromClass", 0); _serverConfigs.insert("getTeachers", defaultConf); _serverIndices.insert("getTeachers", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIEducationClassTeachersApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIEducationClassTeachersApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIEducationClassTeachersApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIEducationClassTeachersApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIEducationClassTeachersApi::setUsername(const QString &username) { _username = username; } void OAIEducationClassTeachersApi::setPassword(const QString &password) { _password = password; } void OAIEducationClassTeachersApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIEducationClassTeachersApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIEducationClassTeachersApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIEducationClassTeachersApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationClassTeachersApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationClassTeachersApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIEducationClassTeachersApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIEducationClassTeachersApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIEducationClassTeachersApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIEducationClassTeachersApi::abortRequests() { emit abortRequestsSignal(); } QString OAIEducationClassTeachersApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIEducationClassTeachersApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIEducationClassTeachersApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIEducationClassTeachersApi::addTeacherToClass(const QString &class_id, const OAIClass_Teacher_Reference &oai_class_teacher_reference) { QString fullPath = QString(_serverConfigs["addTeacherToClass"][_serverIndices.value("addTeacherToClass")].URL()+"/education/classes/{class-id}/teachers/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_class_teacher_reference.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassTeachersApi::addTeacherToClassCallback); connect(this, &OAIEducationClassTeachersApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassTeachersApi::addTeacherToClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit addTeacherToClassSignal(); emit addTeacherToClassSignalFull(worker); } else { emit addTeacherToClassSignalE(error_type, error_str); emit addTeacherToClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassTeachersApi::deleteTeacherFromClass(const QString &class_id, const QString &user_id) { QString fullPath = QString(_serverConfigs["deleteTeacherFromClass"][_serverIndices.value("deleteTeacherFromClass")].URL()+"/education/classes/{class-id}/teachers/{user-id}/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassTeachersApi::deleteTeacherFromClassCallback); connect(this, &OAIEducationClassTeachersApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassTeachersApi::deleteTeacherFromClassCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteTeacherFromClassSignal(); emit deleteTeacherFromClassSignalFull(worker); } else { emit deleteTeacherFromClassSignalE(error_type, error_str); emit deleteTeacherFromClassSignalEFull(worker, error_type, error_str); } } void OAIEducationClassTeachersApi::getTeachers(const QString &class_id) { QString fullPath = QString(_serverConfigs["getTeachers"][_serverIndices.value("getTeachers")].URL()+"/education/classes/{class-id}/teachers"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationClassTeachersApi::getTeachersCallback); connect(this, &OAIEducationClassTeachersApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationClassTeachersApi::getTeachersCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_educationUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getTeachersSignal(output); emit getTeachersSignalFull(worker, output); } else { emit getTeachersSignalE(output, error_type, error_str); emit getTeachersSignalEFull(worker, error_type, error_str); } } void OAIEducationClassTeachersApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationClassTeachersApi.h000066400000000000000000000121751442421066000261340ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIEducationClassTeachersApi_H #define OAI_OAIEducationClassTeachersApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIClass_Teacher_Reference.h" #include "OAICollection_of_educationUser.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIEducationClassTeachersApi : public QObject { Q_OBJECT public: OAIEducationClassTeachersApi(const int timeOut = 0); ~OAIEducationClassTeachersApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] class_id QString [required] * @param[in] oai_class_teacher_reference OAIClass_Teacher_Reference [required] */ void addTeacherToClass(const QString &class_id, const OAIClass_Teacher_Reference &oai_class_teacher_reference); /** * @param[in] class_id QString [required] * @param[in] user_id QString [required] */ void deleteTeacherFromClass(const QString &class_id, const QString &user_id); /** * @param[in] class_id QString [required] */ void getTeachers(const QString &class_id); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void addTeacherToClassCallback(OAIHttpRequestWorker *worker); void deleteTeacherFromClassCallback(OAIHttpRequestWorker *worker); void getTeachersCallback(OAIHttpRequestWorker *worker); signals: void addTeacherToClassSignal(); void deleteTeacherFromClassSignal(); void getTeachersSignal(OAICollection_of_educationUser summary); void addTeacherToClassSignalFull(OAIHttpRequestWorker *worker); void deleteTeacherFromClassSignalFull(OAIHttpRequestWorker *worker); void getTeachersSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_educationUser summary); void addTeacherToClassSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteTeacherFromClassSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getTeachersSignalE(OAICollection_of_educationUser summary, QNetworkReply::NetworkError error_type, QString error_str); void addTeacherToClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteTeacherFromClassSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getTeachersSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationOrganization.cpp000066400000000000000000000113211442421066000257450ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationOrganization.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIEducationOrganizationPrivate { friend class OAIEducationOrganization; QString id; bool id_isSet; bool id_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; }; OAIEducationOrganization::OAIEducationOrganization() : d_ptr() { } OAIEducationOrganization::OAIEducationOrganization(const OAIEducationOrganization& other) : d_ptr(other.d_ptr) { } OAIEducationOrganization::OAIEducationOrganization(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIEducationOrganization::~OAIEducationOrganization() = default; void OAIEducationOrganization::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIEducationOrganizationPrivate{}); Q_D(OAIEducationOrganization); d->id_isSet = false; d->id_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; } } void OAIEducationOrganization::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEducationOrganization::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIEducationOrganization); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; } QString OAIEducationOrganization::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEducationOrganization::asJsonObject() const { Q_D(const OAIEducationOrganization); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } return obj; } QString OAIEducationOrganization::getId() const { Q_D(const OAIEducationOrganization); if(!d){ return {}; } return d->id; } void OAIEducationOrganization::setId(const QString &id) { Q_D(OAIEducationOrganization); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIEducationOrganization::is_id_Set() const{ Q_D(const OAIEducationOrganization); if(!d){ return false; } return d->id_isSet; } bool OAIEducationOrganization::is_id_Valid() const{ Q_D(const OAIEducationOrganization); if(!d){ return false; } return d->id_isValid; } QString OAIEducationOrganization::getDisplayName() const { Q_D(const OAIEducationOrganization); if(!d){ return {}; } return d->display_name; } void OAIEducationOrganization::setDisplayName(const QString &display_name) { Q_D(OAIEducationOrganization); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIEducationOrganization::is_display_name_Set() const{ Q_D(const OAIEducationOrganization); if(!d){ return false; } return d->display_name_isSet; } bool OAIEducationOrganization::is_display_name_Valid() const{ Q_D(const OAIEducationOrganization); if(!d){ return false; } return d->display_name_isValid; } bool OAIEducationOrganization::isSet() const { Q_D(const OAIEducationOrganization); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEducationOrganization::isValid() const { Q_D(const OAIEducationOrganization); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationOrganization.h000066400000000000000000000033571442421066000254240ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIEducationOrganization.h * * Abstract. Represents an organization in educational context */ #ifndef OAIEducationOrganization_H #define OAIEducationOrganization_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationOrganizationPrivate; class OAIEducationOrganization : public OAIObject { public: OAIEducationOrganization(); OAIEducationOrganization(const OAIEducationOrganization &other); OAIEducationOrganization(QString json); ~OAIEducationOrganization() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIEducationOrganization) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEducationOrganization) #endif // OAIEducationOrganization_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationSchool.cpp000066400000000000000000000133651442421066000245420ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationSchool.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIEducationSchoolPrivate { friend class OAIEducationSchool; QString id; bool id_isSet; bool id_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; QString school_number; bool school_number_isSet; bool school_number_isValid; }; OAIEducationSchool::OAIEducationSchool() : d_ptr() { } OAIEducationSchool::OAIEducationSchool(const OAIEducationSchool& other) : d_ptr(other.d_ptr) { } OAIEducationSchool::OAIEducationSchool(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIEducationSchool::~OAIEducationSchool() = default; void OAIEducationSchool::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIEducationSchoolPrivate{}); Q_D(OAIEducationSchool); d->id_isSet = false; d->id_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; d->school_number_isSet = false; d->school_number_isValid = false; } } void OAIEducationSchool::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEducationSchool::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIEducationSchool); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->school_number_isValid = ::OpenAPI::fromJsonValue(d->school_number, json[QString("schoolNumber")]); d->school_number_isSet = !json[QString("schoolNumber")].isNull() && d->school_number_isValid; } QString OAIEducationSchool::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEducationSchool::asJsonObject() const { Q_D(const OAIEducationSchool); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->school_number_isSet) { obj.insert(QString("schoolNumber"), ::OpenAPI::toJsonValue(d->school_number)); } return obj; } QString OAIEducationSchool::getId() const { Q_D(const OAIEducationSchool); if(!d){ return {}; } return d->id; } void OAIEducationSchool::setId(const QString &id) { Q_D(OAIEducationSchool); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIEducationSchool::is_id_Set() const{ Q_D(const OAIEducationSchool); if(!d){ return false; } return d->id_isSet; } bool OAIEducationSchool::is_id_Valid() const{ Q_D(const OAIEducationSchool); if(!d){ return false; } return d->id_isValid; } QString OAIEducationSchool::getDisplayName() const { Q_D(const OAIEducationSchool); if(!d){ return {}; } return d->display_name; } void OAIEducationSchool::setDisplayName(const QString &display_name) { Q_D(OAIEducationSchool); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIEducationSchool::is_display_name_Set() const{ Q_D(const OAIEducationSchool); if(!d){ return false; } return d->display_name_isSet; } bool OAIEducationSchool::is_display_name_Valid() const{ Q_D(const OAIEducationSchool); if(!d){ return false; } return d->display_name_isValid; } QString OAIEducationSchool::getSchoolNumber() const { Q_D(const OAIEducationSchool); if(!d){ return {}; } return d->school_number; } void OAIEducationSchool::setSchoolNumber(const QString &school_number) { Q_D(OAIEducationSchool); Q_ASSERT(d); d->school_number = school_number; d->school_number_isSet = true; } bool OAIEducationSchool::is_school_number_Set() const{ Q_D(const OAIEducationSchool); if(!d){ return false; } return d->school_number_isSet; } bool OAIEducationSchool::is_school_number_Valid() const{ Q_D(const OAIEducationSchool); if(!d){ return false; } return d->school_number_isValid; } bool OAIEducationSchool::isSet() const { Q_D(const OAIEducationSchool); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->school_number_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEducationSchool::isValid() const { Q_D(const OAIEducationSchool); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationSchool.h000066400000000000000000000034411442421066000242010ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIEducationSchool.h * * Represents a school */ #ifndef OAIEducationSchool_H #define OAIEducationSchool_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationSchoolPrivate; class OAIEducationSchool : public OAIObject { public: OAIEducationSchool(); OAIEducationSchool(const OAIEducationSchool &other); OAIEducationSchool(QString json); ~OAIEducationSchool() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QString getSchoolNumber() const; void setSchoolNumber(const QString &school_number); bool is_school_number_Set() const; bool is_school_number_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIEducationSchool) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEducationSchool) #endif // OAIEducationSchool_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationSchoolApi.cpp000066400000000000000000001210211442421066000251610ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationSchoolApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIEducationSchoolApi::OAIEducationSchoolApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIEducationSchoolApi::~OAIEducationSchoolApi() { } void OAIEducationSchoolApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("addClassToSchool", defaultConf); _serverIndices.insert("addClassToSchool", 0); _serverConfigs.insert("addUserToSchool", defaultConf); _serverIndices.insert("addUserToSchool", 0); _serverConfigs.insert("createSchool", defaultConf); _serverIndices.insert("createSchool", 0); _serverConfigs.insert("deleteClassFromSchool", defaultConf); _serverIndices.insert("deleteClassFromSchool", 0); _serverConfigs.insert("deleteSchool", defaultConf); _serverIndices.insert("deleteSchool", 0); _serverConfigs.insert("deleteUserFromSchool", defaultConf); _serverIndices.insert("deleteUserFromSchool", 0); _serverConfigs.insert("getSchool", defaultConf); _serverIndices.insert("getSchool", 0); _serverConfigs.insert("listSchoolClasses", defaultConf); _serverIndices.insert("listSchoolClasses", 0); _serverConfigs.insert("listSchoolUsers", defaultConf); _serverIndices.insert("listSchoolUsers", 0); _serverConfigs.insert("listSchools", defaultConf); _serverIndices.insert("listSchools", 0); _serverConfigs.insert("updateSchool", defaultConf); _serverIndices.insert("updateSchool", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIEducationSchoolApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIEducationSchoolApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIEducationSchoolApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIEducationSchoolApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIEducationSchoolApi::setUsername(const QString &username) { _username = username; } void OAIEducationSchoolApi::setPassword(const QString &password) { _password = password; } void OAIEducationSchoolApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIEducationSchoolApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIEducationSchoolApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIEducationSchoolApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationSchoolApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationSchoolApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIEducationSchoolApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIEducationSchoolApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIEducationSchoolApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIEducationSchoolApi::abortRequests() { emit abortRequestsSignal(); } QString OAIEducationSchoolApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIEducationSchoolApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIEducationSchoolApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIEducationSchoolApi::addClassToSchool(const QString &school_id, const OAIClass_Reference &oai_class_reference) { QString fullPath = QString(_serverConfigs["addClassToSchool"][_serverIndices.value("addClassToSchool")].URL()+"/education/schools/{school-id}/classes/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_class_reference.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::addClassToSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::addClassToSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit addClassToSchoolSignal(); emit addClassToSchoolSignalFull(worker); } else { emit addClassToSchoolSignalE(error_type, error_str); emit addClassToSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::addUserToSchool(const QString &school_id, const OAIEducationUser_Reference &oai_education_user_reference) { QString fullPath = QString(_serverConfigs["addUserToSchool"][_serverIndices.value("addUserToSchool")].URL()+"/education/schools/{school-id}/users/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_education_user_reference.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::addUserToSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::addUserToSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit addUserToSchoolSignal(); emit addUserToSchoolSignalFull(worker); } else { emit addUserToSchoolSignalE(error_type, error_str); emit addUserToSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::createSchool(const OAIEducationSchool &oai_education_school) { QString fullPath = QString(_serverConfigs["createSchool"][_serverIndices.value("createSchool")].URL()+"/education/schools"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_education_school.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::createSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::createSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationSchool output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit createSchoolSignal(output); emit createSchoolSignalFull(worker, output); } else { emit createSchoolSignalE(output, error_type, error_str); emit createSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::deleteClassFromSchool(const QString &school_id, const QString &class_id) { QString fullPath = QString(_serverConfigs["deleteClassFromSchool"][_serverIndices.value("deleteClassFromSchool")].URL()+"/education/schools/{school-id}/classes/{class-id}/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } { QString class_idPathParam("{"); class_idPathParam.append("class-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "class-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"class-id"+pathSuffix : pathPrefix; fullPath.replace(class_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(class_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::deleteClassFromSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::deleteClassFromSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteClassFromSchoolSignal(); emit deleteClassFromSchoolSignalFull(worker); } else { emit deleteClassFromSchoolSignalE(error_type, error_str); emit deleteClassFromSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::deleteSchool(const QString &school_id) { QString fullPath = QString(_serverConfigs["deleteSchool"][_serverIndices.value("deleteSchool")].URL()+"/education/schools/{school-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::deleteSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::deleteSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteSchoolSignal(); emit deleteSchoolSignalFull(worker); } else { emit deleteSchoolSignalE(error_type, error_str); emit deleteSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::deleteUserFromSchool(const QString &school_id, const QString &user_id) { QString fullPath = QString(_serverConfigs["deleteUserFromSchool"][_serverIndices.value("deleteUserFromSchool")].URL()+"/education/schools/{school-id}/users/{user-id}/$ref"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::deleteUserFromSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::deleteUserFromSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteUserFromSchoolSignal(); emit deleteUserFromSchoolSignalFull(worker); } else { emit deleteUserFromSchoolSignalE(error_type, error_str); emit deleteUserFromSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::getSchool(const QString &school_id) { QString fullPath = QString(_serverConfigs["getSchool"][_serverIndices.value("getSchool")].URL()+"/education/schools/{school-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::getSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::getSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationSchool output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getSchoolSignal(output); emit getSchoolSignalFull(worker, output); } else { emit getSchoolSignalE(output, error_type, error_str); emit getSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::listSchoolClasses(const QString &school_id) { QString fullPath = QString(_serverConfigs["listSchoolClasses"][_serverIndices.value("listSchoolClasses")].URL()+"/education/schools/{school-id}/classes"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::listSchoolClassesCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::listSchoolClassesCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_educationClass output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listSchoolClassesSignal(output); emit listSchoolClassesSignalFull(worker, output); } else { emit listSchoolClassesSignalE(output, error_type, error_str); emit listSchoolClassesSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::listSchoolUsers(const QString &school_id) { QString fullPath = QString(_serverConfigs["listSchoolUsers"][_serverIndices.value("listSchoolUsers")].URL()+"/education/schools/{school-id}/users"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::listSchoolUsersCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::listSchoolUsersCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_educationUser_1 output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listSchoolUsersSignal(output); emit listSchoolUsersSignalFull(worker, output); } else { emit listSchoolUsersSignalE(output, error_type, error_str); emit listSchoolUsersSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::listSchools() { QString fullPath = QString(_serverConfigs["listSchools"][_serverIndices.value("listSchools")].URL()+"/education/schools"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::listSchoolsCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::listSchoolsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_schools output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listSchoolsSignal(output); emit listSchoolsSignalFull(worker, output); } else { emit listSchoolsSignalE(output, error_type, error_str); emit listSchoolsSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::updateSchool(const QString &school_id, const OAIEducationSchool &oai_education_school) { QString fullPath = QString(_serverConfigs["updateSchool"][_serverIndices.value("updateSchool")].URL()+"/education/schools/{school-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString school_idPathParam("{"); school_idPathParam.append("school-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "school-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"school-id"+pathSuffix : pathPrefix; fullPath.replace(school_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(school_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PATCH"); { QByteArray output = oai_education_school.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationSchoolApi::updateSchoolCallback); connect(this, &OAIEducationSchoolApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationSchoolApi::updateSchoolCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationSchool output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit updateSchoolSignal(output); emit updateSchoolSignalFull(worker, output); } else { emit updateSchoolSignalE(output, error_type, error_str); emit updateSchoolSignalEFull(worker, error_type, error_str); } } void OAIEducationSchoolApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationSchoolApi.h000066400000000000000000000234421442421066000246360ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIEducationSchoolApi_H #define OAI_OAIEducationSchoolApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIClass_Reference.h" #include "OAICollection_of_educationClass.h" #include "OAICollection_of_educationUser_1.h" #include "OAICollection_of_schools.h" #include "OAIEducationSchool.h" #include "OAIEducationUser_Reference.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIEducationSchoolApi : public QObject { Q_OBJECT public: OAIEducationSchoolApi(const int timeOut = 0); ~OAIEducationSchoolApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] school_id QString [required] * @param[in] oai_class_reference OAIClass_Reference [required] */ void addClassToSchool(const QString &school_id, const OAIClass_Reference &oai_class_reference); /** * @param[in] school_id QString [required] * @param[in] oai_education_user_reference OAIEducationUser_Reference [required] */ void addUserToSchool(const QString &school_id, const OAIEducationUser_Reference &oai_education_user_reference); /** * @param[in] oai_education_school OAIEducationSchool [required] */ void createSchool(const OAIEducationSchool &oai_education_school); /** * @param[in] school_id QString [required] * @param[in] class_id QString [required] */ void deleteClassFromSchool(const QString &school_id, const QString &class_id); /** * @param[in] school_id QString [required] */ void deleteSchool(const QString &school_id); /** * @param[in] school_id QString [required] * @param[in] user_id QString [required] */ void deleteUserFromSchool(const QString &school_id, const QString &user_id); /** * @param[in] school_id QString [required] */ void getSchool(const QString &school_id); /** * @param[in] school_id QString [required] */ void listSchoolClasses(const QString &school_id); /** * @param[in] school_id QString [required] */ void listSchoolUsers(const QString &school_id); void listSchools(); /** * @param[in] school_id QString [required] * @param[in] oai_education_school OAIEducationSchool [required] */ void updateSchool(const QString &school_id, const OAIEducationSchool &oai_education_school); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void addClassToSchoolCallback(OAIHttpRequestWorker *worker); void addUserToSchoolCallback(OAIHttpRequestWorker *worker); void createSchoolCallback(OAIHttpRequestWorker *worker); void deleteClassFromSchoolCallback(OAIHttpRequestWorker *worker); void deleteSchoolCallback(OAIHttpRequestWorker *worker); void deleteUserFromSchoolCallback(OAIHttpRequestWorker *worker); void getSchoolCallback(OAIHttpRequestWorker *worker); void listSchoolClassesCallback(OAIHttpRequestWorker *worker); void listSchoolUsersCallback(OAIHttpRequestWorker *worker); void listSchoolsCallback(OAIHttpRequestWorker *worker); void updateSchoolCallback(OAIHttpRequestWorker *worker); signals: void addClassToSchoolSignal(); void addUserToSchoolSignal(); void createSchoolSignal(OAIEducationSchool summary); void deleteClassFromSchoolSignal(); void deleteSchoolSignal(); void deleteUserFromSchoolSignal(); void getSchoolSignal(OAIEducationSchool summary); void listSchoolClassesSignal(OAICollection_of_educationClass summary); void listSchoolUsersSignal(OAICollection_of_educationUser_1 summary); void listSchoolsSignal(OAICollection_of_schools summary); void updateSchoolSignal(OAIEducationSchool summary); void addClassToSchoolSignalFull(OAIHttpRequestWorker *worker); void addUserToSchoolSignalFull(OAIHttpRequestWorker *worker); void createSchoolSignalFull(OAIHttpRequestWorker *worker, OAIEducationSchool summary); void deleteClassFromSchoolSignalFull(OAIHttpRequestWorker *worker); void deleteSchoolSignalFull(OAIHttpRequestWorker *worker); void deleteUserFromSchoolSignalFull(OAIHttpRequestWorker *worker); void getSchoolSignalFull(OAIHttpRequestWorker *worker, OAIEducationSchool summary); void listSchoolClassesSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_educationClass summary); void listSchoolUsersSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_educationUser_1 summary); void listSchoolsSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_schools summary); void updateSchoolSignalFull(OAIHttpRequestWorker *worker, OAIEducationSchool summary); void addClassToSchoolSignalE(QNetworkReply::NetworkError error_type, QString error_str); void addUserToSchoolSignalE(QNetworkReply::NetworkError error_type, QString error_str); void createSchoolSignalE(OAIEducationSchool summary, QNetworkReply::NetworkError error_type, QString error_str); void deleteClassFromSchoolSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteSchoolSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteUserFromSchoolSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getSchoolSignalE(OAIEducationSchool summary, QNetworkReply::NetworkError error_type, QString error_str); void listSchoolClassesSignalE(OAICollection_of_educationClass summary, QNetworkReply::NetworkError error_type, QString error_str); void listSchoolUsersSignalE(OAICollection_of_educationUser_1 summary, QNetworkReply::NetworkError error_type, QString error_str); void listSchoolsSignalE(OAICollection_of_schools summary, QNetworkReply::NetworkError error_type, QString error_str); void updateSchoolSignalE(OAIEducationSchool summary, QNetworkReply::NetworkError error_type, QString error_str); void addClassToSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void addUserToSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void createSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteClassFromSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteUserFromSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listSchoolClassesSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listSchoolUsersSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listSchoolsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void updateSchoolSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationUser.cpp000066400000000000000000000460441442421066000242310ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationUser.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIEducationUserPrivate { friend class OAIEducationUser; QString id; bool id_isSet; bool id_isValid; bool account_enabled; bool account_enabled_isSet; bool account_enabled_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; QList drives; bool drives_isSet; bool drives_isValid; OAIDrive drive; bool drive_isSet; bool drive_isValid; QList identities; bool identities_isSet; bool identities_isValid; QString mail; bool mail_isSet; bool mail_isValid; QList member_of; bool member_of_isSet; bool member_of_isValid; QString on_premises_sam_account_name; bool on_premises_sam_account_name_isSet; bool on_premises_sam_account_name_isValid; OAIPasswordProfile password_profile; bool password_profile_isSet; bool password_profile_isValid; QString surname; bool surname_isSet; bool surname_isValid; QString given_name; bool given_name_isSet; bool given_name_isValid; QString primary_role; bool primary_role_isSet; bool primary_role_isValid; QString user_type; bool user_type_isSet; bool user_type_isValid; }; OAIEducationUser::OAIEducationUser() : d_ptr() { } OAIEducationUser::OAIEducationUser(const OAIEducationUser& other) : d_ptr(other.d_ptr) { } OAIEducationUser::OAIEducationUser(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIEducationUser::~OAIEducationUser() = default; void OAIEducationUser::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIEducationUserPrivate{}); Q_D(OAIEducationUser); d->id_isSet = false; d->id_isValid = false; d->account_enabled_isSet = false; d->account_enabled_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; d->drives_isSet = false; d->drives_isValid = false; d->drive_isSet = false; d->drive_isValid = false; d->identities_isSet = false; d->identities_isValid = false; d->mail_isSet = false; d->mail_isValid = false; d->member_of_isSet = false; d->member_of_isValid = false; d->on_premises_sam_account_name_isSet = false; d->on_premises_sam_account_name_isValid = false; d->password_profile_isSet = false; d->password_profile_isValid = false; d->surname_isSet = false; d->surname_isValid = false; d->given_name_isSet = false; d->given_name_isValid = false; d->primary_role_isSet = false; d->primary_role_isValid = false; d->user_type_isSet = false; d->user_type_isValid = false; } } void OAIEducationUser::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEducationUser::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIEducationUser); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->account_enabled_isValid = ::OpenAPI::fromJsonValue(d->account_enabled, json[QString("accountEnabled")]); d->account_enabled_isSet = !json[QString("accountEnabled")].isNull() && d->account_enabled_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->drives_isValid = ::OpenAPI::fromJsonValue(d->drives, json[QString("drives")]); d->drives_isSet = !json[QString("drives")].isNull() && d->drives_isValid; d->drive_isValid = ::OpenAPI::fromJsonValue(d->drive, json[QString("drive")]); d->drive_isSet = !json[QString("drive")].isNull() && d->drive_isValid; d->identities_isValid = ::OpenAPI::fromJsonValue(d->identities, json[QString("identities")]); d->identities_isSet = !json[QString("identities")].isNull() && d->identities_isValid; d->mail_isValid = ::OpenAPI::fromJsonValue(d->mail, json[QString("mail")]); d->mail_isSet = !json[QString("mail")].isNull() && d->mail_isValid; d->member_of_isValid = ::OpenAPI::fromJsonValue(d->member_of, json[QString("memberOf")]); d->member_of_isSet = !json[QString("memberOf")].isNull() && d->member_of_isValid; d->on_premises_sam_account_name_isValid = ::OpenAPI::fromJsonValue(d->on_premises_sam_account_name, json[QString("onPremisesSamAccountName")]); d->on_premises_sam_account_name_isSet = !json[QString("onPremisesSamAccountName")].isNull() && d->on_premises_sam_account_name_isValid; d->password_profile_isValid = ::OpenAPI::fromJsonValue(d->password_profile, json[QString("passwordProfile")]); d->password_profile_isSet = !json[QString("passwordProfile")].isNull() && d->password_profile_isValid; d->surname_isValid = ::OpenAPI::fromJsonValue(d->surname, json[QString("surname")]); d->surname_isSet = !json[QString("surname")].isNull() && d->surname_isValid; d->given_name_isValid = ::OpenAPI::fromJsonValue(d->given_name, json[QString("givenName")]); d->given_name_isSet = !json[QString("givenName")].isNull() && d->given_name_isValid; d->primary_role_isValid = ::OpenAPI::fromJsonValue(d->primary_role, json[QString("primaryRole")]); d->primary_role_isSet = !json[QString("primaryRole")].isNull() && d->primary_role_isValid; d->user_type_isValid = ::OpenAPI::fromJsonValue(d->user_type, json[QString("userType")]); d->user_type_isSet = !json[QString("userType")].isNull() && d->user_type_isValid; } QString OAIEducationUser::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEducationUser::asJsonObject() const { Q_D(const OAIEducationUser); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->account_enabled_isSet) { obj.insert(QString("accountEnabled"), ::OpenAPI::toJsonValue(d->account_enabled)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->drives.size() > 0) { obj.insert(QString("drives"), ::OpenAPI::toJsonValue(d->drives)); } if (d->drive.isSet()) { obj.insert(QString("drive"), ::OpenAPI::toJsonValue(d->drive)); } if (d->identities.size() > 0) { obj.insert(QString("identities"), ::OpenAPI::toJsonValue(d->identities)); } if (d->mail_isSet) { obj.insert(QString("mail"), ::OpenAPI::toJsonValue(d->mail)); } if (d->member_of.size() > 0) { obj.insert(QString("memberOf"), ::OpenAPI::toJsonValue(d->member_of)); } if (d->on_premises_sam_account_name_isSet) { obj.insert(QString("onPremisesSamAccountName"), ::OpenAPI::toJsonValue(d->on_premises_sam_account_name)); } if (d->password_profile.isSet()) { obj.insert(QString("passwordProfile"), ::OpenAPI::toJsonValue(d->password_profile)); } if (d->surname_isSet) { obj.insert(QString("surname"), ::OpenAPI::toJsonValue(d->surname)); } if (d->given_name_isSet) { obj.insert(QString("givenName"), ::OpenAPI::toJsonValue(d->given_name)); } if (d->primary_role_isSet) { obj.insert(QString("primaryRole"), ::OpenAPI::toJsonValue(d->primary_role)); } if (d->user_type_isSet) { obj.insert(QString("userType"), ::OpenAPI::toJsonValue(d->user_type)); } return obj; } QString OAIEducationUser::getId() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->id; } void OAIEducationUser::setId(const QString &id) { Q_D(OAIEducationUser); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIEducationUser::is_id_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->id_isSet; } bool OAIEducationUser::is_id_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->id_isValid; } bool OAIEducationUser::isAccountEnabled() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->account_enabled; } void OAIEducationUser::setAccountEnabled(const bool &account_enabled) { Q_D(OAIEducationUser); Q_ASSERT(d); d->account_enabled = account_enabled; d->account_enabled_isSet = true; } bool OAIEducationUser::is_account_enabled_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->account_enabled_isSet; } bool OAIEducationUser::is_account_enabled_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->account_enabled_isValid; } QString OAIEducationUser::getDisplayName() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->display_name; } void OAIEducationUser::setDisplayName(const QString &display_name) { Q_D(OAIEducationUser); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIEducationUser::is_display_name_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->display_name_isSet; } bool OAIEducationUser::is_display_name_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->display_name_isValid; } QList OAIEducationUser::getDrives() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->drives; } void OAIEducationUser::setDrives(const QList &drives) { Q_D(OAIEducationUser); Q_ASSERT(d); d->drives = drives; d->drives_isSet = true; } bool OAIEducationUser::is_drives_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->drives_isSet; } bool OAIEducationUser::is_drives_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->drives_isValid; } OAIDrive OAIEducationUser::getDrive() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->drive; } void OAIEducationUser::setDrive(const OAIDrive &drive) { Q_D(OAIEducationUser); Q_ASSERT(d); d->drive = drive; d->drive_isSet = true; } bool OAIEducationUser::is_drive_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->drive_isSet; } bool OAIEducationUser::is_drive_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->drive_isValid; } QList OAIEducationUser::getIdentities() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->identities; } void OAIEducationUser::setIdentities(const QList &identities) { Q_D(OAIEducationUser); Q_ASSERT(d); d->identities = identities; d->identities_isSet = true; } bool OAIEducationUser::is_identities_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->identities_isSet; } bool OAIEducationUser::is_identities_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->identities_isValid; } QString OAIEducationUser::getMail() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->mail; } void OAIEducationUser::setMail(const QString &mail) { Q_D(OAIEducationUser); Q_ASSERT(d); d->mail = mail; d->mail_isSet = true; } bool OAIEducationUser::is_mail_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->mail_isSet; } bool OAIEducationUser::is_mail_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->mail_isValid; } QList OAIEducationUser::getMemberOf() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->member_of; } void OAIEducationUser::setMemberOf(const QList &member_of) { Q_D(OAIEducationUser); Q_ASSERT(d); d->member_of = member_of; d->member_of_isSet = true; } bool OAIEducationUser::is_member_of_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->member_of_isSet; } bool OAIEducationUser::is_member_of_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->member_of_isValid; } QString OAIEducationUser::getOnPremisesSamAccountName() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->on_premises_sam_account_name; } void OAIEducationUser::setOnPremisesSamAccountName(const QString &on_premises_sam_account_name) { Q_D(OAIEducationUser); Q_ASSERT(d); d->on_premises_sam_account_name = on_premises_sam_account_name; d->on_premises_sam_account_name_isSet = true; } bool OAIEducationUser::is_on_premises_sam_account_name_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->on_premises_sam_account_name_isSet; } bool OAIEducationUser::is_on_premises_sam_account_name_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->on_premises_sam_account_name_isValid; } OAIPasswordProfile OAIEducationUser::getPasswordProfile() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->password_profile; } void OAIEducationUser::setPasswordProfile(const OAIPasswordProfile &password_profile) { Q_D(OAIEducationUser); Q_ASSERT(d); d->password_profile = password_profile; d->password_profile_isSet = true; } bool OAIEducationUser::is_password_profile_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->password_profile_isSet; } bool OAIEducationUser::is_password_profile_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->password_profile_isValid; } QString OAIEducationUser::getSurname() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->surname; } void OAIEducationUser::setSurname(const QString &surname) { Q_D(OAIEducationUser); Q_ASSERT(d); d->surname = surname; d->surname_isSet = true; } bool OAIEducationUser::is_surname_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->surname_isSet; } bool OAIEducationUser::is_surname_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->surname_isValid; } QString OAIEducationUser::getGivenName() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->given_name; } void OAIEducationUser::setGivenName(const QString &given_name) { Q_D(OAIEducationUser); Q_ASSERT(d); d->given_name = given_name; d->given_name_isSet = true; } bool OAIEducationUser::is_given_name_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->given_name_isSet; } bool OAIEducationUser::is_given_name_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->given_name_isValid; } QString OAIEducationUser::getPrimaryRole() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->primary_role; } void OAIEducationUser::setPrimaryRole(const QString &primary_role) { Q_D(OAIEducationUser); Q_ASSERT(d); d->primary_role = primary_role; d->primary_role_isSet = true; } bool OAIEducationUser::is_primary_role_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->primary_role_isSet; } bool OAIEducationUser::is_primary_role_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->primary_role_isValid; } QString OAIEducationUser::getUserType() const { Q_D(const OAIEducationUser); if(!d){ return {}; } return d->user_type; } void OAIEducationUser::setUserType(const QString &user_type) { Q_D(OAIEducationUser); Q_ASSERT(d); d->user_type = user_type; d->user_type_isSet = true; } bool OAIEducationUser::is_user_type_Set() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->user_type_isSet; } bool OAIEducationUser::is_user_type_Valid() const{ Q_D(const OAIEducationUser); if(!d){ return false; } return d->user_type_isValid; } bool OAIEducationUser::isSet() const { Q_D(const OAIEducationUser); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->account_enabled_isSet) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->drives.size() > 0) { isObjectUpdated = true; break; } if (d->drive.isSet()) { isObjectUpdated = true; break; } if (d->identities.size() > 0) { isObjectUpdated = true; break; } if (d->mail_isSet) { isObjectUpdated = true; break; } if (d->member_of.size() > 0) { isObjectUpdated = true; break; } if (d->on_premises_sam_account_name_isSet) { isObjectUpdated = true; break; } if (d->password_profile.isSet()) { isObjectUpdated = true; break; } if (d->surname_isSet) { isObjectUpdated = true; break; } if (d->given_name_isSet) { isObjectUpdated = true; break; } if (d->primary_role_isSet) { isObjectUpdated = true; break; } if (d->user_type_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEducationUser::isValid() const { Q_D(const OAIEducationUser); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationUser.h000066400000000000000000000075151442421066000236760ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIEducationUser.h * * And extension of user with education specific attributes */ #ifndef OAIEducationUser_H #define OAIEducationUser_H #include #include "OAIDrive.h" #include "OAIGroup.h" #include "OAIObjectIdentity.h" #include "OAIPasswordProfile.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIDrive; class OAIObjectIdentity; class OAIGroup; class OAIPasswordProfile; class OAIEducationUserPrivate; class OAIEducationUser : public OAIObject { public: OAIEducationUser(); OAIEducationUser(const OAIEducationUser &other); OAIEducationUser(QString json); ~OAIEducationUser() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; bool isAccountEnabled() const; void setAccountEnabled(const bool &account_enabled); bool is_account_enabled_Set() const; bool is_account_enabled_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QList getDrives() const; void setDrives(const QList &drives); bool is_drives_Set() const; bool is_drives_Valid() const; OAIDrive getDrive() const; void setDrive(const OAIDrive &drive); bool is_drive_Set() const; bool is_drive_Valid() const; QList getIdentities() const; void setIdentities(const QList &identities); bool is_identities_Set() const; bool is_identities_Valid() const; QString getMail() const; void setMail(const QString &mail); bool is_mail_Set() const; bool is_mail_Valid() const; QList getMemberOf() const; void setMemberOf(const QList &member_of); bool is_member_of_Set() const; bool is_member_of_Valid() const; QString getOnPremisesSamAccountName() const; void setOnPremisesSamAccountName(const QString &on_premises_sam_account_name); bool is_on_premises_sam_account_name_Set() const; bool is_on_premises_sam_account_name_Valid() const; OAIPasswordProfile getPasswordProfile() const; void setPasswordProfile(const OAIPasswordProfile &password_profile); bool is_password_profile_Set() const; bool is_password_profile_Valid() const; QString getSurname() const; void setSurname(const QString &surname); bool is_surname_Set() const; bool is_surname_Valid() const; QString getGivenName() const; void setGivenName(const QString &given_name); bool is_given_name_Set() const; bool is_given_name_Valid() const; QString getPrimaryRole() const; void setPrimaryRole(const QString &primary_role); bool is_primary_role_Set() const; bool is_primary_role_Valid() const; QString getUserType() const; void setUserType(const QString &user_type); bool is_user_type_Set() const; bool is_user_type_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIEducationUser) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEducationUser) #endif // OAIEducationUser_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationUserApi.cpp000066400000000000000000001030111442421066000246470ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationUserApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIEducationUserApi::OAIEducationUserApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIEducationUserApi::~OAIEducationUserApi() { } void OAIEducationUserApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("createEducationUser", defaultConf); _serverIndices.insert("createEducationUser", 0); _serverConfigs.insert("deleteEducationUser", defaultConf); _serverIndices.insert("deleteEducationUser", 0); _serverConfigs.insert("getEducationUser", defaultConf); _serverIndices.insert("getEducationUser", 0); _serverConfigs.insert("listEducationUsers", defaultConf); _serverIndices.insert("listEducationUsers", 0); _serverConfigs.insert("updateEducationUser", defaultConf); _serverIndices.insert("updateEducationUser", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIEducationUserApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIEducationUserApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIEducationUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIEducationUserApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIEducationUserApi::setUsername(const QString &username) { _username = username; } void OAIEducationUserApi::setPassword(const QString &password) { _password = password; } void OAIEducationUserApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIEducationUserApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIEducationUserApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIEducationUserApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationUserApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIEducationUserApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIEducationUserApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIEducationUserApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIEducationUserApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIEducationUserApi::abortRequests() { emit abortRequestsSignal(); } QString OAIEducationUserApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIEducationUserApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIEducationUserApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIEducationUserApi::createEducationUser(const OAIEducationUser &oai_education_user) { QString fullPath = QString(_serverConfigs["createEducationUser"][_serverIndices.value("createEducationUser")].URL()+"/education/users"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_education_user.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationUserApi::createEducationUserCallback); connect(this, &OAIEducationUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationUserApi::createEducationUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit createEducationUserSignal(output); emit createEducationUserSignalFull(worker, output); } else { emit createEducationUserSignalE(output, error_type, error_str); emit createEducationUserSignalEFull(worker, error_type, error_str); } } void OAIEducationUserApi::deleteEducationUser(const QString &user_id) { QString fullPath = QString(_serverConfigs["deleteEducationUser"][_serverIndices.value("deleteEducationUser")].URL()+"/education/users/{user-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationUserApi::deleteEducationUserCallback); connect(this, &OAIEducationUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationUserApi::deleteEducationUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteEducationUserSignal(); emit deleteEducationUserSignalFull(worker); } else { emit deleteEducationUserSignalE(error_type, error_str); emit deleteEducationUserSignalEFull(worker, error_type, error_str); } } void OAIEducationUserApi::getEducationUser(const QString &user_id, const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["getEducationUser"][_serverIndices.value("getEducationUser")].URL()+"/education/users/{user-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationUserApi::getEducationUserCallback); connect(this, &OAIEducationUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationUserApi::getEducationUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getEducationUserSignal(output); emit getEducationUserSignalFull(worker, output); } else { emit getEducationUserSignalE(output, error_type, error_str); emit getEducationUserSignalEFull(worker, error_type, error_str); } } void OAIEducationUserApi::listEducationUsers(const ::OpenAPI::OptionalParam> &orderby, const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["listEducationUsers"][_serverIndices.value("listEducationUsers")].URL()+"/education/users"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (orderby.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$orderby", false); if (orderby.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, orderby.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$orderby=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationUserApi::listEducationUsersCallback); connect(this, &OAIEducationUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationUserApi::listEducationUsersCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_educationUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listEducationUsersSignal(output); emit listEducationUsersSignalFull(worker, output); } else { emit listEducationUsersSignalE(output, error_type, error_str); emit listEducationUsersSignalEFull(worker, error_type, error_str); } } void OAIEducationUserApi::updateEducationUser(const QString &user_id, const OAIEducationUser &oai_education_user) { QString fullPath = QString(_serverConfigs["updateEducationUser"][_serverIndices.value("updateEducationUser")].URL()+"/education/users/{user-id}"); if (!_bearerToken.isEmpty()) addHeaders("Authorization", "Bearer " + _bearerToken); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PATCH"); { QByteArray output = oai_education_user.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIEducationUserApi::updateEducationUserCallback); connect(this, &OAIEducationUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIEducationUserApi::updateEducationUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEducationUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit updateEducationUserSignal(output); emit updateEducationUserSignalFull(worker, output); } else { emit updateEducationUserSignalE(output, error_type, error_str); emit updateEducationUserSignalEFull(worker, error_type, error_str); } } void OAIEducationUserApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationUserApi.h000066400000000000000000000152111442421066000243200ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIEducationUserApi_H #define OAI_OAIEducationUserApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_educationUser.h" #include "OAIEducationUser.h" #include "OAIOdata_error.h" #include #include #include #include #include #include #include namespace OpenAPI { class OAIEducationUserApi : public QObject { Q_OBJECT public: OAIEducationUserApi(const int timeOut = 0); ~OAIEducationUserApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] oai_education_user OAIEducationUser [required] */ void createEducationUser(const OAIEducationUser &oai_education_user); /** * @param[in] user_id QString [required] */ void deleteEducationUser(const QString &user_id); /** * @param[in] user_id QString [required] * @param[in] expand QSet [optional] */ void getEducationUser(const QString &user_id, const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); /** * @param[in] orderby QSet [optional] * @param[in] expand QSet [optional] */ void listEducationUsers(const ::OpenAPI::OptionalParam> &orderby = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); /** * @param[in] user_id QString [required] * @param[in] oai_education_user OAIEducationUser [required] */ void updateEducationUser(const QString &user_id, const OAIEducationUser &oai_education_user); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void createEducationUserCallback(OAIHttpRequestWorker *worker); void deleteEducationUserCallback(OAIHttpRequestWorker *worker); void getEducationUserCallback(OAIHttpRequestWorker *worker); void listEducationUsersCallback(OAIHttpRequestWorker *worker); void updateEducationUserCallback(OAIHttpRequestWorker *worker); signals: void createEducationUserSignal(OAIEducationUser summary); void deleteEducationUserSignal(); void getEducationUserSignal(OAIEducationUser summary); void listEducationUsersSignal(OAICollection_of_educationUser summary); void updateEducationUserSignal(OAIEducationUser summary); void createEducationUserSignalFull(OAIHttpRequestWorker *worker, OAIEducationUser summary); void deleteEducationUserSignalFull(OAIHttpRequestWorker *worker); void getEducationUserSignalFull(OAIHttpRequestWorker *worker, OAIEducationUser summary); void listEducationUsersSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_educationUser summary); void updateEducationUserSignalFull(OAIHttpRequestWorker *worker, OAIEducationUser summary); void createEducationUserSignalE(OAIEducationUser summary, QNetworkReply::NetworkError error_type, QString error_str); void deleteEducationUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getEducationUserSignalE(OAIEducationUser summary, QNetworkReply::NetworkError error_type, QString error_str); void listEducationUsersSignalE(OAICollection_of_educationUser summary, QNetworkReply::NetworkError error_type, QString error_str); void updateEducationUserSignalE(OAIEducationUser summary, QNetworkReply::NetworkError error_type, QString error_str); void createEducationUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteEducationUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getEducationUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listEducationUsersSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void updateEducationUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationUser_Reference.cpp000066400000000000000000000072001442421066000261760ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEducationUser_Reference.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIEducationUser_ReferencePrivate { friend class OAIEducationUser_Reference; QString odata_id; bool odata_id_isSet; bool odata_id_isValid; }; OAIEducationUser_Reference::OAIEducationUser_Reference() : d_ptr() { } OAIEducationUser_Reference::OAIEducationUser_Reference(const OAIEducationUser_Reference& other) : d_ptr(other.d_ptr) { } OAIEducationUser_Reference::OAIEducationUser_Reference(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIEducationUser_Reference::~OAIEducationUser_Reference() = default; void OAIEducationUser_Reference::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIEducationUser_ReferencePrivate{}); Q_D(OAIEducationUser_Reference); d->odata_id_isSet = false; d->odata_id_isValid = false; } } void OAIEducationUser_Reference::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEducationUser_Reference::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIEducationUser_Reference); d->odata_id_isValid = ::OpenAPI::fromJsonValue(d->odata_id, json[QString("@odata.id")]); d->odata_id_isSet = !json[QString("@odata.id")].isNull() && d->odata_id_isValid; } QString OAIEducationUser_Reference::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEducationUser_Reference::asJsonObject() const { Q_D(const OAIEducationUser_Reference); if(!d){ return {}; } QJsonObject obj; if (d->odata_id_isSet) { obj.insert(QString("@odata.id"), ::OpenAPI::toJsonValue(d->odata_id)); } return obj; } QString OAIEducationUser_Reference::getOdataId() const { Q_D(const OAIEducationUser_Reference); if(!d){ return {}; } return d->odata_id; } void OAIEducationUser_Reference::setOdataId(const QString &odata_id) { Q_D(OAIEducationUser_Reference); Q_ASSERT(d); d->odata_id = odata_id; d->odata_id_isSet = true; } bool OAIEducationUser_Reference::is_odata_id_Set() const{ Q_D(const OAIEducationUser_Reference); if(!d){ return false; } return d->odata_id_isSet; } bool OAIEducationUser_Reference::is_odata_id_Valid() const{ Q_D(const OAIEducationUser_Reference); if(!d){ return false; } return d->odata_id_isValid; } bool OAIEducationUser_Reference::isSet() const { Q_D(const OAIEducationUser_Reference); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->odata_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEducationUser_Reference::isValid() const { Q_D(const OAIEducationUser_Reference); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEducationUser_Reference.h000066400000000000000000000031031442421066000256410ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIEducationUser_Reference.h * * */ #ifndef OAIEducationUser_Reference_H #define OAIEducationUser_Reference_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEducationUser_ReferencePrivate; class OAIEducationUser_Reference : public OAIObject { public: OAIEducationUser_Reference(); OAIEducationUser_Reference(const OAIEducationUser_Reference &other); OAIEducationUser_Reference(QString json); ~OAIEducationUser_Reference() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getOdataId() const; void setOdataId(const QString &odata_id); bool is_odata_id_Set() const; bool is_odata_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIEducationUser_Reference) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEducationUser_Reference) #endif // OAIEducationUser_Reference_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIEntity.cpp000066400000000000000000000056621442421066000227340ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEntity.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIEntityPrivate { friend class OAIEntity; QString id; bool id_isSet; bool id_isValid; }; OAIEntity::OAIEntity() : d_ptr() { } OAIEntity::OAIEntity(const OAIEntity& other) : d_ptr(other.d_ptr) { } OAIEntity::OAIEntity(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIEntity::~OAIEntity() = default; void OAIEntity::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIEntityPrivate{}); Q_D(OAIEntity); d->id_isSet = false; d->id_isValid = false; } } void OAIEntity::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEntity::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIEntity); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; } QString OAIEntity::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEntity::asJsonObject() const { Q_D(const OAIEntity); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } return obj; } QString OAIEntity::getId() const { Q_D(const OAIEntity); if(!d){ return {}; } return d->id; } void OAIEntity::setId(const QString &id) { Q_D(OAIEntity); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIEntity::is_id_Set() const{ Q_D(const OAIEntity); if(!d){ return false; } return d->id_isSet; } bool OAIEntity::is_id_Valid() const{ Q_D(const OAIEntity); if(!d){ return false; } return d->id_isValid; } bool OAIEntity::isSet() const { Q_D(const OAIEntity); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEntity::isValid() const { Q_D(const OAIEntity); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIEntity.h000066400000000000000000000025161442421066000223740ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIEntity.h * * Represents an entity. */ #ifndef OAIEntity_H #define OAIEntity_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIEntityPrivate; class OAIEntity : public OAIObject { public: OAIEntity(); OAIEntity(const OAIEntity &other); OAIEntity(QString json); ~OAIEntity() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIEntity) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEntity) #endif // OAIEntity_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIEnum.h000066400000000000000000000022501442421066000220170ustar00rootroot00000000000000// enum.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_ENUM_H #define OAI_ENUM_H #include #include #include namespace OpenAPI { class OAIEnum { public: OAIEnum() {} OAIEnum(QString jsonString) { fromJson(jsonString); } virtual ~OAIEnum() {} virtual QJsonValue asJsonValue() const { return QJsonValue(jstr); } virtual QString asJson() const { return jstr; } virtual void fromJson(QString jsonString) { jstr = jsonString; } virtual void fromJsonValue(QJsonValue jval) { jstr = jval.toString(); } virtual bool isSet() const { return false; } virtual bool isValid() const { return true; } private: QString jstr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIEnum) #endif // OAI_ENUM_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIExportPersonalData_request.cpp000066400000000000000000000076551442421066000270130ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIExportPersonalData_request.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIExportPersonalData_requestPrivate { friend class OAIExportPersonalData_request; QString storage_location; bool storage_location_isSet; bool storage_location_isValid; }; OAIExportPersonalData_request::OAIExportPersonalData_request() : d_ptr() { } OAIExportPersonalData_request::OAIExportPersonalData_request(const OAIExportPersonalData_request& other) : d_ptr(other.d_ptr) { } OAIExportPersonalData_request::OAIExportPersonalData_request(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIExportPersonalData_request::~OAIExportPersonalData_request() = default; void OAIExportPersonalData_request::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIExportPersonalData_requestPrivate{}); Q_D(OAIExportPersonalData_request); d->storage_location_isSet = false; d->storage_location_isValid = false; } } void OAIExportPersonalData_request::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIExportPersonalData_request::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIExportPersonalData_request); d->storage_location_isValid = ::OpenAPI::fromJsonValue(d->storage_location, json[QString("storageLocation")]); d->storage_location_isSet = !json[QString("storageLocation")].isNull() && d->storage_location_isValid; } QString OAIExportPersonalData_request::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIExportPersonalData_request::asJsonObject() const { Q_D(const OAIExportPersonalData_request); if(!d){ return {}; } QJsonObject obj; if (d->storage_location_isSet) { obj.insert(QString("storageLocation"), ::OpenAPI::toJsonValue(d->storage_location)); } return obj; } QString OAIExportPersonalData_request::getStorageLocation() const { Q_D(const OAIExportPersonalData_request); if(!d){ return {}; } return d->storage_location; } void OAIExportPersonalData_request::setStorageLocation(const QString &storage_location) { Q_D(OAIExportPersonalData_request); Q_ASSERT(d); d->storage_location = storage_location; d->storage_location_isSet = true; } bool OAIExportPersonalData_request::is_storage_location_Set() const{ Q_D(const OAIExportPersonalData_request); if(!d){ return false; } return d->storage_location_isSet; } bool OAIExportPersonalData_request::is_storage_location_Valid() const{ Q_D(const OAIExportPersonalData_request); if(!d){ return false; } return d->storage_location_isValid; } bool OAIExportPersonalData_request::isSet() const { Q_D(const OAIExportPersonalData_request); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->storage_location_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIExportPersonalData_request::isValid() const { Q_D(const OAIExportPersonalData_request); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIExportPersonalData_request.h000066400000000000000000000032251442421066000264450ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIExportPersonalData_request.h * * */ #ifndef OAIExportPersonalData_request_H #define OAIExportPersonalData_request_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIExportPersonalData_requestPrivate; class OAIExportPersonalData_request : public OAIObject { public: OAIExportPersonalData_request(); OAIExportPersonalData_request(const OAIExportPersonalData_request &other); OAIExportPersonalData_request(QString json); ~OAIExportPersonalData_request() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getStorageLocation() const; void setStorageLocation(const QString &storage_location); bool is_storage_location_Set() const; bool is_storage_location_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIExportPersonalData_request) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIExportPersonalData_request) #endif // OAIExportPersonalData_request_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIFileSystemInfo.cpp000066400000000000000000000151401442421066000243500ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIFileSystemInfo.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIFileSystemInfoPrivate { friend class OAIFileSystemInfo; QDateTime created_date_time; bool created_date_time_isSet; bool created_date_time_isValid; QDateTime last_accessed_date_time; bool last_accessed_date_time_isSet; bool last_accessed_date_time_isValid; QDateTime last_modified_date_time; bool last_modified_date_time_isSet; bool last_modified_date_time_isValid; }; OAIFileSystemInfo::OAIFileSystemInfo() : d_ptr() { } OAIFileSystemInfo::OAIFileSystemInfo(const OAIFileSystemInfo& other) : d_ptr(other.d_ptr) { } OAIFileSystemInfo::OAIFileSystemInfo(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIFileSystemInfo::~OAIFileSystemInfo() = default; void OAIFileSystemInfo::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIFileSystemInfoPrivate{}); Q_D(OAIFileSystemInfo); d->created_date_time_isSet = false; d->created_date_time_isValid = false; d->last_accessed_date_time_isSet = false; d->last_accessed_date_time_isValid = false; d->last_modified_date_time_isSet = false; d->last_modified_date_time_isValid = false; } } void OAIFileSystemInfo::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIFileSystemInfo::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIFileSystemInfo); d->created_date_time_isValid = ::OpenAPI::fromJsonValue(d->created_date_time, json[QString("createdDateTime")]); d->created_date_time_isSet = !json[QString("createdDateTime")].isNull() && d->created_date_time_isValid; d->last_accessed_date_time_isValid = ::OpenAPI::fromJsonValue(d->last_accessed_date_time, json[QString("lastAccessedDateTime")]); d->last_accessed_date_time_isSet = !json[QString("lastAccessedDateTime")].isNull() && d->last_accessed_date_time_isValid; d->last_modified_date_time_isValid = ::OpenAPI::fromJsonValue(d->last_modified_date_time, json[QString("lastModifiedDateTime")]); d->last_modified_date_time_isSet = !json[QString("lastModifiedDateTime")].isNull() && d->last_modified_date_time_isValid; } QString OAIFileSystemInfo::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIFileSystemInfo::asJsonObject() const { Q_D(const OAIFileSystemInfo); if(!d){ return {}; } QJsonObject obj; if (d->created_date_time_isSet) { obj.insert(QString("createdDateTime"), ::OpenAPI::toJsonValue(d->created_date_time)); } if (d->last_accessed_date_time_isSet) { obj.insert(QString("lastAccessedDateTime"), ::OpenAPI::toJsonValue(d->last_accessed_date_time)); } if (d->last_modified_date_time_isSet) { obj.insert(QString("lastModifiedDateTime"), ::OpenAPI::toJsonValue(d->last_modified_date_time)); } return obj; } QDateTime OAIFileSystemInfo::getCreatedDateTime() const { Q_D(const OAIFileSystemInfo); if(!d){ return {}; } return d->created_date_time; } void OAIFileSystemInfo::setCreatedDateTime(const QDateTime &created_date_time) { Q_D(OAIFileSystemInfo); Q_ASSERT(d); d->created_date_time = created_date_time; d->created_date_time_isSet = true; } bool OAIFileSystemInfo::is_created_date_time_Set() const{ Q_D(const OAIFileSystemInfo); if(!d){ return false; } return d->created_date_time_isSet; } bool OAIFileSystemInfo::is_created_date_time_Valid() const{ Q_D(const OAIFileSystemInfo); if(!d){ return false; } return d->created_date_time_isValid; } QDateTime OAIFileSystemInfo::getLastAccessedDateTime() const { Q_D(const OAIFileSystemInfo); if(!d){ return {}; } return d->last_accessed_date_time; } void OAIFileSystemInfo::setLastAccessedDateTime(const QDateTime &last_accessed_date_time) { Q_D(OAIFileSystemInfo); Q_ASSERT(d); d->last_accessed_date_time = last_accessed_date_time; d->last_accessed_date_time_isSet = true; } bool OAIFileSystemInfo::is_last_accessed_date_time_Set() const{ Q_D(const OAIFileSystemInfo); if(!d){ return false; } return d->last_accessed_date_time_isSet; } bool OAIFileSystemInfo::is_last_accessed_date_time_Valid() const{ Q_D(const OAIFileSystemInfo); if(!d){ return false; } return d->last_accessed_date_time_isValid; } QDateTime OAIFileSystemInfo::getLastModifiedDateTime() const { Q_D(const OAIFileSystemInfo); if(!d){ return {}; } return d->last_modified_date_time; } void OAIFileSystemInfo::setLastModifiedDateTime(const QDateTime &last_modified_date_time) { Q_D(OAIFileSystemInfo); Q_ASSERT(d); d->last_modified_date_time = last_modified_date_time; d->last_modified_date_time_isSet = true; } bool OAIFileSystemInfo::is_last_modified_date_time_Set() const{ Q_D(const OAIFileSystemInfo); if(!d){ return false; } return d->last_modified_date_time_isSet; } bool OAIFileSystemInfo::is_last_modified_date_time_Valid() const{ Q_D(const OAIFileSystemInfo); if(!d){ return false; } return d->last_modified_date_time_isValid; } bool OAIFileSystemInfo::isSet() const { Q_D(const OAIFileSystemInfo); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->created_date_time_isSet) { isObjectUpdated = true; break; } if (d->last_accessed_date_time_isSet) { isObjectUpdated = true; break; } if (d->last_modified_date_time_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIFileSystemInfo::isValid() const { Q_D(const OAIFileSystemInfo); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIFileSystemInfo.h000066400000000000000000000037441442421066000240240ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIFileSystemInfo.h * * File system information on client. Read-write. */ #ifndef OAIFileSystemInfo_H #define OAIFileSystemInfo_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIFileSystemInfoPrivate; class OAIFileSystemInfo : public OAIObject { public: OAIFileSystemInfo(); OAIFileSystemInfo(const OAIFileSystemInfo &other); OAIFileSystemInfo(QString json); ~OAIFileSystemInfo() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QDateTime getCreatedDateTime() const; void setCreatedDateTime(const QDateTime &created_date_time); bool is_created_date_time_Set() const; bool is_created_date_time_Valid() const; QDateTime getLastAccessedDateTime() const; void setLastAccessedDateTime(const QDateTime &last_accessed_date_time); bool is_last_accessed_date_time_Set() const; bool is_last_accessed_date_time_Valid() const; QDateTime getLastModifiedDateTime() const; void setLastModifiedDateTime(const QDateTime &last_modified_date_time); bool is_last_modified_date_time_Set() const; bool is_last_modified_date_time_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIFileSystemInfo) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIFileSystemInfo) #endif // OAIFileSystemInfo_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIFolder.cpp000066400000000000000000000102271442421066000226640ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIFolder.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIFolderPrivate { friend class OAIFolder; qint32 child_count; bool child_count_isSet; bool child_count_isValid; OAIFolderView view; bool view_isSet; bool view_isValid; }; OAIFolder::OAIFolder() : d_ptr() { } OAIFolder::OAIFolder(const OAIFolder& other) : d_ptr(other.d_ptr) { } OAIFolder::OAIFolder(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIFolder::~OAIFolder() = default; void OAIFolder::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIFolderPrivate{}); Q_D(OAIFolder); d->child_count_isSet = false; d->child_count_isValid = false; d->view_isSet = false; d->view_isValid = false; } } void OAIFolder::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIFolder::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIFolder); d->child_count_isValid = ::OpenAPI::fromJsonValue(d->child_count, json[QString("childCount")]); d->child_count_isSet = !json[QString("childCount")].isNull() && d->child_count_isValid; d->view_isValid = ::OpenAPI::fromJsonValue(d->view, json[QString("view")]); d->view_isSet = !json[QString("view")].isNull() && d->view_isValid; } QString OAIFolder::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIFolder::asJsonObject() const { Q_D(const OAIFolder); if(!d){ return {}; } QJsonObject obj; if (d->child_count_isSet) { obj.insert(QString("childCount"), ::OpenAPI::toJsonValue(d->child_count)); } if (d->view.isSet()) { obj.insert(QString("view"), ::OpenAPI::toJsonValue(d->view)); } return obj; } qint32 OAIFolder::getChildCount() const { Q_D(const OAIFolder); if(!d){ return {}; } return d->child_count; } void OAIFolder::setChildCount(const qint32 &child_count) { Q_D(OAIFolder); Q_ASSERT(d); d->child_count = child_count; d->child_count_isSet = true; } bool OAIFolder::is_child_count_Set() const{ Q_D(const OAIFolder); if(!d){ return false; } return d->child_count_isSet; } bool OAIFolder::is_child_count_Valid() const{ Q_D(const OAIFolder); if(!d){ return false; } return d->child_count_isValid; } OAIFolderView OAIFolder::getView() const { Q_D(const OAIFolder); if(!d){ return {}; } return d->view; } void OAIFolder::setView(const OAIFolderView &view) { Q_D(OAIFolder); Q_ASSERT(d); d->view = view; d->view_isSet = true; } bool OAIFolder::is_view_Set() const{ Q_D(const OAIFolder); if(!d){ return false; } return d->view_isSet; } bool OAIFolder::is_view_Valid() const{ Q_D(const OAIFolder); if(!d){ return false; } return d->view_isValid; } bool OAIFolder::isSet() const { Q_D(const OAIFolder); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->child_count_isSet) { isObjectUpdated = true; break; } if (d->view.isSet()) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIFolder::isValid() const { Q_D(const OAIFolder); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIFolder.h000066400000000000000000000031021442421066000223230ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIFolder.h * * Folder metadata, if the item is a folder. Read-only. */ #ifndef OAIFolder_H #define OAIFolder_H #include #include "OAIFolderView.h" #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIFolderView; class OAIFolderPrivate; class OAIFolder : public OAIObject { public: OAIFolder(); OAIFolder(const OAIFolder &other); OAIFolder(QString json); ~OAIFolder() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; qint32 getChildCount() const; void setChildCount(const qint32 &child_count); bool is_child_count_Set() const; bool is_child_count_Valid() const; OAIFolderView getView() const; void setView(const OAIFolderView &view); bool is_view_Set() const; bool is_view_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIFolder) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIFolder) #endif // OAIFolder_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIFolderView.cpp000066400000000000000000000127411442421066000235220ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIFolderView.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIFolderViewPrivate { friend class OAIFolderView; QString sort_by; bool sort_by_isSet; bool sort_by_isValid; QString sort_order; bool sort_order_isSet; bool sort_order_isValid; QString view_type; bool view_type_isSet; bool view_type_isValid; }; OAIFolderView::OAIFolderView() : d_ptr() { } OAIFolderView::OAIFolderView(const OAIFolderView& other) : d_ptr(other.d_ptr) { } OAIFolderView::OAIFolderView(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIFolderView::~OAIFolderView() = default; void OAIFolderView::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIFolderViewPrivate{}); Q_D(OAIFolderView); d->sort_by_isSet = false; d->sort_by_isValid = false; d->sort_order_isSet = false; d->sort_order_isValid = false; d->view_type_isSet = false; d->view_type_isValid = false; } } void OAIFolderView::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIFolderView::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIFolderView); d->sort_by_isValid = ::OpenAPI::fromJsonValue(d->sort_by, json[QString("sortBy")]); d->sort_by_isSet = !json[QString("sortBy")].isNull() && d->sort_by_isValid; d->sort_order_isValid = ::OpenAPI::fromJsonValue(d->sort_order, json[QString("sortOrder")]); d->sort_order_isSet = !json[QString("sortOrder")].isNull() && d->sort_order_isValid; d->view_type_isValid = ::OpenAPI::fromJsonValue(d->view_type, json[QString("viewType")]); d->view_type_isSet = !json[QString("viewType")].isNull() && d->view_type_isValid; } QString OAIFolderView::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIFolderView::asJsonObject() const { Q_D(const OAIFolderView); if(!d){ return {}; } QJsonObject obj; if (d->sort_by_isSet) { obj.insert(QString("sortBy"), ::OpenAPI::toJsonValue(d->sort_by)); } if (d->sort_order_isSet) { obj.insert(QString("sortOrder"), ::OpenAPI::toJsonValue(d->sort_order)); } if (d->view_type_isSet) { obj.insert(QString("viewType"), ::OpenAPI::toJsonValue(d->view_type)); } return obj; } QString OAIFolderView::getSortBy() const { Q_D(const OAIFolderView); if(!d){ return {}; } return d->sort_by; } void OAIFolderView::setSortBy(const QString &sort_by) { Q_D(OAIFolderView); Q_ASSERT(d); d->sort_by = sort_by; d->sort_by_isSet = true; } bool OAIFolderView::is_sort_by_Set() const{ Q_D(const OAIFolderView); if(!d){ return false; } return d->sort_by_isSet; } bool OAIFolderView::is_sort_by_Valid() const{ Q_D(const OAIFolderView); if(!d){ return false; } return d->sort_by_isValid; } QString OAIFolderView::getSortOrder() const { Q_D(const OAIFolderView); if(!d){ return {}; } return d->sort_order; } void OAIFolderView::setSortOrder(const QString &sort_order) { Q_D(OAIFolderView); Q_ASSERT(d); d->sort_order = sort_order; d->sort_order_isSet = true; } bool OAIFolderView::is_sort_order_Set() const{ Q_D(const OAIFolderView); if(!d){ return false; } return d->sort_order_isSet; } bool OAIFolderView::is_sort_order_Valid() const{ Q_D(const OAIFolderView); if(!d){ return false; } return d->sort_order_isValid; } QString OAIFolderView::getViewType() const { Q_D(const OAIFolderView); if(!d){ return {}; } return d->view_type; } void OAIFolderView::setViewType(const QString &view_type) { Q_D(OAIFolderView); Q_ASSERT(d); d->view_type = view_type; d->view_type_isSet = true; } bool OAIFolderView::is_view_type_Set() const{ Q_D(const OAIFolderView); if(!d){ return false; } return d->view_type_isSet; } bool OAIFolderView::is_view_type_Valid() const{ Q_D(const OAIFolderView); if(!d){ return false; } return d->view_type_isValid; } bool OAIFolderView::isSet() const { Q_D(const OAIFolderView); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->sort_by_isSet) { isObjectUpdated = true; break; } if (d->sort_order_isSet) { isObjectUpdated = true; break; } if (d->view_type_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIFolderView::isValid() const { Q_D(const OAIFolderView); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIFolderView.h000066400000000000000000000034111442421066000231610ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIFolderView.h * * A collection of properties defining the recommended view for the folder. */ #ifndef OAIFolderView_H #define OAIFolderView_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIFolderViewPrivate; class OAIFolderView : public OAIObject { public: OAIFolderView(); OAIFolderView(const OAIFolderView &other); OAIFolderView(QString json); ~OAIFolderView() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getSortBy() const; void setSortBy(const QString &sort_by); bool is_sort_by_Set() const; bool is_sort_by_Valid() const; QString getSortOrder() const; void setSortOrder(const QString &sort_order); bool is_sort_order_Set() const; bool is_sort_order_Valid() const; QString getViewType() const; void setViewType(const QString &view_type); bool is_view_type_Set() const; bool is_view_type_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIFolderView) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIFolderView) #endif // OAIFolderView_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIGroup.cpp000066400000000000000000000214671442421066000225550ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIGroup.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIGroupPrivate { friend class OAIGroup; QString id; bool id_isSet; bool id_isValid; QString description; bool description_isSet; bool description_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; QList group_types; bool group_types_isSet; bool group_types_isValid; QList members; bool members_isSet; bool members_isValid; QSet membersodata_bind; bool membersodata_bind_isSet; bool membersodata_bind_isValid; }; OAIGroup::OAIGroup() : d_ptr() { } OAIGroup::OAIGroup(const OAIGroup& other) : d_ptr(other.d_ptr) { } OAIGroup::OAIGroup(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIGroup::~OAIGroup() = default; void OAIGroup::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIGroupPrivate{}); Q_D(OAIGroup); d->id_isSet = false; d->id_isValid = false; d->description_isSet = false; d->description_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; d->group_types_isSet = false; d->group_types_isValid = false; d->members_isSet = false; d->members_isValid = false; d->membersodata_bind_isSet = false; d->membersodata_bind_isValid = false; } } void OAIGroup::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIGroup::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIGroup); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->description_isValid = ::OpenAPI::fromJsonValue(d->description, json[QString("description")]); d->description_isSet = !json[QString("description")].isNull() && d->description_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->group_types_isValid = ::OpenAPI::fromJsonValue(d->group_types, json[QString("groupTypes")]); d->group_types_isSet = !json[QString("groupTypes")].isNull() && d->group_types_isValid; d->members_isValid = ::OpenAPI::fromJsonValue(d->members, json[QString("members")]); d->members_isSet = !json[QString("members")].isNull() && d->members_isValid; d->membersodata_bind_isValid = ::OpenAPI::fromJsonValue(d->membersodata_bind, json[QString("members@odata.bind")]); d->membersodata_bind_isSet = !json[QString("members@odata.bind")].isNull() && d->membersodata_bind_isValid; } QString OAIGroup::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIGroup::asJsonObject() const { Q_D(const OAIGroup); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->description_isSet) { obj.insert(QString("description"), ::OpenAPI::toJsonValue(d->description)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->group_types.size() > 0) { obj.insert(QString("groupTypes"), ::OpenAPI::toJsonValue(d->group_types)); } if (d->members.size() > 0) { obj.insert(QString("members"), ::OpenAPI::toJsonValue(d->members)); } if (d->membersodata_bind.size() > 0) { obj.insert(QString("members@odata.bind"), ::OpenAPI::toJsonValue(d->membersodata_bind)); } return obj; } QString OAIGroup::getId() const { Q_D(const OAIGroup); if(!d){ return {}; } return d->id; } void OAIGroup::setId(const QString &id) { Q_D(OAIGroup); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIGroup::is_id_Set() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->id_isSet; } bool OAIGroup::is_id_Valid() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->id_isValid; } QString OAIGroup::getDescription() const { Q_D(const OAIGroup); if(!d){ return {}; } return d->description; } void OAIGroup::setDescription(const QString &description) { Q_D(OAIGroup); Q_ASSERT(d); d->description = description; d->description_isSet = true; } bool OAIGroup::is_description_Set() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->description_isSet; } bool OAIGroup::is_description_Valid() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->description_isValid; } QString OAIGroup::getDisplayName() const { Q_D(const OAIGroup); if(!d){ return {}; } return d->display_name; } void OAIGroup::setDisplayName(const QString &display_name) { Q_D(OAIGroup); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIGroup::is_display_name_Set() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->display_name_isSet; } bool OAIGroup::is_display_name_Valid() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->display_name_isValid; } QList OAIGroup::getGroupTypes() const { Q_D(const OAIGroup); if(!d){ return {}; } return d->group_types; } void OAIGroup::setGroupTypes(const QList &group_types) { Q_D(OAIGroup); Q_ASSERT(d); d->group_types = group_types; d->group_types_isSet = true; } bool OAIGroup::is_group_types_Set() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->group_types_isSet; } bool OAIGroup::is_group_types_Valid() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->group_types_isValid; } QList OAIGroup::getMembers() const { Q_D(const OAIGroup); if(!d){ return {}; } return d->members; } void OAIGroup::setMembers(const QList &members) { Q_D(OAIGroup); Q_ASSERT(d); d->members = members; d->members_isSet = true; } bool OAIGroup::is_members_Set() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->members_isSet; } bool OAIGroup::is_members_Valid() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->members_isValid; } QSet OAIGroup::getMembersodataBind() const { Q_D(const OAIGroup); if(!d){ return {}; } return d->membersodata_bind; } void OAIGroup::setMembersodataBind(const QSet &membersodata_bind) { Q_D(OAIGroup); Q_ASSERT(d); d->membersodata_bind = membersodata_bind; d->membersodata_bind_isSet = true; } bool OAIGroup::is_membersodata_bind_Set() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->membersodata_bind_isSet; } bool OAIGroup::is_membersodata_bind_Valid() const{ Q_D(const OAIGroup); if(!d){ return false; } return d->membersodata_bind_isValid; } bool OAIGroup::isSet() const { Q_D(const OAIGroup); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->description_isSet) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->group_types.size() > 0) { isObjectUpdated = true; break; } if (d->members.size() > 0) { isObjectUpdated = true; break; } if (d->membersodata_bind.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIGroup::isValid() const { Q_D(const OAIGroup); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIGroup.h000066400000000000000000000043371442421066000222170ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIGroup.h * * */ #ifndef OAIGroup_H #define OAIGroup_H #include #include "OAIUser.h" #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIUser; class OAIGroupPrivate; class OAIGroup : public OAIObject { public: OAIGroup(); OAIGroup(const OAIGroup &other); OAIGroup(QString json); ~OAIGroup() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QString getDescription() const; void setDescription(const QString &description); bool is_description_Set() const; bool is_description_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QList getGroupTypes() const; void setGroupTypes(const QList &group_types); bool is_group_types_Set() const; bool is_group_types_Valid() const; QList getMembers() const; void setMembers(const QList &members); bool is_members_Set() const; bool is_members_Valid() const; QSet getMembersodataBind() const; void setMembersodataBind(const QSet &membersodata_bind); bool is_membersodata_bind_Set() const; bool is_membersodata_bind_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIGroup) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIGroup) #endif // OAIGroup_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIGroupApi.cpp000066400000000000000000001027601442421066000232030ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIGroupApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIGroupApi::OAIGroupApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIGroupApi::~OAIGroupApi() { } void OAIGroupApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("addMember", defaultConf); _serverIndices.insert("addMember", 0); _serverConfigs.insert("deleteGroup", defaultConf); _serverIndices.insert("deleteGroup", 0); _serverConfigs.insert("deleteMember", defaultConf); _serverIndices.insert("deleteMember", 0); _serverConfigs.insert("getGroup", defaultConf); _serverIndices.insert("getGroup", 0); _serverConfigs.insert("listMembers", defaultConf); _serverIndices.insert("listMembers", 0); _serverConfigs.insert("updateGroup", defaultConf); _serverIndices.insert("updateGroup", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIGroupApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIGroupApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIGroupApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIGroupApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIGroupApi::setUsername(const QString &username) { _username = username; } void OAIGroupApi::setPassword(const QString &password) { _password = password; } void OAIGroupApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIGroupApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIGroupApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIGroupApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIGroupApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIGroupApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIGroupApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIGroupApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIGroupApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIGroupApi::abortRequests() { emit abortRequestsSignal(); } QString OAIGroupApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIGroupApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIGroupApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIGroupApi::addMember(const QString &group_id, const OAIMember_Reference &oai_member_reference) { QString fullPath = QString(_serverConfigs["addMember"][_serverIndices.value("addMember")].URL()+"/groups/{group-id}/members/$ref"); { QString group_idPathParam("{"); group_idPathParam.append("group-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "group-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"group-id"+pathSuffix : pathPrefix; fullPath.replace(group_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(group_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_member_reference.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupApi::addMemberCallback); connect(this, &OAIGroupApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupApi::addMemberCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit addMemberSignal(); emit addMemberSignalFull(worker); } else { emit addMemberSignalE(error_type, error_str); emit addMemberSignalEFull(worker, error_type, error_str); } } void OAIGroupApi::deleteGroup(const QString &group_id, const ::OpenAPI::OptionalParam &if_match) { QString fullPath = QString(_serverConfigs["deleteGroup"][_serverIndices.value("deleteGroup")].URL()+"/groups/{group-id}"); { QString group_idPathParam("{"); group_idPathParam.append("group-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "group-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"group-id"+pathSuffix : pathPrefix; fullPath.replace(group_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(group_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); if (if_match.hasValue()) { if (!::OpenAPI::toStringValue(if_match.value()).isEmpty()) { input.headers.insert("If-Match", ::OpenAPI::toStringValue(if_match.value())); } } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupApi::deleteGroupCallback); connect(this, &OAIGroupApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupApi::deleteGroupCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteGroupSignal(); emit deleteGroupSignalFull(worker); } else { emit deleteGroupSignalE(error_type, error_str); emit deleteGroupSignalEFull(worker, error_type, error_str); } } void OAIGroupApi::deleteMember(const QString &group_id, const QString &directory_object_id, const ::OpenAPI::OptionalParam &if_match) { QString fullPath = QString(_serverConfigs["deleteMember"][_serverIndices.value("deleteMember")].URL()+"/groups/{group-id}/members/{directory-object-id}/$ref"); { QString group_idPathParam("{"); group_idPathParam.append("group-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "group-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"group-id"+pathSuffix : pathPrefix; fullPath.replace(group_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(group_id))); } { QString directory_object_idPathParam("{"); directory_object_idPathParam.append("directory-object-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "directory-object-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"directory-object-id"+pathSuffix : pathPrefix; fullPath.replace(directory_object_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(directory_object_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); if (if_match.hasValue()) { if (!::OpenAPI::toStringValue(if_match.value()).isEmpty()) { input.headers.insert("If-Match", ::OpenAPI::toStringValue(if_match.value())); } } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupApi::deleteMemberCallback); connect(this, &OAIGroupApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupApi::deleteMemberCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteMemberSignal(); emit deleteMemberSignalFull(worker); } else { emit deleteMemberSignalE(error_type, error_str); emit deleteMemberSignalEFull(worker, error_type, error_str); } } void OAIGroupApi::getGroup(const QString &group_id, const ::OpenAPI::OptionalParam> &select, const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["getGroup"][_serverIndices.value("getGroup")].URL()+"/groups/{group-id}"); { QString group_idPathParam("{"); group_idPathParam.append("group-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "group-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"group-id"+pathSuffix : pathPrefix; fullPath.replace(group_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(group_id))); } QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (select.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$select", false); if (select.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, select.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$select=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupApi::getGroupCallback); connect(this, &OAIGroupApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupApi::getGroupCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIGroup output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getGroupSignal(output); emit getGroupSignalFull(worker, output); } else { emit getGroupSignalE(output, error_type, error_str); emit getGroupSignalEFull(worker, error_type, error_str); } } void OAIGroupApi::listMembers(const QString &group_id) { QString fullPath = QString(_serverConfigs["listMembers"][_serverIndices.value("listMembers")].URL()+"/groups/{group-id}/members"); { QString group_idPathParam("{"); group_idPathParam.append("group-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "group-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"group-id"+pathSuffix : pathPrefix; fullPath.replace(group_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(group_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupApi::listMembersCallback); connect(this, &OAIGroupApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupApi::listMembersCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_users output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listMembersSignal(output); emit listMembersSignalFull(worker, output); } else { emit listMembersSignalE(output, error_type, error_str); emit listMembersSignalEFull(worker, error_type, error_str); } } void OAIGroupApi::updateGroup(const QString &group_id, const OAIGroup &oai_group) { QString fullPath = QString(_serverConfigs["updateGroup"][_serverIndices.value("updateGroup")].URL()+"/groups/{group-id}"); { QString group_idPathParam("{"); group_idPathParam.append("group-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "group-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"group-id"+pathSuffix : pathPrefix; fullPath.replace(group_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(group_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PATCH"); { QByteArray output = oai_group.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupApi::updateGroupCallback); connect(this, &OAIGroupApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupApi::updateGroupCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit updateGroupSignal(); emit updateGroupSignalFull(worker); } else { emit updateGroupSignalE(error_type, error_str); emit updateGroupSignalEFull(worker, error_type, error_str); } } void OAIGroupApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIGroupApi.h000066400000000000000000000157411442421066000226520ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIGroupApi_H #define OAI_OAIGroupApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_users.h" #include "OAIGroup.h" #include "OAIMember_Reference.h" #include "OAIOdata_error.h" #include #include #include #include #include #include #include namespace OpenAPI { class OAIGroupApi : public QObject { Q_OBJECT public: OAIGroupApi(const int timeOut = 0); ~OAIGroupApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] group_id QString [required] * @param[in] oai_member_reference OAIMember_Reference [required] */ void addMember(const QString &group_id, const OAIMember_Reference &oai_member_reference); /** * @param[in] group_id QString [required] * @param[in] if_match QString [optional] */ void deleteGroup(const QString &group_id, const ::OpenAPI::OptionalParam &if_match = ::OpenAPI::OptionalParam()); /** * @param[in] group_id QString [required] * @param[in] directory_object_id QString [required] * @param[in] if_match QString [optional] */ void deleteMember(const QString &group_id, const QString &directory_object_id, const ::OpenAPI::OptionalParam &if_match = ::OpenAPI::OptionalParam()); /** * @param[in] group_id QString [required] * @param[in] select QSet [optional] * @param[in] expand QSet [optional] */ void getGroup(const QString &group_id, const ::OpenAPI::OptionalParam> &select = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); /** * @param[in] group_id QString [required] */ void listMembers(const QString &group_id); /** * @param[in] group_id QString [required] * @param[in] oai_group OAIGroup [required] */ void updateGroup(const QString &group_id, const OAIGroup &oai_group); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void addMemberCallback(OAIHttpRequestWorker *worker); void deleteGroupCallback(OAIHttpRequestWorker *worker); void deleteMemberCallback(OAIHttpRequestWorker *worker); void getGroupCallback(OAIHttpRequestWorker *worker); void listMembersCallback(OAIHttpRequestWorker *worker); void updateGroupCallback(OAIHttpRequestWorker *worker); signals: void addMemberSignal(); void deleteGroupSignal(); void deleteMemberSignal(); void getGroupSignal(OAIGroup summary); void listMembersSignal(OAICollection_of_users summary); void updateGroupSignal(); void addMemberSignalFull(OAIHttpRequestWorker *worker); void deleteGroupSignalFull(OAIHttpRequestWorker *worker); void deleteMemberSignalFull(OAIHttpRequestWorker *worker); void getGroupSignalFull(OAIHttpRequestWorker *worker, OAIGroup summary); void listMembersSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_users summary); void updateGroupSignalFull(OAIHttpRequestWorker *worker); void addMemberSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteGroupSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteMemberSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getGroupSignalE(OAIGroup summary, QNetworkReply::NetworkError error_type, QString error_str); void listMembersSignalE(OAICollection_of_users summary, QNetworkReply::NetworkError error_type, QString error_str); void updateGroupSignalE(QNetworkReply::NetworkError error_type, QString error_str); void addMemberSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteGroupSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void deleteMemberSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getGroupSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listMembersSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void updateGroupSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIGroupsApi.cpp000066400000000000000000000616071442421066000233720ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIGroupsApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIGroupsApi::OAIGroupsApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIGroupsApi::~OAIGroupsApi() { } void OAIGroupsApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("createGroup", defaultConf); _serverIndices.insert("createGroup", 0); _serverConfigs.insert("listGroups", defaultConf); _serverIndices.insert("listGroups", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIGroupsApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIGroupsApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIGroupsApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIGroupsApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIGroupsApi::setUsername(const QString &username) { _username = username; } void OAIGroupsApi::setPassword(const QString &password) { _password = password; } void OAIGroupsApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIGroupsApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIGroupsApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIGroupsApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIGroupsApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIGroupsApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIGroupsApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIGroupsApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIGroupsApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIGroupsApi::abortRequests() { emit abortRequestsSignal(); } QString OAIGroupsApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIGroupsApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIGroupsApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIGroupsApi::createGroup(const OAIGroup &oai_group) { QString fullPath = QString(_serverConfigs["createGroup"][_serverIndices.value("createGroup")].URL()+"/groups"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_group.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupsApi::createGroupCallback); connect(this, &OAIGroupsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupsApi::createGroupCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIGroup output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit createGroupSignal(output); emit createGroupSignalFull(worker, output); } else { emit createGroupSignalE(output, error_type, error_str); emit createGroupSignalEFull(worker, error_type, error_str); } } void OAIGroupsApi::listGroups(const ::OpenAPI::OptionalParam &search, const ::OpenAPI::OptionalParam> &orderby, const ::OpenAPI::OptionalParam> &select, const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["listGroups"][_serverIndices.value("listGroups")].URL()+"/groups"); QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (search.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$search", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$search")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(search.value()))); } if (orderby.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$orderby", false); if (orderby.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, orderby.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$orderby=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (select.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$select", false); if (select.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, select.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$select=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIGroupsApi::listGroupsCallback); connect(this, &OAIGroupsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIGroupsApi::listGroupsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_group output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listGroupsSignal(output); emit listGroupsSignalFull(worker, output); } else { emit listGroupsSignalE(output, error_type, error_str); emit listGroupsSignalEFull(worker, error_type, error_str); } } void OAIGroupsApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIGroupsApi.h000066400000000000000000000114451442421066000230320ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIGroupsApi_H #define OAI_OAIGroupsApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_group.h" #include "OAIGroup.h" #include "OAIOdata_error.h" #include #include #include #include #include #include #include namespace OpenAPI { class OAIGroupsApi : public QObject { Q_OBJECT public: OAIGroupsApi(const int timeOut = 0); ~OAIGroupsApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] oai_group OAIGroup [required] */ void createGroup(const OAIGroup &oai_group); /** * @param[in] search QString [optional] * @param[in] orderby QSet [optional] * @param[in] select QSet [optional] * @param[in] expand QSet [optional] */ void listGroups(const ::OpenAPI::OptionalParam &search = ::OpenAPI::OptionalParam(), const ::OpenAPI::OptionalParam> &orderby = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &select = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void createGroupCallback(OAIHttpRequestWorker *worker); void listGroupsCallback(OAIHttpRequestWorker *worker); signals: void createGroupSignal(OAIGroup summary); void listGroupsSignal(OAICollection_of_group summary); void createGroupSignalFull(OAIHttpRequestWorker *worker, OAIGroup summary); void listGroupsSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_group summary); void createGroupSignalE(OAIGroup summary, QNetworkReply::NetworkError error_type, QString error_str); void listGroupsSignalE(OAICollection_of_group summary, QNetworkReply::NetworkError error_type, QString error_str); void createGroupSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listGroupsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIHashes.cpp000066400000000000000000000151541442421066000226700ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIHashes.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIHashesPrivate { friend class OAIHashes; QString crc32_hash; bool crc32_hash_isSet; bool crc32_hash_isValid; QString quick_xor_hash; bool quick_xor_hash_isSet; bool quick_xor_hash_isValid; QString sha1_hash; bool sha1_hash_isSet; bool sha1_hash_isValid; QString sha256_hash; bool sha256_hash_isSet; bool sha256_hash_isValid; }; OAIHashes::OAIHashes() : d_ptr() { } OAIHashes::OAIHashes(const OAIHashes& other) : d_ptr(other.d_ptr) { } OAIHashes::OAIHashes(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIHashes::~OAIHashes() = default; void OAIHashes::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIHashesPrivate{}); Q_D(OAIHashes); d->crc32_hash_isSet = false; d->crc32_hash_isValid = false; d->quick_xor_hash_isSet = false; d->quick_xor_hash_isValid = false; d->sha1_hash_isSet = false; d->sha1_hash_isValid = false; d->sha256_hash_isSet = false; d->sha256_hash_isValid = false; } } void OAIHashes::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIHashes::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIHashes); d->crc32_hash_isValid = ::OpenAPI::fromJsonValue(d->crc32_hash, json[QString("crc32Hash")]); d->crc32_hash_isSet = !json[QString("crc32Hash")].isNull() && d->crc32_hash_isValid; d->quick_xor_hash_isValid = ::OpenAPI::fromJsonValue(d->quick_xor_hash, json[QString("quickXorHash")]); d->quick_xor_hash_isSet = !json[QString("quickXorHash")].isNull() && d->quick_xor_hash_isValid; d->sha1_hash_isValid = ::OpenAPI::fromJsonValue(d->sha1_hash, json[QString("sha1Hash")]); d->sha1_hash_isSet = !json[QString("sha1Hash")].isNull() && d->sha1_hash_isValid; d->sha256_hash_isValid = ::OpenAPI::fromJsonValue(d->sha256_hash, json[QString("sha256Hash")]); d->sha256_hash_isSet = !json[QString("sha256Hash")].isNull() && d->sha256_hash_isValid; } QString OAIHashes::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIHashes::asJsonObject() const { Q_D(const OAIHashes); if(!d){ return {}; } QJsonObject obj; if (d->crc32_hash_isSet) { obj.insert(QString("crc32Hash"), ::OpenAPI::toJsonValue(d->crc32_hash)); } if (d->quick_xor_hash_isSet) { obj.insert(QString("quickXorHash"), ::OpenAPI::toJsonValue(d->quick_xor_hash)); } if (d->sha1_hash_isSet) { obj.insert(QString("sha1Hash"), ::OpenAPI::toJsonValue(d->sha1_hash)); } if (d->sha256_hash_isSet) { obj.insert(QString("sha256Hash"), ::OpenAPI::toJsonValue(d->sha256_hash)); } return obj; } QString OAIHashes::getCrc32Hash() const { Q_D(const OAIHashes); if(!d){ return {}; } return d->crc32_hash; } void OAIHashes::setCrc32Hash(const QString &crc32_hash) { Q_D(OAIHashes); Q_ASSERT(d); d->crc32_hash = crc32_hash; d->crc32_hash_isSet = true; } bool OAIHashes::is_crc32_hash_Set() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->crc32_hash_isSet; } bool OAIHashes::is_crc32_hash_Valid() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->crc32_hash_isValid; } QString OAIHashes::getQuickXorHash() const { Q_D(const OAIHashes); if(!d){ return {}; } return d->quick_xor_hash; } void OAIHashes::setQuickXorHash(const QString &quick_xor_hash) { Q_D(OAIHashes); Q_ASSERT(d); d->quick_xor_hash = quick_xor_hash; d->quick_xor_hash_isSet = true; } bool OAIHashes::is_quick_xor_hash_Set() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->quick_xor_hash_isSet; } bool OAIHashes::is_quick_xor_hash_Valid() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->quick_xor_hash_isValid; } QString OAIHashes::getSha1Hash() const { Q_D(const OAIHashes); if(!d){ return {}; } return d->sha1_hash; } void OAIHashes::setSha1Hash(const QString &sha1_hash) { Q_D(OAIHashes); Q_ASSERT(d); d->sha1_hash = sha1_hash; d->sha1_hash_isSet = true; } bool OAIHashes::is_sha1_hash_Set() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->sha1_hash_isSet; } bool OAIHashes::is_sha1_hash_Valid() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->sha1_hash_isValid; } QString OAIHashes::getSha256Hash() const { Q_D(const OAIHashes); if(!d){ return {}; } return d->sha256_hash; } void OAIHashes::setSha256Hash(const QString &sha256_hash) { Q_D(OAIHashes); Q_ASSERT(d); d->sha256_hash = sha256_hash; d->sha256_hash_isSet = true; } bool OAIHashes::is_sha256_hash_Set() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->sha256_hash_isSet; } bool OAIHashes::is_sha256_hash_Valid() const{ Q_D(const OAIHashes); if(!d){ return false; } return d->sha256_hash_isValid; } bool OAIHashes::isSet() const { Q_D(const OAIHashes); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->crc32_hash_isSet) { isObjectUpdated = true; break; } if (d->quick_xor_hash_isSet) { isObjectUpdated = true; break; } if (d->sha1_hash_isSet) { isObjectUpdated = true; break; } if (d->sha256_hash_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIHashes::isValid() const { Q_D(const OAIHashes); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIHashes.h000066400000000000000000000036171442421066000223360ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIHashes.h * * Hashes of the file's binary content, if available. Read-only. */ #ifndef OAIHashes_H #define OAIHashes_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIHashesPrivate; class OAIHashes : public OAIObject { public: OAIHashes(); OAIHashes(const OAIHashes &other); OAIHashes(QString json); ~OAIHashes() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getCrc32Hash() const; void setCrc32Hash(const QString &crc32_hash); bool is_crc32_hash_Set() const; bool is_crc32_hash_Valid() const; QString getQuickXorHash() const; void setQuickXorHash(const QString &quick_xor_hash); bool is_quick_xor_hash_Set() const; bool is_quick_xor_hash_Valid() const; QString getSha1Hash() const; void setSha1Hash(const QString &sha1_hash); bool is_sha1_hash_Set() const; bool is_sha1_hash_Valid() const; QString getSha256Hash() const; void setSha256Hash(const QString &sha256_hash); bool is_sha256_hash_Set() const; bool is_sha256_hash_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIHashes) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIHashes) #endif // OAIHashes_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIHelpers.cpp000066400000000000000000000272101442421066000230530ustar00rootroot00000000000000// helpers-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAISerializerSettings { public: struct CustomDateTimeFormat{ bool isStringSet = false; QString formatString; bool isEnumSet = false; Qt::DateFormat formatEnum; }; static CustomDateTimeFormat getCustomDateTimeFormat() { return getInstance()->customDateTimeFormat; } static void setDateTimeFormatString(const QString &dtFormat){ getInstance()->customDateTimeFormat.isStringSet = true; getInstance()->customDateTimeFormat.isEnumSet = false; getInstance()->customDateTimeFormat.formatString = dtFormat; } static void setDateTimeFormatEnum(const Qt::DateFormat &dtFormat){ getInstance()->customDateTimeFormat.isEnumSet = true; getInstance()->customDateTimeFormat.isStringSet = false; getInstance()->customDateTimeFormat.formatEnum = dtFormat; } static OAISerializerSettings *getInstance(){ if(instance == nullptr){ instance = new OAISerializerSettings(); } return instance; } private: explicit OAISerializerSettings(){ instance = this; customDateTimeFormat.isStringSet = false; customDateTimeFormat.isEnumSet = false; } static OAISerializerSettings *instance; CustomDateTimeFormat customDateTimeFormat; }; OAISerializerSettings * OAISerializerSettings::instance = nullptr; bool setDateTimeFormat(const QString &dateTimeFormat){ bool success = false; auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); if (dt.isValid()) { success = true; OAISerializerSettings::setDateTimeFormatString(dateTimeFormat); } return success; } bool setDateTimeFormat(const Qt::DateFormat &dateTimeFormat){ bool success = false; auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); if (dt.isValid()) { success = true; OAISerializerSettings::setDateTimeFormatEnum(dateTimeFormat); } return success; } QString toStringValue(const QString &value) { return value; } QString toStringValue(const QDateTime &value) { if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); } if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); } // ISO 8601 return value.toString(Qt::ISODate); } QString toStringValue(const QByteArray &value) { return QString(value); } QString toStringValue(const QDate &value) { // ISO 8601 return value.toString(Qt::DateFormat::ISODate); } QString toStringValue(const qint32 &value) { return QString::number(value); } QString toStringValue(const qint64 &value) { return QString::number(value); } QString toStringValue(const bool &value) { return QString(value ? "true" : "false"); } QString toStringValue(const float &value) { return QString::number(static_cast(value)); } QString toStringValue(const double &value) { return QString::number(value); } QString toStringValue(const OAIObject &value) { return value.asJson(); } QString toStringValue(const OAIEnum &value) { return value.asJson(); } QString toStringValue(const OAIHttpFileElement &value) { return value.asJson(); } QJsonValue toJsonValue(const QString &value) { return QJsonValue(value); } QJsonValue toJsonValue(const QDateTime &value) { if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString)); } if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum)); } // ISO 8601 return QJsonValue(value.toString(Qt::ISODate)); } QJsonValue toJsonValue(const QByteArray &value) { return QJsonValue(QString(value.toBase64())); } QJsonValue toJsonValue(const QDate &value) { return QJsonValue(value.toString(Qt::ISODate)); } QJsonValue toJsonValue(const qint32 &value) { return QJsonValue(value); } QJsonValue toJsonValue(const qint64 &value) { return QJsonValue(value); } QJsonValue toJsonValue(const bool &value) { return QJsonValue(value); } QJsonValue toJsonValue(const float &value) { return QJsonValue(static_cast(value)); } QJsonValue toJsonValue(const double &value) { return QJsonValue(value); } QJsonValue toJsonValue(const OAIObject &value) { return value.asJsonObject(); } QJsonValue toJsonValue(const OAIEnum &value) { return value.asJsonValue(); } QJsonValue toJsonValue(const OAIHttpFileElement &value) { return value.asJsonValue(); } bool fromStringValue(const QString &inStr, QString &value) { value.clear(); value.append(inStr); return !inStr.isEmpty(); } bool fromStringValue(const QString &inStr, QDateTime &value) { if (inStr.isEmpty()) { return false; } else { QDateTime dateTime; if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); } else { dateTime = QDateTime::fromString(inStr, Qt::ISODate); } if (dateTime.isValid()) { value.setDate(dateTime.date()); value.setTime(dateTime.time()); } else { qDebug() << "DateTime is invalid"; } return dateTime.isValid(); } } bool fromStringValue(const QString &inStr, QByteArray &value) { if (inStr.isEmpty()) { return false; } else { value.clear(); value.append(inStr.toUtf8()); return value.count() > 0; } } bool fromStringValue(const QString &inStr, QDate &value) { if (inStr.isEmpty()) { return false; } else { auto date = QDate::fromString(inStr, Qt::DateFormat::ISODate); if (date.isValid()) { value.setDate(date.year(), date.month(), date.day()); } else { qDebug() << "Date is invalid"; } return date.isValid(); } } bool fromStringValue(const QString &inStr, qint32 &value) { bool ok = false; value = QVariant(inStr).toInt(&ok); return ok; } bool fromStringValue(const QString &inStr, qint64 &value) { bool ok = false; value = QVariant(inStr).toLongLong(&ok); return ok; } bool fromStringValue(const QString &inStr, bool &value) { value = QVariant(inStr).toBool(); return ((inStr == "true") || (inStr == "false")); } bool fromStringValue(const QString &inStr, float &value) { bool ok = false; value = QVariant(inStr).toFloat(&ok); return ok; } bool fromStringValue(const QString &inStr, double &value) { bool ok = false; value = QVariant(inStr).toDouble(&ok); return ok; } bool fromStringValue(const QString &inStr, OAIObject &value) { QJsonParseError err; QJsonDocument::fromJson(inStr.toUtf8(),&err); if ( err.error == QJsonParseError::NoError ){ value.fromJson(inStr); return true; } return false; } bool fromStringValue(const QString &inStr, OAIEnum &value) { value.fromJson(inStr); return true; } bool fromStringValue(const QString &inStr, OAIHttpFileElement &value) { return value.fromStringValue(inStr); } bool fromJsonValue(QString &value, const QJsonValue &jval) { bool ok = true; if (!jval.isUndefined() && !jval.isNull()) { if (jval.isString()) { value = jval.toString(); } else if (jval.isBool()) { value = jval.toBool() ? "true" : "false"; } else if (jval.isDouble()) { value = QString::number(jval.toDouble()); } else { ok = false; } } else { ok = false; } return ok; } bool fromJsonValue(QDateTime &value, const QJsonValue &jval) { bool ok = true; if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); } else { value = QDateTime::fromString(jval.toString(), Qt::ISODate); } ok = value.isValid(); } else { ok = false; } return ok; } bool fromJsonValue(QByteArray &value, const QJsonValue &jval) { bool ok = true; if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QByteArray::fromBase64(jval.toString().toUtf8()); ok = value.size() > 0; } else { ok = false; } return ok; } bool fromJsonValue(QDate &value, const QJsonValue &jval) { bool ok = true; if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { value = QDate::fromString(jval.toString(), Qt::ISODate); ok = value.isValid(); } else { ok = false; } return ok; } bool fromJsonValue(qint32 &value, const QJsonValue &jval) { bool ok = true; if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { value = jval.toInt(); } else { ok = false; } return ok; } bool fromJsonValue(qint64 &value, const QJsonValue &jval) { bool ok = true; if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { value = jval.toVariant().toLongLong(); } else { ok = false; } return ok; } bool fromJsonValue(bool &value, const QJsonValue &jval) { bool ok = true; if (jval.isBool()) { value = jval.toBool(); } else { ok = false; } return ok; } bool fromJsonValue(float &value, const QJsonValue &jval) { bool ok = true; if (jval.isDouble()) { value = static_cast(jval.toDouble()); } else { ok = false; } return ok; } bool fromJsonValue(double &value, const QJsonValue &jval) { bool ok = true; if (jval.isDouble()) { value = jval.toDouble(); } else { ok = false; } return ok; } bool fromJsonValue(OAIObject &value, const QJsonValue &jval) { bool ok = true; if (jval.isObject()) { value.fromJsonObject(jval.toObject()); ok = value.isValid(); } else { ok = false; } return ok; } bool fromJsonValue(OAIEnum &value, const QJsonValue &jval) { value.fromJsonValue(jval); return true; } bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval) { return value.fromJsonValue(jval); } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIHelpers.h000066400000000000000000000174031442421066000225230ustar00rootroot00000000000000// helpers-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_HELPERS_H #define OAI_HELPERS_H #include #include #include #include #include #include #include #include #include #include #include "OAIEnum.h" #include "OAIHttpFileElement.h" #include "OAIObject.h" namespace OpenAPI { template class OptionalParam { public: T m_Value; bool m_hasValue; public: OptionalParam(){ m_hasValue = false; } OptionalParam(const T &val){ m_hasValue = true; m_Value = val; } bool hasValue() const { return m_hasValue; } T value() const{ return m_Value; } }; bool setDateTimeFormat(const QString &format); bool setDateTimeFormat(const Qt::DateFormat &format); template QString toStringValue(const QList &val); template QString toStringValue(const QSet &val); template bool fromStringValue(const QList &inStr, QList &val); template bool fromStringValue(const QSet &inStr, QList &val); template bool fromStringValue(const QMap &inStr, QMap &val); template QJsonValue toJsonValue(const QList &val); template QJsonValue toJsonValue(const QSet &val); template QJsonValue toJsonValue(const QMap &val); template bool fromJsonValue(QList &val, const QJsonValue &jval); template bool fromJsonValue(QSet &val, const QJsonValue &jval); template bool fromJsonValue(QMap &val, const QJsonValue &jval); QString toStringValue(const QString &value); QString toStringValue(const QDateTime &value); QString toStringValue(const QByteArray &value); QString toStringValue(const QDate &value); QString toStringValue(const qint32 &value); QString toStringValue(const qint64 &value); QString toStringValue(const bool &value); QString toStringValue(const float &value); QString toStringValue(const double &value); QString toStringValue(const OAIObject &value); QString toStringValue(const OAIEnum &value); QString toStringValue(const OAIHttpFileElement &value); template QString toStringValue(const QList &val) { QString strArray; for (const auto &item : val) { strArray.append(toStringValue(item) + ","); } if (val.count() > 0) { strArray.chop(1); } return strArray; } template QString toStringValue(const QSet &val) { QString strArray; for (const auto &item : val) { strArray.append(toStringValue(item) + ","); } if (val.count() > 0) { strArray.chop(1); } return strArray; } QJsonValue toJsonValue(const QString &value); QJsonValue toJsonValue(const QDateTime &value); QJsonValue toJsonValue(const QByteArray &value); QJsonValue toJsonValue(const QDate &value); QJsonValue toJsonValue(const qint32 &value); QJsonValue toJsonValue(const qint64 &value); QJsonValue toJsonValue(const bool &value); QJsonValue toJsonValue(const float &value); QJsonValue toJsonValue(const double &value); QJsonValue toJsonValue(const OAIObject &value); QJsonValue toJsonValue(const OAIEnum &value); QJsonValue toJsonValue(const OAIHttpFileElement &value); template QJsonValue toJsonValue(const QList &val) { QJsonArray jArray; for (const auto &item : val) { jArray.append(toJsonValue(item)); } return jArray; } template QJsonValue toJsonValue(const QSet &val) { QJsonArray jArray; for (const auto &item : val) { jArray.append(toJsonValue(item)); } return jArray; } template QJsonValue toJsonValue(const QMap &val) { QJsonObject jObject; for (const auto &itemkey : val.keys()) { jObject.insert(itemkey, toJsonValue(val.value(itemkey))); } return jObject; } bool fromStringValue(const QString &inStr, QString &value); bool fromStringValue(const QString &inStr, QDateTime &value); bool fromStringValue(const QString &inStr, QByteArray &value); bool fromStringValue(const QString &inStr, QDate &value); bool fromStringValue(const QString &inStr, qint32 &value); bool fromStringValue(const QString &inStr, qint64 &value); bool fromStringValue(const QString &inStr, bool &value); bool fromStringValue(const QString &inStr, float &value); bool fromStringValue(const QString &inStr, double &value); bool fromStringValue(const QString &inStr, OAIObject &value); bool fromStringValue(const QString &inStr, OAIEnum &value); bool fromStringValue(const QString &inStr, OAIHttpFileElement &value); template bool fromStringValue(const QList &inStr, QList &val) { bool ok = (inStr.count() > 0); for (const auto &item : inStr) { T itemVal; ok &= fromStringValue(item, itemVal); val.push_back(itemVal); } return ok; } template bool fromStringValue(const QSet &inStr, QList &val) { bool ok = (inStr.count() > 0); for (const auto &item : inStr) { T itemVal; ok &= fromStringValue(item, itemVal); val.push_back(itemVal); } return ok; } template bool fromStringValue(const QMap &inStr, QMap &val) { bool ok = (inStr.count() > 0); for (const auto &itemkey : inStr.keys()) { T itemVal; ok &= fromStringValue(inStr.value(itemkey), itemVal); val.insert(itemkey, itemVal); } return ok; } bool fromJsonValue(QString &value, const QJsonValue &jval); bool fromJsonValue(QDateTime &value, const QJsonValue &jval); bool fromJsonValue(QByteArray &value, const QJsonValue &jval); bool fromJsonValue(QDate &value, const QJsonValue &jval); bool fromJsonValue(qint32 &value, const QJsonValue &jval); bool fromJsonValue(qint64 &value, const QJsonValue &jval); bool fromJsonValue(bool &value, const QJsonValue &jval); bool fromJsonValue(float &value, const QJsonValue &jval); bool fromJsonValue(double &value, const QJsonValue &jval); bool fromJsonValue(OAIObject &value, const QJsonValue &jval); bool fromJsonValue(OAIEnum &value, const QJsonValue &jval); bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval); template bool fromJsonValue(QList &val, const QJsonValue &jval) { bool ok = true; if (jval.isArray()) { for (const auto jitem : jval.toArray()) { T item; ok &= fromJsonValue(item, jitem); val.push_back(item); } } else { ok = false; } return ok; } template bool fromJsonValue(QSet &val, const QJsonValue &jval) { bool ok = true; if (jval.isArray()) { for (const auto jitem : jval.toArray()) { T item; ok &= fromJsonValue(item, jitem); val.insert(item); } } else { ok = false; } return ok; } template bool fromJsonValue(QMap &val, const QJsonValue &jval) { bool ok = true; if (jval.isObject()) { auto varmap = jval.toObject().toVariantMap(); if (varmap.count() > 0) { for (const auto &itemkey : varmap.keys()) { T itemVal; ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); val.insert(itemkey, itemVal); } } } else { ok = false; } return ok; } } // namespace OpenAPI #endif // OAI_HELPERS_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIHttpFileElement.cpp000066400000000000000000000101501442421066000244750ustar00rootroot00000000000000// HttpFileElement.cpp.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include #include #include #include #include "OAIHttpFileElement.h" namespace OpenAPI { void OAIHttpFileElement::setMimeType(const QString &mime) { mime_type = mime; } void OAIHttpFileElement::setFileName(const QString &name) { local_filename = name; } void OAIHttpFileElement::setVariableName(const QString &name) { variable_name = name; } void OAIHttpFileElement::setRequestFileName(const QString &name) { request_filename = name; } bool OAIHttpFileElement::isSet() const { return !local_filename.isEmpty() || !request_filename.isEmpty(); } QString OAIHttpFileElement::asJson() const { QFile file(local_filename); QByteArray bArray; bool result = false; if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } if (!result) { qDebug() << "Error opening file " << local_filename; } return QString(bArray); } QJsonValue OAIHttpFileElement::asJsonValue() const { QFile file(local_filename); QByteArray bArray; bool result = false; if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } if (!result) { qDebug() << "Error opening file " << local_filename; } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QJsonDocument::fromJson(bArray.data()).object(); #else return QJsonDocument::fromBinaryData(bArray.data()).object(); #endif } bool OAIHttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(instr.toUtf8()); file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } bool OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) { QFile file(local_filename); bool result = false; if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) file.write(QJsonDocument(jval.toObject()).toJson()); #else file.write(QJsonDocument(jval.toObject()).toBinaryData()); #endif file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } QByteArray OAIHttpFileElement::asByteArray() const { QFile file(local_filename); QByteArray bArray; bool result = false; if (file.exists()) { result = file.open(QIODevice::ReadOnly); bArray = file.readAll(); file.close(); } if (!result) { qDebug() << "Error opening file " << local_filename; } return bArray; } bool OAIHttpFileElement::fromByteArray(const QByteArray &bytes) { QFile file(local_filename); bool result = false; if (file.exists()) { file.remove(); } result = file.open(QIODevice::WriteOnly); file.write(bytes); file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; } return result; } bool OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray &bytes) { setMimeType(mime); setFileName(localFName); setVariableName(varName); setRequestFileName(reqFname); return fromByteArray(bytes); } QByteArray OAIHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime) { setMimeType(mime); setFileName(localFName); setVariableName(varName); setRequestFileName(reqFname); return asByteArray(); } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIHttpFileElement.h000066400000000000000000000030071442421066000241450ustar00rootroot00000000000000// HttpFileElement.h.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_HTTP_FILE_ELEMENT_H #define OAI_HTTP_FILE_ELEMENT_H #include #include #include namespace OpenAPI { class OAIHttpFileElement { public: QString variable_name; QString local_filename; QString request_filename; QString mime_type; void setMimeType(const QString &mime); void setFileName(const QString &name); void setVariableName(const QString &name); void setRequestFileName(const QString &name); bool isSet() const; bool fromStringValue(const QString &instr); bool fromJsonValue(const QJsonValue &jval); bool fromByteArray(const QByteArray &bytes); bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray &bytes); QString asJson() const; QJsonValue asJsonValue() const; QByteArray asByteArray() const; QByteArray loadFromFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime); }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIHttpFileElement) #endif // OAI_HTTP_FILE_ELEMENT_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIHttpRequest.cpp000066400000000000000000000431511442421066000237430ustar00rootroot00000000000000// HttpRequest.cpp.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include #include #include #include #include #include #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts #else #define SKIP_EMPTY_PARTS QString::SkipEmptyParts #endif #include "OAIHttpRequest.h" namespace OpenAPI { OAIHttpRequestInput::OAIHttpRequestInput() { initialize(); } OAIHttpRequestInput::OAIHttpRequestInput(QString v_url_str, QString v_http_method) { initialize(); url_str = v_url_str; http_method = v_http_method; } void OAIHttpRequestInput::initialize() { var_layout = NOT_SET; url_str = ""; http_method = "GET"; } void OAIHttpRequestInput::add_var(QString key, QString value) { vars[key] = value; } void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { OAIHttpFileElement file; file.variable_name = variable_name; file.local_filename = local_filename; file.request_filename = request_filename; file.mime_type = mime_type; files.append(file); } OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); #else qsrand(QDateTime::currentDateTime().toTime_t()); #endif if (manager == nullptr) { manager = new QNetworkAccessManager(this); } workingDirectory = QDir::currentPath(); timeOutTimer.setSingleShot(true); } OAIHttpRequestWorker::~OAIHttpRequestWorker() { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); timeOutTimer.stop(); for (const auto &item : multiPartFields) { if (item != nullptr) { delete item; } } } QMap OAIHttpRequestWorker::getResponseHeaders() const { return headers; } OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &fieldname) { if (!files.isEmpty()) { if (fieldname.isEmpty()) { return files.first(); } else if (files.contains(fieldname)) { return files[fieldname]; } } return OAIHttpFileElement(); } QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname) { if (!multiPartFields.isEmpty()) { if (fieldname.isEmpty()) { return multiPartFields.first(); } else if (multiPartFields.contains(fieldname)) { return multiPartFields[fieldname]; } } return nullptr; } void OAIHttpRequestWorker::setTimeOut(int timeOutMs) { timeOutTimer.setInterval(timeOutMs); if(timeOutTimer.interval() == 0) { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); } } void OAIHttpRequestWorker::setWorkingDirectory(const QString &path) { if (!path.isEmpty()) { workingDirectory = path; } } void OAIHttpRequestWorker::setResponseCompressionEnabled(bool enable) { isResponseCompressionEnabled = enable; } void OAIHttpRequestWorker::setRequestCompressionEnabled(bool enable) { isRequestCompressionEnabled = enable; } int OAIHttpRequestWorker::getHttpResponseCode() const{ return httpResponseCode; } QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; QString result = ""; QByteArray input_c = input.toLocal8Bit(); char c; for (int i = 0; i < input_c.length(); i++) { c = input_c.at(i); if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') { // ignore and request utf-8 version need_utf_encoding = true; } else if (c == '"') { result += "\\\""; } else { result += c; } } if (result.length() == 0) { need_utf_encoding = true; } if (!need_utf_encoding) { // return simple version return QString("%1=\"%2\"").arg(attribute_name, result); } QString result_utf8 = ""; for (int i = 0; i < input_c.length(); i++) { c = input_c.at(i); if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { result_utf8 += c; } else { result_utf8 += "%" + QString::number(static_cast(input_c.at(i)), 16).toUpper(); } } // return enhanced version with UTF-8 support return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8); } void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { // reset variables QNetworkReply *reply = nullptr; QByteArray request_content = ""; response = ""; error_type = QNetworkReply::NoError; error_str = ""; bool isFormData = false; // decide on the variable layout if (input->files.length() > 0) { input->var_layout = MULTIPART; } if (input->var_layout == NOT_SET) { input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED; } // prepare request content QString boundary = ""; if (input->var_layout == ADDRESS || input->var_layout == URL_ENCODED) { // variable layout is ADDRESS or URL_ENCODED if (input->vars.count() > 0) { bool first = true; isFormData = true; foreach (QString key, input->vars.keys()) { if (!first) { request_content.append("&"); } first = false; request_content.append(QUrl::toPercentEncoding(key)); request_content.append("="); request_content.append(QUrl::toPercentEncoding(input->vars.value(key))); } if (input->var_layout == ADDRESS) { input->url_str += "?" + request_content; request_content = ""; } } } else { // variable layout is MULTIPART boundary = QString("__-----------------------%1%2") #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) .arg(randomGenerator.generate()); #else .arg(QDateTime::currentDateTime().toTime_t()) .arg(qrand()); #endif QString boundary_delimiter = "--"; QString new_line = "\r\n"; // add variables foreach (QString key, input->vars.keys()) { // add boundary request_content.append(boundary_delimiter.toUtf8()); request_content.append(boundary.toUtf8()); request_content.append(new_line.toUtf8()); // add header request_content.append("Content-Disposition: form-data; "); request_content.append(http_attribute_encode("name", key).toUtf8()); request_content.append(new_line.toUtf8()); request_content.append("Content-Type: text/plain"); request_content.append(new_line.toUtf8()); // add header to body splitter request_content.append(new_line.toUtf8()); // add variable content request_content.append(input->vars.value(key).toUtf8()); request_content.append(new_line.toUtf8()); } // add files for (QList::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) { QFileInfo fi(file_info->local_filename); // ensure necessary variables are available if (file_info->local_filename == nullptr || file_info->local_filename.isEmpty() || file_info->variable_name == nullptr || file_info->variable_name.isEmpty() || !fi.exists() || !fi.isFile() || !fi.isReadable()) { // silent abort for the current file continue; } QFile file(file_info->local_filename); if (!file.open(QIODevice::ReadOnly)) { // silent abort for the current file continue; } // ensure filename for the request if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) { file_info->request_filename = fi.fileName(); if (file_info->request_filename.isEmpty()) { file_info->request_filename = "file"; } } // add boundary request_content.append(boundary_delimiter.toUtf8()); request_content.append(boundary.toUtf8()); request_content.append(new_line.toUtf8()); // add header request_content.append( QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename)).toUtf8()); request_content.append(new_line.toUtf8()); if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { request_content.append("Content-Type: "); request_content.append(file_info->mime_type.toUtf8()); request_content.append(new_line.toUtf8()); } request_content.append("Content-Transfer-Encoding: binary"); request_content.append(new_line.toUtf8()); // add header to body splitter request_content.append(new_line.toUtf8()); // add file content request_content.append(file.readAll()); request_content.append(new_line.toUtf8()); file.close(); } // add end of body request_content.append(boundary_delimiter.toUtf8()); request_content.append(boundary.toUtf8()); request_content.append(boundary_delimiter.toUtf8()); } if (input->request_body.size() > 0) { qDebug() << "got a request body"; request_content.clear(); if(!isFormData && (input->var_layout != MULTIPART) && isRequestCompressionEnabled){ request_content.append(compress(input->request_body, 7, OAICompressionType::Gzip)); } else { request_content.append(input->request_body); } } // prepare connection QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); if (OAIHttpRequestWorker::sslDefaultConfiguration != nullptr) { request.setSslConfiguration(*OAIHttpRequestWorker::sslDefaultConfiguration); } request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt"); foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toUtf8(), input->headers.value(key).toUtf8()); } if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) { if (!input->headers.contains("Content-Type")) { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); } else { request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type")); } if(isRequestCompressionEnabled){ request.setRawHeader("Content-Encoding", "gzip"); } } else if (input->var_layout == URL_ENCODED) { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); } else if (input->var_layout == MULTIPART) { request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary); } if(isResponseCompressionEnabled){ request.setRawHeader("Accept-Encoding", "gzip"); } else { request.setRawHeader("Accept-Encoding", "identity"); } if (input->http_method == "GET") { reply = manager->get(request); } else if (input->http_method == "POST") { reply = manager->post(request, request_content); } else if (input->http_method == "PUT") { reply = manager->put(request, request_content); } else if (input->http_method == "HEAD") { reply = manager->head(request); } else if (input->http_method == "DELETE") { reply = manager->deleteResource(request); } else { #if (QT_VERSION >= 0x050800) reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); #else QBuffer *buffer = new QBuffer; buffer->setData(request_content); buffer->open(QIODevice::ReadOnly); reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); buffer->setParent(reply); #endif } if (reply != nullptr) { reply->setParent(this); connect(reply, &QNetworkReply::finished, [this, reply] { on_reply_finished(reply); }); } if (timeOutTimer.interval() > 0) { QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] { on_reply_timeout(reply); }); timeOutTimer.start(); } } void OAIHttpRequestWorker::on_reply_finished(QNetworkReply *reply) { bool codeSts = false; if(timeOutTimer.isActive()) { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); timeOutTimer.stop(); } error_type = reply->error(); error_str = reply->errorString(); if (reply->rawHeaderPairs().count() > 0) { for (const auto &item : reply->rawHeaderPairs()) { headers.insert(item.first, item.second); } } auto rescode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&codeSts); if(codeSts){ httpResponseCode = rescode; } else{ httpResponseCode = -1; } process_response(reply); reply->deleteLater(); emit on_execution_finished(this); } void OAIHttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { error_type = QNetworkReply::TimeoutError; response = ""; error_str = "Timed out waiting for response"; disconnect(reply, nullptr, nullptr, nullptr); reply->abort(); reply->deleteLater(); emit on_execution_finished(this); } void OAIHttpRequestWorker::process_response(QNetworkReply *reply) { QString contentDispositionHdr; QString contentTypeHdr; QString contentEncodingHdr; for(auto hdr: getResponseHeaders().keys()){ if(hdr.compare(QString("Content-Disposition"), Qt::CaseInsensitive) == 0){ contentDispositionHdr = getResponseHeaders().value(hdr); } if(hdr.compare(QString("Content-Type"), Qt::CaseInsensitive) == 0){ contentTypeHdr = getResponseHeaders().value(hdr); } if(hdr.compare(QString("Content-Encoding"), Qt::CaseInsensitive) == 0){ contentEncodingHdr = getResponseHeaders().value(hdr); } } if (!contentDispositionHdr.isEmpty()) { auto contentDisposition = contentDispositionHdr.split(QString(";"), SKIP_EMPTY_PARTS); auto contentType = !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); for (const auto &file : contentDisposition) { if (file.contains(QString("filename"))) { filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); break; } } OAIHttpFileElement felement; felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, reply->readAll()); files.insert(filename, felement); } } else if (!contentTypeHdr.isEmpty()) { auto contentType = contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS); if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { // TODO : Handle Multipart responses } else { if(!contentEncodingHdr.isEmpty()){ auto encoding = contentEncodingHdr.split(QString(";"), SKIP_EMPTY_PARTS); if(encoding.count() > 0){ auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ response = decompress(reply->readAll()); } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ response = reply->readAll(); } } } else { response = reply->readAll(); } } } } QByteArray OAIHttpRequestWorker::decompress(const QByteArray& data){ Q_UNUSED(data); return QByteArray(); } QByteArray OAIHttpRequestWorker::compress(const QByteArray& input, int level, OAICompressionType compressType) { Q_UNUSED(input); Q_UNUSED(level); Q_UNUSED(compressType); return QByteArray(); } QSslConfiguration *OAIHttpRequestWorker::sslDefaultConfiguration; } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIHttpRequest.h000066400000000000000000000063741442421066000234160ustar00rootroot00000000000000// HttpRequest.h.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Based on http://www.creativepulse.gr/en/blog/2014/restful-api-requests-using-qt-cpp-for-linux-mac-osx-ms-windows * By Alex Stylianos * **/ #ifndef OAI_HTTPREQUESTWORKER_H #define OAI_HTTPREQUESTWORKER_H #include #include #include #include #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #include #endif #include "OAIHttpFileElement.h" namespace OpenAPI { enum OAIHttpRequestVarLayout { NOT_SET, ADDRESS, URL_ENCODED, MULTIPART }; class OAIHttpRequestInput { public: QString url_str; QString http_method; OAIHttpRequestVarLayout var_layout; QMap vars; QMap headers; QList files; QByteArray request_body; OAIHttpRequestInput(); OAIHttpRequestInput(QString v_url_str, QString v_http_method); void initialize(); void add_var(QString key, QString value); void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); }; class OAIHttpRequestWorker : public QObject { Q_OBJECT public: explicit OAIHttpRequestWorker(QObject *parent = nullptr, QNetworkAccessManager *manager = nullptr); virtual ~OAIHttpRequestWorker(); QByteArray response; QNetworkReply::NetworkError error_type; QString error_str; QMap getResponseHeaders() const; QString http_attribute_encode(QString attribute_name, QString input); void execute(OAIHttpRequestInput *input); static QSslConfiguration *sslDefaultConfiguration; void setTimeOut(int timeOutMs); void setWorkingDirectory(const QString &path); OAIHttpFileElement getHttpFileElement(const QString &fieldname = QString()); QByteArray *getMultiPartField(const QString &fieldname = QString()); void setResponseCompressionEnabled(bool enable); void setRequestCompressionEnabled(bool enable); int getHttpResponseCode() const; signals: void on_execution_finished(OAIHttpRequestWorker *worker); private: enum OAICompressionType{ Zlib, Gzip }; QNetworkAccessManager *manager; QMap headers; QMap files; QMap multiPartFields; QString workingDirectory; QTimer timeOutTimer; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) QRandomGenerator randomGenerator; #endif void on_reply_timeout(QNetworkReply *reply); void on_reply_finished(QNetworkReply *reply); void process_response(QNetworkReply *reply); QByteArray decompress(const QByteArray& data); QByteArray compress(const QByteArray& input, int level, OAICompressionType compressType); }; } // namespace OpenAPI #endif // OAI_HTTPREQUESTWORKER_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIIdentity.cpp000066400000000000000000000103271442421066000232430ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIIdentity.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIIdentityPrivate { friend class OAIIdentity; QString display_name; bool display_name_isSet; bool display_name_isValid; QString id; bool id_isSet; bool id_isValid; }; OAIIdentity::OAIIdentity() : d_ptr() { } OAIIdentity::OAIIdentity(const OAIIdentity& other) : d_ptr(other.d_ptr) { } OAIIdentity::OAIIdentity(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIIdentity::~OAIIdentity() = default; void OAIIdentity::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIIdentityPrivate{}); Q_D(OAIIdentity); d->display_name_isSet = false; d->display_name_isValid = false; d->id_isSet = false; d->id_isValid = false; } } void OAIIdentity::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIIdentity::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIIdentity); d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; } QString OAIIdentity::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIIdentity::asJsonObject() const { Q_D(const OAIIdentity); if(!d){ return {}; } QJsonObject obj; if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } return obj; } QString OAIIdentity::getDisplayName() const { Q_D(const OAIIdentity); if(!d){ return {}; } return d->display_name; } void OAIIdentity::setDisplayName(const QString &display_name) { Q_D(OAIIdentity); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIIdentity::is_display_name_Set() const{ Q_D(const OAIIdentity); if(!d){ return false; } return d->display_name_isSet; } bool OAIIdentity::is_display_name_Valid() const{ Q_D(const OAIIdentity); if(!d){ return false; } return d->display_name_isValid; } QString OAIIdentity::getId() const { Q_D(const OAIIdentity); if(!d){ return {}; } return d->id; } void OAIIdentity::setId(const QString &id) { Q_D(OAIIdentity); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIIdentity::is_id_Set() const{ Q_D(const OAIIdentity); if(!d){ return false; } return d->id_isSet; } bool OAIIdentity::is_id_Valid() const{ Q_D(const OAIIdentity); if(!d){ return false; } return d->id_isValid; } bool OAIIdentity::isSet() const { Q_D(const OAIIdentity); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIIdentity::isValid() const { Q_D(const OAIIdentity); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->display_name_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIIdentity.h000066400000000000000000000027761442421066000227210ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIIdentity.h * * */ #ifndef OAIIdentity_H #define OAIIdentity_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentityPrivate; class OAIIdentity : public OAIObject { public: OAIIdentity(); OAIIdentity(const OAIIdentity &other); OAIIdentity(QString json); ~OAIIdentity() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIIdentity) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIIdentity) #endif // OAIIdentity_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIIdentitySet.cpp000066400000000000000000000150161442421066000237170ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIIdentitySet.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIIdentitySetPrivate { friend class OAIIdentitySet; OAIIdentity application; bool application_isSet; bool application_isValid; OAIIdentity device; bool device_isSet; bool device_isValid; OAIIdentity user; bool user_isSet; bool user_isValid; OAIIdentity group; bool group_isSet; bool group_isValid; }; OAIIdentitySet::OAIIdentitySet() : d_ptr() { } OAIIdentitySet::OAIIdentitySet(const OAIIdentitySet& other) : d_ptr(other.d_ptr) { } OAIIdentitySet::OAIIdentitySet(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIIdentitySet::~OAIIdentitySet() = default; void OAIIdentitySet::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIIdentitySetPrivate{}); Q_D(OAIIdentitySet); d->application_isSet = false; d->application_isValid = false; d->device_isSet = false; d->device_isValid = false; d->user_isSet = false; d->user_isValid = false; d->group_isSet = false; d->group_isValid = false; } } void OAIIdentitySet::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIIdentitySet::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIIdentitySet); d->application_isValid = ::OpenAPI::fromJsonValue(d->application, json[QString("application")]); d->application_isSet = !json[QString("application")].isNull() && d->application_isValid; d->device_isValid = ::OpenAPI::fromJsonValue(d->device, json[QString("device")]); d->device_isSet = !json[QString("device")].isNull() && d->device_isValid; d->user_isValid = ::OpenAPI::fromJsonValue(d->user, json[QString("user")]); d->user_isSet = !json[QString("user")].isNull() && d->user_isValid; d->group_isValid = ::OpenAPI::fromJsonValue(d->group, json[QString("group")]); d->group_isSet = !json[QString("group")].isNull() && d->group_isValid; } QString OAIIdentitySet::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIIdentitySet::asJsonObject() const { Q_D(const OAIIdentitySet); if(!d){ return {}; } QJsonObject obj; if (d->application.isSet()) { obj.insert(QString("application"), ::OpenAPI::toJsonValue(d->application)); } if (d->device.isSet()) { obj.insert(QString("device"), ::OpenAPI::toJsonValue(d->device)); } if (d->user.isSet()) { obj.insert(QString("user"), ::OpenAPI::toJsonValue(d->user)); } if (d->group.isSet()) { obj.insert(QString("group"), ::OpenAPI::toJsonValue(d->group)); } return obj; } OAIIdentity OAIIdentitySet::getApplication() const { Q_D(const OAIIdentitySet); if(!d){ return {}; } return d->application; } void OAIIdentitySet::setApplication(const OAIIdentity &application) { Q_D(OAIIdentitySet); Q_ASSERT(d); d->application = application; d->application_isSet = true; } bool OAIIdentitySet::is_application_Set() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->application_isSet; } bool OAIIdentitySet::is_application_Valid() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->application_isValid; } OAIIdentity OAIIdentitySet::getDevice() const { Q_D(const OAIIdentitySet); if(!d){ return {}; } return d->device; } void OAIIdentitySet::setDevice(const OAIIdentity &device) { Q_D(OAIIdentitySet); Q_ASSERT(d); d->device = device; d->device_isSet = true; } bool OAIIdentitySet::is_device_Set() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->device_isSet; } bool OAIIdentitySet::is_device_Valid() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->device_isValid; } OAIIdentity OAIIdentitySet::getUser() const { Q_D(const OAIIdentitySet); if(!d){ return {}; } return d->user; } void OAIIdentitySet::setUser(const OAIIdentity &user) { Q_D(OAIIdentitySet); Q_ASSERT(d); d->user = user; d->user_isSet = true; } bool OAIIdentitySet::is_user_Set() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->user_isSet; } bool OAIIdentitySet::is_user_Valid() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->user_isValid; } OAIIdentity OAIIdentitySet::getGroup() const { Q_D(const OAIIdentitySet); if(!d){ return {}; } return d->group; } void OAIIdentitySet::setGroup(const OAIIdentity &group) { Q_D(OAIIdentitySet); Q_ASSERT(d); d->group = group; d->group_isSet = true; } bool OAIIdentitySet::is_group_Set() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->group_isSet; } bool OAIIdentitySet::is_group_Valid() const{ Q_D(const OAIIdentitySet); if(!d){ return false; } return d->group_isValid; } bool OAIIdentitySet::isSet() const { Q_D(const OAIIdentitySet); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->application.isSet()) { isObjectUpdated = true; break; } if (d->device.isSet()) { isObjectUpdated = true; break; } if (d->user.isSet()) { isObjectUpdated = true; break; } if (d->group.isSet()) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIIdentitySet::isValid() const { Q_D(const OAIIdentitySet); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIIdentitySet.h000066400000000000000000000036241442421066000233660ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIIdentitySet.h * * Optional. User account. */ #ifndef OAIIdentitySet_H #define OAIIdentitySet_H #include #include "OAIIdentity.h" #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentity; class OAIIdentitySetPrivate; class OAIIdentitySet : public OAIObject { public: OAIIdentitySet(); OAIIdentitySet(const OAIIdentitySet &other); OAIIdentitySet(QString json); ~OAIIdentitySet() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; OAIIdentity getApplication() const; void setApplication(const OAIIdentity &application); bool is_application_Set() const; bool is_application_Valid() const; OAIIdentity getDevice() const; void setDevice(const OAIIdentity &device); bool is_device_Set() const; bool is_device_Valid() const; OAIIdentity getUser() const; void setUser(const OAIIdentity &user); bool is_user_Set() const; bool is_user_Valid() const; OAIIdentity getGroup() const; void setGroup(const OAIIdentity &group); bool is_group_Set() const; bool is_group_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIIdentitySet) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIIdentitySet) #endif // OAIIdentitySet_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIImage.cpp000066400000000000000000000077621442421066000225050ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIImage.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIImagePrivate { friend class OAIImage; qint32 height; bool height_isSet; bool height_isValid; qint32 width; bool width_isSet; bool width_isValid; }; OAIImage::OAIImage() : d_ptr() { } OAIImage::OAIImage(const OAIImage& other) : d_ptr(other.d_ptr) { } OAIImage::OAIImage(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIImage::~OAIImage() = default; void OAIImage::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIImagePrivate{}); Q_D(OAIImage); d->height_isSet = false; d->height_isValid = false; d->width_isSet = false; d->width_isValid = false; } } void OAIImage::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIImage::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIImage); d->height_isValid = ::OpenAPI::fromJsonValue(d->height, json[QString("height")]); d->height_isSet = !json[QString("height")].isNull() && d->height_isValid; d->width_isValid = ::OpenAPI::fromJsonValue(d->width, json[QString("width")]); d->width_isSet = !json[QString("width")].isNull() && d->width_isValid; } QString OAIImage::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIImage::asJsonObject() const { Q_D(const OAIImage); if(!d){ return {}; } QJsonObject obj; if (d->height_isSet) { obj.insert(QString("height"), ::OpenAPI::toJsonValue(d->height)); } if (d->width_isSet) { obj.insert(QString("width"), ::OpenAPI::toJsonValue(d->width)); } return obj; } qint32 OAIImage::getHeight() const { Q_D(const OAIImage); if(!d){ return {}; } return d->height; } void OAIImage::setHeight(const qint32 &height) { Q_D(OAIImage); Q_ASSERT(d); d->height = height; d->height_isSet = true; } bool OAIImage::is_height_Set() const{ Q_D(const OAIImage); if(!d){ return false; } return d->height_isSet; } bool OAIImage::is_height_Valid() const{ Q_D(const OAIImage); if(!d){ return false; } return d->height_isValid; } qint32 OAIImage::getWidth() const { Q_D(const OAIImage); if(!d){ return {}; } return d->width; } void OAIImage::setWidth(const qint32 &width) { Q_D(OAIImage); Q_ASSERT(d); d->width = width; d->width_isSet = true; } bool OAIImage::is_width_Set() const{ Q_D(const OAIImage); if(!d){ return false; } return d->width_isSet; } bool OAIImage::is_width_Valid() const{ Q_D(const OAIImage); if(!d){ return false; } return d->width_isValid; } bool OAIImage::isSet() const { Q_D(const OAIImage); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->height_isSet) { isObjectUpdated = true; break; } if (d->width_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIImage::isValid() const { Q_D(const OAIImage); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIImage.h000066400000000000000000000027431442421066000221440ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIImage.h * * Image metadata, if the item is an image. Read-only. */ #ifndef OAIImage_H #define OAIImage_H #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIImagePrivate; class OAIImage : public OAIObject { public: OAIImage(); OAIImage(const OAIImage &other); OAIImage(QString json); ~OAIImage() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; qint32 getHeight() const; void setHeight(const qint32 &height); bool is_height_Set() const; bool is_height_Valid() const; qint32 getWidth() const; void setWidth(const qint32 &width); bool is_width_Set() const; bool is_width_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIImage) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIImage) #endif // OAIImage_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIItemReference.cpp000066400000000000000000000212571442421066000241730ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIItemReference.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIItemReferencePrivate { friend class OAIItemReference; QString drive_id; bool drive_id_isSet; bool drive_id_isValid; QString drive_type; bool drive_type_isSet; bool drive_type_isValid; QString id; bool id_isSet; bool id_isValid; QString name; bool name_isSet; bool name_isValid; QString path; bool path_isSet; bool path_isValid; QString share_id; bool share_id_isSet; bool share_id_isValid; }; OAIItemReference::OAIItemReference() : d_ptr() { } OAIItemReference::OAIItemReference(const OAIItemReference& other) : d_ptr(other.d_ptr) { } OAIItemReference::OAIItemReference(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIItemReference::~OAIItemReference() = default; void OAIItemReference::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIItemReferencePrivate{}); Q_D(OAIItemReference); d->drive_id_isSet = false; d->drive_id_isValid = false; d->drive_type_isSet = false; d->drive_type_isValid = false; d->id_isSet = false; d->id_isValid = false; d->name_isSet = false; d->name_isValid = false; d->path_isSet = false; d->path_isValid = false; d->share_id_isSet = false; d->share_id_isValid = false; } } void OAIItemReference::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIItemReference::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIItemReference); d->drive_id_isValid = ::OpenAPI::fromJsonValue(d->drive_id, json[QString("driveId")]); d->drive_id_isSet = !json[QString("driveId")].isNull() && d->drive_id_isValid; d->drive_type_isValid = ::OpenAPI::fromJsonValue(d->drive_type, json[QString("driveType")]); d->drive_type_isSet = !json[QString("driveType")].isNull() && d->drive_type_isValid; d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->name_isValid = ::OpenAPI::fromJsonValue(d->name, json[QString("name")]); d->name_isSet = !json[QString("name")].isNull() && d->name_isValid; d->path_isValid = ::OpenAPI::fromJsonValue(d->path, json[QString("path")]); d->path_isSet = !json[QString("path")].isNull() && d->path_isValid; d->share_id_isValid = ::OpenAPI::fromJsonValue(d->share_id, json[QString("shareId")]); d->share_id_isSet = !json[QString("shareId")].isNull() && d->share_id_isValid; } QString OAIItemReference::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIItemReference::asJsonObject() const { Q_D(const OAIItemReference); if(!d){ return {}; } QJsonObject obj; if (d->drive_id_isSet) { obj.insert(QString("driveId"), ::OpenAPI::toJsonValue(d->drive_id)); } if (d->drive_type_isSet) { obj.insert(QString("driveType"), ::OpenAPI::toJsonValue(d->drive_type)); } if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->name_isSet) { obj.insert(QString("name"), ::OpenAPI::toJsonValue(d->name)); } if (d->path_isSet) { obj.insert(QString("path"), ::OpenAPI::toJsonValue(d->path)); } if (d->share_id_isSet) { obj.insert(QString("shareId"), ::OpenAPI::toJsonValue(d->share_id)); } return obj; } QString OAIItemReference::getDriveId() const { Q_D(const OAIItemReference); if(!d){ return {}; } return d->drive_id; } void OAIItemReference::setDriveId(const QString &drive_id) { Q_D(OAIItemReference); Q_ASSERT(d); d->drive_id = drive_id; d->drive_id_isSet = true; } bool OAIItemReference::is_drive_id_Set() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->drive_id_isSet; } bool OAIItemReference::is_drive_id_Valid() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->drive_id_isValid; } QString OAIItemReference::getDriveType() const { Q_D(const OAIItemReference); if(!d){ return {}; } return d->drive_type; } void OAIItemReference::setDriveType(const QString &drive_type) { Q_D(OAIItemReference); Q_ASSERT(d); d->drive_type = drive_type; d->drive_type_isSet = true; } bool OAIItemReference::is_drive_type_Set() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->drive_type_isSet; } bool OAIItemReference::is_drive_type_Valid() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->drive_type_isValid; } QString OAIItemReference::getId() const { Q_D(const OAIItemReference); if(!d){ return {}; } return d->id; } void OAIItemReference::setId(const QString &id) { Q_D(OAIItemReference); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIItemReference::is_id_Set() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->id_isSet; } bool OAIItemReference::is_id_Valid() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->id_isValid; } QString OAIItemReference::getName() const { Q_D(const OAIItemReference); if(!d){ return {}; } return d->name; } void OAIItemReference::setName(const QString &name) { Q_D(OAIItemReference); Q_ASSERT(d); d->name = name; d->name_isSet = true; } bool OAIItemReference::is_name_Set() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->name_isSet; } bool OAIItemReference::is_name_Valid() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->name_isValid; } QString OAIItemReference::getPath() const { Q_D(const OAIItemReference); if(!d){ return {}; } return d->path; } void OAIItemReference::setPath(const QString &path) { Q_D(OAIItemReference); Q_ASSERT(d); d->path = path; d->path_isSet = true; } bool OAIItemReference::is_path_Set() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->path_isSet; } bool OAIItemReference::is_path_Valid() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->path_isValid; } QString OAIItemReference::getShareId() const { Q_D(const OAIItemReference); if(!d){ return {}; } return d->share_id; } void OAIItemReference::setShareId(const QString &share_id) { Q_D(OAIItemReference); Q_ASSERT(d); d->share_id = share_id; d->share_id_isSet = true; } bool OAIItemReference::is_share_id_Set() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->share_id_isSet; } bool OAIItemReference::is_share_id_Valid() const{ Q_D(const OAIItemReference); if(!d){ return false; } return d->share_id_isValid; } bool OAIItemReference::isSet() const { Q_D(const OAIItemReference); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->drive_id_isSet) { isObjectUpdated = true; break; } if (d->drive_type_isSet) { isObjectUpdated = true; break; } if (d->id_isSet) { isObjectUpdated = true; break; } if (d->name_isSet) { isObjectUpdated = true; break; } if (d->path_isSet) { isObjectUpdated = true; break; } if (d->share_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIItemReference::isValid() const { Q_D(const OAIItemReference); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIItemReference.h000066400000000000000000000041521442421066000236330ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIItemReference.h * * */ #ifndef OAIItemReference_H #define OAIItemReference_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIItemReferencePrivate; class OAIItemReference : public OAIObject { public: OAIItemReference(); OAIItemReference(const OAIItemReference &other); OAIItemReference(QString json); ~OAIItemReference() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getDriveId() const; void setDriveId(const QString &drive_id); bool is_drive_id_Set() const; bool is_drive_id_Valid() const; QString getDriveType() const; void setDriveType(const QString &drive_type); bool is_drive_type_Set() const; bool is_drive_type_Valid() const; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; QString getName() const; void setName(const QString &name); bool is_name_Set() const; bool is_name_Valid() const; QString getPath() const; void setPath(const QString &path); bool is_path_Set() const; bool is_path_Valid() const; QString getShareId() const; void setShareId(const QString &share_id); bool is_share_id_Set() const; bool is_share_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIItemReference) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIItemReference) #endif // OAIItemReference_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeChangepasswordApi.cpp000066400000000000000000000266201442421066000253410ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMeChangepasswordApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIMeChangepasswordApi::OAIMeChangepasswordApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIMeChangepasswordApi::~OAIMeChangepasswordApi() { } void OAIMeChangepasswordApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("changeOwnPassword", defaultConf); _serverIndices.insert("changeOwnPassword", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIMeChangepasswordApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIMeChangepasswordApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIMeChangepasswordApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIMeChangepasswordApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIMeChangepasswordApi::setUsername(const QString &username) { _username = username; } void OAIMeChangepasswordApi::setPassword(const QString &password) { _password = password; } void OAIMeChangepasswordApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIMeChangepasswordApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIMeChangepasswordApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIMeChangepasswordApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeChangepasswordApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeChangepasswordApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIMeChangepasswordApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIMeChangepasswordApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIMeChangepasswordApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIMeChangepasswordApi::abortRequests() { emit abortRequestsSignal(); } QString OAIMeChangepasswordApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIMeChangepasswordApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIMeChangepasswordApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIMeChangepasswordApi::changeOwnPassword(const OAIPassword_change &oai_password_change) { QString fullPath = QString(_serverConfigs["changeOwnPassword"][_serverIndices.value("changeOwnPassword")].URL()+"/me/changePassword"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_password_change.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIMeChangepasswordApi::changeOwnPasswordCallback); connect(this, &OAIMeChangepasswordApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIMeChangepasswordApi::changeOwnPasswordCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit changeOwnPasswordSignal(); emit changeOwnPasswordSignalFull(worker); } else { emit changeOwnPasswordSignalE(error_type, error_str); emit changeOwnPasswordSignalEFull(worker, error_type, error_str); } } void OAIMeChangepasswordApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeChangepasswordApi.h000066400000000000000000000074311442421066000250050ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIMeChangepasswordApi_H #define OAI_OAIMeChangepasswordApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIOdata_error.h" #include "OAIPassword_change.h" #include #include #include #include #include #include namespace OpenAPI { class OAIMeChangepasswordApi : public QObject { Q_OBJECT public: OAIMeChangepasswordApi(const int timeOut = 0); ~OAIMeChangepasswordApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] oai_password_change OAIPassword_change [required] */ void changeOwnPassword(const OAIPassword_change &oai_password_change); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void changeOwnPasswordCallback(OAIHttpRequestWorker *worker); signals: void changeOwnPasswordSignal(); void changeOwnPasswordSignalFull(OAIHttpRequestWorker *worker); void changeOwnPasswordSignalE(QNetworkReply::NetworkError error_type, QString error_str); void changeOwnPasswordSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDriveApi.cpp000066400000000000000000000256511442421066000234450ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMeDriveApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIMeDriveApi::OAIMeDriveApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIMeDriveApi::~OAIMeDriveApi() { } void OAIMeDriveApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("getHome", defaultConf); _serverIndices.insert("getHome", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIMeDriveApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIMeDriveApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIMeDriveApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIMeDriveApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIMeDriveApi::setUsername(const QString &username) { _username = username; } void OAIMeDriveApi::setPassword(const QString &password) { _password = password; } void OAIMeDriveApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIMeDriveApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIMeDriveApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIMeDriveApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDriveApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDriveApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIMeDriveApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIMeDriveApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIMeDriveApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIMeDriveApi::abortRequests() { emit abortRequestsSignal(); } QString OAIMeDriveApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIMeDriveApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIMeDriveApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIMeDriveApi::getHome() { QString fullPath = QString(_serverConfigs["getHome"][_serverIndices.value("getHome")].URL()+"/me/drive"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIMeDriveApi::getHomeCallback); connect(this, &OAIMeDriveApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIMeDriveApi::getHomeCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIDrive output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getHomeSignal(output); emit getHomeSignalFull(worker, output); } else { emit getHomeSignalE(output, error_type, error_str); emit getHomeSignalEFull(worker, error_type, error_str); } } void OAIMeDriveApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDriveApi.h000066400000000000000000000071331442421066000231050ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIMeDriveApi_H #define OAI_OAIMeDriveApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIDrive.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIMeDriveApi : public QObject { Q_OBJECT public: OAIMeDriveApi(const int timeOut = 0); ~OAIMeDriveApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); void getHome(); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void getHomeCallback(OAIHttpRequestWorker *worker); signals: void getHomeSignal(OAIDrive summary); void getHomeSignalFull(OAIHttpRequestWorker *worker, OAIDrive summary); void getHomeSignalE(OAIDrive summary, QNetworkReply::NetworkError error_type, QString error_str); void getHomeSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDriveRootApi.cpp000066400000000000000000000261261442421066000243070ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMeDriveRootApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIMeDriveRootApi::OAIMeDriveRootApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIMeDriveRootApi::~OAIMeDriveRootApi() { } void OAIMeDriveRootApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("homeGetRoot", defaultConf); _serverIndices.insert("homeGetRoot", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIMeDriveRootApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIMeDriveRootApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIMeDriveRootApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIMeDriveRootApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIMeDriveRootApi::setUsername(const QString &username) { _username = username; } void OAIMeDriveRootApi::setPassword(const QString &password) { _password = password; } void OAIMeDriveRootApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIMeDriveRootApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIMeDriveRootApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIMeDriveRootApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDriveRootApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDriveRootApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIMeDriveRootApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIMeDriveRootApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIMeDriveRootApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIMeDriveRootApi::abortRequests() { emit abortRequestsSignal(); } QString OAIMeDriveRootApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIMeDriveRootApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIMeDriveRootApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIMeDriveRootApi::homeGetRoot() { QString fullPath = QString(_serverConfigs["homeGetRoot"][_serverIndices.value("homeGetRoot")].URL()+"/me/drive/root"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIMeDriveRootApi::homeGetRootCallback); connect(this, &OAIMeDriveRootApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIMeDriveRootApi::homeGetRootCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIDriveItem output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit homeGetRootSignal(output); emit homeGetRootSignalFull(worker, output); } else { emit homeGetRootSignalE(output, error_type, error_str); emit homeGetRootSignalEFull(worker, error_type, error_str); } } void OAIMeDriveRootApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDriveRootApi.h000066400000000000000000000072271442421066000237550ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIMeDriveRootApi_H #define OAI_OAIMeDriveRootApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIDriveItem.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIMeDriveRootApi : public QObject { Q_OBJECT public: OAIMeDriveRootApi(const int timeOut = 0); ~OAIMeDriveRootApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); void homeGetRoot(); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void homeGetRootCallback(OAIHttpRequestWorker *worker); signals: void homeGetRootSignal(OAIDriveItem summary); void homeGetRootSignalFull(OAIHttpRequestWorker *worker, OAIDriveItem summary); void homeGetRootSignalE(OAIDriveItem summary, QNetworkReply::NetworkError error_type, QString error_str); void homeGetRootSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDriveRootChildrenApi.cpp000066400000000000000000000266121442421066000257600ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMeDriveRootChildrenApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIMeDriveRootChildrenApi::OAIMeDriveRootChildrenApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIMeDriveRootChildrenApi::~OAIMeDriveRootChildrenApi() { } void OAIMeDriveRootChildrenApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("homeGetChildren", defaultConf); _serverIndices.insert("homeGetChildren", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIMeDriveRootChildrenApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIMeDriveRootChildrenApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIMeDriveRootChildrenApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIMeDriveRootChildrenApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIMeDriveRootChildrenApi::setUsername(const QString &username) { _username = username; } void OAIMeDriveRootChildrenApi::setPassword(const QString &password) { _password = password; } void OAIMeDriveRootChildrenApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIMeDriveRootChildrenApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIMeDriveRootChildrenApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIMeDriveRootChildrenApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDriveRootChildrenApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDriveRootChildrenApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIMeDriveRootChildrenApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIMeDriveRootChildrenApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIMeDriveRootChildrenApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIMeDriveRootChildrenApi::abortRequests() { emit abortRequestsSignal(); } QString OAIMeDriveRootChildrenApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIMeDriveRootChildrenApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIMeDriveRootChildrenApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIMeDriveRootChildrenApi::homeGetChildren() { QString fullPath = QString(_serverConfigs["homeGetChildren"][_serverIndices.value("homeGetChildren")].URL()+"/me/drive/root/children"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIMeDriveRootChildrenApi::homeGetChildrenCallback); connect(this, &OAIMeDriveRootChildrenApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIMeDriveRootChildrenApi::homeGetChildrenCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_driveItems output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit homeGetChildrenSignal(output); emit homeGetChildrenSignalFull(worker, output); } else { emit homeGetChildrenSignalE(output, error_type, error_str); emit homeGetChildrenSignalEFull(worker, error_type, error_str); } } void OAIMeDriveRootChildrenApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDriveRootChildrenApi.h000066400000000000000000000074231442421066000254240ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIMeDriveRootChildrenApi_H #define OAI_OAIMeDriveRootChildrenApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_driveItems.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIMeDriveRootChildrenApi : public QObject { Q_OBJECT public: OAIMeDriveRootChildrenApi(const int timeOut = 0); ~OAIMeDriveRootChildrenApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); void homeGetChildren(); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void homeGetChildrenCallback(OAIHttpRequestWorker *worker); signals: void homeGetChildrenSignal(OAICollection_of_driveItems summary); void homeGetChildrenSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_driveItems summary); void homeGetChildrenSignalE(OAICollection_of_driveItems summary, QNetworkReply::NetworkError error_type, QString error_str); void homeGetChildrenSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDrivesApi.cpp000066400000000000000000000305531442421066000236250ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMeDrivesApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIMeDrivesApi::OAIMeDrivesApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIMeDrivesApi::~OAIMeDrivesApi() { } void OAIMeDrivesApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("listMyDrives", defaultConf); _serverIndices.insert("listMyDrives", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIMeDrivesApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIMeDrivesApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIMeDrivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIMeDrivesApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIMeDrivesApi::setUsername(const QString &username) { _username = username; } void OAIMeDrivesApi::setPassword(const QString &password) { _password = password; } void OAIMeDrivesApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIMeDrivesApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIMeDrivesApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIMeDrivesApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDrivesApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeDrivesApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIMeDrivesApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIMeDrivesApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIMeDrivesApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIMeDrivesApi::abortRequests() { emit abortRequestsSignal(); } QString OAIMeDrivesApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIMeDrivesApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIMeDrivesApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIMeDrivesApi::listMyDrives(const ::OpenAPI::OptionalParam &orderby, const ::OpenAPI::OptionalParam &filter) { QString fullPath = QString(_serverConfigs["listMyDrives"][_serverIndices.value("listMyDrives")].URL()+"/me/drives"); QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (orderby.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$orderby", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$orderby")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(orderby.value()))); } if (filter.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$filter", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$filter")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(filter.value()))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIMeDrivesApi::listMyDrivesCallback); connect(this, &OAIMeDrivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIMeDrivesApi::listMyDrivesCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_drives output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listMyDrivesSignal(output); emit listMyDrivesSignalFull(worker, output); } else { emit listMyDrivesSignalE(output, error_type, error_str); emit listMyDrivesSignalEFull(worker, error_type, error_str); } } void OAIMeDrivesApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeDrivesApi.h000066400000000000000000000077161442421066000232770ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIMeDrivesApi_H #define OAI_OAIMeDrivesApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_drives.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIMeDrivesApi : public QObject { Q_OBJECT public: OAIMeDrivesApi(const int timeOut = 0); ~OAIMeDrivesApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] orderby QString [optional] * @param[in] filter QString [optional] */ void listMyDrives(const ::OpenAPI::OptionalParam &orderby = ::OpenAPI::OptionalParam(), const ::OpenAPI::OptionalParam &filter = ::OpenAPI::OptionalParam()); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void listMyDrivesCallback(OAIHttpRequestWorker *worker); signals: void listMyDrivesSignal(OAICollection_of_drives summary); void listMyDrivesSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_drives summary); void listMyDrivesSignalE(OAICollection_of_drives summary, QNetworkReply::NetworkError error_type, QString error_str); void listMyDrivesSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeUserApi.cpp000066400000000000000000000353201442421066000233040ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMeUserApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIMeUserApi::OAIMeUserApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIMeUserApi::~OAIMeUserApi() { } void OAIMeUserApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("getOwnUser", defaultConf); _serverIndices.insert("getOwnUser", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIMeUserApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIMeUserApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIMeUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIMeUserApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIMeUserApi::setUsername(const QString &username) { _username = username; } void OAIMeUserApi::setPassword(const QString &password) { _password = password; } void OAIMeUserApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIMeUserApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIMeUserApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIMeUserApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeUserApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIMeUserApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIMeUserApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIMeUserApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIMeUserApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIMeUserApi::abortRequests() { emit abortRequestsSignal(); } QString OAIMeUserApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIMeUserApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIMeUserApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIMeUserApi::getOwnUser(const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["getOwnUser"][_serverIndices.value("getOwnUser")].URL()+"/me"); QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIMeUserApi::getOwnUserCallback); connect(this, &OAIMeUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIMeUserApi::getOwnUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getOwnUserSignal(output); emit getOwnUserSignalFull(worker, output); } else { emit getOwnUserSignalE(output, error_type, error_str); emit getOwnUserSignalEFull(worker, error_type, error_str); } } void OAIMeUserApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMeUserApi.h000066400000000000000000000074251442421066000227560ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIMeUserApi_H #define OAI_OAIMeUserApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIOdata_error.h" #include "OAIUser.h" #include #include #include #include #include #include #include namespace OpenAPI { class OAIMeUserApi : public QObject { Q_OBJECT public: OAIMeUserApi(const int timeOut = 0); ~OAIMeUserApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] expand QSet [optional] */ void getOwnUser(const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void getOwnUserCallback(OAIHttpRequestWorker *worker); signals: void getOwnUserSignal(OAIUser summary); void getOwnUserSignalFull(OAIHttpRequestWorker *worker, OAIUser summary); void getOwnUserSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString error_str); void getOwnUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIMember_Reference.cpp000066400000000000000000000066311442421066000246420ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIMember_Reference.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIMember_ReferencePrivate { friend class OAIMember_Reference; QString odata_id; bool odata_id_isSet; bool odata_id_isValid; }; OAIMember_Reference::OAIMember_Reference() : d_ptr() { } OAIMember_Reference::OAIMember_Reference(const OAIMember_Reference& other) : d_ptr(other.d_ptr) { } OAIMember_Reference::OAIMember_Reference(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIMember_Reference::~OAIMember_Reference() = default; void OAIMember_Reference::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIMember_ReferencePrivate{}); Q_D(OAIMember_Reference); d->odata_id_isSet = false; d->odata_id_isValid = false; } } void OAIMember_Reference::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIMember_Reference::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIMember_Reference); d->odata_id_isValid = ::OpenAPI::fromJsonValue(d->odata_id, json[QString("@odata.id")]); d->odata_id_isSet = !json[QString("@odata.id")].isNull() && d->odata_id_isValid; } QString OAIMember_Reference::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIMember_Reference::asJsonObject() const { Q_D(const OAIMember_Reference); if(!d){ return {}; } QJsonObject obj; if (d->odata_id_isSet) { obj.insert(QString("@odata.id"), ::OpenAPI::toJsonValue(d->odata_id)); } return obj; } QString OAIMember_Reference::getOdataId() const { Q_D(const OAIMember_Reference); if(!d){ return {}; } return d->odata_id; } void OAIMember_Reference::setOdataId(const QString &odata_id) { Q_D(OAIMember_Reference); Q_ASSERT(d); d->odata_id = odata_id; d->odata_id_isSet = true; } bool OAIMember_Reference::is_odata_id_Set() const{ Q_D(const OAIMember_Reference); if(!d){ return false; } return d->odata_id_isSet; } bool OAIMember_Reference::is_odata_id_Valid() const{ Q_D(const OAIMember_Reference); if(!d){ return false; } return d->odata_id_isValid; } bool OAIMember_Reference::isSet() const { Q_D(const OAIMember_Reference); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->odata_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIMember_Reference::isValid() const { Q_D(const OAIMember_Reference); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIMember_Reference.h000066400000000000000000000027411442421066000243050ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIMember_Reference.h * * */ #ifndef OAIMember_Reference_H #define OAIMember_Reference_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIMember_ReferencePrivate; class OAIMember_Reference : public OAIObject { public: OAIMember_Reference(); OAIMember_Reference(const OAIMember_Reference &other); OAIMember_Reference(QString json); ~OAIMember_Reference() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getOdataId() const; void setOdataId(const QString &odata_id); bool is_odata_id_Set() const; bool is_odata_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIMember_Reference) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIMember_Reference) #endif // OAIMember_Reference_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIOauth.cpp000066400000000000000000000236621442421066000225400ustar00rootroot00000000000000#include "OAIOauth.h" namespace OpenAPI { /* * Base class to perform oauth2 flows * */ void OauthBase::onFinish(QNetworkReply *rep) { //TODO emit error signal when token is wrong QJsonDocument document = QJsonDocument::fromJson(rep->readAll()); QJsonObject rootObj = document.object(); QString token = rootObj.find("access_token").value().toString(); QString scope = rootObj.find("scope").value().toString(); QString type = rootObj.find("token_type").value().toString(); int expiresIn = rootObj.find("expires_in").value().toInt(); addToken(oauthToken(token, expiresIn, scope, type)); } oauthToken OauthBase::getToken(QString scope) { auto tokenIt = m_oauthTokenMap.find(scope); return tokenIt != m_oauthTokenMap.end() ? tokenIt.value() : oauthToken(); } void OauthBase::addToken(oauthToken token) { m_oauthTokenMap.insert(token.getScope(),token); emit tokenReceived(); } void OauthBase::removeToken(QString scope) { m_oauthTokenMap.remove(scope); } /* * Class to perform the authorization code flow * */ OauthCode::OauthCode(QObject *parent) : OauthBase(parent){} void OauthCode::link(){ connect(&m_server, SIGNAL(dataReceived(QMap)), this, SLOT(onVerificationReceived(QMap))); connect(this, SIGNAL(authenticationNeeded()), this, SLOT(authenticationNeededCallback())); connect(this, SIGNAL(tokenReceived()), &m_server, SLOT(stop())); } void OauthCode::unlink() { disconnect(this,0,0,0); disconnect(&m_server,0,0,0); } void OauthCode::setVariables(QString authUrl, QString tokenUrl, QString scope, QString state, QString redirectUri, QString clientId, QString clientSecret, QString accessType){ m_authUrl = QUrl(authUrl); m_tokenUrl = QUrl(tokenUrl); m_scope = scope; m_accessType = accessType; m_state = state; m_redirectUri = redirectUri; m_clientId = clientId; m_clientSecret = clientSecret; } void OauthCode::authenticationNeededCallback() { m_server.start(); } void OauthCode::onVerificationReceived(const QMap response) { // Save access code QString state(response.value("state")); QString scope(response.value("scope")); QString code(response.value("code")); //create query with the required fields QUrlQuery postData; postData.addQueryItem("grant_type", "authorization_code"); postData.addQueryItem("client_id", m_clientId); postData.addQueryItem("client_secret", m_clientSecret); postData.addQueryItem("code", code); postData.addQueryItem("redirect_uri", m_redirectUri); QNetworkAccessManager * manager = new QNetworkAccessManager(this); QNetworkRequest request(m_tokenUrl); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(onFinish(QNetworkReply *))); manager->post(request, postData.query().toUtf8()); } /* * Class to perform the implicit flow * */ OauthImplicit::OauthImplicit(QObject *parent) : OauthBase(parent){} void OauthImplicit::link() { //TODO correct linking connect(&m_server, SIGNAL(dataReceived(QMap)), this, SLOT(ImplicitTokenReceived(QMap))); connect(this, SIGNAL(authenticationNeeded()), this, SLOT(authenticationNeededCallback())); connect(this, SIGNAL(tokenReceived()), &m_server, SLOT(stop())); m_linked = true; } void OauthImplicit::unlink() { disconnect(this,0,0,0); disconnect(&m_server,0,0,0); m_linked = false; } void OauthImplicit::setVariables(QString authUrl, QString scope, QString state, QString redirectUri, QString clientId, QString accessType){ m_authUrl = QUrl(authUrl); m_scope = scope; m_accessType = accessType; m_state = state; m_redirectUri = redirectUri; m_clientId = clientId; } void OauthImplicit::authenticationNeededCallback() { m_server.start(); } void OauthImplicit::ImplicitTokenReceived(const QMap response) { QString token = response.find("access_token").value(); QString scope = response.find("scope").value(); QString type = response.find("token_type").value(); int expiresIn = response.find("expires_in").value().toInt(); addToken(oauthToken(token, expiresIn, scope, type)); } /* * Class to perform the client credentials flow * */ OauthCredentials::OauthCredentials(QObject *parent) : OauthBase(parent){} void OauthCredentials::link() { connect(this, SIGNAL(authenticationNeeded()), this, SLOT(authenticationNeededCallback())); } void OauthCredentials::unlink() { disconnect(this,0,0,0); } void OauthCredentials::setVariables(QString tokenUrl, QString scope, QString clientId, QString clientSecret){ m_tokenUrl = QUrl(tokenUrl); m_scope = scope; m_clientId = clientId; m_clientSecret = clientSecret; } void OauthCredentials::authenticationNeededCallback() { //create query with the required fields QUrlQuery postData; postData.addQueryItem("grant_type", "client_credentials"); postData.addQueryItem("client_id", m_clientId); postData.addQueryItem("client_secret", m_clientSecret); postData.addQueryItem("scope", m_scope); QNetworkAccessManager * manager = new QNetworkAccessManager(this); QNetworkRequest request(m_tokenUrl); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(onFinish(QNetworkReply *))); manager->post(request, postData.query().toUtf8()); } /* * Class to perform the resource owner password flow * */ OauthPassword::OauthPassword(QObject *parent) : OauthBase(parent){} void OauthPassword::link() { connect(this, SIGNAL(authenticationNeeded()), this, SLOT(authenticationNeededCallback())); } void OauthPassword::unlink() { disconnect(this,0,0,0); } void OauthPassword::setVariables(QString tokenUrl, QString scope, QString clientId, QString clientSecret, QString username, QString password){ m_tokenUrl = QUrl(tokenUrl); m_scope = scope; m_clientId = clientId; m_clientSecret = clientSecret; m_username = username; m_password = password; } void OauthPassword::authenticationNeededCallback() { //create query with the required fields QUrlQuery postData; postData.addQueryItem("grant_type", "password"); postData.addQueryItem("username", m_username); postData.addQueryItem("password", m_password); postData.addQueryItem("client_id", m_clientId); postData.addQueryItem("client_secret", m_clientSecret); postData.addQueryItem("scope", m_scope); QNetworkAccessManager * manager = new QNetworkAccessManager(this); QNetworkRequest request(m_tokenUrl); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(onFinish(QNetworkReply *))); manager->post(request, postData.query().toUtf8()); } /* * Class that provides a simple reply server * */ ReplyServer::ReplyServer(QObject *parent) : QTcpServer(parent) { connect(this, SIGNAL(newConnection()), this, SLOT(onConnected())); m_reply ="you can close this window now!"; } void ReplyServer::start() { if(!listen(QHostAddress::Any, 9999)) { qDebug() << "Server could not start"; } else { qDebug() << "Server started!"; } } void ReplyServer::stop() { qDebug() << "Stopping the Server..."; QTcpServer::close(); } void ReplyServer::onConnected() { // need to grab the socket QTcpSocket *socket = nextPendingConnection(); connect(socket, SIGNAL(readyRead()), this, SLOT(read()), Qt::UniqueConnection); connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); } void ReplyServer::read() { QTcpSocket *socket = qobject_cast(sender()); if (!socket) { qDebug() << "No socket available"; return; } qDebug() << "Socket connected"; QTextStream os(socket); os.setAutoDetectUnicode(true); os << "HTTP/1.0 200 Ok\r\n" "Content-Type: text/html; charset=\"utf-8\"\r\n" "\r\n" <<"\ \ \ \ \ \

You can close this window now!

\ \ "; QByteArray data = socket->readLine(); QString splitGetLine = QString(data); splitGetLine.remove("GET"); splitGetLine.remove("HTTP/1.1"); splitGetLine.remove("\r\n"); splitGetLine.remove(" "); //prefix is needed to extract query params QUrl getTokenUrl("http://" + splitGetLine); QList< QPair > tokens; QUrlQuery query(getTokenUrl); tokens = query.queryItems(); QMap queryParams; QPair tokenPair; foreach (tokenPair, tokens) { QString key = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.first.trimmed().toLatin1())); QString value = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.second.trimmed().toLatin1())); queryParams.insert(key, value); } if (!queryParams.contains("state")) { socket->close(); return; } socket->close(); emit dataReceived(queryParams); } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIOauth.h000066400000000000000000000104321442421066000221740ustar00rootroot00000000000000// oauth.h.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Providing a Oauth2 Class and a ReplyServer for the Oauth2 authorization code flow. */ #ifndef OAI_OAUTH2_H #define OAI_OAUTH2_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace OpenAPI { class oauthToken { public: oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){ m_validUntil = time(0) + expiresIn; } oauthToken(){ m_validUntil = time(0) - 1; } QString getToken(){return m_token;}; QString getScope(){return m_scope;}; QString getType(){return m_type;}; bool isValid(){return time(0) < m_validUntil;}; private: QString m_token; time_t m_validUntil; QString m_scope; QString m_type; }; class ReplyServer : public QTcpServer { Q_OBJECT public: explicit ReplyServer(QObject *parent = nullptr); void setReply(QByteArray reply){m_reply = reply;}; void run(); private: QByteArray m_reply; signals: void dataReceived(QMap); public slots: void onConnected(); void read(); void start(); void stop(); }; //Base class class OauthBase : public QObject { Q_OBJECT public: OauthBase(QObject* parent = nullptr) : QObject(parent) {}; oauthToken getToken(QString scope); void addToken(oauthToken token); void removeToken(QString scope); bool linked(){return m_linked;}; virtual void link()=0; virtual void unlink()=0; protected: QMap m_oauthTokenMap; QUrl m_authUrl; QUrl m_tokenUrl; QString m_scope, m_accessType, m_state, m_redirectUri, m_clientId, m_clientSecret; bool m_linked; public slots: virtual void authenticationNeededCallback()=0; void onFinish(QNetworkReply *rep); signals: void authenticationNeeded(); void tokenReceived(); }; // Authorization code flow class OauthCode : public OauthBase { Q_OBJECT public: OauthCode(QObject *parent = nullptr); void link() override; void unlink() override; void setVariables(QString authUrl, QString tokenUrl, QString scope, QString state, QString redirectUri, QString clientId, QString clientSecret, QString accessType = ""); private: ReplyServer m_server; public slots: void authenticationNeededCallback() override; void onVerificationReceived(const QMap response); }; // Implicit flow class OauthImplicit : public OauthBase { Q_OBJECT public: OauthImplicit(QObject *parent = nullptr); void link() override; void unlink() override; void setVariables(QString authUrl, QString scope, QString state, QString redirectUri, QString clientId, QString accessType = ""); private: ReplyServer m_server; public slots: void authenticationNeededCallback() override; void ImplicitTokenReceived(const QMap response); }; //client credentials flow class OauthCredentials : public OauthBase { Q_OBJECT public: OauthCredentials(QObject *parent = nullptr); void link() override; void unlink() override; void setVariables(QString tokenUrl, QString scope, QString clientId, QString clientSecret); public slots: void authenticationNeededCallback() override; }; //resource owner password flow class OauthPassword : public OauthBase { Q_OBJECT public: OauthPassword(QObject *parent = nullptr); void link() override; void unlink() override; void setVariables(QString tokenUrl, QString scope, QString clientId, QString clientSecret, QString username, QString password); private: QString m_username, m_password; public slots: void authenticationNeededCallback() override; }; } // namespace OpenAPI #endif // OAI_OAUTH2_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIObject.h000066400000000000000000000025201442421066000223210ustar00rootroot00000000000000// object.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OBJECT_H #define OAI_OBJECT_H #include #include #include namespace OpenAPI { class OAIObject { public: OAIObject() {} OAIObject(QString jsonString) { fromJson(jsonString); } virtual ~OAIObject() {} virtual QJsonObject asJsonObject() const { return jObj; } virtual QString asJson() const { QJsonDocument doc(jObj); return QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); } virtual void fromJson(QString jsonString) { QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8()); jObj = doc.object(); } virtual void fromJsonObject(QJsonObject json) { jObj = json; } virtual bool isSet() const { return false; } virtual bool isValid() const { return true; } private: QJsonObject jObj; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIObject) #endif // OAI_OBJECT_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIObjectIdentity.cpp000066400000000000000000000112611442421066000243700ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIObjectIdentity.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIObjectIdentityPrivate { friend class OAIObjectIdentity; QString issuer; bool issuer_isSet; bool issuer_isValid; QString issuer_assigned_id; bool issuer_assigned_id_isSet; bool issuer_assigned_id_isValid; }; OAIObjectIdentity::OAIObjectIdentity() : d_ptr() { } OAIObjectIdentity::OAIObjectIdentity(const OAIObjectIdentity& other) : d_ptr(other.d_ptr) { } OAIObjectIdentity::OAIObjectIdentity(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIObjectIdentity::~OAIObjectIdentity() = default; void OAIObjectIdentity::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIObjectIdentityPrivate{}); Q_D(OAIObjectIdentity); d->issuer_isSet = false; d->issuer_isValid = false; d->issuer_assigned_id_isSet = false; d->issuer_assigned_id_isValid = false; } } void OAIObjectIdentity::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIObjectIdentity::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIObjectIdentity); d->issuer_isValid = ::OpenAPI::fromJsonValue(d->issuer, json[QString("issuer")]); d->issuer_isSet = !json[QString("issuer")].isNull() && d->issuer_isValid; d->issuer_assigned_id_isValid = ::OpenAPI::fromJsonValue(d->issuer_assigned_id, json[QString("issuerAssignedId")]); d->issuer_assigned_id_isSet = !json[QString("issuerAssignedId")].isNull() && d->issuer_assigned_id_isValid; } QString OAIObjectIdentity::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIObjectIdentity::asJsonObject() const { Q_D(const OAIObjectIdentity); if(!d){ return {}; } QJsonObject obj; if (d->issuer_isSet) { obj.insert(QString("issuer"), ::OpenAPI::toJsonValue(d->issuer)); } if (d->issuer_assigned_id_isSet) { obj.insert(QString("issuerAssignedId"), ::OpenAPI::toJsonValue(d->issuer_assigned_id)); } return obj; } QString OAIObjectIdentity::getIssuer() const { Q_D(const OAIObjectIdentity); if(!d){ return {}; } return d->issuer; } void OAIObjectIdentity::setIssuer(const QString &issuer) { Q_D(OAIObjectIdentity); Q_ASSERT(d); d->issuer = issuer; d->issuer_isSet = true; } bool OAIObjectIdentity::is_issuer_Set() const{ Q_D(const OAIObjectIdentity); if(!d){ return false; } return d->issuer_isSet; } bool OAIObjectIdentity::is_issuer_Valid() const{ Q_D(const OAIObjectIdentity); if(!d){ return false; } return d->issuer_isValid; } QString OAIObjectIdentity::getIssuerAssignedId() const { Q_D(const OAIObjectIdentity); if(!d){ return {}; } return d->issuer_assigned_id; } void OAIObjectIdentity::setIssuerAssignedId(const QString &issuer_assigned_id) { Q_D(OAIObjectIdentity); Q_ASSERT(d); d->issuer_assigned_id = issuer_assigned_id; d->issuer_assigned_id_isSet = true; } bool OAIObjectIdentity::is_issuer_assigned_id_Set() const{ Q_D(const OAIObjectIdentity); if(!d){ return false; } return d->issuer_assigned_id_isSet; } bool OAIObjectIdentity::is_issuer_assigned_id_Valid() const{ Q_D(const OAIObjectIdentity); if(!d){ return false; } return d->issuer_assigned_id_isValid; } bool OAIObjectIdentity::isSet() const { Q_D(const OAIObjectIdentity); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->issuer_isSet) { isObjectUpdated = true; break; } if (d->issuer_assigned_id_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIObjectIdentity::isValid() const { Q_D(const OAIObjectIdentity); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIObjectIdentity.h000066400000000000000000000032721442421066000240400ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIObjectIdentity.h * * Represents an identity used to sign in to a user account */ #ifndef OAIObjectIdentity_H #define OAIObjectIdentity_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIObjectIdentityPrivate; class OAIObjectIdentity : public OAIObject { public: OAIObjectIdentity(); OAIObjectIdentity(const OAIObjectIdentity &other); OAIObjectIdentity(QString json); ~OAIObjectIdentity() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getIssuer() const; void setIssuer(const QString &issuer); bool is_issuer_Set() const; bool is_issuer_Valid() const; QString getIssuerAssignedId() const; void setIssuerAssignedId(const QString &issuer_assigned_id); bool is_issuer_assigned_id_Set() const; bool is_issuer_assigned_id_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIObjectIdentity) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIObjectIdentity) #endif // OAIObjectIdentity_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIOdata_error.cpp000066400000000000000000000063411442421066000237140ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIOdata_error.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIOdata_errorPrivate { friend class OAIOdata_error; OAIOdata_error_main error; bool error_isSet; bool error_isValid; }; OAIOdata_error::OAIOdata_error() : d_ptr() { } OAIOdata_error::OAIOdata_error(const OAIOdata_error& other) : d_ptr(other.d_ptr) { } OAIOdata_error::OAIOdata_error(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIOdata_error::~OAIOdata_error() = default; void OAIOdata_error::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIOdata_errorPrivate{}); Q_D(OAIOdata_error); d->error_isSet = false; d->error_isValid = false; } } void OAIOdata_error::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIOdata_error::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIOdata_error); d->error_isValid = ::OpenAPI::fromJsonValue(d->error, json[QString("error")]); d->error_isSet = !json[QString("error")].isNull() && d->error_isValid; } QString OAIOdata_error::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIOdata_error::asJsonObject() const { Q_D(const OAIOdata_error); if(!d){ return {}; } QJsonObject obj; if (d->error.isSet()) { obj.insert(QString("error"), ::OpenAPI::toJsonValue(d->error)); } return obj; } OAIOdata_error_main OAIOdata_error::getError() const { Q_D(const OAIOdata_error); if(!d){ return {}; } return d->error; } void OAIOdata_error::setError(const OAIOdata_error_main &error) { Q_D(OAIOdata_error); Q_ASSERT(d); d->error = error; d->error_isSet = true; } bool OAIOdata_error::is_error_Set() const{ Q_D(const OAIOdata_error); if(!d){ return false; } return d->error_isSet; } bool OAIOdata_error::is_error_Valid() const{ Q_D(const OAIOdata_error); if(!d){ return false; } return d->error_isValid; } bool OAIOdata_error::isSet() const { Q_D(const OAIOdata_error); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->error.isSet()) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIOdata_error::isValid() const { Q_D(const OAIOdata_error); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->error_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIOdata_error.h000066400000000000000000000027171442421066000233640ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIOdata_error.h * * */ #ifndef OAIOdata_error_H #define OAIOdata_error_H #include #include "OAIOdata_error_main.h" #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIOdata_error_main; class OAIOdata_errorPrivate; class OAIOdata_error : public OAIObject { public: OAIOdata_error(); OAIOdata_error(const OAIOdata_error &other); OAIOdata_error(QString json); ~OAIOdata_error() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; OAIOdata_error_main getError() const; void setError(const OAIOdata_error_main &error); bool is_error_Set() const; bool is_error_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIOdata_error) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIOdata_error) #endif // OAIOdata_error_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIOdata_error_detail.cpp000066400000000000000000000132671442421066000252430ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIOdata_error_detail.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIOdata_error_detailPrivate { friend class OAIOdata_error_detail; QString code; bool code_isSet; bool code_isValid; QString message; bool message_isSet; bool message_isValid; QString target; bool target_isSet; bool target_isValid; }; OAIOdata_error_detail::OAIOdata_error_detail() : d_ptr() { } OAIOdata_error_detail::OAIOdata_error_detail(const OAIOdata_error_detail& other) : d_ptr(other.d_ptr) { } OAIOdata_error_detail::OAIOdata_error_detail(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIOdata_error_detail::~OAIOdata_error_detail() = default; void OAIOdata_error_detail::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIOdata_error_detailPrivate{}); Q_D(OAIOdata_error_detail); d->code_isSet = false; d->code_isValid = false; d->message_isSet = false; d->message_isValid = false; d->target_isSet = false; d->target_isValid = false; } } void OAIOdata_error_detail::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIOdata_error_detail::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIOdata_error_detail); d->code_isValid = ::OpenAPI::fromJsonValue(d->code, json[QString("code")]); d->code_isSet = !json[QString("code")].isNull() && d->code_isValid; d->message_isValid = ::OpenAPI::fromJsonValue(d->message, json[QString("message")]); d->message_isSet = !json[QString("message")].isNull() && d->message_isValid; d->target_isValid = ::OpenAPI::fromJsonValue(d->target, json[QString("target")]); d->target_isSet = !json[QString("target")].isNull() && d->target_isValid; } QString OAIOdata_error_detail::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIOdata_error_detail::asJsonObject() const { Q_D(const OAIOdata_error_detail); if(!d){ return {}; } QJsonObject obj; if (d->code_isSet) { obj.insert(QString("code"), ::OpenAPI::toJsonValue(d->code)); } if (d->message_isSet) { obj.insert(QString("message"), ::OpenAPI::toJsonValue(d->message)); } if (d->target_isSet) { obj.insert(QString("target"), ::OpenAPI::toJsonValue(d->target)); } return obj; } QString OAIOdata_error_detail::getCode() const { Q_D(const OAIOdata_error_detail); if(!d){ return {}; } return d->code; } void OAIOdata_error_detail::setCode(const QString &code) { Q_D(OAIOdata_error_detail); Q_ASSERT(d); d->code = code; d->code_isSet = true; } bool OAIOdata_error_detail::is_code_Set() const{ Q_D(const OAIOdata_error_detail); if(!d){ return false; } return d->code_isSet; } bool OAIOdata_error_detail::is_code_Valid() const{ Q_D(const OAIOdata_error_detail); if(!d){ return false; } return d->code_isValid; } QString OAIOdata_error_detail::getMessage() const { Q_D(const OAIOdata_error_detail); if(!d){ return {}; } return d->message; } void OAIOdata_error_detail::setMessage(const QString &message) { Q_D(OAIOdata_error_detail); Q_ASSERT(d); d->message = message; d->message_isSet = true; } bool OAIOdata_error_detail::is_message_Set() const{ Q_D(const OAIOdata_error_detail); if(!d){ return false; } return d->message_isSet; } bool OAIOdata_error_detail::is_message_Valid() const{ Q_D(const OAIOdata_error_detail); if(!d){ return false; } return d->message_isValid; } QString OAIOdata_error_detail::getTarget() const { Q_D(const OAIOdata_error_detail); if(!d){ return {}; } return d->target; } void OAIOdata_error_detail::setTarget(const QString &target) { Q_D(OAIOdata_error_detail); Q_ASSERT(d); d->target = target; d->target_isSet = true; } bool OAIOdata_error_detail::is_target_Set() const{ Q_D(const OAIOdata_error_detail); if(!d){ return false; } return d->target_isSet; } bool OAIOdata_error_detail::is_target_Valid() const{ Q_D(const OAIOdata_error_detail); if(!d){ return false; } return d->target_isValid; } bool OAIOdata_error_detail::isSet() const { Q_D(const OAIOdata_error_detail); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->code_isSet) { isObjectUpdated = true; break; } if (d->message_isSet) { isObjectUpdated = true; break; } if (d->target_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIOdata_error_detail::isValid() const { Q_D(const OAIOdata_error_detail); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->code_isValid && d->message_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIOdata_error_detail.h000066400000000000000000000034121442421066000246770ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIOdata_error_detail.h * * */ #ifndef OAIOdata_error_detail_H #define OAIOdata_error_detail_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIOdata_error_detailPrivate; class OAIOdata_error_detail : public OAIObject { public: OAIOdata_error_detail(); OAIOdata_error_detail(const OAIOdata_error_detail &other); OAIOdata_error_detail(QString json); ~OAIOdata_error_detail() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getCode() const; void setCode(const QString &code); bool is_code_Set() const; bool is_code_Valid() const; QString getMessage() const; void setMessage(const QString &message); bool is_message_Set() const; bool is_message_Valid() const; QString getTarget() const; void setTarget(const QString &target); bool is_target_Set() const; bool is_target_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIOdata_error_detail) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIOdata_error_detail) #endif // OAIOdata_error_detail_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIOdata_error_main.cpp000066400000000000000000000200101442421066000247050ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIOdata_error_main.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIOdata_error_mainPrivate { friend class OAIOdata_error_main; QString code; bool code_isSet; bool code_isValid; QString message; bool message_isSet; bool message_isValid; QString target; bool target_isSet; bool target_isValid; QList details; bool details_isSet; bool details_isValid; OAIObject innererror; bool innererror_isSet; bool innererror_isValid; }; OAIOdata_error_main::OAIOdata_error_main() : d_ptr() { } OAIOdata_error_main::OAIOdata_error_main(const OAIOdata_error_main& other) : d_ptr(other.d_ptr) { } OAIOdata_error_main::OAIOdata_error_main(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIOdata_error_main::~OAIOdata_error_main() = default; void OAIOdata_error_main::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIOdata_error_mainPrivate{}); Q_D(OAIOdata_error_main); d->code_isSet = false; d->code_isValid = false; d->message_isSet = false; d->message_isValid = false; d->target_isSet = false; d->target_isValid = false; d->details_isSet = false; d->details_isValid = false; d->innererror_isSet = false; d->innererror_isValid = false; } } void OAIOdata_error_main::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIOdata_error_main::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIOdata_error_main); d->code_isValid = ::OpenAPI::fromJsonValue(d->code, json[QString("code")]); d->code_isSet = !json[QString("code")].isNull() && d->code_isValid; d->message_isValid = ::OpenAPI::fromJsonValue(d->message, json[QString("message")]); d->message_isSet = !json[QString("message")].isNull() && d->message_isValid; d->target_isValid = ::OpenAPI::fromJsonValue(d->target, json[QString("target")]); d->target_isSet = !json[QString("target")].isNull() && d->target_isValid; d->details_isValid = ::OpenAPI::fromJsonValue(d->details, json[QString("details")]); d->details_isSet = !json[QString("details")].isNull() && d->details_isValid; d->innererror_isValid = ::OpenAPI::fromJsonValue(d->innererror, json[QString("innererror")]); d->innererror_isSet = !json[QString("innererror")].isNull() && d->innererror_isValid; } QString OAIOdata_error_main::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIOdata_error_main::asJsonObject() const { Q_D(const OAIOdata_error_main); if(!d){ return {}; } QJsonObject obj; if (d->code_isSet) { obj.insert(QString("code"), ::OpenAPI::toJsonValue(d->code)); } if (d->message_isSet) { obj.insert(QString("message"), ::OpenAPI::toJsonValue(d->message)); } if (d->target_isSet) { obj.insert(QString("target"), ::OpenAPI::toJsonValue(d->target)); } if (d->details.size() > 0) { obj.insert(QString("details"), ::OpenAPI::toJsonValue(d->details)); } if (d->innererror_isSet) { obj.insert(QString("innererror"), ::OpenAPI::toJsonValue(d->innererror)); } return obj; } QString OAIOdata_error_main::getCode() const { Q_D(const OAIOdata_error_main); if(!d){ return {}; } return d->code; } void OAIOdata_error_main::setCode(const QString &code) { Q_D(OAIOdata_error_main); Q_ASSERT(d); d->code = code; d->code_isSet = true; } bool OAIOdata_error_main::is_code_Set() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->code_isSet; } bool OAIOdata_error_main::is_code_Valid() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->code_isValid; } QString OAIOdata_error_main::getMessage() const { Q_D(const OAIOdata_error_main); if(!d){ return {}; } return d->message; } void OAIOdata_error_main::setMessage(const QString &message) { Q_D(OAIOdata_error_main); Q_ASSERT(d); d->message = message; d->message_isSet = true; } bool OAIOdata_error_main::is_message_Set() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->message_isSet; } bool OAIOdata_error_main::is_message_Valid() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->message_isValid; } QString OAIOdata_error_main::getTarget() const { Q_D(const OAIOdata_error_main); if(!d){ return {}; } return d->target; } void OAIOdata_error_main::setTarget(const QString &target) { Q_D(OAIOdata_error_main); Q_ASSERT(d); d->target = target; d->target_isSet = true; } bool OAIOdata_error_main::is_target_Set() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->target_isSet; } bool OAIOdata_error_main::is_target_Valid() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->target_isValid; } QList OAIOdata_error_main::getDetails() const { Q_D(const OAIOdata_error_main); if(!d){ return {}; } return d->details; } void OAIOdata_error_main::setDetails(const QList &details) { Q_D(OAIOdata_error_main); Q_ASSERT(d); d->details = details; d->details_isSet = true; } bool OAIOdata_error_main::is_details_Set() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->details_isSet; } bool OAIOdata_error_main::is_details_Valid() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->details_isValid; } OAIObject OAIOdata_error_main::getInnererror() const { Q_D(const OAIOdata_error_main); if(!d){ return {}; } return d->innererror; } void OAIOdata_error_main::setInnererror(const OAIObject &innererror) { Q_D(OAIOdata_error_main); Q_ASSERT(d); d->innererror = innererror; d->innererror_isSet = true; } bool OAIOdata_error_main::is_innererror_Set() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->innererror_isSet; } bool OAIOdata_error_main::is_innererror_Valid() const{ Q_D(const OAIOdata_error_main); if(!d){ return false; } return d->innererror_isValid; } bool OAIOdata_error_main::isSet() const { Q_D(const OAIOdata_error_main); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->code_isSet) { isObjectUpdated = true; break; } if (d->message_isSet) { isObjectUpdated = true; break; } if (d->target_isSet) { isObjectUpdated = true; break; } if (d->details.size() > 0) { isObjectUpdated = true; break; } if (d->innererror_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIOdata_error_main::isValid() const { Q_D(const OAIOdata_error_main); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->code_isValid && d->message_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIOdata_error_main.h000066400000000000000000000042671442421066000243720ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIOdata_error_main.h * * */ #ifndef OAIOdata_error_main_H #define OAIOdata_error_main_H #include #include "OAIObject.h" #include "OAIOdata_error_detail.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIOdata_error_detail; class OAIOdata_error_mainPrivate; class OAIOdata_error_main : public OAIObject { public: OAIOdata_error_main(); OAIOdata_error_main(const OAIOdata_error_main &other); OAIOdata_error_main(QString json); ~OAIOdata_error_main() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getCode() const; void setCode(const QString &code); bool is_code_Set() const; bool is_code_Valid() const; QString getMessage() const; void setMessage(const QString &message); bool is_message_Set() const; bool is_message_Valid() const; QString getTarget() const; void setTarget(const QString &target); bool is_target_Set() const; bool is_target_Valid() const; QList getDetails() const; void setDetails(const QList &details); bool is_details_Set() const; bool is_details_Valid() const; OAIObject getInnererror() const; void setInnererror(const OAIObject &innererror); bool is_innererror_Set() const; bool is_innererror_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIOdata_error_main) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIOdata_error_main) #endif // OAIOdata_error_main_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIOpenGraphFile.cpp000066400000000000000000000135111442421066000241330ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIOpenGraphFile.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIOpenGraphFilePrivate { friend class OAIOpenGraphFile; OAIHashes hashes; bool hashes_isSet; bool hashes_isValid; QString mime_type; bool mime_type_isSet; bool mime_type_isValid; bool processing_metadata; bool processing_metadata_isSet; bool processing_metadata_isValid; }; OAIOpenGraphFile::OAIOpenGraphFile() : d_ptr() { } OAIOpenGraphFile::OAIOpenGraphFile(const OAIOpenGraphFile& other) : d_ptr(other.d_ptr) { } OAIOpenGraphFile::OAIOpenGraphFile(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIOpenGraphFile::~OAIOpenGraphFile() = default; void OAIOpenGraphFile::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIOpenGraphFilePrivate{}); Q_D(OAIOpenGraphFile); d->hashes_isSet = false; d->hashes_isValid = false; d->mime_type_isSet = false; d->mime_type_isValid = false; d->processing_metadata_isSet = false; d->processing_metadata_isValid = false; } } void OAIOpenGraphFile::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIOpenGraphFile::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIOpenGraphFile); d->hashes_isValid = ::OpenAPI::fromJsonValue(d->hashes, json[QString("hashes")]); d->hashes_isSet = !json[QString("hashes")].isNull() && d->hashes_isValid; d->mime_type_isValid = ::OpenAPI::fromJsonValue(d->mime_type, json[QString("mimeType")]); d->mime_type_isSet = !json[QString("mimeType")].isNull() && d->mime_type_isValid; d->processing_metadata_isValid = ::OpenAPI::fromJsonValue(d->processing_metadata, json[QString("processingMetadata")]); d->processing_metadata_isSet = !json[QString("processingMetadata")].isNull() && d->processing_metadata_isValid; } QString OAIOpenGraphFile::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIOpenGraphFile::asJsonObject() const { Q_D(const OAIOpenGraphFile); if(!d){ return {}; } QJsonObject obj; if (d->hashes.isSet()) { obj.insert(QString("hashes"), ::OpenAPI::toJsonValue(d->hashes)); } if (d->mime_type_isSet) { obj.insert(QString("mimeType"), ::OpenAPI::toJsonValue(d->mime_type)); } if (d->processing_metadata_isSet) { obj.insert(QString("processingMetadata"), ::OpenAPI::toJsonValue(d->processing_metadata)); } return obj; } OAIHashes OAIOpenGraphFile::getHashes() const { Q_D(const OAIOpenGraphFile); if(!d){ return {}; } return d->hashes; } void OAIOpenGraphFile::setHashes(const OAIHashes &hashes) { Q_D(OAIOpenGraphFile); Q_ASSERT(d); d->hashes = hashes; d->hashes_isSet = true; } bool OAIOpenGraphFile::is_hashes_Set() const{ Q_D(const OAIOpenGraphFile); if(!d){ return false; } return d->hashes_isSet; } bool OAIOpenGraphFile::is_hashes_Valid() const{ Q_D(const OAIOpenGraphFile); if(!d){ return false; } return d->hashes_isValid; } QString OAIOpenGraphFile::getMimeType() const { Q_D(const OAIOpenGraphFile); if(!d){ return {}; } return d->mime_type; } void OAIOpenGraphFile::setMimeType(const QString &mime_type) { Q_D(OAIOpenGraphFile); Q_ASSERT(d); d->mime_type = mime_type; d->mime_type_isSet = true; } bool OAIOpenGraphFile::is_mime_type_Set() const{ Q_D(const OAIOpenGraphFile); if(!d){ return false; } return d->mime_type_isSet; } bool OAIOpenGraphFile::is_mime_type_Valid() const{ Q_D(const OAIOpenGraphFile); if(!d){ return false; } return d->mime_type_isValid; } bool OAIOpenGraphFile::isProcessingMetadata() const { Q_D(const OAIOpenGraphFile); if(!d){ return {}; } return d->processing_metadata; } void OAIOpenGraphFile::setProcessingMetadata(const bool &processing_metadata) { Q_D(OAIOpenGraphFile); Q_ASSERT(d); d->processing_metadata = processing_metadata; d->processing_metadata_isSet = true; } bool OAIOpenGraphFile::is_processing_metadata_Set() const{ Q_D(const OAIOpenGraphFile); if(!d){ return false; } return d->processing_metadata_isSet; } bool OAIOpenGraphFile::is_processing_metadata_Valid() const{ Q_D(const OAIOpenGraphFile); if(!d){ return false; } return d->processing_metadata_isValid; } bool OAIOpenGraphFile::isSet() const { Q_D(const OAIOpenGraphFile); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->hashes.isSet()) { isObjectUpdated = true; break; } if (d->mime_type_isSet) { isObjectUpdated = true; break; } if (d->processing_metadata_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIOpenGraphFile::isValid() const { Q_D(const OAIOpenGraphFile); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIOpenGraphFile.h000066400000000000000000000035521442421066000236040ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIOpenGraphFile.h * * File metadata, if the item is a file. Read-only. */ #ifndef OAIOpenGraphFile_H #define OAIOpenGraphFile_H #include #include "OAIHashes.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIHashes; class OAIOpenGraphFilePrivate; class OAIOpenGraphFile : public OAIObject { public: OAIOpenGraphFile(); OAIOpenGraphFile(const OAIOpenGraphFile &other); OAIOpenGraphFile(QString json); ~OAIOpenGraphFile() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; OAIHashes getHashes() const; void setHashes(const OAIHashes &hashes); bool is_hashes_Set() const; bool is_hashes_Valid() const; QString getMimeType() const; void setMimeType(const QString &mime_type); bool is_mime_type_Set() const; bool is_mime_type_Valid() const; bool isProcessingMetadata() const; void setProcessingMetadata(const bool &processing_metadata); bool is_processing_metadata_Set() const; bool is_processing_metadata_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIOpenGraphFile) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIOpenGraphFile) #endif // OAIOpenGraphFile_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIPasswordProfile.cpp000066400000000000000000000122251442421066000245740ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIPasswordProfile.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIPasswordProfilePrivate { friend class OAIPasswordProfile; bool force_change_password_next_sign_in; bool force_change_password_next_sign_in_isSet; bool force_change_password_next_sign_in_isValid; QString password; bool password_isSet; bool password_isValid; }; OAIPasswordProfile::OAIPasswordProfile() : d_ptr() { } OAIPasswordProfile::OAIPasswordProfile(const OAIPasswordProfile& other) : d_ptr(other.d_ptr) { } OAIPasswordProfile::OAIPasswordProfile(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIPasswordProfile::~OAIPasswordProfile() = default; void OAIPasswordProfile::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIPasswordProfilePrivate{}); Q_D(OAIPasswordProfile); d->force_change_password_next_sign_in_isSet = false; d->force_change_password_next_sign_in_isValid = false; d->password_isSet = false; d->password_isValid = false; } } void OAIPasswordProfile::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIPasswordProfile::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIPasswordProfile); d->force_change_password_next_sign_in_isValid = ::OpenAPI::fromJsonValue(d->force_change_password_next_sign_in, json[QString("forceChangePasswordNextSignIn")]); d->force_change_password_next_sign_in_isSet = !json[QString("forceChangePasswordNextSignIn")].isNull() && d->force_change_password_next_sign_in_isValid; d->password_isValid = ::OpenAPI::fromJsonValue(d->password, json[QString("password")]); d->password_isSet = !json[QString("password")].isNull() && d->password_isValid; } QString OAIPasswordProfile::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIPasswordProfile::asJsonObject() const { Q_D(const OAIPasswordProfile); if(!d){ return {}; } QJsonObject obj; if (d->force_change_password_next_sign_in_isSet) { obj.insert(QString("forceChangePasswordNextSignIn"), ::OpenAPI::toJsonValue(d->force_change_password_next_sign_in)); } if (d->password_isSet) { obj.insert(QString("password"), ::OpenAPI::toJsonValue(d->password)); } return obj; } bool OAIPasswordProfile::isForceChangePasswordNextSignIn() const { Q_D(const OAIPasswordProfile); if(!d){ return {}; } return d->force_change_password_next_sign_in; } void OAIPasswordProfile::setForceChangePasswordNextSignIn(const bool &force_change_password_next_sign_in) { Q_D(OAIPasswordProfile); Q_ASSERT(d); d->force_change_password_next_sign_in = force_change_password_next_sign_in; d->force_change_password_next_sign_in_isSet = true; } bool OAIPasswordProfile::is_force_change_password_next_sign_in_Set() const{ Q_D(const OAIPasswordProfile); if(!d){ return false; } return d->force_change_password_next_sign_in_isSet; } bool OAIPasswordProfile::is_force_change_password_next_sign_in_Valid() const{ Q_D(const OAIPasswordProfile); if(!d){ return false; } return d->force_change_password_next_sign_in_isValid; } QString OAIPasswordProfile::getPassword() const { Q_D(const OAIPasswordProfile); if(!d){ return {}; } return d->password; } void OAIPasswordProfile::setPassword(const QString &password) { Q_D(OAIPasswordProfile); Q_ASSERT(d); d->password = password; d->password_isSet = true; } bool OAIPasswordProfile::is_password_Set() const{ Q_D(const OAIPasswordProfile); if(!d){ return false; } return d->password_isSet; } bool OAIPasswordProfile::is_password_Valid() const{ Q_D(const OAIPasswordProfile); if(!d){ return false; } return d->password_isValid; } bool OAIPasswordProfile::isSet() const { Q_D(const OAIPasswordProfile); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->force_change_password_next_sign_in_isSet) { isObjectUpdated = true; break; } if (d->password_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIPasswordProfile::isValid() const { Q_D(const OAIPasswordProfile); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIPasswordProfile.h000066400000000000000000000034041442421066000242400ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIPasswordProfile.h * * Password Profile associated with a user */ #ifndef OAIPasswordProfile_H #define OAIPasswordProfile_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIPasswordProfilePrivate; class OAIPasswordProfile : public OAIObject { public: OAIPasswordProfile(); OAIPasswordProfile(const OAIPasswordProfile &other); OAIPasswordProfile(QString json); ~OAIPasswordProfile() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; bool isForceChangePasswordNextSignIn() const; void setForceChangePasswordNextSignIn(const bool &force_change_password_next_sign_in); bool is_force_change_password_next_sign_in_Set() const; bool is_force_change_password_next_sign_in_Valid() const; QString getPassword() const; void setPassword(const QString &password); bool is_password_Set() const; bool is_password_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIPasswordProfile) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIPasswordProfile) #endif // OAIPasswordProfile_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIPassword_change.cpp000066400000000000000000000115741442421066000245660ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIPassword_change.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIPassword_changePrivate { friend class OAIPassword_change; QString current_password; bool current_password_isSet; bool current_password_isValid; QString new_password; bool new_password_isSet; bool new_password_isValid; }; OAIPassword_change::OAIPassword_change() : d_ptr() { } OAIPassword_change::OAIPassword_change(const OAIPassword_change& other) : d_ptr(other.d_ptr) { } OAIPassword_change::OAIPassword_change(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIPassword_change::~OAIPassword_change() = default; void OAIPassword_change::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIPassword_changePrivate{}); Q_D(OAIPassword_change); d->current_password_isSet = false; d->current_password_isValid = false; d->new_password_isSet = false; d->new_password_isValid = false; } } void OAIPassword_change::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIPassword_change::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIPassword_change); d->current_password_isValid = ::OpenAPI::fromJsonValue(d->current_password, json[QString("currentPassword")]); d->current_password_isSet = !json[QString("currentPassword")].isNull() && d->current_password_isValid; d->new_password_isValid = ::OpenAPI::fromJsonValue(d->new_password, json[QString("newPassword")]); d->new_password_isSet = !json[QString("newPassword")].isNull() && d->new_password_isValid; } QString OAIPassword_change::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIPassword_change::asJsonObject() const { Q_D(const OAIPassword_change); if(!d){ return {}; } QJsonObject obj; if (d->current_password_isSet) { obj.insert(QString("currentPassword"), ::OpenAPI::toJsonValue(d->current_password)); } if (d->new_password_isSet) { obj.insert(QString("newPassword"), ::OpenAPI::toJsonValue(d->new_password)); } return obj; } QString OAIPassword_change::getCurrentPassword() const { Q_D(const OAIPassword_change); if(!d){ return {}; } return d->current_password; } void OAIPassword_change::setCurrentPassword(const QString ¤t_password) { Q_D(OAIPassword_change); Q_ASSERT(d); d->current_password = current_password; d->current_password_isSet = true; } bool OAIPassword_change::is_current_password_Set() const{ Q_D(const OAIPassword_change); if(!d){ return false; } return d->current_password_isSet; } bool OAIPassword_change::is_current_password_Valid() const{ Q_D(const OAIPassword_change); if(!d){ return false; } return d->current_password_isValid; } QString OAIPassword_change::getNewPassword() const { Q_D(const OAIPassword_change); if(!d){ return {}; } return d->new_password; } void OAIPassword_change::setNewPassword(const QString &new_password) { Q_D(OAIPassword_change); Q_ASSERT(d); d->new_password = new_password; d->new_password_isSet = true; } bool OAIPassword_change::is_new_password_Set() const{ Q_D(const OAIPassword_change); if(!d){ return false; } return d->new_password_isSet; } bool OAIPassword_change::is_new_password_Valid() const{ Q_D(const OAIPassword_change); if(!d){ return false; } return d->new_password_isValid; } bool OAIPassword_change::isSet() const { Q_D(const OAIPassword_change); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->current_password_isSet) { isObjectUpdated = true; break; } if (d->new_password_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIPassword_change::isValid() const { Q_D(const OAIPassword_change); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->current_password_isValid && d->new_password_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIPassword_change.h000066400000000000000000000032441442421066000242260ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIPassword_change.h * * */ #ifndef OAIPassword_change_H #define OAIPassword_change_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIPassword_changePrivate; class OAIPassword_change : public OAIObject { public: OAIPassword_change(); OAIPassword_change(const OAIPassword_change &other); OAIPassword_change(QString json); ~OAIPassword_change() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getCurrentPassword() const; void setCurrentPassword(const QString ¤t_password); bool is_current_password_Set() const; bool is_current_password_Valid() const; QString getNewPassword() const; void setNewPassword(const QString &new_password); bool is_new_password_Set() const; bool is_new_password_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIPassword_change) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIPassword_change) #endif // OAIPassword_change_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIPermission.cpp000066400000000000000000000140751442421066000236060ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIPermission.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIPermissionPrivate { friend class OAIPermission; QDateTime expiration_date_time; bool expiration_date_time_isSet; bool expiration_date_time_isValid; QList granted_to_identities; bool granted_to_identities_isSet; bool granted_to_identities_isValid; QList roles; bool roles_isSet; bool roles_isValid; }; OAIPermission::OAIPermission() : d_ptr() { } OAIPermission::OAIPermission(const OAIPermission& other) : d_ptr(other.d_ptr) { } OAIPermission::OAIPermission(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIPermission::~OAIPermission() = default; void OAIPermission::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIPermissionPrivate{}); Q_D(OAIPermission); d->expiration_date_time_isSet = false; d->expiration_date_time_isValid = false; d->granted_to_identities_isSet = false; d->granted_to_identities_isValid = false; d->roles_isSet = false; d->roles_isValid = false; } } void OAIPermission::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIPermission::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIPermission); d->expiration_date_time_isValid = ::OpenAPI::fromJsonValue(d->expiration_date_time, json[QString("expirationDateTime")]); d->expiration_date_time_isSet = !json[QString("expirationDateTime")].isNull() && d->expiration_date_time_isValid; d->granted_to_identities_isValid = ::OpenAPI::fromJsonValue(d->granted_to_identities, json[QString("grantedToIdentities")]); d->granted_to_identities_isSet = !json[QString("grantedToIdentities")].isNull() && d->granted_to_identities_isValid; d->roles_isValid = ::OpenAPI::fromJsonValue(d->roles, json[QString("roles")]); d->roles_isSet = !json[QString("roles")].isNull() && d->roles_isValid; } QString OAIPermission::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIPermission::asJsonObject() const { Q_D(const OAIPermission); if(!d){ return {}; } QJsonObject obj; if (d->expiration_date_time_isSet) { obj.insert(QString("expirationDateTime"), ::OpenAPI::toJsonValue(d->expiration_date_time)); } if (d->granted_to_identities.size() > 0) { obj.insert(QString("grantedToIdentities"), ::OpenAPI::toJsonValue(d->granted_to_identities)); } if (d->roles.size() > 0) { obj.insert(QString("roles"), ::OpenAPI::toJsonValue(d->roles)); } return obj; } QDateTime OAIPermission::getExpirationDateTime() const { Q_D(const OAIPermission); if(!d){ return {}; } return d->expiration_date_time; } void OAIPermission::setExpirationDateTime(const QDateTime &expiration_date_time) { Q_D(OAIPermission); Q_ASSERT(d); d->expiration_date_time = expiration_date_time; d->expiration_date_time_isSet = true; } bool OAIPermission::is_expiration_date_time_Set() const{ Q_D(const OAIPermission); if(!d){ return false; } return d->expiration_date_time_isSet; } bool OAIPermission::is_expiration_date_time_Valid() const{ Q_D(const OAIPermission); if(!d){ return false; } return d->expiration_date_time_isValid; } QList OAIPermission::getGrantedToIdentities() const { Q_D(const OAIPermission); if(!d){ return {}; } return d->granted_to_identities; } void OAIPermission::setGrantedToIdentities(const QList &granted_to_identities) { Q_D(OAIPermission); Q_ASSERT(d); d->granted_to_identities = granted_to_identities; d->granted_to_identities_isSet = true; } bool OAIPermission::is_granted_to_identities_Set() const{ Q_D(const OAIPermission); if(!d){ return false; } return d->granted_to_identities_isSet; } bool OAIPermission::is_granted_to_identities_Valid() const{ Q_D(const OAIPermission); if(!d){ return false; } return d->granted_to_identities_isValid; } QList OAIPermission::getRoles() const { Q_D(const OAIPermission); if(!d){ return {}; } return d->roles; } void OAIPermission::setRoles(const QList &roles) { Q_D(OAIPermission); Q_ASSERT(d); d->roles = roles; d->roles_isSet = true; } bool OAIPermission::is_roles_Set() const{ Q_D(const OAIPermission); if(!d){ return false; } return d->roles_isSet; } bool OAIPermission::is_roles_Valid() const{ Q_D(const OAIPermission); if(!d){ return false; } return d->roles_isValid; } bool OAIPermission::isSet() const { Q_D(const OAIPermission); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->expiration_date_time_isSet) { isObjectUpdated = true; break; } if (d->granted_to_identities.size() > 0) { isObjectUpdated = true; break; } if (d->roles.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIPermission::isValid() const { Q_D(const OAIPermission); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIPermission.h000066400000000000000000000040221442421066000232420ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIPermission.h * * The Permission resource provides information about a sharing permission granted for a DriveItem resource. */ #ifndef OAIPermission_H #define OAIPermission_H #include #include "OAIIdentitySet.h" #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentitySet; class OAIPermissionPrivate; class OAIPermission : public OAIObject { public: OAIPermission(); OAIPermission(const OAIPermission &other); OAIPermission(QString json); ~OAIPermission() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QDateTime getExpirationDateTime() const; void setExpirationDateTime(const QDateTime &expiration_date_time); bool is_expiration_date_time_Set() const; bool is_expiration_date_time_Valid() const; QList getGrantedToIdentities() const; void setGrantedToIdentities(const QList &granted_to_identities); bool is_granted_to_identities_Set() const; bool is_granted_to_identities_Valid() const; QList getRoles() const; void setRoles(const QList &roles); bool is_roles_Set() const; bool is_roles_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIPermission) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIPermission) #endif // OAIPermission_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIQuota.cpp000066400000000000000000000161211442421066000225410ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIQuota.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIQuotaPrivate { friend class OAIQuota; qint64 deleted; bool deleted_isSet; bool deleted_isValid; qint64 remaining; bool remaining_isSet; bool remaining_isValid; QString state; bool state_isSet; bool state_isValid; qint64 total; bool total_isSet; bool total_isValid; qint64 used; bool used_isSet; bool used_isValid; }; OAIQuota::OAIQuota() : d_ptr() { } OAIQuota::OAIQuota(const OAIQuota& other) : d_ptr(other.d_ptr) { } OAIQuota::OAIQuota(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIQuota::~OAIQuota() = default; void OAIQuota::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIQuotaPrivate{}); Q_D(OAIQuota); d->deleted_isSet = false; d->deleted_isValid = false; d->remaining_isSet = false; d->remaining_isValid = false; d->state_isSet = false; d->state_isValid = false; d->total_isSet = false; d->total_isValid = false; d->used_isSet = false; d->used_isValid = false; } } void OAIQuota::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIQuota::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIQuota); d->deleted_isValid = ::OpenAPI::fromJsonValue(d->deleted, json[QString("deleted")]); d->deleted_isSet = !json[QString("deleted")].isNull() && d->deleted_isValid; d->remaining_isValid = ::OpenAPI::fromJsonValue(d->remaining, json[QString("remaining")]); d->remaining_isSet = !json[QString("remaining")].isNull() && d->remaining_isValid; d->state_isValid = ::OpenAPI::fromJsonValue(d->state, json[QString("state")]); d->state_isSet = !json[QString("state")].isNull() && d->state_isValid; d->total_isValid = ::OpenAPI::fromJsonValue(d->total, json[QString("total")]); d->total_isSet = !json[QString("total")].isNull() && d->total_isValid; d->used_isValid = ::OpenAPI::fromJsonValue(d->used, json[QString("used")]); d->used_isSet = !json[QString("used")].isNull() && d->used_isValid; } QString OAIQuota::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIQuota::asJsonObject() const { Q_D(const OAIQuota); if(!d){ return {}; } QJsonObject obj; if (d->deleted_isSet) { obj.insert(QString("deleted"), ::OpenAPI::toJsonValue(d->deleted)); } if (d->remaining_isSet) { obj.insert(QString("remaining"), ::OpenAPI::toJsonValue(d->remaining)); } if (d->state_isSet) { obj.insert(QString("state"), ::OpenAPI::toJsonValue(d->state)); } if (d->total_isSet) { obj.insert(QString("total"), ::OpenAPI::toJsonValue(d->total)); } if (d->used_isSet) { obj.insert(QString("used"), ::OpenAPI::toJsonValue(d->used)); } return obj; } qint64 OAIQuota::getDeleted() const { Q_D(const OAIQuota); if(!d){ return {}; } return d->deleted; } void OAIQuota::setDeleted(const qint64 &deleted) { Q_D(OAIQuota); Q_ASSERT(d); d->deleted = deleted; d->deleted_isSet = true; } bool OAIQuota::is_deleted_Set() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->deleted_isSet; } bool OAIQuota::is_deleted_Valid() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->deleted_isValid; } qint64 OAIQuota::getRemaining() const { Q_D(const OAIQuota); if(!d){ return {}; } return d->remaining; } void OAIQuota::setRemaining(const qint64 &remaining) { Q_D(OAIQuota); Q_ASSERT(d); d->remaining = remaining; d->remaining_isSet = true; } bool OAIQuota::is_remaining_Set() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->remaining_isSet; } bool OAIQuota::is_remaining_Valid() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->remaining_isValid; } QString OAIQuota::getState() const { Q_D(const OAIQuota); if(!d){ return {}; } return d->state; } void OAIQuota::setState(const QString &state) { Q_D(OAIQuota); Q_ASSERT(d); d->state = state; d->state_isSet = true; } bool OAIQuota::is_state_Set() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->state_isSet; } bool OAIQuota::is_state_Valid() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->state_isValid; } qint64 OAIQuota::getTotal() const { Q_D(const OAIQuota); if(!d){ return {}; } return d->total; } void OAIQuota::setTotal(const qint64 &total) { Q_D(OAIQuota); Q_ASSERT(d); d->total = total; d->total_isSet = true; } bool OAIQuota::is_total_Set() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->total_isSet; } bool OAIQuota::is_total_Valid() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->total_isValid; } qint64 OAIQuota::getUsed() const { Q_D(const OAIQuota); if(!d){ return {}; } return d->used; } void OAIQuota::setUsed(const qint64 &used) { Q_D(OAIQuota); Q_ASSERT(d); d->used = used; d->used_isSet = true; } bool OAIQuota::is_used_Set() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->used_isSet; } bool OAIQuota::is_used_Valid() const{ Q_D(const OAIQuota); if(!d){ return false; } return d->used_isValid; } bool OAIQuota::isSet() const { Q_D(const OAIQuota); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->deleted_isSet) { isObjectUpdated = true; break; } if (d->remaining_isSet) { isObjectUpdated = true; break; } if (d->state_isSet) { isObjectUpdated = true; break; } if (d->total_isSet) { isObjectUpdated = true; break; } if (d->used_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIQuota::isValid() const { Q_D(const OAIQuota); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIQuota.h000066400000000000000000000036661442421066000222200ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIQuota.h * * Optional. Information about the drive's storage space quota. Read-only. */ #ifndef OAIQuota_H #define OAIQuota_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIQuotaPrivate; class OAIQuota : public OAIObject { public: OAIQuota(); OAIQuota(const OAIQuota &other); OAIQuota(QString json); ~OAIQuota() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; qint64 getDeleted() const; void setDeleted(const qint64 &deleted); bool is_deleted_Set() const; bool is_deleted_Valid() const; qint64 getRemaining() const; void setRemaining(const qint64 &remaining); bool is_remaining_Set() const; bool is_remaining_Valid() const; QString getState() const; void setState(const QString &state); bool is_state_Set() const; bool is_state_Valid() const; qint64 getTotal() const; void setTotal(const qint64 &total); bool is_total_Set() const; bool is_total_Valid() const; qint64 getUsed() const; void setUsed(const qint64 &used); bool is_used_Set() const; bool is_used_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIQuota) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIQuota) #endif // OAIQuota_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIRemoteItem.cpp000066400000000000000000000557251442421066000235370ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIRemoteItem.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIRemoteItemPrivate { friend class OAIRemoteItem; OAIIdentitySet created_by; bool created_by_isSet; bool created_by_isValid; QDateTime created_date_time; bool created_date_time_isSet; bool created_date_time_isValid; OAIOpenGraphFile file; bool file_isSet; bool file_isValid; OAIFileSystemInfo file_system_info; bool file_system_info_isSet; bool file_system_info_isValid; OAIFolder folder; bool folder_isSet; bool folder_isValid; QString id; bool id_isSet; bool id_isValid; OAIImage image; bool image_isSet; bool image_isValid; OAIIdentitySet last_modified_by; bool last_modified_by_isSet; bool last_modified_by_isValid; QDateTime last_modified_date_time; bool last_modified_date_time_isSet; bool last_modified_date_time_isValid; QString name; bool name_isSet; bool name_isValid; QString e_tag; bool e_tag_isSet; bool e_tag_isValid; QString c_tag; bool c_tag_isSet; bool c_tag_isValid; OAIItemReference parent_reference; bool parent_reference_isSet; bool parent_reference_isValid; OAIShared shared; bool shared_isSet; bool shared_isValid; qint64 size; bool size_isSet; bool size_isValid; OAISpecialFolder special_folder; bool special_folder_isSet; bool special_folder_isValid; QString web_dav_url; bool web_dav_url_isSet; bool web_dav_url_isValid; QString web_url; bool web_url_isSet; bool web_url_isValid; }; OAIRemoteItem::OAIRemoteItem() : d_ptr() { } OAIRemoteItem::OAIRemoteItem(const OAIRemoteItem& other) : d_ptr(other.d_ptr) { } OAIRemoteItem::OAIRemoteItem(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIRemoteItem::~OAIRemoteItem() = default; void OAIRemoteItem::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIRemoteItemPrivate{}); Q_D(OAIRemoteItem); d->created_by_isSet = false; d->created_by_isValid = false; d->created_date_time_isSet = false; d->created_date_time_isValid = false; d->file_isSet = false; d->file_isValid = false; d->file_system_info_isSet = false; d->file_system_info_isValid = false; d->folder_isSet = false; d->folder_isValid = false; d->id_isSet = false; d->id_isValid = false; d->image_isSet = false; d->image_isValid = false; d->last_modified_by_isSet = false; d->last_modified_by_isValid = false; d->last_modified_date_time_isSet = false; d->last_modified_date_time_isValid = false; d->name_isSet = false; d->name_isValid = false; d->e_tag_isSet = false; d->e_tag_isValid = false; d->c_tag_isSet = false; d->c_tag_isValid = false; d->parent_reference_isSet = false; d->parent_reference_isValid = false; d->shared_isSet = false; d->shared_isValid = false; d->size_isSet = false; d->size_isValid = false; d->special_folder_isSet = false; d->special_folder_isValid = false; d->web_dav_url_isSet = false; d->web_dav_url_isValid = false; d->web_url_isSet = false; d->web_url_isValid = false; } } void OAIRemoteItem::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIRemoteItem::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIRemoteItem); d->created_by_isValid = ::OpenAPI::fromJsonValue(d->created_by, json[QString("createdBy")]); d->created_by_isSet = !json[QString("createdBy")].isNull() && d->created_by_isValid; d->created_date_time_isValid = ::OpenAPI::fromJsonValue(d->created_date_time, json[QString("createdDateTime")]); d->created_date_time_isSet = !json[QString("createdDateTime")].isNull() && d->created_date_time_isValid; d->file_isValid = ::OpenAPI::fromJsonValue(d->file, json[QString("file")]); d->file_isSet = !json[QString("file")].isNull() && d->file_isValid; d->file_system_info_isValid = ::OpenAPI::fromJsonValue(d->file_system_info, json[QString("fileSystemInfo")]); d->file_system_info_isSet = !json[QString("fileSystemInfo")].isNull() && d->file_system_info_isValid; d->folder_isValid = ::OpenAPI::fromJsonValue(d->folder, json[QString("folder")]); d->folder_isSet = !json[QString("folder")].isNull() && d->folder_isValid; d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->image_isValid = ::OpenAPI::fromJsonValue(d->image, json[QString("image")]); d->image_isSet = !json[QString("image")].isNull() && d->image_isValid; d->last_modified_by_isValid = ::OpenAPI::fromJsonValue(d->last_modified_by, json[QString("lastModifiedBy")]); d->last_modified_by_isSet = !json[QString("lastModifiedBy")].isNull() && d->last_modified_by_isValid; d->last_modified_date_time_isValid = ::OpenAPI::fromJsonValue(d->last_modified_date_time, json[QString("lastModifiedDateTime")]); d->last_modified_date_time_isSet = !json[QString("lastModifiedDateTime")].isNull() && d->last_modified_date_time_isValid; d->name_isValid = ::OpenAPI::fromJsonValue(d->name, json[QString("name")]); d->name_isSet = !json[QString("name")].isNull() && d->name_isValid; d->e_tag_isValid = ::OpenAPI::fromJsonValue(d->e_tag, json[QString("eTag")]); d->e_tag_isSet = !json[QString("eTag")].isNull() && d->e_tag_isValid; d->c_tag_isValid = ::OpenAPI::fromJsonValue(d->c_tag, json[QString("cTag")]); d->c_tag_isSet = !json[QString("cTag")].isNull() && d->c_tag_isValid; d->parent_reference_isValid = ::OpenAPI::fromJsonValue(d->parent_reference, json[QString("parentReference")]); d->parent_reference_isSet = !json[QString("parentReference")].isNull() && d->parent_reference_isValid; d->shared_isValid = ::OpenAPI::fromJsonValue(d->shared, json[QString("shared")]); d->shared_isSet = !json[QString("shared")].isNull() && d->shared_isValid; d->size_isValid = ::OpenAPI::fromJsonValue(d->size, json[QString("size")]); d->size_isSet = !json[QString("size")].isNull() && d->size_isValid; d->special_folder_isValid = ::OpenAPI::fromJsonValue(d->special_folder, json[QString("specialFolder")]); d->special_folder_isSet = !json[QString("specialFolder")].isNull() && d->special_folder_isValid; d->web_dav_url_isValid = ::OpenAPI::fromJsonValue(d->web_dav_url, json[QString("webDavUrl")]); d->web_dav_url_isSet = !json[QString("webDavUrl")].isNull() && d->web_dav_url_isValid; d->web_url_isValid = ::OpenAPI::fromJsonValue(d->web_url, json[QString("webUrl")]); d->web_url_isSet = !json[QString("webUrl")].isNull() && d->web_url_isValid; } QString OAIRemoteItem::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIRemoteItem::asJsonObject() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } QJsonObject obj; if (d->created_by.isSet()) { obj.insert(QString("createdBy"), ::OpenAPI::toJsonValue(d->created_by)); } if (d->created_date_time_isSet) { obj.insert(QString("createdDateTime"), ::OpenAPI::toJsonValue(d->created_date_time)); } if (d->file.isSet()) { obj.insert(QString("file"), ::OpenAPI::toJsonValue(d->file)); } if (d->file_system_info.isSet()) { obj.insert(QString("fileSystemInfo"), ::OpenAPI::toJsonValue(d->file_system_info)); } if (d->folder.isSet()) { obj.insert(QString("folder"), ::OpenAPI::toJsonValue(d->folder)); } if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->image.isSet()) { obj.insert(QString("image"), ::OpenAPI::toJsonValue(d->image)); } if (d->last_modified_by.isSet()) { obj.insert(QString("lastModifiedBy"), ::OpenAPI::toJsonValue(d->last_modified_by)); } if (d->last_modified_date_time_isSet) { obj.insert(QString("lastModifiedDateTime"), ::OpenAPI::toJsonValue(d->last_modified_date_time)); } if (d->name_isSet) { obj.insert(QString("name"), ::OpenAPI::toJsonValue(d->name)); } if (d->e_tag_isSet) { obj.insert(QString("eTag"), ::OpenAPI::toJsonValue(d->e_tag)); } if (d->c_tag_isSet) { obj.insert(QString("cTag"), ::OpenAPI::toJsonValue(d->c_tag)); } if (d->parent_reference.isSet()) { obj.insert(QString("parentReference"), ::OpenAPI::toJsonValue(d->parent_reference)); } if (d->shared.isSet()) { obj.insert(QString("shared"), ::OpenAPI::toJsonValue(d->shared)); } if (d->size_isSet) { obj.insert(QString("size"), ::OpenAPI::toJsonValue(d->size)); } if (d->special_folder.isSet()) { obj.insert(QString("specialFolder"), ::OpenAPI::toJsonValue(d->special_folder)); } if (d->web_dav_url_isSet) { obj.insert(QString("webDavUrl"), ::OpenAPI::toJsonValue(d->web_dav_url)); } if (d->web_url_isSet) { obj.insert(QString("webUrl"), ::OpenAPI::toJsonValue(d->web_url)); } return obj; } OAIIdentitySet OAIRemoteItem::getCreatedBy() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->created_by; } void OAIRemoteItem::setCreatedBy(const OAIIdentitySet &created_by) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->created_by = created_by; d->created_by_isSet = true; } bool OAIRemoteItem::is_created_by_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->created_by_isSet; } bool OAIRemoteItem::is_created_by_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->created_by_isValid; } QDateTime OAIRemoteItem::getCreatedDateTime() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->created_date_time; } void OAIRemoteItem::setCreatedDateTime(const QDateTime &created_date_time) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->created_date_time = created_date_time; d->created_date_time_isSet = true; } bool OAIRemoteItem::is_created_date_time_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->created_date_time_isSet; } bool OAIRemoteItem::is_created_date_time_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->created_date_time_isValid; } OAIOpenGraphFile OAIRemoteItem::getFile() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->file; } void OAIRemoteItem::setFile(const OAIOpenGraphFile &file) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->file = file; d->file_isSet = true; } bool OAIRemoteItem::is_file_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->file_isSet; } bool OAIRemoteItem::is_file_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->file_isValid; } OAIFileSystemInfo OAIRemoteItem::getFileSystemInfo() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->file_system_info; } void OAIRemoteItem::setFileSystemInfo(const OAIFileSystemInfo &file_system_info) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->file_system_info = file_system_info; d->file_system_info_isSet = true; } bool OAIRemoteItem::is_file_system_info_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->file_system_info_isSet; } bool OAIRemoteItem::is_file_system_info_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->file_system_info_isValid; } OAIFolder OAIRemoteItem::getFolder() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->folder; } void OAIRemoteItem::setFolder(const OAIFolder &folder) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->folder = folder; d->folder_isSet = true; } bool OAIRemoteItem::is_folder_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->folder_isSet; } bool OAIRemoteItem::is_folder_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->folder_isValid; } QString OAIRemoteItem::getId() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->id; } void OAIRemoteItem::setId(const QString &id) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIRemoteItem::is_id_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->id_isSet; } bool OAIRemoteItem::is_id_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->id_isValid; } OAIImage OAIRemoteItem::getImage() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->image; } void OAIRemoteItem::setImage(const OAIImage &image) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->image = image; d->image_isSet = true; } bool OAIRemoteItem::is_image_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->image_isSet; } bool OAIRemoteItem::is_image_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->image_isValid; } OAIIdentitySet OAIRemoteItem::getLastModifiedBy() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->last_modified_by; } void OAIRemoteItem::setLastModifiedBy(const OAIIdentitySet &last_modified_by) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->last_modified_by = last_modified_by; d->last_modified_by_isSet = true; } bool OAIRemoteItem::is_last_modified_by_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->last_modified_by_isSet; } bool OAIRemoteItem::is_last_modified_by_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->last_modified_by_isValid; } QDateTime OAIRemoteItem::getLastModifiedDateTime() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->last_modified_date_time; } void OAIRemoteItem::setLastModifiedDateTime(const QDateTime &last_modified_date_time) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->last_modified_date_time = last_modified_date_time; d->last_modified_date_time_isSet = true; } bool OAIRemoteItem::is_last_modified_date_time_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->last_modified_date_time_isSet; } bool OAIRemoteItem::is_last_modified_date_time_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->last_modified_date_time_isValid; } QString OAIRemoteItem::getName() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->name; } void OAIRemoteItem::setName(const QString &name) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->name = name; d->name_isSet = true; } bool OAIRemoteItem::is_name_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->name_isSet; } bool OAIRemoteItem::is_name_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->name_isValid; } QString OAIRemoteItem::getETag() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->e_tag; } void OAIRemoteItem::setETag(const QString &e_tag) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->e_tag = e_tag; d->e_tag_isSet = true; } bool OAIRemoteItem::is_e_tag_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->e_tag_isSet; } bool OAIRemoteItem::is_e_tag_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->e_tag_isValid; } QString OAIRemoteItem::getCTag() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->c_tag; } void OAIRemoteItem::setCTag(const QString &c_tag) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->c_tag = c_tag; d->c_tag_isSet = true; } bool OAIRemoteItem::is_c_tag_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->c_tag_isSet; } bool OAIRemoteItem::is_c_tag_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->c_tag_isValid; } OAIItemReference OAIRemoteItem::getParentReference() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->parent_reference; } void OAIRemoteItem::setParentReference(const OAIItemReference &parent_reference) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->parent_reference = parent_reference; d->parent_reference_isSet = true; } bool OAIRemoteItem::is_parent_reference_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->parent_reference_isSet; } bool OAIRemoteItem::is_parent_reference_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->parent_reference_isValid; } OAIShared OAIRemoteItem::getShared() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->shared; } void OAIRemoteItem::setShared(const OAIShared &shared) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->shared = shared; d->shared_isSet = true; } bool OAIRemoteItem::is_shared_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->shared_isSet; } bool OAIRemoteItem::is_shared_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->shared_isValid; } qint64 OAIRemoteItem::getSize() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->size; } void OAIRemoteItem::setSize(const qint64 &size) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->size = size; d->size_isSet = true; } bool OAIRemoteItem::is_size_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->size_isSet; } bool OAIRemoteItem::is_size_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->size_isValid; } OAISpecialFolder OAIRemoteItem::getSpecialFolder() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->special_folder; } void OAIRemoteItem::setSpecialFolder(const OAISpecialFolder &special_folder) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->special_folder = special_folder; d->special_folder_isSet = true; } bool OAIRemoteItem::is_special_folder_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->special_folder_isSet; } bool OAIRemoteItem::is_special_folder_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->special_folder_isValid; } QString OAIRemoteItem::getWebDavUrl() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->web_dav_url; } void OAIRemoteItem::setWebDavUrl(const QString &web_dav_url) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->web_dav_url = web_dav_url; d->web_dav_url_isSet = true; } bool OAIRemoteItem::is_web_dav_url_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->web_dav_url_isSet; } bool OAIRemoteItem::is_web_dav_url_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->web_dav_url_isValid; } QString OAIRemoteItem::getWebUrl() const { Q_D(const OAIRemoteItem); if(!d){ return {}; } return d->web_url; } void OAIRemoteItem::setWebUrl(const QString &web_url) { Q_D(OAIRemoteItem); Q_ASSERT(d); d->web_url = web_url; d->web_url_isSet = true; } bool OAIRemoteItem::is_web_url_Set() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->web_url_isSet; } bool OAIRemoteItem::is_web_url_Valid() const{ Q_D(const OAIRemoteItem); if(!d){ return false; } return d->web_url_isValid; } bool OAIRemoteItem::isSet() const { Q_D(const OAIRemoteItem); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->created_by.isSet()) { isObjectUpdated = true; break; } if (d->created_date_time_isSet) { isObjectUpdated = true; break; } if (d->file.isSet()) { isObjectUpdated = true; break; } if (d->file_system_info.isSet()) { isObjectUpdated = true; break; } if (d->folder.isSet()) { isObjectUpdated = true; break; } if (d->id_isSet) { isObjectUpdated = true; break; } if (d->image.isSet()) { isObjectUpdated = true; break; } if (d->last_modified_by.isSet()) { isObjectUpdated = true; break; } if (d->last_modified_date_time_isSet) { isObjectUpdated = true; break; } if (d->name_isSet) { isObjectUpdated = true; break; } if (d->e_tag_isSet) { isObjectUpdated = true; break; } if (d->c_tag_isSet) { isObjectUpdated = true; break; } if (d->parent_reference.isSet()) { isObjectUpdated = true; break; } if (d->shared.isSet()) { isObjectUpdated = true; break; } if (d->size_isSet) { isObjectUpdated = true; break; } if (d->special_folder.isSet()) { isObjectUpdated = true; break; } if (d->web_dav_url_isSet) { isObjectUpdated = true; break; } if (d->web_url_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIRemoteItem::isValid() const { Q_D(const OAIRemoteItem); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIRemoteItem.h000066400000000000000000000111521442421066000231660ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIRemoteItem.h * * Remote item data, if the item is shared from a drive other than the one being accessed. Read-only. */ #ifndef OAIRemoteItem_H #define OAIRemoteItem_H #include #include "OAIFileSystemInfo.h" #include "OAIFolder.h" #include "OAIIdentitySet.h" #include "OAIImage.h" #include "OAIItemReference.h" #include "OAIOpenGraphFile.h" #include "OAIShared.h" #include "OAISpecialFolder.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentitySet; class OAIOpenGraphFile; class OAIFileSystemInfo; class OAIFolder; class OAIImage; class OAIItemReference; class OAIShared; class OAISpecialFolder; class OAIRemoteItemPrivate; class OAIRemoteItem : public OAIObject { public: OAIRemoteItem(); OAIRemoteItem(const OAIRemoteItem &other); OAIRemoteItem(QString json); ~OAIRemoteItem() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; OAIIdentitySet getCreatedBy() const; void setCreatedBy(const OAIIdentitySet &created_by); bool is_created_by_Set() const; bool is_created_by_Valid() const; QDateTime getCreatedDateTime() const; void setCreatedDateTime(const QDateTime &created_date_time); bool is_created_date_time_Set() const; bool is_created_date_time_Valid() const; OAIOpenGraphFile getFile() const; void setFile(const OAIOpenGraphFile &file); bool is_file_Set() const; bool is_file_Valid() const; OAIFileSystemInfo getFileSystemInfo() const; void setFileSystemInfo(const OAIFileSystemInfo &file_system_info); bool is_file_system_info_Set() const; bool is_file_system_info_Valid() const; OAIFolder getFolder() const; void setFolder(const OAIFolder &folder); bool is_folder_Set() const; bool is_folder_Valid() const; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; OAIImage getImage() const; void setImage(const OAIImage &image); bool is_image_Set() const; bool is_image_Valid() const; OAIIdentitySet getLastModifiedBy() const; void setLastModifiedBy(const OAIIdentitySet &last_modified_by); bool is_last_modified_by_Set() const; bool is_last_modified_by_Valid() const; QDateTime getLastModifiedDateTime() const; void setLastModifiedDateTime(const QDateTime &last_modified_date_time); bool is_last_modified_date_time_Set() const; bool is_last_modified_date_time_Valid() const; QString getName() const; void setName(const QString &name); bool is_name_Set() const; bool is_name_Valid() const; QString getETag() const; void setETag(const QString &e_tag); bool is_e_tag_Set() const; bool is_e_tag_Valid() const; QString getCTag() const; void setCTag(const QString &c_tag); bool is_c_tag_Set() const; bool is_c_tag_Valid() const; OAIItemReference getParentReference() const; void setParentReference(const OAIItemReference &parent_reference); bool is_parent_reference_Set() const; bool is_parent_reference_Valid() const; OAIShared getShared() const; void setShared(const OAIShared &shared); bool is_shared_Set() const; bool is_shared_Valid() const; qint64 getSize() const; void setSize(const qint64 &size); bool is_size_Set() const; bool is_size_Valid() const; OAISpecialFolder getSpecialFolder() const; void setSpecialFolder(const OAISpecialFolder &special_folder); bool is_special_folder_Set() const; bool is_special_folder_Valid() const; QString getWebDavUrl() const; void setWebDavUrl(const QString &web_dav_url); bool is_web_dav_url_Set() const; bool is_web_dav_url_Valid() const; QString getWebUrl() const; void setWebUrl(const QString &web_url); bool is_web_url_Set() const; bool is_web_url_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIRemoteItem) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIRemoteItem) #endif // OAIRemoteItem_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIServerConfiguration.h000066400000000000000000000050221442421066000251110ustar00rootroot00000000000000// ServerConfiguration.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Representing a Server configuration. */ #ifndef OAI_SERVERVCONFIGURATION_H #define OAI_SERVERVCONFIGURATION_H #include #include #include #include #include #include "OAIServerVariable.h" namespace OpenAPI { class OAIServerConfiguration { public: /** * @param url A URL to the target host. * @param description A description of the host designated by the URL. * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ OAIServerConfiguration(const QUrl &url, const QString &description, const QMap &variables) : _description(description), _variables(variables), _url(url){} OAIServerConfiguration(){} ~OAIServerConfiguration(){} /** * Format URL template using given variables. * * @param variables A map between a variable name and its value. * @return Formatted URL. */ QString URL() { QString url = _url.toString(); if(!_variables.empty()){ // go through variables and replace placeholders for (auto const& v : _variables.keys()) { QString name = v; OAIServerVariable serverVariable = _variables.value(v); QString value = serverVariable._defaultValue; if (!serverVariable._enumValues.empty() && !serverVariable._enumValues.contains(value)) { qFatal("The variable %s in the server URL has invalid value %s.", qPrintable(name), qPrintable(value)); } QRegularExpression regex(QString("\\{" + name + "\\}")); url = url.replace(regex, value); } return url; } return url; } int setDefaultValue(const QString &variable,const QString &value){ if(_variables.contains(variable)) return _variables[variable].setDefaultValue(value); return -1; } QString _description; QMap _variables; QUrl _url; }; } // namespace OpenAPI #endif // OAI_SERVERVCONFIGURATION_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIServerVariable.h000066400000000000000000000030411442421066000240260ustar00rootroot00000000000000// ServerVariable.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Representing a Server Variable for server URL template substitution. */ #ifndef OAI_SERVERVARIABLE_H #define OAI_SERVERVARIABLE_H #include #include namespace OpenAPI { class OAIServerVariable { public: /** * @param description A description for the server variable. * @param defaultValue The default value to use for substitution. * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. */ OAIServerVariable(const QString &description, const QString &defaultValue, const QSet &enumValues) : _defaultValue(defaultValue), _description(description), _enumValues(enumValues){} OAIServerVariable(){} ~OAIServerVariable(){} int setDefaultValue(const QString& value){ if( _enumValues.contains(value)){ _defaultValue = value; return 0; } return -2; } QString getDefaultValue(){return _defaultValue;} QSet getEnumValues(){return _enumValues;} QString _defaultValue; QString _description; QSet _enumValues; }; } // namespace OpenAPI #endif // OAI_SERVERVARIABLE_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIShared.cpp000066400000000000000000000147041442421066000226630ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIShared.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAISharedPrivate { friend class OAIShared; OAIIdentitySet owner; bool owner_isSet; bool owner_isValid; QString scope; bool scope_isSet; bool scope_isValid; OAIIdentitySet shared_by; bool shared_by_isSet; bool shared_by_isValid; QDateTime shared_date_time; bool shared_date_time_isSet; bool shared_date_time_isValid; }; OAIShared::OAIShared() : d_ptr() { } OAIShared::OAIShared(const OAIShared& other) : d_ptr(other.d_ptr) { } OAIShared::OAIShared(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIShared::~OAIShared() = default; void OAIShared::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAISharedPrivate{}); Q_D(OAIShared); d->owner_isSet = false; d->owner_isValid = false; d->scope_isSet = false; d->scope_isValid = false; d->shared_by_isSet = false; d->shared_by_isValid = false; d->shared_date_time_isSet = false; d->shared_date_time_isValid = false; } } void OAIShared::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIShared::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIShared); d->owner_isValid = ::OpenAPI::fromJsonValue(d->owner, json[QString("owner")]); d->owner_isSet = !json[QString("owner")].isNull() && d->owner_isValid; d->scope_isValid = ::OpenAPI::fromJsonValue(d->scope, json[QString("scope")]); d->scope_isSet = !json[QString("scope")].isNull() && d->scope_isValid; d->shared_by_isValid = ::OpenAPI::fromJsonValue(d->shared_by, json[QString("sharedBy")]); d->shared_by_isSet = !json[QString("sharedBy")].isNull() && d->shared_by_isValid; d->shared_date_time_isValid = ::OpenAPI::fromJsonValue(d->shared_date_time, json[QString("sharedDateTime")]); d->shared_date_time_isSet = !json[QString("sharedDateTime")].isNull() && d->shared_date_time_isValid; } QString OAIShared::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIShared::asJsonObject() const { Q_D(const OAIShared); if(!d){ return {}; } QJsonObject obj; if (d->owner.isSet()) { obj.insert(QString("owner"), ::OpenAPI::toJsonValue(d->owner)); } if (d->scope_isSet) { obj.insert(QString("scope"), ::OpenAPI::toJsonValue(d->scope)); } if (d->shared_by.isSet()) { obj.insert(QString("sharedBy"), ::OpenAPI::toJsonValue(d->shared_by)); } if (d->shared_date_time_isSet) { obj.insert(QString("sharedDateTime"), ::OpenAPI::toJsonValue(d->shared_date_time)); } return obj; } OAIIdentitySet OAIShared::getOwner() const { Q_D(const OAIShared); if(!d){ return {}; } return d->owner; } void OAIShared::setOwner(const OAIIdentitySet &owner) { Q_D(OAIShared); Q_ASSERT(d); d->owner = owner; d->owner_isSet = true; } bool OAIShared::is_owner_Set() const{ Q_D(const OAIShared); if(!d){ return false; } return d->owner_isSet; } bool OAIShared::is_owner_Valid() const{ Q_D(const OAIShared); if(!d){ return false; } return d->owner_isValid; } QString OAIShared::getScope() const { Q_D(const OAIShared); if(!d){ return {}; } return d->scope; } void OAIShared::setScope(const QString &scope) { Q_D(OAIShared); Q_ASSERT(d); d->scope = scope; d->scope_isSet = true; } bool OAIShared::is_scope_Set() const{ Q_D(const OAIShared); if(!d){ return false; } return d->scope_isSet; } bool OAIShared::is_scope_Valid() const{ Q_D(const OAIShared); if(!d){ return false; } return d->scope_isValid; } OAIIdentitySet OAIShared::getSharedBy() const { Q_D(const OAIShared); if(!d){ return {}; } return d->shared_by; } void OAIShared::setSharedBy(const OAIIdentitySet &shared_by) { Q_D(OAIShared); Q_ASSERT(d); d->shared_by = shared_by; d->shared_by_isSet = true; } bool OAIShared::is_shared_by_Set() const{ Q_D(const OAIShared); if(!d){ return false; } return d->shared_by_isSet; } bool OAIShared::is_shared_by_Valid() const{ Q_D(const OAIShared); if(!d){ return false; } return d->shared_by_isValid; } QDateTime OAIShared::getSharedDateTime() const { Q_D(const OAIShared); if(!d){ return {}; } return d->shared_date_time; } void OAIShared::setSharedDateTime(const QDateTime &shared_date_time) { Q_D(OAIShared); Q_ASSERT(d); d->shared_date_time = shared_date_time; d->shared_date_time_isSet = true; } bool OAIShared::is_shared_date_time_Set() const{ Q_D(const OAIShared); if(!d){ return false; } return d->shared_date_time_isSet; } bool OAIShared::is_shared_date_time_Valid() const{ Q_D(const OAIShared); if(!d){ return false; } return d->shared_date_time_isValid; } bool OAIShared::isSet() const { Q_D(const OAIShared); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->owner.isSet()) { isObjectUpdated = true; break; } if (d->scope_isSet) { isObjectUpdated = true; break; } if (d->shared_by.isSet()) { isObjectUpdated = true; break; } if (d->shared_date_time_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIShared::isValid() const { Q_D(const OAIShared); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIShared.h000066400000000000000000000036141442421066000223260ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIShared.h * * */ #ifndef OAIShared_H #define OAIShared_H #include #include "OAIIdentitySet.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentitySet; class OAISharedPrivate; class OAIShared : public OAIObject { public: OAIShared(); OAIShared(const OAIShared &other); OAIShared(QString json); ~OAIShared() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; OAIIdentitySet getOwner() const; void setOwner(const OAIIdentitySet &owner); bool is_owner_Set() const; bool is_owner_Valid() const; QString getScope() const; void setScope(const QString &scope); bool is_scope_Set() const; bool is_scope_Valid() const; OAIIdentitySet getSharedBy() const; void setSharedBy(const OAIIdentitySet &shared_by); bool is_shared_by_Set() const; bool is_shared_by_Valid() const; QDateTime getSharedDateTime() const; void setSharedDateTime(const QDateTime &shared_date_time); bool is_shared_date_time_Set() const; bool is_shared_date_time_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIShared) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIShared) #endif // OAIShared_H libre-graph-api-cpp-qt-client-1.0.4/client/OAISpecialFolder.cpp000066400000000000000000000063151442421066000241700ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAISpecialFolder.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAISpecialFolderPrivate { friend class OAISpecialFolder; QString name; bool name_isSet; bool name_isValid; }; OAISpecialFolder::OAISpecialFolder() : d_ptr() { } OAISpecialFolder::OAISpecialFolder(const OAISpecialFolder& other) : d_ptr(other.d_ptr) { } OAISpecialFolder::OAISpecialFolder(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAISpecialFolder::~OAISpecialFolder() = default; void OAISpecialFolder::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAISpecialFolderPrivate{}); Q_D(OAISpecialFolder); d->name_isSet = false; d->name_isValid = false; } } void OAISpecialFolder::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAISpecialFolder::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAISpecialFolder); d->name_isValid = ::OpenAPI::fromJsonValue(d->name, json[QString("name")]); d->name_isSet = !json[QString("name")].isNull() && d->name_isValid; } QString OAISpecialFolder::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAISpecialFolder::asJsonObject() const { Q_D(const OAISpecialFolder); if(!d){ return {}; } QJsonObject obj; if (d->name_isSet) { obj.insert(QString("name"), ::OpenAPI::toJsonValue(d->name)); } return obj; } QString OAISpecialFolder::getName() const { Q_D(const OAISpecialFolder); if(!d){ return {}; } return d->name; } void OAISpecialFolder::setName(const QString &name) { Q_D(OAISpecialFolder); Q_ASSERT(d); d->name = name; d->name_isSet = true; } bool OAISpecialFolder::is_name_Set() const{ Q_D(const OAISpecialFolder); if(!d){ return false; } return d->name_isSet; } bool OAISpecialFolder::is_name_Valid() const{ Q_D(const OAISpecialFolder); if(!d){ return false; } return d->name_isValid; } bool OAISpecialFolder::isSet() const { Q_D(const OAISpecialFolder); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->name_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAISpecialFolder::isValid() const { Q_D(const OAISpecialFolder); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAISpecialFolder.h000066400000000000000000000030011442421066000236220ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAISpecialFolder.h * * If the current item is also available as a special folder, this facet is returned. Read-only */ #ifndef OAISpecialFolder_H #define OAISpecialFolder_H #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAISpecialFolderPrivate; class OAISpecialFolder : public OAIObject { public: OAISpecialFolder(); OAISpecialFolder(const OAISpecialFolder &other); OAISpecialFolder(QString json); ~OAISpecialFolder() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getName() const; void setName(const QString &name); bool is_name_Set() const; bool is_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAISpecialFolder) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAISpecialFolder) #endif // OAISpecialFolder_H libre-graph-api-cpp-qt-client-1.0.4/client/OAITagAssignment.cpp000066400000000000000000000107571442421066000242250ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAITagAssignment.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAITagAssignmentPrivate { friend class OAITagAssignment; QString resource_id; bool resource_id_isSet; bool resource_id_isValid; QList tags; bool tags_isSet; bool tags_isValid; }; OAITagAssignment::OAITagAssignment() : d_ptr() { } OAITagAssignment::OAITagAssignment(const OAITagAssignment& other) : d_ptr(other.d_ptr) { } OAITagAssignment::OAITagAssignment(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAITagAssignment::~OAITagAssignment() = default; void OAITagAssignment::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAITagAssignmentPrivate{}); Q_D(OAITagAssignment); d->resource_id_isSet = false; d->resource_id_isValid = false; d->tags_isSet = false; d->tags_isValid = false; } } void OAITagAssignment::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAITagAssignment::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAITagAssignment); d->resource_id_isValid = ::OpenAPI::fromJsonValue(d->resource_id, json[QString("resourceId")]); d->resource_id_isSet = !json[QString("resourceId")].isNull() && d->resource_id_isValid; d->tags_isValid = ::OpenAPI::fromJsonValue(d->tags, json[QString("tags")]); d->tags_isSet = !json[QString("tags")].isNull() && d->tags_isValid; } QString OAITagAssignment::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAITagAssignment::asJsonObject() const { Q_D(const OAITagAssignment); if(!d){ return {}; } QJsonObject obj; if (d->resource_id_isSet) { obj.insert(QString("resourceId"), ::OpenAPI::toJsonValue(d->resource_id)); } if (d->tags.size() > 0) { obj.insert(QString("tags"), ::OpenAPI::toJsonValue(d->tags)); } return obj; } QString OAITagAssignment::getResourceId() const { Q_D(const OAITagAssignment); if(!d){ return {}; } return d->resource_id; } void OAITagAssignment::setResourceId(const QString &resource_id) { Q_D(OAITagAssignment); Q_ASSERT(d); d->resource_id = resource_id; d->resource_id_isSet = true; } bool OAITagAssignment::is_resource_id_Set() const{ Q_D(const OAITagAssignment); if(!d){ return false; } return d->resource_id_isSet; } bool OAITagAssignment::is_resource_id_Valid() const{ Q_D(const OAITagAssignment); if(!d){ return false; } return d->resource_id_isValid; } QList OAITagAssignment::getTags() const { Q_D(const OAITagAssignment); if(!d){ return {}; } return d->tags; } void OAITagAssignment::setTags(const QList &tags) { Q_D(OAITagAssignment); Q_ASSERT(d); d->tags = tags; d->tags_isSet = true; } bool OAITagAssignment::is_tags_Set() const{ Q_D(const OAITagAssignment); if(!d){ return false; } return d->tags_isSet; } bool OAITagAssignment::is_tags_Valid() const{ Q_D(const OAITagAssignment); if(!d){ return false; } return d->tags_isValid; } bool OAITagAssignment::isSet() const { Q_D(const OAITagAssignment); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->resource_id_isSet) { isObjectUpdated = true; break; } if (d->tags.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAITagAssignment::isValid() const { Q_D(const OAITagAssignment); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->resource_id_isValid && d->tags_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAITagAssignment.h000066400000000000000000000031501442421066000236570ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAITagAssignment.h * * */ #ifndef OAITagAssignment_H #define OAITagAssignment_H #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAITagAssignmentPrivate; class OAITagAssignment : public OAIObject { public: OAITagAssignment(); OAITagAssignment(const OAITagAssignment &other); OAITagAssignment(QString json); ~OAITagAssignment() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getResourceId() const; void setResourceId(const QString &resource_id); bool is_resource_id_Set() const; bool is_resource_id_Valid() const; QList getTags() const; void setTags(const QList &tags); bool is_tags_Set() const; bool is_tags_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAITagAssignment) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAITagAssignment) #endif // OAITagAssignment_H libre-graph-api-cpp-qt-client-1.0.4/client/OAITagUnassignment.cpp000066400000000000000000000111011442421066000245500ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAITagUnassignment.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAITagUnassignmentPrivate { friend class OAITagUnassignment; QString resource_id; bool resource_id_isSet; bool resource_id_isValid; QList tags; bool tags_isSet; bool tags_isValid; }; OAITagUnassignment::OAITagUnassignment() : d_ptr() { } OAITagUnassignment::OAITagUnassignment(const OAITagUnassignment& other) : d_ptr(other.d_ptr) { } OAITagUnassignment::OAITagUnassignment(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAITagUnassignment::~OAITagUnassignment() = default; void OAITagUnassignment::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAITagUnassignmentPrivate{}); Q_D(OAITagUnassignment); d->resource_id_isSet = false; d->resource_id_isValid = false; d->tags_isSet = false; d->tags_isValid = false; } } void OAITagUnassignment::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAITagUnassignment::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAITagUnassignment); d->resource_id_isValid = ::OpenAPI::fromJsonValue(d->resource_id, json[QString("resourceId")]); d->resource_id_isSet = !json[QString("resourceId")].isNull() && d->resource_id_isValid; d->tags_isValid = ::OpenAPI::fromJsonValue(d->tags, json[QString("tags")]); d->tags_isSet = !json[QString("tags")].isNull() && d->tags_isValid; } QString OAITagUnassignment::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAITagUnassignment::asJsonObject() const { Q_D(const OAITagUnassignment); if(!d){ return {}; } QJsonObject obj; if (d->resource_id_isSet) { obj.insert(QString("resourceId"), ::OpenAPI::toJsonValue(d->resource_id)); } if (d->tags.size() > 0) { obj.insert(QString("tags"), ::OpenAPI::toJsonValue(d->tags)); } return obj; } QString OAITagUnassignment::getResourceId() const { Q_D(const OAITagUnassignment); if(!d){ return {}; } return d->resource_id; } void OAITagUnassignment::setResourceId(const QString &resource_id) { Q_D(OAITagUnassignment); Q_ASSERT(d); d->resource_id = resource_id; d->resource_id_isSet = true; } bool OAITagUnassignment::is_resource_id_Set() const{ Q_D(const OAITagUnassignment); if(!d){ return false; } return d->resource_id_isSet; } bool OAITagUnassignment::is_resource_id_Valid() const{ Q_D(const OAITagUnassignment); if(!d){ return false; } return d->resource_id_isValid; } QList OAITagUnassignment::getTags() const { Q_D(const OAITagUnassignment); if(!d){ return {}; } return d->tags; } void OAITagUnassignment::setTags(const QList &tags) { Q_D(OAITagUnassignment); Q_ASSERT(d); d->tags = tags; d->tags_isSet = true; } bool OAITagUnassignment::is_tags_Set() const{ Q_D(const OAITagUnassignment); if(!d){ return false; } return d->tags_isSet; } bool OAITagUnassignment::is_tags_Valid() const{ Q_D(const OAITagUnassignment); if(!d){ return false; } return d->tags_isValid; } bool OAITagUnassignment::isSet() const { Q_D(const OAITagUnassignment); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->resource_id_isSet) { isObjectUpdated = true; break; } if (d->tags.size() > 0) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAITagUnassignment::isValid() const { Q_D(const OAITagUnassignment); if(!d){ return false; } // only required properties are required for the object to be considered valid return d->resource_id_isValid && d->tags_isValid && true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAITagUnassignment.h000066400000000000000000000032041442421066000242220ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAITagUnassignment.h * * */ #ifndef OAITagUnassignment_H #define OAITagUnassignment_H #include #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAITagUnassignmentPrivate; class OAITagUnassignment : public OAIObject { public: OAITagUnassignment(); OAITagUnassignment(const OAITagUnassignment &other); OAITagUnassignment(QString json); ~OAITagUnassignment() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getResourceId() const; void setResourceId(const QString &resource_id); bool is_resource_id_Set() const; bool is_resource_id_Valid() const; QList getTags() const; void setTags(const QList &tags); bool is_tags_Set() const; bool is_tags_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAITagUnassignment) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAITagUnassignment) #endif // OAITagUnassignment_H libre-graph-api-cpp-qt-client-1.0.4/client/OAITagsApi.cpp000066400000000000000000000360571442421066000230120ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAITagsApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAITagsApi::OAITagsApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAITagsApi::~OAITagsApi() { } void OAITagsApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("assignTags", defaultConf); _serverIndices.insert("assignTags", 0); _serverConfigs.insert("getTags", defaultConf); _serverIndices.insert("getTags", 0); _serverConfigs.insert("unassignTags", defaultConf); _serverIndices.insert("unassignTags", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAITagsApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAITagsApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAITagsApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAITagsApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAITagsApi::setUsername(const QString &username) { _username = username; } void OAITagsApi::setPassword(const QString &password) { _password = password; } void OAITagsApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAITagsApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAITagsApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAITagsApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAITagsApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAITagsApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAITagsApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAITagsApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAITagsApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAITagsApi::abortRequests() { emit abortRequestsSignal(); } QString OAITagsApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAITagsApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAITagsApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAITagsApi::assignTags(const ::OpenAPI::OptionalParam &oai_tag_assignment) { QString fullPath = QString(_serverConfigs["assignTags"][_serverIndices.value("assignTags")].URL()+"/extensions/org.libregraph/tags"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PUT"); if (oai_tag_assignment.hasValue()){ QByteArray output = oai_tag_assignment.value().asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAITagsApi::assignTagsCallback); connect(this, &OAITagsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAITagsApi::assignTagsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit assignTagsSignal(); emit assignTagsSignalFull(worker); } else { emit assignTagsSignalE(error_type, error_str); emit assignTagsSignalEFull(worker, error_type, error_str); } } void OAITagsApi::getTags() { QString fullPath = QString(_serverConfigs["getTags"][_serverIndices.value("getTags")].URL()+"/extensions/org.libregraph/tags"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAITagsApi::getTagsCallback); connect(this, &OAITagsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAITagsApi::getTagsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_tags output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getTagsSignal(output); emit getTagsSignalFull(worker, output); } else { emit getTagsSignalE(output, error_type, error_str); emit getTagsSignalEFull(worker, error_type, error_str); } } void OAITagsApi::unassignTags(const ::OpenAPI::OptionalParam &oai_tag_unassignment) { QString fullPath = QString(_serverConfigs["unassignTags"][_serverIndices.value("unassignTags")].URL()+"/extensions/org.libregraph/tags"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); if (oai_tag_unassignment.hasValue()){ QByteArray output = oai_tag_unassignment.value().asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAITagsApi::unassignTagsCallback); connect(this, &OAITagsApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAITagsApi::unassignTagsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit unassignTagsSignal(); emit unassignTagsSignalFull(worker); } else { emit unassignTagsSignalE(error_type, error_str); emit unassignTagsSignalEFull(worker, error_type, error_str); } } void OAITagsApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAITagsApi.h000066400000000000000000000115241442421066000224470ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAITagsApi_H #define OAI_OAITagsApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_tags.h" #include "OAIOdata_error.h" #include "OAITagAssignment.h" #include "OAITagUnassignment.h" #include #include #include #include #include #include namespace OpenAPI { class OAITagsApi : public QObject { Q_OBJECT public: OAITagsApi(const int timeOut = 0); ~OAITagsApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] oai_tag_assignment OAITagAssignment [optional] */ void assignTags(const ::OpenAPI::OptionalParam &oai_tag_assignment = ::OpenAPI::OptionalParam()); void getTags(); /** * @param[in] oai_tag_unassignment OAITagUnassignment [optional] */ void unassignTags(const ::OpenAPI::OptionalParam &oai_tag_unassignment = ::OpenAPI::OptionalParam()); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void assignTagsCallback(OAIHttpRequestWorker *worker); void getTagsCallback(OAIHttpRequestWorker *worker); void unassignTagsCallback(OAIHttpRequestWorker *worker); signals: void assignTagsSignal(); void getTagsSignal(OAICollection_of_tags summary); void unassignTagsSignal(); void assignTagsSignalFull(OAIHttpRequestWorker *worker); void getTagsSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_tags summary); void unassignTagsSignalFull(OAIHttpRequestWorker *worker); void assignTagsSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getTagsSignalE(OAICollection_of_tags summary, QNetworkReply::NetworkError error_type, QString error_str); void unassignTagsSignalE(QNetworkReply::NetworkError error_type, QString error_str); void assignTagsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getTagsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void unassignTagsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAITrash.cpp000066400000000000000000000106501442421066000225320ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAITrash.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAITrashPrivate { friend class OAITrash; OAIIdentitySet trashed_by; bool trashed_by_isSet; bool trashed_by_isValid; QDateTime trashed_date_time; bool trashed_date_time_isSet; bool trashed_date_time_isValid; }; OAITrash::OAITrash() : d_ptr() { } OAITrash::OAITrash(const OAITrash& other) : d_ptr(other.d_ptr) { } OAITrash::OAITrash(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAITrash::~OAITrash() = default; void OAITrash::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAITrashPrivate{}); Q_D(OAITrash); d->trashed_by_isSet = false; d->trashed_by_isValid = false; d->trashed_date_time_isSet = false; d->trashed_date_time_isValid = false; } } void OAITrash::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAITrash::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAITrash); d->trashed_by_isValid = ::OpenAPI::fromJsonValue(d->trashed_by, json[QString("trashedBy")]); d->trashed_by_isSet = !json[QString("trashedBy")].isNull() && d->trashed_by_isValid; d->trashed_date_time_isValid = ::OpenAPI::fromJsonValue(d->trashed_date_time, json[QString("trashedDateTime")]); d->trashed_date_time_isSet = !json[QString("trashedDateTime")].isNull() && d->trashed_date_time_isValid; } QString OAITrash::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAITrash::asJsonObject() const { Q_D(const OAITrash); if(!d){ return {}; } QJsonObject obj; if (d->trashed_by.isSet()) { obj.insert(QString("trashedBy"), ::OpenAPI::toJsonValue(d->trashed_by)); } if (d->trashed_date_time_isSet) { obj.insert(QString("trashedDateTime"), ::OpenAPI::toJsonValue(d->trashed_date_time)); } return obj; } OAIIdentitySet OAITrash::getTrashedBy() const { Q_D(const OAITrash); if(!d){ return {}; } return d->trashed_by; } void OAITrash::setTrashedBy(const OAIIdentitySet &trashed_by) { Q_D(OAITrash); Q_ASSERT(d); d->trashed_by = trashed_by; d->trashed_by_isSet = true; } bool OAITrash::is_trashed_by_Set() const{ Q_D(const OAITrash); if(!d){ return false; } return d->trashed_by_isSet; } bool OAITrash::is_trashed_by_Valid() const{ Q_D(const OAITrash); if(!d){ return false; } return d->trashed_by_isValid; } QDateTime OAITrash::getTrashedDateTime() const { Q_D(const OAITrash); if(!d){ return {}; } return d->trashed_date_time; } void OAITrash::setTrashedDateTime(const QDateTime &trashed_date_time) { Q_D(OAITrash); Q_ASSERT(d); d->trashed_date_time = trashed_date_time; d->trashed_date_time_isSet = true; } bool OAITrash::is_trashed_date_time_Set() const{ Q_D(const OAITrash); if(!d){ return false; } return d->trashed_date_time_isSet; } bool OAITrash::is_trashed_date_time_Valid() const{ Q_D(const OAITrash); if(!d){ return false; } return d->trashed_date_time_isValid; } bool OAITrash::isSet() const { Q_D(const OAITrash); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->trashed_by.isSet()) { isObjectUpdated = true; break; } if (d->trashed_date_time_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAITrash::isValid() const { Q_D(const OAITrash); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAITrash.h000066400000000000000000000031671442421066000222040ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAITrash.h * * Metadata for trashed drive Items */ #ifndef OAITrash_H #define OAITrash_H #include #include "OAIIdentitySet.h" #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIIdentitySet; class OAITrashPrivate; class OAITrash : public OAIObject { public: OAITrash(); OAITrash(const OAITrash &other); OAITrash(QString json); ~OAITrash() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; OAIIdentitySet getTrashedBy() const; void setTrashedBy(const OAIIdentitySet &trashed_by); bool is_trashed_by_Set() const; bool is_trashed_by_Valid() const; QDateTime getTrashedDateTime() const; void setTrashedDateTime(const QDateTime &trashed_date_time); bool is_trashed_date_time_Set() const; bool is_trashed_date_time_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAITrash) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAITrash) #endif // OAITrash_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIUser.cpp000066400000000000000000000441441442421066000223740ustar00rootroot00000000000000// model-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIUser.h" #include #include #include #include #include "OAIHelpers.h" namespace OpenAPI { class OAIUserPrivate { friend class OAIUser; QString id; bool id_isSet; bool id_isValid; bool account_enabled; bool account_enabled_isSet; bool account_enabled_isValid; QList app_role_assignments; bool app_role_assignments_isSet; bool app_role_assignments_isValid; QString display_name; bool display_name_isSet; bool display_name_isValid; QList drives; bool drives_isSet; bool drives_isValid; OAIDrive drive; bool drive_isSet; bool drive_isValid; QList identities; bool identities_isSet; bool identities_isValid; QString mail; bool mail_isSet; bool mail_isValid; QList member_of; bool member_of_isSet; bool member_of_isValid; QString on_premises_sam_account_name; bool on_premises_sam_account_name_isSet; bool on_premises_sam_account_name_isValid; OAIPasswordProfile password_profile; bool password_profile_isSet; bool password_profile_isValid; QString surname; bool surname_isSet; bool surname_isValid; QString given_name; bool given_name_isSet; bool given_name_isValid; QString user_type; bool user_type_isSet; bool user_type_isValid; }; OAIUser::OAIUser() : d_ptr() { } OAIUser::OAIUser(const OAIUser& other) : d_ptr(other.d_ptr) { } OAIUser::OAIUser(QString json) : d_ptr(nullptr) { this->fromJson(json); } OAIUser::~OAIUser() = default; void OAIUser::initializeModel() { if (d_ptr == nullptr) { d_ptr.reset(new OAIUserPrivate{}); Q_D(OAIUser); d->id_isSet = false; d->id_isValid = false; d->account_enabled_isSet = false; d->account_enabled_isValid = false; d->app_role_assignments_isSet = false; d->app_role_assignments_isValid = false; d->display_name_isSet = false; d->display_name_isValid = false; d->drives_isSet = false; d->drives_isValid = false; d->drive_isSet = false; d->drive_isValid = false; d->identities_isSet = false; d->identities_isValid = false; d->mail_isSet = false; d->mail_isValid = false; d->member_of_isSet = false; d->member_of_isValid = false; d->on_premises_sam_account_name_isSet = false; d->on_premises_sam_account_name_isValid = false; d->password_profile_isSet = false; d->password_profile_isValid = false; d->surname_isSet = false; d->surname_isValid = false; d->given_name_isSet = false; d->given_name_isValid = false; d->user_type_isSet = false; d->user_type_isValid = false; } } void OAIUser::fromJson(QString jsonString) { QByteArray array(jsonString.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIUser::fromJsonObject(QJsonObject json) { initializeModel(); Q_D(OAIUser); d->id_isValid = ::OpenAPI::fromJsonValue(d->id, json[QString("id")]); d->id_isSet = !json[QString("id")].isNull() && d->id_isValid; d->account_enabled_isValid = ::OpenAPI::fromJsonValue(d->account_enabled, json[QString("accountEnabled")]); d->account_enabled_isSet = !json[QString("accountEnabled")].isNull() && d->account_enabled_isValid; d->app_role_assignments_isValid = ::OpenAPI::fromJsonValue(d->app_role_assignments, json[QString("appRoleAssignments")]); d->app_role_assignments_isSet = !json[QString("appRoleAssignments")].isNull() && d->app_role_assignments_isValid; d->display_name_isValid = ::OpenAPI::fromJsonValue(d->display_name, json[QString("displayName")]); d->display_name_isSet = !json[QString("displayName")].isNull() && d->display_name_isValid; d->drives_isValid = ::OpenAPI::fromJsonValue(d->drives, json[QString("drives")]); d->drives_isSet = !json[QString("drives")].isNull() && d->drives_isValid; d->drive_isValid = ::OpenAPI::fromJsonValue(d->drive, json[QString("drive")]); d->drive_isSet = !json[QString("drive")].isNull() && d->drive_isValid; d->identities_isValid = ::OpenAPI::fromJsonValue(d->identities, json[QString("identities")]); d->identities_isSet = !json[QString("identities")].isNull() && d->identities_isValid; d->mail_isValid = ::OpenAPI::fromJsonValue(d->mail, json[QString("mail")]); d->mail_isSet = !json[QString("mail")].isNull() && d->mail_isValid; d->member_of_isValid = ::OpenAPI::fromJsonValue(d->member_of, json[QString("memberOf")]); d->member_of_isSet = !json[QString("memberOf")].isNull() && d->member_of_isValid; d->on_premises_sam_account_name_isValid = ::OpenAPI::fromJsonValue(d->on_premises_sam_account_name, json[QString("onPremisesSamAccountName")]); d->on_premises_sam_account_name_isSet = !json[QString("onPremisesSamAccountName")].isNull() && d->on_premises_sam_account_name_isValid; d->password_profile_isValid = ::OpenAPI::fromJsonValue(d->password_profile, json[QString("passwordProfile")]); d->password_profile_isSet = !json[QString("passwordProfile")].isNull() && d->password_profile_isValid; d->surname_isValid = ::OpenAPI::fromJsonValue(d->surname, json[QString("surname")]); d->surname_isSet = !json[QString("surname")].isNull() && d->surname_isValid; d->given_name_isValid = ::OpenAPI::fromJsonValue(d->given_name, json[QString("givenName")]); d->given_name_isSet = !json[QString("givenName")].isNull() && d->given_name_isValid; d->user_type_isValid = ::OpenAPI::fromJsonValue(d->user_type, json[QString("userType")]); d->user_type_isSet = !json[QString("userType")].isNull() && d->user_type_isValid; } QString OAIUser::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIUser::asJsonObject() const { Q_D(const OAIUser); if(!d){ return {}; } QJsonObject obj; if (d->id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(d->id)); } if (d->account_enabled_isSet) { obj.insert(QString("accountEnabled"), ::OpenAPI::toJsonValue(d->account_enabled)); } if (d->app_role_assignments.size() > 0) { obj.insert(QString("appRoleAssignments"), ::OpenAPI::toJsonValue(d->app_role_assignments)); } if (d->display_name_isSet) { obj.insert(QString("displayName"), ::OpenAPI::toJsonValue(d->display_name)); } if (d->drives.size() > 0) { obj.insert(QString("drives"), ::OpenAPI::toJsonValue(d->drives)); } if (d->drive.isSet()) { obj.insert(QString("drive"), ::OpenAPI::toJsonValue(d->drive)); } if (d->identities.size() > 0) { obj.insert(QString("identities"), ::OpenAPI::toJsonValue(d->identities)); } if (d->mail_isSet) { obj.insert(QString("mail"), ::OpenAPI::toJsonValue(d->mail)); } if (d->member_of.size() > 0) { obj.insert(QString("memberOf"), ::OpenAPI::toJsonValue(d->member_of)); } if (d->on_premises_sam_account_name_isSet) { obj.insert(QString("onPremisesSamAccountName"), ::OpenAPI::toJsonValue(d->on_premises_sam_account_name)); } if (d->password_profile.isSet()) { obj.insert(QString("passwordProfile"), ::OpenAPI::toJsonValue(d->password_profile)); } if (d->surname_isSet) { obj.insert(QString("surname"), ::OpenAPI::toJsonValue(d->surname)); } if (d->given_name_isSet) { obj.insert(QString("givenName"), ::OpenAPI::toJsonValue(d->given_name)); } if (d->user_type_isSet) { obj.insert(QString("userType"), ::OpenAPI::toJsonValue(d->user_type)); } return obj; } QString OAIUser::getId() const { Q_D(const OAIUser); if(!d){ return {}; } return d->id; } void OAIUser::setId(const QString &id) { Q_D(OAIUser); Q_ASSERT(d); d->id = id; d->id_isSet = true; } bool OAIUser::is_id_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->id_isSet; } bool OAIUser::is_id_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->id_isValid; } bool OAIUser::isAccountEnabled() const { Q_D(const OAIUser); if(!d){ return {}; } return d->account_enabled; } void OAIUser::setAccountEnabled(const bool &account_enabled) { Q_D(OAIUser); Q_ASSERT(d); d->account_enabled = account_enabled; d->account_enabled_isSet = true; } bool OAIUser::is_account_enabled_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->account_enabled_isSet; } bool OAIUser::is_account_enabled_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->account_enabled_isValid; } QList OAIUser::getAppRoleAssignments() const { Q_D(const OAIUser); if(!d){ return {}; } return d->app_role_assignments; } void OAIUser::setAppRoleAssignments(const QList &app_role_assignments) { Q_D(OAIUser); Q_ASSERT(d); d->app_role_assignments = app_role_assignments; d->app_role_assignments_isSet = true; } bool OAIUser::is_app_role_assignments_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->app_role_assignments_isSet; } bool OAIUser::is_app_role_assignments_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->app_role_assignments_isValid; } QString OAIUser::getDisplayName() const { Q_D(const OAIUser); if(!d){ return {}; } return d->display_name; } void OAIUser::setDisplayName(const QString &display_name) { Q_D(OAIUser); Q_ASSERT(d); d->display_name = display_name; d->display_name_isSet = true; } bool OAIUser::is_display_name_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->display_name_isSet; } bool OAIUser::is_display_name_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->display_name_isValid; } QList OAIUser::getDrives() const { Q_D(const OAIUser); if(!d){ return {}; } return d->drives; } void OAIUser::setDrives(const QList &drives) { Q_D(OAIUser); Q_ASSERT(d); d->drives = drives; d->drives_isSet = true; } bool OAIUser::is_drives_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->drives_isSet; } bool OAIUser::is_drives_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->drives_isValid; } OAIDrive OAIUser::getDrive() const { Q_D(const OAIUser); if(!d){ return {}; } return d->drive; } void OAIUser::setDrive(const OAIDrive &drive) { Q_D(OAIUser); Q_ASSERT(d); d->drive = drive; d->drive_isSet = true; } bool OAIUser::is_drive_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->drive_isSet; } bool OAIUser::is_drive_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->drive_isValid; } QList OAIUser::getIdentities() const { Q_D(const OAIUser); if(!d){ return {}; } return d->identities; } void OAIUser::setIdentities(const QList &identities) { Q_D(OAIUser); Q_ASSERT(d); d->identities = identities; d->identities_isSet = true; } bool OAIUser::is_identities_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->identities_isSet; } bool OAIUser::is_identities_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->identities_isValid; } QString OAIUser::getMail() const { Q_D(const OAIUser); if(!d){ return {}; } return d->mail; } void OAIUser::setMail(const QString &mail) { Q_D(OAIUser); Q_ASSERT(d); d->mail = mail; d->mail_isSet = true; } bool OAIUser::is_mail_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->mail_isSet; } bool OAIUser::is_mail_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->mail_isValid; } QList OAIUser::getMemberOf() const { Q_D(const OAIUser); if(!d){ return {}; } return d->member_of; } void OAIUser::setMemberOf(const QList &member_of) { Q_D(OAIUser); Q_ASSERT(d); d->member_of = member_of; d->member_of_isSet = true; } bool OAIUser::is_member_of_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->member_of_isSet; } bool OAIUser::is_member_of_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->member_of_isValid; } QString OAIUser::getOnPremisesSamAccountName() const { Q_D(const OAIUser); if(!d){ return {}; } return d->on_premises_sam_account_name; } void OAIUser::setOnPremisesSamAccountName(const QString &on_premises_sam_account_name) { Q_D(OAIUser); Q_ASSERT(d); d->on_premises_sam_account_name = on_premises_sam_account_name; d->on_premises_sam_account_name_isSet = true; } bool OAIUser::is_on_premises_sam_account_name_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->on_premises_sam_account_name_isSet; } bool OAIUser::is_on_premises_sam_account_name_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->on_premises_sam_account_name_isValid; } OAIPasswordProfile OAIUser::getPasswordProfile() const { Q_D(const OAIUser); if(!d){ return {}; } return d->password_profile; } void OAIUser::setPasswordProfile(const OAIPasswordProfile &password_profile) { Q_D(OAIUser); Q_ASSERT(d); d->password_profile = password_profile; d->password_profile_isSet = true; } bool OAIUser::is_password_profile_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->password_profile_isSet; } bool OAIUser::is_password_profile_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->password_profile_isValid; } QString OAIUser::getSurname() const { Q_D(const OAIUser); if(!d){ return {}; } return d->surname; } void OAIUser::setSurname(const QString &surname) { Q_D(OAIUser); Q_ASSERT(d); d->surname = surname; d->surname_isSet = true; } bool OAIUser::is_surname_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->surname_isSet; } bool OAIUser::is_surname_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->surname_isValid; } QString OAIUser::getGivenName() const { Q_D(const OAIUser); if(!d){ return {}; } return d->given_name; } void OAIUser::setGivenName(const QString &given_name) { Q_D(OAIUser); Q_ASSERT(d); d->given_name = given_name; d->given_name_isSet = true; } bool OAIUser::is_given_name_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->given_name_isSet; } bool OAIUser::is_given_name_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->given_name_isValid; } QString OAIUser::getUserType() const { Q_D(const OAIUser); if(!d){ return {}; } return d->user_type; } void OAIUser::setUserType(const QString &user_type) { Q_D(OAIUser); Q_ASSERT(d); d->user_type = user_type; d->user_type_isSet = true; } bool OAIUser::is_user_type_Set() const{ Q_D(const OAIUser); if(!d){ return false; } return d->user_type_isSet; } bool OAIUser::is_user_type_Valid() const{ Q_D(const OAIUser); if(!d){ return false; } return d->user_type_isValid; } bool OAIUser::isSet() const { Q_D(const OAIUser); if(!d){ return false; } bool isObjectUpdated = false; do { if (d->id_isSet) { isObjectUpdated = true; break; } if (d->account_enabled_isSet) { isObjectUpdated = true; break; } if (d->app_role_assignments.size() > 0) { isObjectUpdated = true; break; } if (d->display_name_isSet) { isObjectUpdated = true; break; } if (d->drives.size() > 0) { isObjectUpdated = true; break; } if (d->drive.isSet()) { isObjectUpdated = true; break; } if (d->identities.size() > 0) { isObjectUpdated = true; break; } if (d->mail_isSet) { isObjectUpdated = true; break; } if (d->member_of.size() > 0) { isObjectUpdated = true; break; } if (d->on_premises_sam_account_name_isSet) { isObjectUpdated = true; break; } if (d->password_profile.isSet()) { isObjectUpdated = true; break; } if (d->surname_isSet) { isObjectUpdated = true; break; } if (d->given_name_isSet) { isObjectUpdated = true; break; } if (d->user_type_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIUser::isValid() const { Q_D(const OAIUser); if(!d){ return false; } // only required properties are required for the object to be considered valid return true; } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIUser.h000066400000000000000000000075161442421066000220430ustar00rootroot00000000000000// model-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* * OAIUser.h * * Represents an Active Directory user object. */ #ifndef OAIUser_H #define OAIUser_H #include #include "OAIAppRoleAssignment.h" #include "OAIDrive.h" #include "OAIGroup.h" #include "OAIObjectIdentity.h" #include "OAIPasswordProfile.h" #include #include #include "OAIEnum.h" #include "OAIObject.h" namespace OpenAPI { class OAIAppRoleAssignment; class OAIDrive; class OAIObjectIdentity; class OAIGroup; class OAIPasswordProfile; class OAIUserPrivate; class OAIUser : public OAIObject { public: OAIUser(); OAIUser(const OAIUser &other); OAIUser(QString json); ~OAIUser() override; QString asJson() const override; QJsonObject asJsonObject() const override; void fromJsonObject(QJsonObject json) override; void fromJson(QString jsonString) override; QString getId() const; void setId(const QString &id); bool is_id_Set() const; bool is_id_Valid() const; bool isAccountEnabled() const; void setAccountEnabled(const bool &account_enabled); bool is_account_enabled_Set() const; bool is_account_enabled_Valid() const; QList getAppRoleAssignments() const; void setAppRoleAssignments(const QList &app_role_assignments); bool is_app_role_assignments_Set() const; bool is_app_role_assignments_Valid() const; QString getDisplayName() const; void setDisplayName(const QString &display_name); bool is_display_name_Set() const; bool is_display_name_Valid() const; QList getDrives() const; void setDrives(const QList &drives); bool is_drives_Set() const; bool is_drives_Valid() const; OAIDrive getDrive() const; void setDrive(const OAIDrive &drive); bool is_drive_Set() const; bool is_drive_Valid() const; QList getIdentities() const; void setIdentities(const QList &identities); bool is_identities_Set() const; bool is_identities_Valid() const; QString getMail() const; void setMail(const QString &mail); bool is_mail_Set() const; bool is_mail_Valid() const; QList getMemberOf() const; void setMemberOf(const QList &member_of); bool is_member_of_Set() const; bool is_member_of_Valid() const; QString getOnPremisesSamAccountName() const; void setOnPremisesSamAccountName(const QString &on_premises_sam_account_name); bool is_on_premises_sam_account_name_Set() const; bool is_on_premises_sam_account_name_Valid() const; OAIPasswordProfile getPasswordProfile() const; void setPasswordProfile(const OAIPasswordProfile &password_profile); bool is_password_profile_Set() const; bool is_password_profile_Valid() const; QString getSurname() const; void setSurname(const QString &surname); bool is_surname_Set() const; bool is_surname_Valid() const; QString getGivenName() const; void setGivenName(const QString &given_name); bool is_given_name_Set() const; bool is_given_name_Valid() const; QString getUserType() const; void setUserType(const QString &user_type); bool is_user_type_Set() const; bool is_user_type_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; private: void initializeModel(); Q_DECLARE_PRIVATE(OAIUser) QSharedPointer d_ptr; }; } // namespace OpenAPI Q_DECLARE_METATYPE(OpenAPI::OAIUser) #endif // OAIUser_H libre-graph-api-cpp-qt-client-1.0.4/client/OAIUserApi.cpp000066400000000000000000000666501442421066000230340ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIUserApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIUserApi::OAIUserApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIUserApi::~OAIUserApi() { } void OAIUserApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("deleteUser", defaultConf); _serverIndices.insert("deleteUser", 0); _serverConfigs.insert("exportPersonalData", defaultConf); _serverIndices.insert("exportPersonalData", 0); _serverConfigs.insert("getUser", defaultConf); _serverIndices.insert("getUser", 0); _serverConfigs.insert("updateUser", defaultConf); _serverIndices.insert("updateUser", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIUserApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIUserApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIUserApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIUserApi::setUsername(const QString &username) { _username = username; } void OAIUserApi::setPassword(const QString &password) { _password = password; } void OAIUserApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIUserApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIUserApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIUserApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIUserApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIUserApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIUserApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIUserApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIUserApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIUserApi::abortRequests() { emit abortRequestsSignal(); } QString OAIUserApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIUserApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIUserApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIUserApi::deleteUser(const QString &user_id, const ::OpenAPI::OptionalParam &if_match) { QString fullPath = QString(_serverConfigs["deleteUser"][_serverIndices.value("deleteUser")].URL()+"/users/{user-id}"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); if (if_match.hasValue()) { if (!::OpenAPI::toStringValue(if_match.value()).isEmpty()) { input.headers.insert("If-Match", ::OpenAPI::toStringValue(if_match.value())); } } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserApi::deleteUserCallback); connect(this, &OAIUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserApi::deleteUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit deleteUserSignal(); emit deleteUserSignalFull(worker); } else { emit deleteUserSignalE(error_type, error_str); emit deleteUserSignalEFull(worker, error_type, error_str); } } void OAIUserApi::exportPersonalData(const QString &user_id, const ::OpenAPI::OptionalParam &oai_export_personal_data_request) { QString fullPath = QString(_serverConfigs["exportPersonalData"][_serverIndices.value("exportPersonalData")].URL()+"/users/{user-id}/exportPersonalData"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); if (oai_export_personal_data_request.hasValue()){ QByteArray output = oai_export_personal_data_request.value().asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserApi::exportPersonalDataCallback); connect(this, &OAIUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserApi::exportPersonalDataCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit exportPersonalDataSignal(); emit exportPersonalDataSignalFull(worker); } else { emit exportPersonalDataSignalE(error_type, error_str); emit exportPersonalDataSignalEFull(worker, error_type, error_str); } } void OAIUserApi::getUser(const QString &user_id, const ::OpenAPI::OptionalParam> &select, const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["getUser"][_serverIndices.value("getUser")].URL()+"/users/{user-id}"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (select.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$select", false); if (select.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, select.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$select=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserApi::getUserCallback); connect(this, &OAIUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserApi::getUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit getUserSignal(output); emit getUserSignalFull(worker, output); } else { emit getUserSignalE(output, error_type, error_str); emit getUserSignalEFull(worker, error_type, error_str); } } void OAIUserApi::updateUser(const QString &user_id, const OAIUser &oai_user) { QString fullPath = QString(_serverConfigs["updateUser"][_serverIndices.value("updateUser")].URL()+"/users/{user-id}"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "PATCH"); { QByteArray output = oai_user.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserApi::updateUserCallback); connect(this, &OAIUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserApi::updateUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit updateUserSignal(output); emit updateUserSignalFull(worker, output); } else { emit updateUserSignalE(output, error_type, error_str); emit updateUserSignalEFull(worker, error_type, error_str); } } void OAIUserApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIUserApi.h000066400000000000000000000136231442421066000224710ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIUserApi_H #define OAI_OAIUserApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIExportPersonalData_request.h" #include "OAIOdata_error.h" #include "OAIUser.h" #include #include #include #include #include #include #include namespace OpenAPI { class OAIUserApi : public QObject { Q_OBJECT public: OAIUserApi(const int timeOut = 0); ~OAIUserApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] user_id QString [required] * @param[in] if_match QString [optional] */ void deleteUser(const QString &user_id, const ::OpenAPI::OptionalParam &if_match = ::OpenAPI::OptionalParam()); /** * @param[in] user_id QString [required] * @param[in] oai_export_personal_data_request OAIExportPersonalData_request [optional] */ void exportPersonalData(const QString &user_id, const ::OpenAPI::OptionalParam &oai_export_personal_data_request = ::OpenAPI::OptionalParam()); /** * @param[in] user_id QString [required] * @param[in] select QSet [optional] * @param[in] expand QSet [optional] */ void getUser(const QString &user_id, const ::OpenAPI::OptionalParam> &select = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); /** * @param[in] user_id QString [required] * @param[in] oai_user OAIUser [required] */ void updateUser(const QString &user_id, const OAIUser &oai_user); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void deleteUserCallback(OAIHttpRequestWorker *worker); void exportPersonalDataCallback(OAIHttpRequestWorker *worker); void getUserCallback(OAIHttpRequestWorker *worker); void updateUserCallback(OAIHttpRequestWorker *worker); signals: void deleteUserSignal(); void exportPersonalDataSignal(); void getUserSignal(OAIUser summary); void updateUserSignal(OAIUser summary); void deleteUserSignalFull(OAIHttpRequestWorker *worker); void exportPersonalDataSignalFull(OAIHttpRequestWorker *worker); void getUserSignalFull(OAIHttpRequestWorker *worker, OAIUser summary); void updateUserSignalFull(OAIHttpRequestWorker *worker, OAIUser summary); void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); void exportPersonalDataSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getUserSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString error_str); void updateUserSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString error_str); void deleteUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void exportPersonalDataSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void getUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void updateUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIUserAppRoleAssignmentApi.cpp000066400000000000000000000463071442421066000263450ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIUserAppRoleAssignmentApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIUserAppRoleAssignmentApi::OAIUserAppRoleAssignmentApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIUserAppRoleAssignmentApi::~OAIUserAppRoleAssignmentApi() { } void OAIUserAppRoleAssignmentApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("user_CreateAppRoleAssignments", defaultConf); _serverIndices.insert("user_CreateAppRoleAssignments", 0); _serverConfigs.insert("user_DeleteAppRoleAssignments", defaultConf); _serverIndices.insert("user_DeleteAppRoleAssignments", 0); _serverConfigs.insert("user_ListAppRoleAssignments", defaultConf); _serverIndices.insert("user_ListAppRoleAssignments", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIUserAppRoleAssignmentApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIUserAppRoleAssignmentApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIUserAppRoleAssignmentApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIUserAppRoleAssignmentApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIUserAppRoleAssignmentApi::setUsername(const QString &username) { _username = username; } void OAIUserAppRoleAssignmentApi::setPassword(const QString &password) { _password = password; } void OAIUserAppRoleAssignmentApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIUserAppRoleAssignmentApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIUserAppRoleAssignmentApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIUserAppRoleAssignmentApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIUserAppRoleAssignmentApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIUserAppRoleAssignmentApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIUserAppRoleAssignmentApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIUserAppRoleAssignmentApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIUserAppRoleAssignmentApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIUserAppRoleAssignmentApi::abortRequests() { emit abortRequestsSignal(); } QString OAIUserAppRoleAssignmentApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIUserAppRoleAssignmentApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIUserAppRoleAssignmentApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIUserAppRoleAssignmentApi::user_CreateAppRoleAssignments(const QString &user_id, const OAIAppRoleAssignment &oai_app_role_assignment) { QString fullPath = QString(_serverConfigs["user_CreateAppRoleAssignments"][_serverIndices.value("user_CreateAppRoleAssignments")].URL()+"/users/{user-id}/appRoleAssignments"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_app_role_assignment.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserAppRoleAssignmentApi::user_CreateAppRoleAssignmentsCallback); connect(this, &OAIUserAppRoleAssignmentApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserAppRoleAssignmentApi::user_CreateAppRoleAssignmentsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIAppRoleAssignment output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit user_CreateAppRoleAssignmentsSignal(output); emit user_CreateAppRoleAssignmentsSignalFull(worker, output); } else { emit user_CreateAppRoleAssignmentsSignalE(output, error_type, error_str); emit user_CreateAppRoleAssignmentsSignalEFull(worker, error_type, error_str); } } void OAIUserAppRoleAssignmentApi::user_DeleteAppRoleAssignments(const QString &user_id, const QString &app_role_assignment_id, const ::OpenAPI::OptionalParam &if_match) { QString fullPath = QString(_serverConfigs["user_DeleteAppRoleAssignments"][_serverIndices.value("user_DeleteAppRoleAssignments")].URL()+"/users/{user-id}/appRoleAssignments/{appRoleAssignment-id}"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } { QString app_role_assignment_idPathParam("{"); app_role_assignment_idPathParam.append("appRoleAssignment-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "appRoleAssignment-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"appRoleAssignment-id"+pathSuffix : pathPrefix; fullPath.replace(app_role_assignment_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(app_role_assignment_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); if (if_match.hasValue()) { if (!::OpenAPI::toStringValue(if_match.value()).isEmpty()) { input.headers.insert("If-Match", ::OpenAPI::toStringValue(if_match.value())); } } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserAppRoleAssignmentApi::user_DeleteAppRoleAssignmentsCallback); connect(this, &OAIUserAppRoleAssignmentApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserAppRoleAssignmentApi::user_DeleteAppRoleAssignmentsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit user_DeleteAppRoleAssignmentsSignal(); emit user_DeleteAppRoleAssignmentsSignalFull(worker); } else { emit user_DeleteAppRoleAssignmentsSignalE(error_type, error_str); emit user_DeleteAppRoleAssignmentsSignalEFull(worker, error_type, error_str); } } void OAIUserAppRoleAssignmentApi::user_ListAppRoleAssignments(const QString &user_id) { QString fullPath = QString(_serverConfigs["user_ListAppRoleAssignments"][_serverIndices.value("user_ListAppRoleAssignments")].URL()+"/users/{user-id}/appRoleAssignments"); { QString user_idPathParam("{"); user_idPathParam.append("user-id").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "user-id", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"user-id"+pathSuffix : pathPrefix; fullPath.replace(user_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(user_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUserAppRoleAssignmentApi::user_ListAppRoleAssignmentsCallback); connect(this, &OAIUserAppRoleAssignmentApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUserAppRoleAssignmentApi::user_ListAppRoleAssignmentsCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_appRoleAssignments output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit user_ListAppRoleAssignmentsSignal(output); emit user_ListAppRoleAssignmentsSignalFull(worker, output); } else { emit user_ListAppRoleAssignmentsSignalE(output, error_type, error_str); emit user_ListAppRoleAssignmentsSignalEFull(worker, error_type, error_str); } } void OAIUserAppRoleAssignmentApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIUserAppRoleAssignmentApi.h000066400000000000000000000130731442421066000260040ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIUserAppRoleAssignmentApi_H #define OAI_OAIUserAppRoleAssignmentApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAIAppRoleAssignment.h" #include "OAICollection_of_appRoleAssignments.h" #include "OAIOdata_error.h" #include #include #include #include #include #include namespace OpenAPI { class OAIUserAppRoleAssignmentApi : public QObject { Q_OBJECT public: OAIUserAppRoleAssignmentApi(const int timeOut = 0); ~OAIUserAppRoleAssignmentApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] user_id QString [required] * @param[in] oai_app_role_assignment OAIAppRoleAssignment [required] */ void user_CreateAppRoleAssignments(const QString &user_id, const OAIAppRoleAssignment &oai_app_role_assignment); /** * @param[in] user_id QString [required] * @param[in] app_role_assignment_id QString [required] * @param[in] if_match QString [optional] */ void user_DeleteAppRoleAssignments(const QString &user_id, const QString &app_role_assignment_id, const ::OpenAPI::OptionalParam &if_match = ::OpenAPI::OptionalParam()); /** * @param[in] user_id QString [required] */ void user_ListAppRoleAssignments(const QString &user_id); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void user_CreateAppRoleAssignmentsCallback(OAIHttpRequestWorker *worker); void user_DeleteAppRoleAssignmentsCallback(OAIHttpRequestWorker *worker); void user_ListAppRoleAssignmentsCallback(OAIHttpRequestWorker *worker); signals: void user_CreateAppRoleAssignmentsSignal(OAIAppRoleAssignment summary); void user_DeleteAppRoleAssignmentsSignal(); void user_ListAppRoleAssignmentsSignal(OAICollection_of_appRoleAssignments summary); void user_CreateAppRoleAssignmentsSignalFull(OAIHttpRequestWorker *worker, OAIAppRoleAssignment summary); void user_DeleteAppRoleAssignmentsSignalFull(OAIHttpRequestWorker *worker); void user_ListAppRoleAssignmentsSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_appRoleAssignments summary); void user_CreateAppRoleAssignmentsSignalE(OAIAppRoleAssignment summary, QNetworkReply::NetworkError error_type, QString error_str); void user_DeleteAppRoleAssignmentsSignalE(QNetworkReply::NetworkError error_type, QString error_str); void user_ListAppRoleAssignmentsSignalE(OAICollection_of_appRoleAssignments summary, QNetworkReply::NetworkError error_type, QString error_str); void user_CreateAppRoleAssignmentsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void user_DeleteAppRoleAssignmentsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void user_ListAppRoleAssignmentsSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/OAIUsersApi.cpp000066400000000000000000000627241442421066000232150ustar00rootroot00000000000000// api-body.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIUsersApi.h" #include "OAIServerConfiguration.h" #include #include namespace OpenAPI { OAIUsersApi::OAIUsersApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIUsersApi::~OAIUsersApi() { } void OAIUsersApi::initializeServerConfigs() { //Default server QList defaultConf = QList(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0"), "ownCloud Infinite Scale Latest", QMap())); defaultConf.append(OAIServerConfiguration( QUrl("https://localhost:9200/graph/v1.0"), "ownCloud Infinite Scale Development Setup", QMap())); _serverConfigs.insert("createUser", defaultConf); _serverIndices.insert("createUser", 0); _serverConfigs.insert("listUsers", defaultConf); _serverIndices.insert("listUsers", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIUsersApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIUsersApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIUsersApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIUsersApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIUsersApi::setUsername(const QString &username) { _username = username; } void OAIUsersApi::setPassword(const QString &password) { _password = password; } void OAIUsersApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIUsersApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIUsersApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIUsersApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIUsersApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIUsersApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIUsersApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIUsersApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIUsersApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIUsersApi::abortRequests() { emit abortRequestsSignal(); } QString OAIUsersApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIUsersApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIUsersApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIUsersApi::createUser(const OAIUser &oai_user) { QString fullPath = QString(_serverConfigs["createUser"][_serverIndices.value("createUser")].URL()+"/users"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_user.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUsersApi::createUserCallback); connect(this, &OAIUsersApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUsersApi::createUserCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit createUserSignal(output); emit createUserSignalFull(worker, output); } else { emit createUserSignalE(output, error_type, error_str); emit createUserSignalEFull(worker, error_type, error_str); } } void OAIUsersApi::listUsers(const ::OpenAPI::OptionalParam &search, const ::OpenAPI::OptionalParam &filter, const ::OpenAPI::OptionalParam> &orderby, const ::OpenAPI::OptionalParam> &select, const ::OpenAPI::OptionalParam> &expand) { QString fullPath = QString(_serverConfigs["listUsers"][_serverIndices.value("listUsers")].URL()+"/users"); QString queryPrefix, querySuffix, queryDelimiter, queryStyle; if (search.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$search", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$search")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(search.value()))); } if (filter.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$filter", true); if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("$filter")).append(querySuffix).append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(filter.value()))); } if (orderby.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$orderby", false); if (orderby.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, orderby.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$orderby=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$orderby").append(querySuffix); qint32 count = 0; foreach (QString t, orderby.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (select.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$select", false); if (select.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, select.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$select=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$select").append(querySuffix); qint32 count = 0; foreach (QString t, select.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } if (expand.hasValue()) { queryStyle = "form"; if (queryStyle == "") queryStyle = "form"; queryPrefix = getParamStylePrefix(queryStyle); querySuffix = getParamStyleSuffix(queryStyle); queryDelimiter = getParamStyleDelimiter(queryStyle, "$expand", false); if (expand.value().size() > 0) { if (QString("csv").indexOf("multi") == 0) { foreach (QString t, expand.value()) { if (fullPath.indexOf("?") > 0) fullPath.append(queryPrefix); else fullPath.append("?"); fullPath.append("$expand=").append(::OpenAPI::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter)); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append("\t"); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("csv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("pipes") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } else if (QString("csv").indexOf("deepObject") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?").append(queryPrefix).append("$expand").append(querySuffix); qint32 count = 0; foreach (QString t, expand.value()) { if (count > 0) { fullPath.append(queryDelimiter); } fullPath.append(::OpenAPI::toStringValue(t)); count++; } } } } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIUsersApi::listUsersCallback); connect(this, &OAIUsersApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIUsersApi::listUsersCallback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAICollection_of_user output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit listUsersSignal(output); emit listUsersSignalFull(worker, output); } else { emit listUsersSignalE(output, error_type, error_str); emit listUsersSignalEFull(worker, error_type, error_str); } } void OAIUsersApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retreive a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI libre-graph-api-cpp-qt-client-1.0.4/client/OAIUsersApi.h000066400000000000000000000116131442421066000226510ustar00rootroot00000000000000// api-header.mustache // licenseInfo.mustache /** * Libre Graph API * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. * * The version of the OpenAPI document: v1.0.4 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAIUsersApi_H #define OAI_OAIUsersApi_H #include "OAIHelpers.h" #include "OAIHttpRequest.h" #include "OAIServerConfiguration.h" #include "OAIOauth.h" #include "OAICollection_of_user.h" #include "OAIOdata_error.h" #include "OAIUser.h" #include #include #include #include #include #include #include namespace OpenAPI { class OAIUsersApi : public QObject { Q_OBJECT public: OAIUsersApi(const int timeOut = 0); ~OAIUsersApi(); void initializeServerConfigs(); int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); void setServerIndex(const QString &operation, int serverIndex); void setApiKey(const QString &apiKeyName, const QString &apiKey); void setBearerToken(const QString &token); void setUsername(const QString &username); void setPassword(const QString &password); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); void setNetworkAccessManager(QNetworkAccessManager* manager); int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); void abortRequests(); QString getParamStylePrefix(const QString &style); QString getParamStyleSuffix(const QString &style); QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); /** * @param[in] oai_user OAIUser [required] */ void createUser(const OAIUser &oai_user); /** * @param[in] search QString [optional] * @param[in] filter QString [optional] * @param[in] orderby QSet [optional] * @param[in] select QSet [optional] * @param[in] expand QSet [optional] */ void listUsers(const ::OpenAPI::OptionalParam &search = ::OpenAPI::OptionalParam(), const ::OpenAPI::OptionalParam &filter = ::OpenAPI::OptionalParam(), const ::OpenAPI::OptionalParam> &orderby = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &select = ::OpenAPI::OptionalParam>(), const ::OpenAPI::OptionalParam> &expand = ::OpenAPI::OptionalParam>()); private: QMap _serverIndices; QMap> _serverConfigs; QMap _apiKeys; QString _bearerToken; QString _username; QString _password; int _timeOut; QString _workingDirectory; QNetworkAccessManager* _manager; QMap _defaultHeaders; bool _isResponseCompressionEnabled; bool _isRequestCompressionEnabled; OAIHttpRequestInput _latestInput; OAIHttpRequestWorker *_latestWorker; QStringList _latestScope; OauthCode _authFlow; OauthImplicit _implicitFlow; OauthCredentials _credentialFlow; OauthPassword _passwordFlow; int _OauthMethod = 0; void createUserCallback(OAIHttpRequestWorker *worker); void listUsersCallback(OAIHttpRequestWorker *worker); signals: void createUserSignal(OAIUser summary); void listUsersSignal(OAICollection_of_user summary); void createUserSignalFull(OAIHttpRequestWorker *worker, OAIUser summary); void listUsersSignalFull(OAIHttpRequestWorker *worker, OAICollection_of_user summary); void createUserSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString error_str); void listUsersSignalE(OAICollection_of_user summary, QNetworkReply::NetworkError error_type, QString error_str); void createUserSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void listUsersSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); void abortRequestsSignal(); void allPendingRequestsCompleted(); public slots: void tokenAvailable(); }; } // namespace OpenAPI #endif libre-graph-api-cpp-qt-client-1.0.4/client/client.pri000066400000000000000000000134671442421066000224170ustar00rootroot00000000000000QT += network HEADERS += \ # Models $${PWD}/OAIAppRole.h \ $${PWD}/OAIAppRoleAssignment.h \ $${PWD}/OAIApplication.h \ $${PWD}/OAIClass_Member_Reference.h \ $${PWD}/OAIClass_Reference.h \ $${PWD}/OAIClass_Teacher_Reference.h \ $${PWD}/OAICollection_of_appRoleAssignments.h \ $${PWD}/OAICollection_of_applications.h \ $${PWD}/OAICollection_of_class.h \ $${PWD}/OAICollection_of_driveItems.h \ $${PWD}/OAICollection_of_drives.h \ $${PWD}/OAICollection_of_drives_1.h \ $${PWD}/OAICollection_of_educationClass.h \ $${PWD}/OAICollection_of_educationUser.h \ $${PWD}/OAICollection_of_educationUser_1.h \ $${PWD}/OAICollection_of_group.h \ $${PWD}/OAICollection_of_schools.h \ $${PWD}/OAICollection_of_tags.h \ $${PWD}/OAICollection_of_user.h \ $${PWD}/OAICollection_of_users.h \ $${PWD}/OAIDeleted.h \ $${PWD}/OAIDirectoryObject.h \ $${PWD}/OAIDrive.h \ $${PWD}/OAIDriveItem.h \ $${PWD}/OAIEducationClass.h \ $${PWD}/OAIEducationOrganization.h \ $${PWD}/OAIEducationSchool.h \ $${PWD}/OAIEducationUser.h \ $${PWD}/OAIEducationUser_Reference.h \ $${PWD}/OAIEntity.h \ $${PWD}/OAIExportPersonalData_request.h \ $${PWD}/OAIFileSystemInfo.h \ $${PWD}/OAIFolder.h \ $${PWD}/OAIFolderView.h \ $${PWD}/OAIGroup.h \ $${PWD}/OAIHashes.h \ $${PWD}/OAIIdentity.h \ $${PWD}/OAIIdentitySet.h \ $${PWD}/OAIImage.h \ $${PWD}/OAIItemReference.h \ $${PWD}/OAIMember_Reference.h \ $${PWD}/OAIObjectIdentity.h \ $${PWD}/OAIOdata_error.h \ $${PWD}/OAIOdata_error_detail.h \ $${PWD}/OAIOdata_error_main.h \ $${PWD}/OAIOpenGraphFile.h \ $${PWD}/OAIPasswordProfile.h \ $${PWD}/OAIPassword_change.h \ $${PWD}/OAIPermission.h \ $${PWD}/OAIQuota.h \ $${PWD}/OAIRemoteItem.h \ $${PWD}/OAIShared.h \ $${PWD}/OAISpecialFolder.h \ $${PWD}/OAITagAssignment.h \ $${PWD}/OAITagUnassignment.h \ $${PWD}/OAITrash.h \ $${PWD}/OAIUser.h \ # APIs $${PWD}/OAIApplicationsApi.h \ $${PWD}/OAIDrivesApi.h \ $${PWD}/OAIDrivesGetDrivesApi.h \ $${PWD}/OAIDrivesRootApi.h \ $${PWD}/OAIEducationClassApi.h \ $${PWD}/OAIEducationClassTeachersApi.h \ $${PWD}/OAIEducationSchoolApi.h \ $${PWD}/OAIEducationUserApi.h \ $${PWD}/OAIGroupApi.h \ $${PWD}/OAIGroupsApi.h \ $${PWD}/OAIMeChangepasswordApi.h \ $${PWD}/OAIMeDriveApi.h \ $${PWD}/OAIMeDriveRootApi.h \ $${PWD}/OAIMeDriveRootChildrenApi.h \ $${PWD}/OAIMeDrivesApi.h \ $${PWD}/OAIMeUserApi.h \ $${PWD}/OAITagsApi.h \ $${PWD}/OAIUserApi.h \ $${PWD}/OAIUserAppRoleAssignmentApi.h \ $${PWD}/OAIUsersApi.h \ # Others $${PWD}/OAIHelpers.h \ $${PWD}/OAIHttpRequest.h \ $${PWD}/OAIObject.h \ $${PWD}/OAIEnum.h \ $${PWD}/OAIHttpFileElement.h \ $${PWD}/OAIServerConfiguration.h \ $${PWD}/OAIServerVariable.h \ $${PWD}/OAIOauth.h SOURCES += \ # Models $${PWD}/OAIAppRole.cpp \ $${PWD}/OAIAppRoleAssignment.cpp \ $${PWD}/OAIApplication.cpp \ $${PWD}/OAIClass_Member_Reference.cpp \ $${PWD}/OAIClass_Reference.cpp \ $${PWD}/OAIClass_Teacher_Reference.cpp \ $${PWD}/OAICollection_of_appRoleAssignments.cpp \ $${PWD}/OAICollection_of_applications.cpp \ $${PWD}/OAICollection_of_class.cpp \ $${PWD}/OAICollection_of_driveItems.cpp \ $${PWD}/OAICollection_of_drives.cpp \ $${PWD}/OAICollection_of_drives_1.cpp \ $${PWD}/OAICollection_of_educationClass.cpp \ $${PWD}/OAICollection_of_educationUser.cpp \ $${PWD}/OAICollection_of_educationUser_1.cpp \ $${PWD}/OAICollection_of_group.cpp \ $${PWD}/OAICollection_of_schools.cpp \ $${PWD}/OAICollection_of_tags.cpp \ $${PWD}/OAICollection_of_user.cpp \ $${PWD}/OAICollection_of_users.cpp \ $${PWD}/OAIDeleted.cpp \ $${PWD}/OAIDirectoryObject.cpp \ $${PWD}/OAIDrive.cpp \ $${PWD}/OAIDriveItem.cpp \ $${PWD}/OAIEducationClass.cpp \ $${PWD}/OAIEducationOrganization.cpp \ $${PWD}/OAIEducationSchool.cpp \ $${PWD}/OAIEducationUser.cpp \ $${PWD}/OAIEducationUser_Reference.cpp \ $${PWD}/OAIEntity.cpp \ $${PWD}/OAIExportPersonalData_request.cpp \ $${PWD}/OAIFileSystemInfo.cpp \ $${PWD}/OAIFolder.cpp \ $${PWD}/OAIFolderView.cpp \ $${PWD}/OAIGroup.cpp \ $${PWD}/OAIHashes.cpp \ $${PWD}/OAIIdentity.cpp \ $${PWD}/OAIIdentitySet.cpp \ $${PWD}/OAIImage.cpp \ $${PWD}/OAIItemReference.cpp \ $${PWD}/OAIMember_Reference.cpp \ $${PWD}/OAIObjectIdentity.cpp \ $${PWD}/OAIOdata_error.cpp \ $${PWD}/OAIOdata_error_detail.cpp \ $${PWD}/OAIOdata_error_main.cpp \ $${PWD}/OAIOpenGraphFile.cpp \ $${PWD}/OAIPasswordProfile.cpp \ $${PWD}/OAIPassword_change.cpp \ $${PWD}/OAIPermission.cpp \ $${PWD}/OAIQuota.cpp \ $${PWD}/OAIRemoteItem.cpp \ $${PWD}/OAIShared.cpp \ $${PWD}/OAISpecialFolder.cpp \ $${PWD}/OAITagAssignment.cpp \ $${PWD}/OAITagUnassignment.cpp \ $${PWD}/OAITrash.cpp \ $${PWD}/OAIUser.cpp \ # APIs $${PWD}/OAIApplicationsApi.cpp \ $${PWD}/OAIDrivesApi.cpp \ $${PWD}/OAIDrivesGetDrivesApi.cpp \ $${PWD}/OAIDrivesRootApi.cpp \ $${PWD}/OAIEducationClassApi.cpp \ $${PWD}/OAIEducationClassTeachersApi.cpp \ $${PWD}/OAIEducationSchoolApi.cpp \ $${PWD}/OAIEducationUserApi.cpp \ $${PWD}/OAIGroupApi.cpp \ $${PWD}/OAIGroupsApi.cpp \ $${PWD}/OAIMeChangepasswordApi.cpp \ $${PWD}/OAIMeDriveApi.cpp \ $${PWD}/OAIMeDriveRootApi.cpp \ $${PWD}/OAIMeDriveRootChildrenApi.cpp \ $${PWD}/OAIMeDrivesApi.cpp \ $${PWD}/OAIMeUserApi.cpp \ $${PWD}/OAITagsApi.cpp \ $${PWD}/OAIUserApi.cpp \ $${PWD}/OAIUserAppRoleAssignmentApi.cpp \ $${PWD}/OAIUsersApi.cpp \ # Others $${PWD}/OAIHelpers.cpp \ $${PWD}/OAIHttpRequest.cpp \ $${PWD}/OAIHttpFileElement.cpp \ $${PWD}/OAIOauth.cpp