Support ListRepositories, ListOrganizations, GetUserInfo, ListRepositoryWebhook, DeleteRepositoryWebhook api.

This commit is contained in:
sdk-team
2020-12-18 11:05:12 +00:00
parent 4b1cbc0461
commit cf63bd74d6
26 changed files with 1763 additions and 0 deletions

View File

@@ -627,6 +627,42 @@ CodeupClient::DeleteRepositoryTagOutcomeCallable CodeupClient::deleteRepositoryT
return task->get_future();
}
CodeupClient::DeleteRepositoryWebhookOutcome CodeupClient::deleteRepositoryWebhook(const DeleteRepositoryWebhookRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteRepositoryWebhookOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteRepositoryWebhookOutcome(DeleteRepositoryWebhookResult(outcome.result()));
else
return DeleteRepositoryWebhookOutcome(outcome.error());
}
void CodeupClient::deleteRepositoryWebhookAsync(const DeleteRepositoryWebhookRequest& request, const DeleteRepositoryWebhookAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteRepositoryWebhook(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::DeleteRepositoryWebhookOutcomeCallable CodeupClient::deleteRepositoryWebhookCallable(const DeleteRepositoryWebhookRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteRepositoryWebhookOutcome()>>(
[this, request]()
{
return this->deleteRepositoryWebhook(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::GetBranchInfoOutcome CodeupClient::getBranchInfo(const GetBranchInfoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -879,6 +915,42 @@ CodeupClient::GetRepositoryTagOutcomeCallable CodeupClient::getRepositoryTagCall
return task->get_future();
}
CodeupClient::GetUserInfoOutcome CodeupClient::getUserInfo(const GetUserInfoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetUserInfoOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetUserInfoOutcome(GetUserInfoResult(outcome.result()));
else
return GetUserInfoOutcome(outcome.error());
}
void CodeupClient::getUserInfoAsync(const GetUserInfoRequest& request, const GetUserInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getUserInfo(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::GetUserInfoOutcomeCallable CodeupClient::getUserInfoCallable(const GetUserInfoRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetUserInfoOutcome()>>(
[this, request]()
{
return this->getUserInfo(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,78 @@ CodeupClient::ListGroupsOutcomeCallable CodeupClient::listGroupsCallable(const L
return task->get_future();
}
CodeupClient::ListOrganizationsOutcome CodeupClient::listOrganizations(const ListOrganizationsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListOrganizationsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListOrganizationsOutcome(ListOrganizationsResult(outcome.result()));
else
return ListOrganizationsOutcome(outcome.error());
}
void CodeupClient::listOrganizationsAsync(const ListOrganizationsRequest& request, const ListOrganizationsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listOrganizations(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::ListOrganizationsOutcomeCallable CodeupClient::listOrganizationsCallable(const ListOrganizationsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListOrganizationsOutcome()>>(
[this, request]()
{
return this->listOrganizations(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::ListRepositoriesOutcome CodeupClient::listRepositories(const ListRepositoriesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListRepositoriesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListRepositoriesOutcome(ListRepositoriesResult(outcome.result()));
else
return ListRepositoriesOutcome(outcome.error());
}
void CodeupClient::listRepositoriesAsync(const ListRepositoriesRequest& request, const ListRepositoriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listRepositories(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::ListRepositoriesOutcomeCallable CodeupClient::listRepositoriesCallable(const ListRepositoriesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListRepositoriesOutcome()>>(
[this, request]()
{
return this->listRepositories(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::ListRepositoryBranchesOutcome CodeupClient::listRepositoryBranches(const ListRepositoryBranchesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -1131,6 +1275,42 @@ CodeupClient::ListRepositoryTreeOutcomeCallable CodeupClient::listRepositoryTree
return task->get_future();
}
CodeupClient::ListRepositoryWebhookOutcome CodeupClient::listRepositoryWebhook(const ListRepositoryWebhookRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListRepositoryWebhookOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListRepositoryWebhookOutcome(ListRepositoryWebhookResult(outcome.result()));
else
return ListRepositoryWebhookOutcome(outcome.error());
}
void CodeupClient::listRepositoryWebhookAsync(const ListRepositoryWebhookRequest& request, const ListRepositoryWebhookAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listRepositoryWebhook(request), context);
};
asyncExecute(new Runnable(fn));
}
CodeupClient::ListRepositoryWebhookOutcomeCallable CodeupClient::listRepositoryWebhookCallable(const ListRepositoryWebhookRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListRepositoryWebhookOutcome()>>(
[this, request]()
{
return this->listRepositoryWebhook(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CodeupClient::MergeMergeRequestOutcome CodeupClient::mergeMergeRequest(const MergeMergeRequestRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -66,6 +66,8 @@ void AddWebhookResult::parse(const std::string &payload)
result_.lastTestResult = resultNode["LastTestResult"].asString();
if(!resultNode["Description"].isNull())
result_.description = resultNode["Description"].asString();
if(!resultNode["SecretToken"].isNull())
result_.secretToken = resultNode["SecretToken"].asString();
if(!value["ErrorCode"].isNull())
errorCode_ = value["ErrorCode"].asString();
if(!value["Success"].isNull())

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

View File

@@ -0,0 +1,95 @@
/*
* 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/DeleteRepositoryWebhookResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
DeleteRepositoryWebhookResult::DeleteRepositoryWebhookResult() :
ServiceResult()
{}
DeleteRepositoryWebhookResult::DeleteRepositoryWebhookResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DeleteRepositoryWebhookResult::~DeleteRepositoryWebhookResult()
{}
void DeleteRepositoryWebhookResult::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 = std::stol(resultNode["Id"].asString());
if(!resultNode["Url"].isNull())
result_.url = resultNode["Url"].asString();
if(!resultNode["CreatedAt"].isNull())
result_.createdAt = resultNode["CreatedAt"].asString();
if(!resultNode["ProjectId"].isNull())
result_.projectId = std::stol(resultNode["ProjectId"].asString());
if(!resultNode["PushEvents"].isNull())
result_.pushEvents = resultNode["PushEvents"].asString() == "true";
if(!resultNode["MergeRequestsEvents"].isNull())
result_.mergeRequestsEvents = resultNode["MergeRequestsEvents"].asString() == "true";
if(!resultNode["TagPushEvents"].isNull())
result_.tagPushEvents = resultNode["TagPushEvents"].asString() == "true";
if(!resultNode["NoteEvents"].isNull())
result_.noteEvents = resultNode["NoteEvents"].asString() == "true";
if(!resultNode["EnableSslVerification"].isNull())
result_.enableSslVerification = resultNode["EnableSslVerification"].asString() == "true";
if(!resultNode["LastTestResult"].isNull())
result_.lastTestResult = resultNode["LastTestResult"].asString();
if(!resultNode["Description"].isNull())
result_.description = resultNode["Description"].asString();
if(!resultNode["SecretToken"].isNull())
result_.secretToken = resultNode["SecretToken"].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 DeleteRepositoryWebhookResult::getErrorCode()const
{
return errorCode_;
}
std::string DeleteRepositoryWebhookResult::getErrorMessage()const
{
return errorMessage_;
}
bool DeleteRepositoryWebhookResult::getSuccess()const
{
return success_;
}
DeleteRepositoryWebhookResult::Result DeleteRepositoryWebhookResult::getResult()const
{
return result_;
}

View File

@@ -0,0 +1,41 @@
/*
* 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/GetUserInfoRequest.h>
using AlibabaCloud::Codeup::Model::GetUserInfoRequest;
GetUserInfoRequest::GetUserInfoRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v3/user/current");
setMethod(HttpRequest::Method::Get);
}
GetUserInfoRequest::~GetUserInfoRequest()
{}
std::string GetUserInfoRequest::getAccessToken()const
{
return accessToken_;
}
void GetUserInfoRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}

View File

@@ -0,0 +1,83 @@
/*
* 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/GetUserInfoResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
GetUserInfoResult::GetUserInfoResult() :
ServiceResult()
{}
GetUserInfoResult::GetUserInfoResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetUserInfoResult::~GetUserInfoResult()
{}
void GetUserInfoResult::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 = std::stol(resultNode["Id"].asString());
if(!resultNode["ExternalUserId"].isNull())
result_.externalUserId = resultNode["ExternalUserId"].asString();
if(!resultNode["Username"].isNull())
result_.username = resultNode["Username"].asString();
if(!resultNode["Name"].isNull())
result_.name = resultNode["Name"].asString();
if(!resultNode["Email"].isNull())
result_.email = resultNode["Email"].asString();
if(!resultNode["AvatarUrl"].isNull())
result_.avatarUrl = resultNode["AvatarUrl"].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 GetUserInfoResult::getErrorCode()const
{
return errorCode_;
}
std::string GetUserInfoResult::getErrorMessage()const
{
return errorMessage_;
}
bool GetUserInfoResult::getSuccess()const
{
return success_;
}
GetUserInfoResult::Result GetUserInfoResult::getResult()const
{
return result_;
}

View File

@@ -0,0 +1,63 @@
/*
* 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/ListOrganizationsRequest.h>
using AlibabaCloud::Codeup::Model::ListOrganizationsRequest;
ListOrganizationsRequest::ListOrganizationsRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v4/organization");
setMethod(HttpRequest::Method::Get);
}
ListOrganizationsRequest::~ListOrganizationsRequest()
{}
int ListOrganizationsRequest::getAccessLevel()const
{
return accessLevel_;
}
void ListOrganizationsRequest::setAccessLevel(int accessLevel)
{
accessLevel_ = accessLevel;
setParameter("AccessLevel", std::to_string(accessLevel));
}
int ListOrganizationsRequest::getMinAccessLevel()const
{
return minAccessLevel_;
}
void ListOrganizationsRequest::setMinAccessLevel(int minAccessLevel)
{
minAccessLevel_ = minAccessLevel;
setParameter("MinAccessLevel", std::to_string(minAccessLevel));
}
std::string ListOrganizationsRequest::getAccessToken()const
{
return accessToken_;
}
void ListOrganizationsRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}

View File

@@ -0,0 +1,84 @@
/*
* 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/ListOrganizationsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
ListOrganizationsResult::ListOrganizationsResult() :
ServiceResult()
{}
ListOrganizationsResult::ListOrganizationsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListOrganizationsResult::~ListOrganizationsResult()
{}
void ListOrganizationsResult::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["OrganizationId"].isNull())
resultObject.organizationId = valueResultResultItem["OrganizationId"].asString();
if(!valueResultResultItem["OrganizationName"].isNull())
resultObject.organizationName = valueResultResultItem["OrganizationName"].asString();
if(!valueResultResultItem["OrganizationRole"].isNull())
resultObject.organizationRole = valueResultResultItem["OrganizationRole"].asString();
if(!valueResultResultItem["AccessLevel"].isNull())
resultObject.accessLevel = std::stoi(valueResultResultItem["AccessLevel"].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();
}
std::string ListOrganizationsResult::getErrorCode()const
{
return errorCode_;
}
std::string ListOrganizationsResult::getErrorMessage()const
{
return errorMessage_;
}
bool ListOrganizationsResult::getSuccess()const
{
return success_;
}
std::vector<ListOrganizationsResult::ResultItem> ListOrganizationsResult::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/ListRepositoriesRequest.h>
using AlibabaCloud::Codeup::Model::ListRepositoriesRequest;
ListRepositoriesRequest::ListRepositoriesRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v3/projects/all");
setMethod(HttpRequest::Method::Get);
}
ListRepositoriesRequest::~ListRepositoriesRequest()
{}
std::string ListRepositoriesRequest::getAccessToken()const
{
return accessToken_;
}
void ListRepositoriesRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}
bool ListRepositoriesRequest::getArchive()const
{
return archive_;
}
void ListRepositoriesRequest::setArchive(bool archive)
{
archive_ = archive;
setParameter("Archive", archive ? "true" : "false");
}
std::string ListRepositoriesRequest::getSort()const
{
return sort_;
}
void ListRepositoriesRequest::setSort(const std::string& sort)
{
sort_ = sort;
setParameter("Sort", sort);
}
std::string ListRepositoriesRequest::getOrganizationId()const
{
return organizationId_;
}
void ListRepositoriesRequest::setOrganizationId(const std::string& organizationId)
{
organizationId_ = organizationId;
setParameter("OrganizationId", organizationId);
}
std::string ListRepositoriesRequest::getSearch()const
{
return search_;
}
void ListRepositoriesRequest::setSearch(const std::string& search)
{
search_ = search;
setParameter("Search", search);
}
long ListRepositoriesRequest::getPageSize()const
{
return pageSize_;
}
void ListRepositoriesRequest::setPageSize(long pageSize)
{
pageSize_ = pageSize;
setParameter("PageSize", std::to_string(pageSize));
}
long ListRepositoriesRequest::getPage()const
{
return page_;
}
void ListRepositoriesRequest::setPage(long page)
{
page_ = page;
setParameter("Page", std::to_string(page));
}
std::string ListRepositoriesRequest::getOrder()const
{
return order_;
}
void ListRepositoriesRequest::setOrder(const std::string& order)
{
order_ = order;
setParameter("Order", order);
}

View File

@@ -0,0 +1,121 @@
/*
* 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/ListRepositoriesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
ListRepositoriesResult::ListRepositoriesResult() :
ServiceResult()
{}
ListRepositoriesResult::ListRepositoriesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListRepositoriesResult::~ListRepositoriesResult()
{}
void ListRepositoriesResult::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 = std::stol(valueResultResultItem["Id"].asString());
if(!valueResultResultItem["Description"].isNull())
resultObject.description = valueResultResultItem["Description"].asString();
if(!valueResultResultItem["VisibilityLevel"].isNull())
resultObject.visibilityLevel = valueResultResultItem["VisibilityLevel"].asString();
if(!valueResultResultItem["WebUrl"].isNull())
resultObject.webUrl = valueResultResultItem["WebUrl"].asString();
if(!valueResultResultItem["Name"].isNull())
resultObject.name = valueResultResultItem["Name"].asString();
if(!valueResultResultItem["NameWithNamespace"].isNull())
resultObject.nameWithNamespace = valueResultResultItem["NameWithNamespace"].asString();
if(!valueResultResultItem["Path"].isNull())
resultObject.path = valueResultResultItem["Path"].asString();
if(!valueResultResultItem["PathWithNamespace"].isNull())
resultObject.pathWithNamespace = valueResultResultItem["PathWithNamespace"].asString();
if(!valueResultResultItem["CreatedAt"].isNull())
resultObject.createdAt = valueResultResultItem["CreatedAt"].asString();
if(!valueResultResultItem["LastActivityAt"].isNull())
resultObject.lastActivityAt = valueResultResultItem["LastActivityAt"].asString();
if(!valueResultResultItem["Archive"].isNull())
resultObject.archive = valueResultResultItem["Archive"].asString() == "true";
if(!valueResultResultItem["AvatarUrl"].isNull())
resultObject.avatarUrl = valueResultResultItem["AvatarUrl"].asString();
if(!valueResultResultItem["DemoProjectStatus"].isNull())
resultObject.demoProjectStatus = valueResultResultItem["DemoProjectStatus"].asString() == "true";
if(!valueResultResultItem["AccessLevel"].isNull())
resultObject.accessLevel = std::stoi(valueResultResultItem["AccessLevel"].asString());
if(!valueResultResultItem["ImportStatus"].isNull())
resultObject.importStatus = valueResultResultItem["ImportStatus"].asString();
if(!valueResultResultItem["NamespaceId"].isNull())
resultObject.namespaceId = std::stol(valueResultResultItem["NamespaceId"].asString());
if(!valueResultResultItem["UpdatedAt"].isNull())
resultObject.updatedAt = valueResultResultItem["UpdatedAt"].asString();
if(!valueResultResultItem["StarCount"].isNull())
resultObject.starCount = std::stol(valueResultResultItem["StarCount"].asString());
if(!valueResultResultItem["Star"].isNull())
resultObject.star = valueResultResultItem["Star"].asString() == "true";
result_.push_back(resultObject);
}
if(!value["ErrorCode"].isNull())
errorCode_ = std::stoi(value["ErrorCode"].asString());
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Total"].isNull())
total_ = std::stol(value["Total"].asString());
}
long ListRepositoriesResult::getTotal()const
{
return total_;
}
int ListRepositoriesResult::getErrorCode()const
{
return errorCode_;
}
std::string ListRepositoriesResult::getErrorMessage()const
{
return errorMessage_;
}
bool ListRepositoriesResult::getSuccess()const
{
return success_;
}
std::vector<ListRepositoriesResult::ResultItem> ListRepositoriesResult::getResult()const
{
return result_;
}

View 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/ListRepositoryWebhookRequest.h>
using AlibabaCloud::Codeup::Model::ListRepositoryWebhookRequest;
ListRepositoryWebhookRequest::ListRepositoryWebhookRequest() :
RoaServiceRequest("codeup", "2020-04-14")
{
setResourcePath("/api/v3/projects/[ProjectId]/hooks");
setMethod(HttpRequest::Method::Get);
}
ListRepositoryWebhookRequest::~ListRepositoryWebhookRequest()
{}
std::string ListRepositoryWebhookRequest::getOrganizationId()const
{
return organizationId_;
}
void ListRepositoryWebhookRequest::setOrganizationId(const std::string& organizationId)
{
organizationId_ = organizationId;
setParameter("OrganizationId", organizationId);
}
long ListRepositoryWebhookRequest::getPageSize()const
{
return pageSize_;
}
void ListRepositoryWebhookRequest::setPageSize(long pageSize)
{
pageSize_ = pageSize;
setParameter("PageSize", std::to_string(pageSize));
}
std::string ListRepositoryWebhookRequest::getAccessToken()const
{
return accessToken_;
}
void ListRepositoryWebhookRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setParameter("AccessToken", accessToken);
}
long ListRepositoryWebhookRequest::getPage()const
{
return page_;
}
void ListRepositoryWebhookRequest::setPage(long page)
{
page_ = page;
setParameter("Page", std::to_string(page));
}
long ListRepositoryWebhookRequest::getProjectId()const
{
return projectId_;
}
void ListRepositoryWebhookRequest::setProjectId(long projectId)
{
projectId_ = projectId;
setParameter("ProjectId", std::to_string(projectId));
}

View File

@@ -0,0 +1,107 @@
/*
* 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/ListRepositoryWebhookResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Codeup;
using namespace AlibabaCloud::Codeup::Model;
ListRepositoryWebhookResult::ListRepositoryWebhookResult() :
ServiceResult()
{}
ListRepositoryWebhookResult::ListRepositoryWebhookResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListRepositoryWebhookResult::~ListRepositoryWebhookResult()
{}
void ListRepositoryWebhookResult::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 = std::stol(valueResultResultItem["Id"].asString());
if(!valueResultResultItem["Url"].isNull())
resultObject.url = valueResultResultItem["Url"].asString();
if(!valueResultResultItem["CreatedAt"].isNull())
resultObject.createdAt = valueResultResultItem["CreatedAt"].asString();
if(!valueResultResultItem["ProjectId"].isNull())
resultObject.projectId = std::stol(valueResultResultItem["ProjectId"].asString());
if(!valueResultResultItem["PushEvents"].isNull())
resultObject.pushEvents = valueResultResultItem["PushEvents"].asString() == "true";
if(!valueResultResultItem["MergeRequestsEvents"].isNull())
resultObject.mergeRequestsEvents = valueResultResultItem["MergeRequestsEvents"].asString() == "true";
if(!valueResultResultItem["TagPushEvents"].isNull())
resultObject.tagPushEvents = valueResultResultItem["TagPushEvents"].asString() == "true";
if(!valueResultResultItem["NoteEvents"].isNull())
resultObject.noteEvents = valueResultResultItem["NoteEvents"].asString() == "true";
if(!valueResultResultItem["EnableSslVerification"].isNull())
resultObject.enableSslVerification = valueResultResultItem["EnableSslVerification"].asString() == "true";
if(!valueResultResultItem["LastTestResult"].isNull())
resultObject.lastTestResult = valueResultResultItem["LastTestResult"].asString();
if(!valueResultResultItem["Description"].isNull())
resultObject.description = valueResultResultItem["Description"].asString();
if(!valueResultResultItem["SecretToken"].isNull())
resultObject.secretToken = valueResultResultItem["SecretToken"].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 ListRepositoryWebhookResult::getTotal()const
{
return total_;
}
std::string ListRepositoryWebhookResult::getErrorCode()const
{
return errorCode_;
}
std::string ListRepositoryWebhookResult::getErrorMessage()const
{
return errorMessage_;
}
bool ListRepositoryWebhookResult::getSuccess()const
{
return success_;
}
std::vector<ListRepositoryWebhookResult::ResultItem> ListRepositoryWebhookResult::getResult()const
{
return result_;
}