diff --git a/CHANGELOG b/CHANGELOG index fad334d67..ab57f8e5e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-07-23 Version: 1.36.534 +- Supported CloudGame. + 2020-07-23 Version: 1.36.533 - Supported AAA for BBB. - Fixed bugs for CCC. diff --git a/VERSION b/VERSION index c74beeea0..fe7e8acad 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.533 \ No newline at end of file +1.36.534 \ No newline at end of file diff --git a/cloudgame/CMakeLists.txt b/cloudgame/CMakeLists.txt new file mode 100644 index 000000000..fa9a8fdbc --- /dev/null +++ b/cloudgame/CMakeLists.txt @@ -0,0 +1,90 @@ +# +# Copyright 2009-2017 Alibaba Cloud All rights reserved. +# +# 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. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(cloudgame_public_header + include/alibabacloud/cloudgame/CloudgameClient.h + include/alibabacloud/cloudgame/CloudgameExport.h ) + +set(cloudgame_public_header_model + include/alibabacloud/cloudgame/model/ListGamesRequest.h + include/alibabacloud/cloudgame/model/ListGamesResult.h + include/alibabacloud/cloudgame/model/ListProjectsRequest.h + include/alibabacloud/cloudgame/model/ListProjectsResult.h ) + +set(cloudgame_src + src/CloudgameClient.cc + src/model/ListGamesRequest.cc + src/model/ListGamesResult.cc + src/model/ListProjectsRequest.cc + src/model/ListProjectsResult.cc ) + +add_library(cloudgame ${LIB_TYPE} + ${cloudgame_public_header} + ${cloudgame_public_header_model} + ${cloudgame_src}) + +set_target_properties(cloudgame + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}cloudgame + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(cloudgame + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_CLOUDGAME_LIBRARY) +endif() + +target_include_directories(cloudgame + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(cloudgame + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(cloudgame + jsoncpp) + target_include_directories(cloudgame + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(cloudgame + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(cloudgame + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(cloudgame + PRIVATE /usr/include/jsoncpp) + target_link_libraries(cloudgame + jsoncpp) +endif() + +install(FILES ${cloudgame_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudgame) +install(FILES ${cloudgame_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudgame/model) +install(TARGETS cloudgame + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/cloudgame/include/alibabacloud/cloudgame/CloudgameClient.h b/cloudgame/include/alibabacloud/cloudgame/CloudgameClient.h new file mode 100644 index 000000000..c58ef56aa --- /dev/null +++ b/cloudgame/include/alibabacloud/cloudgame/CloudgameClient.h @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#ifndef ALIBABACLOUD_CLOUDGAME_CLOUDGAMECLIENT_H_ +#define ALIBABACLOUD_CLOUDGAME_CLOUDGAMECLIENT_H_ + +#include +#include +#include +#include +#include "CloudgameExport.h" +#include "model/ListGamesRequest.h" +#include "model/ListGamesResult.h" +#include "model/ListProjectsRequest.h" +#include "model/ListProjectsResult.h" + + +namespace AlibabaCloud +{ + namespace Cloudgame + { + class ALIBABACLOUD_CLOUDGAME_EXPORT CloudgameClient : public RpcServiceClient + { + public: + typedef Outcome ListGamesOutcome; + typedef std::future ListGamesOutcomeCallable; + typedef std::function&)> ListGamesAsyncHandler; + typedef Outcome ListProjectsOutcome; + typedef std::future ListProjectsOutcomeCallable; + typedef std::function&)> ListProjectsAsyncHandler; + + CloudgameClient(const Credentials &credentials, const ClientConfiguration &configuration); + CloudgameClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + CloudgameClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~CloudgameClient(); + ListGamesOutcome listGames(const Model::ListGamesRequest &request)const; + void listGamesAsync(const Model::ListGamesRequest& request, const ListGamesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListGamesOutcomeCallable listGamesCallable(const Model::ListGamesRequest& request) const; + ListProjectsOutcome listProjects(const Model::ListProjectsRequest &request)const; + void listProjectsAsync(const Model::ListProjectsRequest& request, const ListProjectsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListProjectsOutcomeCallable listProjectsCallable(const Model::ListProjectsRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_CLOUDGAME_CLOUDGAMECLIENT_H_ diff --git a/cloudgame/include/alibabacloud/cloudgame/CloudgameExport.h b/cloudgame/include/alibabacloud/cloudgame/CloudgameExport.h new file mode 100644 index 000000000..c0b51aac1 --- /dev/null +++ b/cloudgame/include/alibabacloud/cloudgame/CloudgameExport.h @@ -0,0 +1,32 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#ifndef ALIBABACLOUD_CLOUDGAME_CLOUDGAMEEXPORT_H_ +#define ALIBABACLOUD_CLOUDGAME_CLOUDGAMEEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_CLOUDGAME_LIBRARY) +# define ALIBABACLOUD_CLOUDGAME_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_CLOUDGAME_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_CLOUDGAME_EXPORT +#endif + +#endif // !ALIBABACLOUD_CLOUDGAME_CLOUDGAMEEXPORT_H_ \ No newline at end of file diff --git a/cloudgame/include/alibabacloud/cloudgame/model/ListGamesRequest.h b/cloudgame/include/alibabacloud/cloudgame/model/ListGamesRequest.h new file mode 100644 index 000000000..3185b233a --- /dev/null +++ b/cloudgame/include/alibabacloud/cloudgame/model/ListGamesRequest.h @@ -0,0 +1,57 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#ifndef ALIBABACLOUD_CLOUDGAME_MODEL_LISTGAMESREQUEST_H_ +#define ALIBABACLOUD_CLOUDGAME_MODEL_LISTGAMESREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudgame + { + namespace Model + { + class ALIBABACLOUD_CLOUDGAME_EXPORT ListGamesRequest : public RpcServiceRequest + { + + public: + ListGamesRequest(); + ~ListGamesRequest(); + + std::string getOrderKey()const; + void setOrderKey(const std::string& orderKey); + std::string getSortType()const; + void setSortType(const std::string& sortType); + int getPageNumber()const; + void setPageNumber(int pageNumber); + int getPageSize()const; + void setPageSize(int pageSize); + + private: + std::string orderKey_; + std::string sortType_; + int pageNumber_; + int pageSize_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDGAME_MODEL_LISTGAMESREQUEST_H_ \ No newline at end of file diff --git a/cloudgame/include/alibabacloud/cloudgame/model/ListGamesResult.h b/cloudgame/include/alibabacloud/cloudgame/model/ListGamesResult.h new file mode 100644 index 000000000..b54913a7f --- /dev/null +++ b/cloudgame/include/alibabacloud/cloudgame/model/ListGamesResult.h @@ -0,0 +1,70 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#ifndef ALIBABACLOUD_CLOUDGAME_MODEL_LISTGAMESRESULT_H_ +#define ALIBABACLOUD_CLOUDGAME_MODEL_LISTGAMESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudgame + { + namespace Model + { + class ALIBABACLOUD_CLOUDGAME_EXPORT ListGamesResult : public ServiceResult + { + public: + struct DataListItem + { + std::string status; + std::string frameRate; + std::string inputType; + std::string device; + std::string gameName; + std::string installPath; + std::string curVersion; + std::string savePath; + std::string gameId; + std::string resolution; + }; + + + ListGamesResult(); + explicit ListGamesResult(const std::string &payload); + ~ListGamesResult(); + std::vector getDataList()const; + int getPageSize()const; + int getCurrentPage()const; + std::string getCount()const; + + protected: + void parse(const std::string &payload); + private: + std::vector dataList_; + int pageSize_; + int currentPage_; + std::string count_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDGAME_MODEL_LISTGAMESRESULT_H_ \ No newline at end of file diff --git a/cloudgame/include/alibabacloud/cloudgame/model/ListProjectsRequest.h b/cloudgame/include/alibabacloud/cloudgame/model/ListProjectsRequest.h new file mode 100644 index 000000000..efe9b79c9 --- /dev/null +++ b/cloudgame/include/alibabacloud/cloudgame/model/ListProjectsRequest.h @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#ifndef ALIBABACLOUD_CLOUDGAME_MODEL_LISTPROJECTSREQUEST_H_ +#define ALIBABACLOUD_CLOUDGAME_MODEL_LISTPROJECTSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudgame + { + namespace Model + { + class ALIBABACLOUD_CLOUDGAME_EXPORT ListProjectsRequest : public RpcServiceRequest + { + + public: + ListProjectsRequest(); + ~ListProjectsRequest(); + + std::string getProjectName()const; + void setProjectName(const std::string& projectName); + int getPageNumber()const; + void setPageNumber(int pageNumber); + int getPageSize()const; + void setPageSize(int pageSize); + + private: + std::string projectName_; + int pageNumber_; + int pageSize_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDGAME_MODEL_LISTPROJECTSREQUEST_H_ \ No newline at end of file diff --git a/cloudgame/include/alibabacloud/cloudgame/model/ListProjectsResult.h b/cloudgame/include/alibabacloud/cloudgame/model/ListProjectsResult.h new file mode 100644 index 000000000..2bfb797d7 --- /dev/null +++ b/cloudgame/include/alibabacloud/cloudgame/model/ListProjectsResult.h @@ -0,0 +1,69 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#ifndef ALIBABACLOUD_CLOUDGAME_MODEL_LISTPROJECTSRESULT_H_ +#define ALIBABACLOUD_CLOUDGAME_MODEL_LISTPROJECTSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudgame + { + namespace Model + { + class ALIBABACLOUD_CLOUDGAME_EXPORT ListProjectsResult : public ServiceResult + { + public: + struct DataListItem + { + std::string highDefinitionCodeRate; + std::string highDefinitionResolution; + std::string projectName; + std::string standardResolution; + std::string projectId; + std::string highestCodeRate; + int concurrencyLimitNumber; + std::string standardCodeRate; + std::string highestResolution; + }; + + + ListProjectsResult(); + explicit ListProjectsResult(const std::string &payload); + ~ListProjectsResult(); + std::vector getDataList()const; + int getPageSize()const; + int getCurrentPage()const; + int getCount()const; + + protected: + void parse(const std::string &payload); + private: + std::vector dataList_; + int pageSize_; + int currentPage_; + int count_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDGAME_MODEL_LISTPROJECTSRESULT_H_ \ No newline at end of file diff --git a/cloudgame/src/CloudgameClient.cc b/cloudgame/src/CloudgameClient.cc new file mode 100644 index 000000000..fee4e6324 --- /dev/null +++ b/cloudgame/src/CloudgameClient.cc @@ -0,0 +1,125 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#include +#include + +using namespace AlibabaCloud; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::Cloudgame; +using namespace AlibabaCloud::Cloudgame::Model; + +namespace +{ + const std::string SERVICE_NAME = "cloudgame"; +} + +CloudgameClient::CloudgameClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +CloudgameClient::CloudgameClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +CloudgameClient::CloudgameClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +CloudgameClient::~CloudgameClient() +{} + +CloudgameClient::ListGamesOutcome CloudgameClient::listGames(const ListGamesRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListGamesOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListGamesOutcome(ListGamesResult(outcome.result())); + else + return ListGamesOutcome(outcome.error()); +} + +void CloudgameClient::listGamesAsync(const ListGamesRequest& request, const ListGamesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listGames(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudgameClient::ListGamesOutcomeCallable CloudgameClient::listGamesCallable(const ListGamesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listGames(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +CloudgameClient::ListProjectsOutcome CloudgameClient::listProjects(const ListProjectsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListProjectsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListProjectsOutcome(ListProjectsResult(outcome.result())); + else + return ListProjectsOutcome(outcome.error()); +} + +void CloudgameClient::listProjectsAsync(const ListProjectsRequest& request, const ListProjectsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listProjects(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudgameClient::ListProjectsOutcomeCallable CloudgameClient::listProjectsCallable(const ListProjectsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listProjects(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/cloudgame/src/model/ListGamesRequest.cc b/cloudgame/src/model/ListGamesRequest.cc new file mode 100644 index 000000000..301db53a0 --- /dev/null +++ b/cloudgame/src/model/ListGamesRequest.cc @@ -0,0 +1,73 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#include + +using AlibabaCloud::Cloudgame::Model::ListGamesRequest; + +ListGamesRequest::ListGamesRequest() : + RpcServiceRequest("cloudgame", "2020-04-29", "ListGames") +{ + setMethod(HttpRequest::Method::Post); +} + +ListGamesRequest::~ListGamesRequest() +{} + +std::string ListGamesRequest::getOrderKey()const +{ + return orderKey_; +} + +void ListGamesRequest::setOrderKey(const std::string& orderKey) +{ + orderKey_ = orderKey; + setParameter("OrderKey", orderKey); +} + +std::string ListGamesRequest::getSortType()const +{ + return sortType_; +} + +void ListGamesRequest::setSortType(const std::string& sortType) +{ + sortType_ = sortType; + setParameter("SortType", sortType); +} + +int ListGamesRequest::getPageNumber()const +{ + return pageNumber_; +} + +void ListGamesRequest::setPageNumber(int pageNumber) +{ + pageNumber_ = pageNumber; + setParameter("PageNumber", std::to_string(pageNumber)); +} + +int ListGamesRequest::getPageSize()const +{ + return pageSize_; +} + +void ListGamesRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + diff --git a/cloudgame/src/model/ListGamesResult.cc b/cloudgame/src/model/ListGamesResult.cc new file mode 100644 index 000000000..858338fcc --- /dev/null +++ b/cloudgame/src/model/ListGamesResult.cc @@ -0,0 +1,96 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#include +#include + +using namespace AlibabaCloud::Cloudgame; +using namespace AlibabaCloud::Cloudgame::Model; + +ListGamesResult::ListGamesResult() : + ServiceResult() +{} + +ListGamesResult::ListGamesResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ListGamesResult::~ListGamesResult() +{} + +void ListGamesResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDataListNode = value["DataList"]["DataListItem"]; + for (auto valueDataListDataListItem : allDataListNode) + { + DataListItem dataListObject; + if(!valueDataListDataListItem["GameId"].isNull()) + dataListObject.gameId = valueDataListDataListItem["GameId"].asString(); + if(!valueDataListDataListItem["GameName"].isNull()) + dataListObject.gameName = valueDataListDataListItem["GameName"].asString(); + if(!valueDataListDataListItem["InstallPath"].isNull()) + dataListObject.installPath = valueDataListDataListItem["InstallPath"].asString(); + if(!valueDataListDataListItem["SavePath"].isNull()) + dataListObject.savePath = valueDataListDataListItem["SavePath"].asString(); + if(!valueDataListDataListItem["Resolution"].isNull()) + dataListObject.resolution = valueDataListDataListItem["Resolution"].asString(); + if(!valueDataListDataListItem["FrameRate"].isNull()) + dataListObject.frameRate = valueDataListDataListItem["FrameRate"].asString(); + if(!valueDataListDataListItem["InputType"].isNull()) + dataListObject.inputType = valueDataListDataListItem["InputType"].asString(); + if(!valueDataListDataListItem["Device"].isNull()) + dataListObject.device = valueDataListDataListItem["Device"].asString(); + if(!valueDataListDataListItem["Status"].isNull()) + dataListObject.status = valueDataListDataListItem["Status"].asString(); + if(!valueDataListDataListItem["CurVersion"].isNull()) + dataListObject.curVersion = valueDataListDataListItem["CurVersion"].asString(); + dataList_.push_back(dataListObject); + } + if(!value["Count"].isNull()) + count_ = value["Count"].asString(); + if(!value["PageSize"].isNull()) + pageSize_ = std::stoi(value["PageSize"].asString()); + if(!value["CurrentPage"].isNull()) + currentPage_ = std::stoi(value["CurrentPage"].asString()); + +} + +std::vector ListGamesResult::getDataList()const +{ + return dataList_; +} + +int ListGamesResult::getPageSize()const +{ + return pageSize_; +} + +int ListGamesResult::getCurrentPage()const +{ + return currentPage_; +} + +std::string ListGamesResult::getCount()const +{ + return count_; +} + diff --git a/cloudgame/src/model/ListProjectsRequest.cc b/cloudgame/src/model/ListProjectsRequest.cc new file mode 100644 index 000000000..d8d4677f2 --- /dev/null +++ b/cloudgame/src/model/ListProjectsRequest.cc @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#include + +using AlibabaCloud::Cloudgame::Model::ListProjectsRequest; + +ListProjectsRequest::ListProjectsRequest() : + RpcServiceRequest("cloudgame", "2020-04-29", "ListProjects") +{ + setMethod(HttpRequest::Method::Post); +} + +ListProjectsRequest::~ListProjectsRequest() +{} + +std::string ListProjectsRequest::getProjectName()const +{ + return projectName_; +} + +void ListProjectsRequest::setProjectName(const std::string& projectName) +{ + projectName_ = projectName; + setParameter("ProjectName", projectName); +} + +int ListProjectsRequest::getPageNumber()const +{ + return pageNumber_; +} + +void ListProjectsRequest::setPageNumber(int pageNumber) +{ + pageNumber_ = pageNumber; + setParameter("PageNumber", std::to_string(pageNumber)); +} + +int ListProjectsRequest::getPageSize()const +{ + return pageSize_; +} + +void ListProjectsRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + diff --git a/cloudgame/src/model/ListProjectsResult.cc b/cloudgame/src/model/ListProjectsResult.cc new file mode 100644 index 000000000..557fea87b --- /dev/null +++ b/cloudgame/src/model/ListProjectsResult.cc @@ -0,0 +1,94 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * 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. + */ + +#include +#include + +using namespace AlibabaCloud::Cloudgame; +using namespace AlibabaCloud::Cloudgame::Model; + +ListProjectsResult::ListProjectsResult() : + ServiceResult() +{} + +ListProjectsResult::ListProjectsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ListProjectsResult::~ListProjectsResult() +{} + +void ListProjectsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDataListNode = value["DataList"]["DataListItem"]; + for (auto valueDataListDataListItem : allDataListNode) + { + DataListItem dataListObject; + if(!valueDataListDataListItem["StandardCodeRate"].isNull()) + dataListObject.standardCodeRate = valueDataListDataListItem["StandardCodeRate"].asString(); + if(!valueDataListDataListItem["HighDefinitionResolution"].isNull()) + dataListObject.highDefinitionResolution = valueDataListDataListItem["HighDefinitionResolution"].asString(); + if(!valueDataListDataListItem["HighDefinitionCodeRate"].isNull()) + dataListObject.highDefinitionCodeRate = valueDataListDataListItem["HighDefinitionCodeRate"].asString(); + if(!valueDataListDataListItem["StandardResolution"].isNull()) + dataListObject.standardResolution = valueDataListDataListItem["StandardResolution"].asString(); + if(!valueDataListDataListItem["ProjectId"].isNull()) + dataListObject.projectId = valueDataListDataListItem["ProjectId"].asString(); + if(!valueDataListDataListItem["ConcurrencyLimitNumber"].isNull()) + dataListObject.concurrencyLimitNumber = std::stoi(valueDataListDataListItem["ConcurrencyLimitNumber"].asString()); + if(!valueDataListDataListItem["HighestCodeRate"].isNull()) + dataListObject.highestCodeRate = valueDataListDataListItem["HighestCodeRate"].asString(); + if(!valueDataListDataListItem["ProjectName"].isNull()) + dataListObject.projectName = valueDataListDataListItem["ProjectName"].asString(); + if(!valueDataListDataListItem["HighestResolution"].isNull()) + dataListObject.highestResolution = valueDataListDataListItem["HighestResolution"].asString(); + dataList_.push_back(dataListObject); + } + if(!value["Count"].isNull()) + count_ = std::stoi(value["Count"].asString()); + if(!value["CurrentPage"].isNull()) + currentPage_ = std::stoi(value["CurrentPage"].asString()); + if(!value["PageSize"].isNull()) + pageSize_ = std::stoi(value["PageSize"].asString()); + +} + +std::vector ListProjectsResult::getDataList()const +{ + return dataList_; +} + +int ListProjectsResult::getPageSize()const +{ + return pageSize_; +} + +int ListProjectsResult::getCurrentPage()const +{ + return currentPage_; +} + +int ListProjectsResult::getCount()const +{ + return count_; +} +