Add GetRepositoryCommit and ListRepositoryCommitDiff API.
This commit is contained in:
@@ -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<const AsyncCallerContext>& 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<std::packaged_task<GetRepositoryCommitOutcome()>>(
|
||||
[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<const AsyncCallerContext>& 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<std::packaged_task<ListRepositoryCommitDiffOutcome()>>(
|
||||
[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();
|
||||
|
||||
74
codeup/src/model/GetRepositoryCommitRequest.cc
Normal file
74
codeup/src/model/GetRepositoryCommitRequest.cc
Normal file
@@ -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 <alibabacloud/codeup/model/GetRepositoryCommitRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
101
codeup/src/model/GetRepositoryCommitResult.cc
Normal file
101
codeup/src/model/GetRepositoryCommitResult.cc
Normal file
@@ -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 <alibabacloud/codeup/model/GetRepositoryCommitResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
85
codeup/src/model/ListRepositoryCommitDiffRequest.cc
Normal file
85
codeup/src/model/ListRepositoryCommitDiffRequest.cc
Normal file
@@ -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 <alibabacloud/codeup/model/ListRepositoryCommitDiffRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
102
codeup/src/model/ListRepositoryCommitDiffResult.cc
Normal file
102
codeup/src/model/ListRepositoryCommitDiffResult.cc
Normal file
@@ -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 <alibabacloud/codeup/model/ListRepositoryCommitDiffResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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::ResultItem> ListRepositoryCommitDiffResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user