From ae995d3475378df1fca696853821326b52b6d815 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Wed, 12 May 2021 14:20:44 +0000 Subject: [PATCH] Add GetRepositoryCommit and ListRepositoryCommitDiff API. --- CHANGELOG | 3 + VERSION | 2 +- codeup/CMakeLists.txt | 8 ++ .../alibabacloud/codeup/CodeupClient.h | 16 +++ .../codeup/model/GetRepositoryCommitRequest.h | 57 ++++++++++ .../codeup/model/GetRepositoryCommitResult.h | 78 ++++++++++++++ .../model/ListRepositoryCommitDiffRequest.h | 60 +++++++++++ .../model/ListRepositoryCommitDiffResult.h | 73 +++++++++++++ codeup/src/CodeupClient.cc | 72 +++++++++++++ .../src/model/GetRepositoryCommitRequest.cc | 74 +++++++++++++ codeup/src/model/GetRepositoryCommitResult.cc | 101 +++++++++++++++++ .../model/ListRepositoryCommitDiffRequest.cc | 85 +++++++++++++++ .../model/ListRepositoryCommitDiffResult.cc | 102 ++++++++++++++++++ 13 files changed, 730 insertions(+), 1 deletion(-) create mode 100644 codeup/include/alibabacloud/codeup/model/GetRepositoryCommitRequest.h create mode 100644 codeup/include/alibabacloud/codeup/model/GetRepositoryCommitResult.h create mode 100644 codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffRequest.h create mode 100644 codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffResult.h create mode 100644 codeup/src/model/GetRepositoryCommitRequest.cc create mode 100644 codeup/src/model/GetRepositoryCommitResult.cc create mode 100644 codeup/src/model/ListRepositoryCommitDiffRequest.cc create mode 100644 codeup/src/model/ListRepositoryCommitDiffResult.cc diff --git a/CHANGELOG b/CHANGELOG index 3b1859dbb..af5e38123 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2021-05-12 Version: 1.36.729 +- Add GetRepositoryCommit and ListRepositoryCommitDiff API. + 2021-05-12 Version: 1.36.728 - Create Lindorm Open api. diff --git a/VERSION b/VERSION index 3c833f157..57f7ea94a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.728 \ No newline at end of file +1.36.729 \ No newline at end of file diff --git a/codeup/CMakeLists.txt b/codeup/CMakeLists.txt index 90b703c06..9eefa18da 100644 --- a/codeup/CMakeLists.txt +++ b/codeup/CMakeLists.txt @@ -89,6 +89,8 @@ set(codeup_public_header_model include/alibabacloud/codeup/model/GetOrganizationSecurityCenterStatusResult.h include/alibabacloud/codeup/model/GetProjectMemberRequest.h include/alibabacloud/codeup/model/GetProjectMemberResult.h + include/alibabacloud/codeup/model/GetRepositoryCommitRequest.h + include/alibabacloud/codeup/model/GetRepositoryCommitResult.h include/alibabacloud/codeup/model/GetRepositoryInfoRequest.h include/alibabacloud/codeup/model/GetRepositoryInfoResult.h include/alibabacloud/codeup/model/GetRepositoryTagRequest.h @@ -115,6 +117,8 @@ set(codeup_public_header_model include/alibabacloud/codeup/model/ListRepositoriesResult.h include/alibabacloud/codeup/model/ListRepositoryBranchesRequest.h include/alibabacloud/codeup/model/ListRepositoryBranchesResult.h + include/alibabacloud/codeup/model/ListRepositoryCommitDiffRequest.h + include/alibabacloud/codeup/model/ListRepositoryCommitDiffResult.h include/alibabacloud/codeup/model/ListRepositoryCommitsRequest.h include/alibabacloud/codeup/model/ListRepositoryCommitsResult.h include/alibabacloud/codeup/model/ListRepositoryMemberRequest.h @@ -214,6 +218,8 @@ set(codeup_src src/model/GetOrganizationSecurityCenterStatusResult.cc src/model/GetProjectMemberRequest.cc src/model/GetProjectMemberResult.cc + src/model/GetRepositoryCommitRequest.cc + src/model/GetRepositoryCommitResult.cc src/model/GetRepositoryInfoRequest.cc src/model/GetRepositoryInfoResult.cc src/model/GetRepositoryTagRequest.cc @@ -240,6 +246,8 @@ set(codeup_src src/model/ListRepositoriesResult.cc src/model/ListRepositoryBranchesRequest.cc src/model/ListRepositoryBranchesResult.cc + src/model/ListRepositoryCommitDiffRequest.cc + src/model/ListRepositoryCommitDiffResult.cc src/model/ListRepositoryCommitsRequest.cc src/model/ListRepositoryCommitsResult.cc src/model/ListRepositoryMemberRequest.cc diff --git a/codeup/include/alibabacloud/codeup/CodeupClient.h b/codeup/include/alibabacloud/codeup/CodeupClient.h index b75743682..9dcda417c 100644 --- a/codeup/include/alibabacloud/codeup/CodeupClient.h +++ b/codeup/include/alibabacloud/codeup/CodeupClient.h @@ -90,6 +90,8 @@ #include "model/GetOrganizationSecurityCenterStatusResult.h" #include "model/GetProjectMemberRequest.h" #include "model/GetProjectMemberResult.h" +#include "model/GetRepositoryCommitRequest.h" +#include "model/GetRepositoryCommitResult.h" #include "model/GetRepositoryInfoRequest.h" #include "model/GetRepositoryInfoResult.h" #include "model/GetRepositoryTagRequest.h" @@ -116,6 +118,8 @@ #include "model/ListRepositoriesResult.h" #include "model/ListRepositoryBranchesRequest.h" #include "model/ListRepositoryBranchesResult.h" +#include "model/ListRepositoryCommitDiffRequest.h" +#include "model/ListRepositoryCommitDiffResult.h" #include "model/ListRepositoryCommitsRequest.h" #include "model/ListRepositoryCommitsResult.h" #include "model/ListRepositoryMemberRequest.h" @@ -255,6 +259,9 @@ namespace AlibabaCloud typedef Outcome GetProjectMemberOutcome; typedef std::future GetProjectMemberOutcomeCallable; typedef std::function&)> GetProjectMemberAsyncHandler; + typedef Outcome GetRepositoryCommitOutcome; + typedef std::future GetRepositoryCommitOutcomeCallable; + typedef std::function&)> GetRepositoryCommitAsyncHandler; typedef Outcome GetRepositoryInfoOutcome; typedef std::future GetRepositoryInfoOutcomeCallable; typedef std::function&)> GetRepositoryInfoAsyncHandler; @@ -294,6 +301,9 @@ namespace AlibabaCloud typedef Outcome ListRepositoryBranchesOutcome; typedef std::future ListRepositoryBranchesOutcomeCallable; typedef std::function&)> ListRepositoryBranchesAsyncHandler; + typedef Outcome ListRepositoryCommitDiffOutcome; + typedef std::future ListRepositoryCommitDiffOutcomeCallable; + typedef std::function&)> ListRepositoryCommitDiffAsyncHandler; typedef Outcome ListRepositoryCommitsOutcome; typedef std::future ListRepositoryCommitsOutcomeCallable; typedef std::function&)> ListRepositoryCommitsAsyncHandler; @@ -443,6 +453,9 @@ namespace AlibabaCloud GetProjectMemberOutcome getProjectMember(const Model::GetProjectMemberRequest &request)const; void getProjectMemberAsync(const Model::GetProjectMemberRequest& request, const GetProjectMemberAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetProjectMemberOutcomeCallable getProjectMemberCallable(const Model::GetProjectMemberRequest& request) const; + GetRepositoryCommitOutcome getRepositoryCommit(const Model::GetRepositoryCommitRequest &request)const; + void getRepositoryCommitAsync(const Model::GetRepositoryCommitRequest& request, const GetRepositoryCommitAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetRepositoryCommitOutcomeCallable getRepositoryCommitCallable(const Model::GetRepositoryCommitRequest& request) const; GetRepositoryInfoOutcome getRepositoryInfo(const Model::GetRepositoryInfoRequest &request)const; void getRepositoryInfoAsync(const Model::GetRepositoryInfoRequest& request, const GetRepositoryInfoAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetRepositoryInfoOutcomeCallable getRepositoryInfoCallable(const Model::GetRepositoryInfoRequest& request) const; @@ -482,6 +495,9 @@ namespace AlibabaCloud ListRepositoryBranchesOutcome listRepositoryBranches(const Model::ListRepositoryBranchesRequest &request)const; void listRepositoryBranchesAsync(const Model::ListRepositoryBranchesRequest& request, const ListRepositoryBranchesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListRepositoryBranchesOutcomeCallable listRepositoryBranchesCallable(const Model::ListRepositoryBranchesRequest& request) const; + ListRepositoryCommitDiffOutcome listRepositoryCommitDiff(const Model::ListRepositoryCommitDiffRequest &request)const; + void listRepositoryCommitDiffAsync(const Model::ListRepositoryCommitDiffRequest& request, const ListRepositoryCommitDiffAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListRepositoryCommitDiffOutcomeCallable listRepositoryCommitDiffCallable(const Model::ListRepositoryCommitDiffRequest& request) const; ListRepositoryCommitsOutcome listRepositoryCommits(const Model::ListRepositoryCommitsRequest &request)const; void listRepositoryCommitsAsync(const Model::ListRepositoryCommitsRequest& request, const ListRepositoryCommitsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListRepositoryCommitsOutcomeCallable listRepositoryCommitsCallable(const Model::ListRepositoryCommitsRequest& request) const; diff --git a/codeup/include/alibabacloud/codeup/model/GetRepositoryCommitRequest.h b/codeup/include/alibabacloud/codeup/model/GetRepositoryCommitRequest.h new file mode 100644 index 000000000..d5013d036 --- /dev/null +++ b/codeup/include/alibabacloud/codeup/model/GetRepositoryCommitRequest.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_CODEUP_MODEL_GETREPOSITORYCOMMITREQUEST_H_ +#define ALIBABACLOUD_CODEUP_MODEL_GETREPOSITORYCOMMITREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Codeup + { + namespace Model + { + class ALIBABACLOUD_CODEUP_EXPORT GetRepositoryCommitRequest : public RoaServiceRequest + { + + public: + GetRepositoryCommitRequest(); + ~GetRepositoryCommitRequest(); + + std::string getOrganizationId()const; + void setOrganizationId(const std::string& organizationId); + std::string getAccessToken()const; + void setAccessToken(const std::string& accessToken); + long getProjectId()const; + void setProjectId(long projectId); + std::string getSha()const; + void setSha(const std::string& sha); + + private: + std::string organizationId_; + std::string accessToken_; + long projectId_; + std::string sha_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CODEUP_MODEL_GETREPOSITORYCOMMITREQUEST_H_ \ No newline at end of file diff --git a/codeup/include/alibabacloud/codeup/model/GetRepositoryCommitResult.h b/codeup/include/alibabacloud/codeup/model/GetRepositoryCommitResult.h new file mode 100644 index 000000000..3a22468ea --- /dev/null +++ b/codeup/include/alibabacloud/codeup/model/GetRepositoryCommitResult.h @@ -0,0 +1,78 @@ +/* + * 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_CODEUP_MODEL_GETREPOSITORYCOMMITRESULT_H_ +#define ALIBABACLOUD_CODEUP_MODEL_GETREPOSITORYCOMMITRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Codeup + { + namespace Model + { + class ALIBABACLOUD_CODEUP_EXPORT GetRepositoryCommitResult : public ServiceResult + { + public: + struct Result + { + struct Signature + { + std::string verificationStatus; + std::string gpgKeyId; + }; + std::string authorName; + std::string message; + std::string createdAt; + std::string title; + std::string authorEmail; + std::string authorDate; + std::string committedDate; + std::string committerEmail; + std::vector parentIds; + Signature signature; + std::string shortId; + std::string id; + std::string committerName; + }; + + + GetRepositoryCommitResult(); + explicit GetRepositoryCommitResult(const std::string &payload); + ~GetRepositoryCommitResult(); + std::string getErrorCode()const; + std::string getErrorMessage()const; + bool getSuccess()const; + Result getResult()const; + + protected: + void parse(const std::string &payload); + private: + std::string errorCode_; + std::string errorMessage_; + bool success_; + Result result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CODEUP_MODEL_GETREPOSITORYCOMMITRESULT_H_ \ No newline at end of file diff --git a/codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffRequest.h b/codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffRequest.h new file mode 100644 index 000000000..839cb5431 --- /dev/null +++ b/codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffRequest.h @@ -0,0 +1,60 @@ +/* + * 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_CODEUP_MODEL_LISTREPOSITORYCOMMITDIFFREQUEST_H_ +#define ALIBABACLOUD_CODEUP_MODEL_LISTREPOSITORYCOMMITDIFFREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Codeup + { + namespace Model + { + class ALIBABACLOUD_CODEUP_EXPORT ListRepositoryCommitDiffRequest : public RoaServiceRequest + { + + public: + ListRepositoryCommitDiffRequest(); + ~ListRepositoryCommitDiffRequest(); + + std::string getOrganizationId()const; + void setOrganizationId(const std::string& organizationId); + std::string getAccessToken()const; + void setAccessToken(const std::string& accessToken); + int getContextLine()const; + void setContextLine(int contextLine); + long getProjectId()const; + void setProjectId(long projectId); + std::string getSha()const; + void setSha(const std::string& sha); + + private: + std::string organizationId_; + std::string accessToken_; + int contextLine_; + long projectId_; + std::string sha_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CODEUP_MODEL_LISTREPOSITORYCOMMITDIFFREQUEST_H_ \ No newline at end of file diff --git a/codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffResult.h b/codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffResult.h new file mode 100644 index 000000000..fedb37fe3 --- /dev/null +++ b/codeup/include/alibabacloud/codeup/model/ListRepositoryCommitDiffResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_CODEUP_MODEL_LISTREPOSITORYCOMMITDIFFRESULT_H_ +#define ALIBABACLOUD_CODEUP_MODEL_LISTREPOSITORYCOMMITDIFFRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Codeup + { + namespace Model + { + class ALIBABACLOUD_CODEUP_EXPORT ListRepositoryCommitDiffResult : public ServiceResult + { + public: + struct ResultItem + { + bool isNewLfs; + std::string newId; + std::string bMode; + std::string diff; + bool deletedFile; + std::string oldId; + bool isOldLfs; + bool newFile; + std::string oldPath; + bool renamedFile; + bool isBinary; + std::string newPath; + std::string aMode; + }; + + + ListRepositoryCommitDiffResult(); + explicit ListRepositoryCommitDiffResult(const std::string &payload); + ~ListRepositoryCommitDiffResult(); + std::string getErrorCode()const; + std::string getErrorMessage()const; + bool getSuccess()const; + std::vector getResult()const; + + protected: + void parse(const std::string &payload); + private: + std::string errorCode_; + std::string errorMessage_; + bool success_; + std::vector result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CODEUP_MODEL_LISTREPOSITORYCOMMITDIFFRESULT_H_ \ No newline at end of file diff --git a/codeup/src/CodeupClient.cc b/codeup/src/CodeupClient.cc index d9c968c2a..15ccc3530 100644 --- a/codeup/src/CodeupClient.cc +++ b/codeup/src/CodeupClient.cc @@ -1275,6 +1275,42 @@ CodeupClient::GetProjectMemberOutcomeCallable CodeupClient::getProjectMemberCall return task->get_future(); } +CodeupClient::GetRepositoryCommitOutcome CodeupClient::getRepositoryCommit(const GetRepositoryCommitRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetRepositoryCommitOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetRepositoryCommitOutcome(GetRepositoryCommitResult(outcome.result())); + else + return GetRepositoryCommitOutcome(outcome.error()); +} + +void CodeupClient::getRepositoryCommitAsync(const GetRepositoryCommitRequest& request, const GetRepositoryCommitAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getRepositoryCommit(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CodeupClient::GetRepositoryCommitOutcomeCallable CodeupClient::getRepositoryCommitCallable(const GetRepositoryCommitRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getRepositoryCommit(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + CodeupClient::GetRepositoryInfoOutcome CodeupClient::getRepositoryInfo(const GetRepositoryInfoRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -1743,6 +1779,42 @@ CodeupClient::ListRepositoryBranchesOutcomeCallable CodeupClient::listRepository return task->get_future(); } +CodeupClient::ListRepositoryCommitDiffOutcome CodeupClient::listRepositoryCommitDiff(const ListRepositoryCommitDiffRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListRepositoryCommitDiffOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListRepositoryCommitDiffOutcome(ListRepositoryCommitDiffResult(outcome.result())); + else + return ListRepositoryCommitDiffOutcome(outcome.error()); +} + +void CodeupClient::listRepositoryCommitDiffAsync(const ListRepositoryCommitDiffRequest& request, const ListRepositoryCommitDiffAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listRepositoryCommitDiff(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CodeupClient::ListRepositoryCommitDiffOutcomeCallable CodeupClient::listRepositoryCommitDiffCallable(const ListRepositoryCommitDiffRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listRepositoryCommitDiff(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + CodeupClient::ListRepositoryCommitsOutcome CodeupClient::listRepositoryCommits(const ListRepositoryCommitsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/codeup/src/model/GetRepositoryCommitRequest.cc b/codeup/src/model/GetRepositoryCommitRequest.cc new file mode 100644 index 000000000..2d8f35756 --- /dev/null +++ b/codeup/src/model/GetRepositoryCommitRequest.cc @@ -0,0 +1,74 @@ +/* + * 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::Codeup::Model::GetRepositoryCommitRequest; + +GetRepositoryCommitRequest::GetRepositoryCommitRequest() : + RoaServiceRequest("codeup", "2020-04-14") +{ + setResourcePath("/api/v4/projects/[ProjectId]/repository/commits/[Sha]"); + setMethod(HttpRequest::Method::Get); +} + +GetRepositoryCommitRequest::~GetRepositoryCommitRequest() +{} + +std::string GetRepositoryCommitRequest::getOrganizationId()const +{ + return organizationId_; +} + +void GetRepositoryCommitRequest::setOrganizationId(const std::string& organizationId) +{ + organizationId_ = organizationId; + setParameter("OrganizationId", organizationId); +} + +std::string GetRepositoryCommitRequest::getAccessToken()const +{ + return accessToken_; +} + +void GetRepositoryCommitRequest::setAccessToken(const std::string& accessToken) +{ + accessToken_ = accessToken; + setParameter("AccessToken", accessToken); +} + +long GetRepositoryCommitRequest::getProjectId()const +{ + return projectId_; +} + +void GetRepositoryCommitRequest::setProjectId(long projectId) +{ + projectId_ = projectId; + setParameter("ProjectId", std::to_string(projectId)); +} + +std::string GetRepositoryCommitRequest::getSha()const +{ + return sha_; +} + +void GetRepositoryCommitRequest::setSha(const std::string& sha) +{ + sha_ = sha; + setParameter("Sha", sha); +} + diff --git a/codeup/src/model/GetRepositoryCommitResult.cc b/codeup/src/model/GetRepositoryCommitResult.cc new file mode 100644 index 000000000..bea67f322 --- /dev/null +++ b/codeup/src/model/GetRepositoryCommitResult.cc @@ -0,0 +1,101 @@ +/* + * 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::Codeup; +using namespace AlibabaCloud::Codeup::Model; + +GetRepositoryCommitResult::GetRepositoryCommitResult() : + ServiceResult() +{} + +GetRepositoryCommitResult::GetRepositoryCommitResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetRepositoryCommitResult::~GetRepositoryCommitResult() +{} + +void GetRepositoryCommitResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto resultNode = value["Result"]; + if(!resultNode["AuthorDate"].isNull()) + result_.authorDate = resultNode["AuthorDate"].asString(); + if(!resultNode["AuthorEmail"].isNull()) + result_.authorEmail = resultNode["AuthorEmail"].asString(); + if(!resultNode["AuthorName"].isNull()) + result_.authorName = resultNode["AuthorName"].asString(); + if(!resultNode["CommittedDate"].isNull()) + result_.committedDate = resultNode["CommittedDate"].asString(); + if(!resultNode["CommitterEmail"].isNull()) + result_.committerEmail = resultNode["CommitterEmail"].asString(); + if(!resultNode["CommitterName"].isNull()) + result_.committerName = resultNode["CommitterName"].asString(); + if(!resultNode["CreatedAt"].isNull()) + result_.createdAt = resultNode["CreatedAt"].asString(); + if(!resultNode["Id"].isNull()) + result_.id = resultNode["Id"].asString(); + if(!resultNode["Message"].isNull()) + result_.message = resultNode["Message"].asString(); + if(!resultNode["ShortId"].isNull()) + result_.shortId = resultNode["ShortId"].asString(); + if(!resultNode["Title"].isNull()) + result_.title = resultNode["Title"].asString(); + auto signatureNode = resultNode["Signature"]; + if(!signatureNode["GpgKeyId"].isNull()) + result_.signature.gpgKeyId = signatureNode["GpgKeyId"].asString(); + if(!signatureNode["VerificationStatus"].isNull()) + result_.signature.verificationStatus = signatureNode["VerificationStatus"].asString(); + auto allParentIds = resultNode["ParentIds"]["ParentIds"]; + for (auto value : allParentIds) + result_.parentIds.push_back(value.asString()); + if(!value["ErrorCode"].isNull()) + errorCode_ = value["ErrorCode"].asString(); + if(!value["ErrorMessage"].isNull()) + errorMessage_ = value["ErrorMessage"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::string GetRepositoryCommitResult::getErrorCode()const +{ + return errorCode_; +} + +std::string GetRepositoryCommitResult::getErrorMessage()const +{ + return errorMessage_; +} + +bool GetRepositoryCommitResult::getSuccess()const +{ + return success_; +} + +GetRepositoryCommitResult::Result GetRepositoryCommitResult::getResult()const +{ + return result_; +} + diff --git a/codeup/src/model/ListRepositoryCommitDiffRequest.cc b/codeup/src/model/ListRepositoryCommitDiffRequest.cc new file mode 100644 index 000000000..5122e55fa --- /dev/null +++ b/codeup/src/model/ListRepositoryCommitDiffRequest.cc @@ -0,0 +1,85 @@ +/* + * 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::Codeup::Model::ListRepositoryCommitDiffRequest; + +ListRepositoryCommitDiffRequest::ListRepositoryCommitDiffRequest() : + RoaServiceRequest("codeup", "2020-04-14") +{ + setResourcePath("/api/v3/projects/[ProjectId]/repository/commits/[Sha]/diff"); + setMethod(HttpRequest::Method::Get); +} + +ListRepositoryCommitDiffRequest::~ListRepositoryCommitDiffRequest() +{} + +std::string ListRepositoryCommitDiffRequest::getOrganizationId()const +{ + return organizationId_; +} + +void ListRepositoryCommitDiffRequest::setOrganizationId(const std::string& organizationId) +{ + organizationId_ = organizationId; + setParameter("OrganizationId", organizationId); +} + +std::string ListRepositoryCommitDiffRequest::getAccessToken()const +{ + return accessToken_; +} + +void ListRepositoryCommitDiffRequest::setAccessToken(const std::string& accessToken) +{ + accessToken_ = accessToken; + setParameter("AccessToken", accessToken); +} + +int ListRepositoryCommitDiffRequest::getContextLine()const +{ + return contextLine_; +} + +void ListRepositoryCommitDiffRequest::setContextLine(int contextLine) +{ + contextLine_ = contextLine; + setParameter("ContextLine", std::to_string(contextLine)); +} + +long ListRepositoryCommitDiffRequest::getProjectId()const +{ + return projectId_; +} + +void ListRepositoryCommitDiffRequest::setProjectId(long projectId) +{ + projectId_ = projectId; + setParameter("ProjectId", std::to_string(projectId)); +} + +std::string ListRepositoryCommitDiffRequest::getSha()const +{ + return sha_; +} + +void ListRepositoryCommitDiffRequest::setSha(const std::string& sha) +{ + sha_ = sha; + setParameter("Sha", sha); +} + diff --git a/codeup/src/model/ListRepositoryCommitDiffResult.cc b/codeup/src/model/ListRepositoryCommitDiffResult.cc new file mode 100644 index 000000000..e50c2461c --- /dev/null +++ b/codeup/src/model/ListRepositoryCommitDiffResult.cc @@ -0,0 +1,102 @@ +/* + * 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::Codeup; +using namespace AlibabaCloud::Codeup::Model; + +ListRepositoryCommitDiffResult::ListRepositoryCommitDiffResult() : + ServiceResult() +{} + +ListRepositoryCommitDiffResult::ListRepositoryCommitDiffResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ListRepositoryCommitDiffResult::~ListRepositoryCommitDiffResult() +{} + +void ListRepositoryCommitDiffResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allResultNode = value["Result"]["ResultItem"]; + for (auto valueResultResultItem : allResultNode) + { + ResultItem resultObject; + if(!valueResultResultItem["AMode"].isNull()) + resultObject.aMode = valueResultResultItem["AMode"].asString(); + if(!valueResultResultItem["BMode"].isNull()) + resultObject.bMode = valueResultResultItem["BMode"].asString(); + if(!valueResultResultItem["DeletedFile"].isNull()) + resultObject.deletedFile = valueResultResultItem["DeletedFile"].asString() == "true"; + if(!valueResultResultItem["Diff"].isNull()) + resultObject.diff = valueResultResultItem["Diff"].asString(); + if(!valueResultResultItem["IsBinary"].isNull()) + resultObject.isBinary = valueResultResultItem["IsBinary"].asString() == "true"; + if(!valueResultResultItem["IsNewLfs"].isNull()) + resultObject.isNewLfs = valueResultResultItem["IsNewLfs"].asString() == "true"; + if(!valueResultResultItem["IsOldLfs"].isNull()) + resultObject.isOldLfs = valueResultResultItem["IsOldLfs"].asString() == "true"; + if(!valueResultResultItem["NewFile"].isNull()) + resultObject.newFile = valueResultResultItem["NewFile"].asString() == "true"; + if(!valueResultResultItem["NewId"].isNull()) + resultObject.newId = valueResultResultItem["NewId"].asString(); + if(!valueResultResultItem["NewPath"].isNull()) + resultObject.newPath = valueResultResultItem["NewPath"].asString(); + if(!valueResultResultItem["OldId"].isNull()) + resultObject.oldId = valueResultResultItem["OldId"].asString(); + if(!valueResultResultItem["OldPath"].isNull()) + resultObject.oldPath = valueResultResultItem["OldPath"].asString(); + if(!valueResultResultItem["RenamedFile"].isNull()) + resultObject.renamedFile = valueResultResultItem["RenamedFile"].asString() == "true"; + result_.push_back(resultObject); + } + if(!value["ErrorCode"].isNull()) + errorCode_ = value["ErrorCode"].asString(); + if(!value["ErrorMessage"].isNull()) + errorMessage_ = value["ErrorMessage"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::string ListRepositoryCommitDiffResult::getErrorCode()const +{ + return errorCode_; +} + +std::string ListRepositoryCommitDiffResult::getErrorMessage()const +{ + return errorMessage_; +} + +bool ListRepositoryCommitDiffResult::getSuccess()const +{ + return success_; +} + +std::vector ListRepositoryCommitDiffResult::getResult()const +{ + return result_; +} +