Add tags api, include GetRepositoryTag, ListRepositoryTags, DeleteRepositoryTag.

This commit is contained in:
sdk-team
2020-11-26 02:21:41 +00:00
parent 5ae199177a
commit f937d7b2e5
16 changed files with 1152 additions and 0 deletions

View File

@@ -591,6 +591,42 @@ CodeupClient::DeleteRepositoryMemberOutcomeCallable CodeupClient::deleteReposito
return task->get_future();
}
CodeupClient::DeleteRepositoryTagOutcome CodeupClient::deleteRepositoryTag(const DeleteRepositoryTagRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteRepositoryTagOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteRepositoryTagOutcome(DeleteRepositoryTagResult(outcome.result()));
else
return DeleteRepositoryTagOutcome(outcome.error());
}
void CodeupClient::deleteRepositoryTagAsync(const DeleteRepositoryTagRequest& request, const DeleteRepositoryTagAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteRepositoryTag(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::DeleteRepositoryTagOutcomeCallable CodeupClient::deleteRepositoryTagCallable(const DeleteRepositoryTagRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteRepositoryTagOutcome()>>(
[this, request]()
{
return this->deleteRepositoryTag(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::GetBranchInfoOutcome CodeupClient::getBranchInfo(const GetBranchInfoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -807,6 +843,42 @@ CodeupClient::GetRepositoryInfoOutcomeCallable CodeupClient::getRepositoryInfoCa
return task->get_future();
}
CodeupClient::GetRepositoryTagOutcome CodeupClient::getRepositoryTag(const GetRepositoryTagRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetRepositoryTagOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetRepositoryTagOutcome(GetRepositoryTagResult(outcome.result()));
else
return GetRepositoryTagOutcome(outcome.error());
}
void CodeupClient::getRepositoryTagAsync(const GetRepositoryTagRequest& request, const GetRepositoryTagAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getRepositoryTag(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::GetRepositoryTagOutcomeCallable CodeupClient::getRepositoryTagCallable(const GetRepositoryTagRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetRepositoryTagOutcome()>>(
[this, request]()
{
return this->getRepositoryTag(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::ListGroupMemberOutcome CodeupClient::listGroupMember(const ListGroupMemberRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -987,6 +1059,42 @@ CodeupClient::ListRepositoryMemberOutcomeCallable CodeupClient::listRepositoryMe
return task->get_future();
}
CodeupClient::ListRepositoryTagsOutcome CodeupClient::listRepositoryTags(const ListRepositoryTagsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListRepositoryTagsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListRepositoryTagsOutcome(ListRepositoryTagsResult(outcome.result()));
else
return ListRepositoryTagsOutcome(outcome.error());
}
void CodeupClient::listRepositoryTagsAsync(const ListRepositoryTagsRequest& request, const ListRepositoryTagsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listRepositoryTags(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::ListRepositoryTagsOutcomeCallable CodeupClient::listRepositoryTagsCallable(const ListRepositoryTagsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListRepositoryTagsOutcome()>>(
[this, request]()
{
return this->listRepositoryTags(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::ListRepositoryTreeOutcome CodeupClient::listRepositoryTree(const ListRepositoryTreeRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View 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/DeleteRepositoryTagRequest.h>
using AlibabaCloud::Codeup::Model::DeleteRepositoryTagRequest;
DeleteRepositoryTagRequest::DeleteRepositoryTagRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v3/projects/[ProjectId]/repository/tags/[TagName]");
setMethod(HttpRequest::Method::Delete);
}
DeleteRepositoryTagRequest::~DeleteRepositoryTagRequest()
{}
std::string DeleteRepositoryTagRequest::getOrganizationId()const
{
return organizationId_;
}
void DeleteRepositoryTagRequest::setOrganizationId(const std::string& organizationId)
{
organizationId_ = organizationId;
setParameter("OrganizationId", organizationId);
}
std::string DeleteRepositoryTagRequest::getTagName()const
{
return tagName_;
}
void DeleteRepositoryTagRequest::setTagName(const std::string& tagName)
{
tagName_ = tagName;
setParameter("TagName", tagName);
}
std::string DeleteRepositoryTagRequest::getAccessToken()const
{
return accessToken_;
}
void DeleteRepositoryTagRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}
long DeleteRepositoryTagRequest::getProjectId()const
{
return projectId_;
}
void DeleteRepositoryTagRequest::setProjectId(long projectId)
{
projectId_ = projectId;
setParameter("ProjectId", std::to_string(projectId));
}

View File

@@ -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 <alibabacloud/codeup/model/DeleteRepositoryTagResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
DeleteRepositoryTagResult::DeleteRepositoryTagResult() :
ServiceResult()
{}
DeleteRepositoryTagResult::DeleteRepositoryTagResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DeleteRepositoryTagResult::~DeleteRepositoryTagResult()
{}
void DeleteRepositoryTagResult::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["TagName"].isNull())
result_.tagName = resultNode["TagName"].asString();
if(!value["ErrorCode"].isNull())
errorCode_ = value["ErrorCode"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
}
std::string DeleteRepositoryTagResult::getErrorCode()const
{
return errorCode_;
}
std::string DeleteRepositoryTagResult::getErrorMessage()const
{
return errorMessage_;
}
bool DeleteRepositoryTagResult::getSuccess()const
{
return success_;
}
DeleteRepositoryTagResult::Result DeleteRepositoryTagResult::getResult()const
{
return result_;
}

View 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/GetRepositoryTagRequest.h>
using AlibabaCloud::Codeup::Model::GetRepositoryTagRequest;
GetRepositoryTagRequest::GetRepositoryTagRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v3/projects/[ProjectId]/repository/tags/[TagName]");
setMethod(HttpRequest::Method::Get);
}
GetRepositoryTagRequest::~GetRepositoryTagRequest()
{}
std::string GetRepositoryTagRequest::getOrganizationId()const
{
return organizationId_;
}
void GetRepositoryTagRequest::setOrganizationId(const std::string& organizationId)
{
organizationId_ = organizationId;
setParameter("OrganizationId", organizationId);
}
std::string GetRepositoryTagRequest::getTagName()const
{
return tagName_;
}
void GetRepositoryTagRequest::setTagName(const std::string& tagName)
{
tagName_ = tagName;
setParameter("TagName", tagName);
}
std::string GetRepositoryTagRequest::getAccessToken()const
{
return accessToken_;
}
void GetRepositoryTagRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}
long GetRepositoryTagRequest::getProjectId()const
{
return projectId_;
}
void GetRepositoryTagRequest::setProjectId(long projectId)
{
projectId_ = projectId;
setParameter("ProjectId", std::to_string(projectId));
}

View File

@@ -0,0 +1,113 @@
/*
* 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/GetRepositoryTagResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
GetRepositoryTagResult::GetRepositoryTagResult() :
ServiceResult()
{}
GetRepositoryTagResult::GetRepositoryTagResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetRepositoryTagResult::~GetRepositoryTagResult()
{}
void GetRepositoryTagResult::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["Id"].isNull())
result_.id = resultNode["Id"].asString();
if(!resultNode["Name"].isNull())
result_.name = resultNode["Name"].asString();
if(!resultNode["Message"].isNull())
result_.message = resultNode["Message"].asString();
auto commitNode = resultNode["Commit"];
if(!commitNode["Id"].isNull())
result_.commit.id = commitNode["Id"].asString();
if(!commitNode["ShortId"].isNull())
result_.commit.shortId = commitNode["ShortId"].asString();
if(!commitNode["Title"].isNull())
result_.commit.title = commitNode["Title"].asString();
if(!commitNode["AuthorName"].isNull())
result_.commit.authorName = commitNode["AuthorName"].asString();
if(!commitNode["AuthorEmail"].isNull())
result_.commit.authorEmail = commitNode["AuthorEmail"].asString();
if(!commitNode["CreatedAt"].isNull())
result_.commit.createdAt = commitNode["CreatedAt"].asString();
if(!commitNode["Message"].isNull())
result_.commit.message = commitNode["Message"].asString();
if(!commitNode["AuthoredDate"].isNull())
result_.commit.authoredDate = commitNode["AuthoredDate"].asString();
if(!commitNode["CommittedDate"].isNull())
result_.commit.committedDate = commitNode["CommittedDate"].asString();
if(!commitNode["CommitterEmail"].isNull())
result_.commit.committerEmail = commitNode["CommitterEmail"].asString();
if(!commitNode["CommitterName"].isNull())
result_.commit.committerName = commitNode["CommitterName"].asString();
auto signature1Node = commitNode["Signature"];
if(!signature1Node["GpgKeyId"].isNull())
result_.commit.signature1.gpgKeyId = signature1Node["GpgKeyId"].asString();
if(!signature1Node["VerificationStatus"].isNull())
result_.commit.signature1.verificationStatus = signature1Node["VerificationStatus"].asString();
auto allParentIds = commitNode["ParentIds"]["ParentIds"];
for (auto value : allParentIds)
result_.commit.parentIds.push_back(value.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();
if(!value["ErrorCode"].isNull())
errorCode_ = value["ErrorCode"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
}
std::string GetRepositoryTagResult::getErrorCode()const
{
return errorCode_;
}
std::string GetRepositoryTagResult::getErrorMessage()const
{
return errorMessage_;
}
bool GetRepositoryTagResult::getSuccess()const
{
return success_;
}
GetRepositoryTagResult::Result GetRepositoryTagResult::getResult()const
{
return result_;
}

View File

@@ -0,0 +1,118 @@
/*
* 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/ListRepositoryTagsRequest.h>
using AlibabaCloud::Codeup::Model::ListRepositoryTagsRequest;
ListRepositoryTagsRequest::ListRepositoryTagsRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v4/projects/[ProjectId]/repository/tags");
setMethod(HttpRequest::Method::Get);
}
ListRepositoryTagsRequest::~ListRepositoryTagsRequest()
{}
std::string ListRepositoryTagsRequest::getAccessToken()const
{
return accessToken_;
}
void ListRepositoryTagsRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}
bool ListRepositoryTagsRequest::getShowSignature()const
{
return showSignature_;
}
void ListRepositoryTagsRequest::setShowSignature(bool showSignature)
{
showSignature_ = showSignature;
setParameter("ShowSignature", showSignature ? "true" : "false");
}
std::string ListRepositoryTagsRequest::getSort()const
{
return sort_;
}
void ListRepositoryTagsRequest::setSort(const std::string& sort)
{
sort_ = sort;
setParameter("Sort", sort);
}
std::string ListRepositoryTagsRequest::getOrganizationId()const
{
return organizationId_;
}
void ListRepositoryTagsRequest::setOrganizationId(const std::string& organizationId)
{
organizationId_ = organizationId;
setParameter("OrganizationId", organizationId);
}
std::string ListRepositoryTagsRequest::getSearch()const
{
return search_;
}
void ListRepositoryTagsRequest::setSearch(const std::string& search)
{
search_ = search;
setParameter("Search", search);
}
long ListRepositoryTagsRequest::getPageSize()const
{
return pageSize_;
}
void ListRepositoryTagsRequest::setPageSize(long pageSize)
{
pageSize_ = pageSize;
setParameter("PageSize", std::to_string(pageSize));
}
long ListRepositoryTagsRequest::getPage()const
{
return page_;
}
void ListRepositoryTagsRequest::setPage(long page)
{
page_ = page;
setParameter("Page", std::to_string(page));
}
long ListRepositoryTagsRequest::getProjectId()const
{
return projectId_;
}
void ListRepositoryTagsRequest::setProjectId(long projectId)
{
projectId_ = projectId;
setParameter("ProjectId", std::to_string(projectId));
}

View File

@@ -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 <alibabacloud/codeup/model/ListRepositoryTagsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
ListRepositoryTagsResult::ListRepositoryTagsResult() :
ServiceResult()
{}
ListRepositoryTagsResult::ListRepositoryTagsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListRepositoryTagsResult::~ListRepositoryTagsResult()
{}
void ListRepositoryTagsResult::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["Id"].isNull())
resultObject.id = valueResultResultItem["Id"].asString();
if(!valueResultResultItem["Name"].isNull())
resultObject.name = valueResultResultItem["Name"].asString();
if(!valueResultResultItem["Message"].isNull())
resultObject.message = valueResultResultItem["Message"].asString();
auto commitNode = value["Commit"];
if(!commitNode["Id"].isNull())
resultObject.commit.id = commitNode["Id"].asString();
if(!commitNode["ShortId"].isNull())
resultObject.commit.shortId = commitNode["ShortId"].asString();
if(!commitNode["Title"].isNull())
resultObject.commit.title = commitNode["Title"].asString();
if(!commitNode["AuthorName"].isNull())
resultObject.commit.authorName = commitNode["AuthorName"].asString();
if(!commitNode["AuthorEmail"].isNull())
resultObject.commit.authorEmail = commitNode["AuthorEmail"].asString();
if(!commitNode["CreatedAt"].isNull())
resultObject.commit.createdAt = commitNode["CreatedAt"].asString();
if(!commitNode["Message"].isNull())
resultObject.commit.message = commitNode["Message"].asString();
if(!commitNode["AuthoredDate"].isNull())
resultObject.commit.authoredDate = commitNode["AuthoredDate"].asString();
if(!commitNode["CommittedDate"].isNull())
resultObject.commit.committedDate = commitNode["CommittedDate"].asString();
if(!commitNode["CommitterEmail"].isNull())
resultObject.commit.committerEmail = commitNode["CommitterEmail"].asString();
if(!commitNode["CommitterName"].isNull())
resultObject.commit.committerName = commitNode["CommitterName"].asString();
auto signature1Node = commitNode["Signature"];
if(!signature1Node["GpgKeyId"].isNull())
resultObject.commit.signature1.gpgKeyId = signature1Node["GpgKeyId"].asString();
if(!signature1Node["VerificationStatus"].isNull())
resultObject.commit.signature1.verificationStatus = signature1Node["VerificationStatus"].asString();
auto allParentIds = commitNode["ParentIds"]["ParentIds"];
for (auto value : allParentIds)
resultObject.commit.parentIds.push_back(value.asString());
auto signatureNode = value["Signature"];
if(!signatureNode["GpgKeyId"].isNull())
resultObject.signature.gpgKeyId = signatureNode["GpgKeyId"].asString();
if(!signatureNode["VerificationStatus"].isNull())
resultObject.signature.verificationStatus = signatureNode["VerificationStatus"].asString();
result_.push_back(resultObject);
}
if(!value["ErrorCode"].isNull())
errorCode_ = value["ErrorCode"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
if(!value["Total"].isNull())
total_ = std::stol(value["Total"].asString());
}
long ListRepositoryTagsResult::getTotal()const
{
return total_;
}
std::string ListRepositoryTagsResult::getErrorCode()const
{
return errorCode_;
}
std::string ListRepositoryTagsResult::getErrorMessage()const
{
return errorMessage_;
}
bool ListRepositoryTagsResult::getSuccess()const
{
return success_;
}
std::vector<ListRepositoryTagsResult::ResultItem> ListRepositoryTagsResult::getResult()const
{
return result_;
}