Add API to list repo members with group inherited info.
This commit is contained in:
@@ -951,6 +951,42 @@ CodeupClient::GetBranchInfoOutcomeCallable CodeupClient::getBranchInfoCallable(c
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::GetCodeCompletionOutcome CodeupClient::getCodeCompletion(const GetCodeCompletionRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetCodeCompletionOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetCodeCompletionOutcome(GetCodeCompletionResult(outcome.result()));
|
||||
else
|
||||
return GetCodeCompletionOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CodeupClient::getCodeCompletionAsync(const GetCodeCompletionRequest& request, const GetCodeCompletionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getCodeCompletion(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CodeupClient::GetCodeCompletionOutcomeCallable CodeupClient::getCodeCompletionCallable(const GetCodeCompletionRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetCodeCompletionOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getCodeCompletion(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::GetCodeupOrganizationOutcome CodeupClient::getCodeupOrganization(const GetCodeupOrganizationRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
@@ -1779,6 +1815,42 @@ CodeupClient::ListRepositoryMemberOutcomeCallable CodeupClient::listRepositoryMe
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::ListRepositoryMemberWithInheritedOutcome CodeupClient::listRepositoryMemberWithInherited(const ListRepositoryMemberWithInheritedRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListRepositoryMemberWithInheritedOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListRepositoryMemberWithInheritedOutcome(ListRepositoryMemberWithInheritedResult(outcome.result()));
|
||||
else
|
||||
return ListRepositoryMemberWithInheritedOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CodeupClient::listRepositoryMemberWithInheritedAsync(const ListRepositoryMemberWithInheritedRequest& request, const ListRepositoryMemberWithInheritedAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listRepositoryMemberWithInherited(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CodeupClient::ListRepositoryMemberWithInheritedOutcomeCallable CodeupClient::listRepositoryMemberWithInheritedCallable(const ListRepositoryMemberWithInheritedRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListRepositoryMemberWithInheritedOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listRepositoryMemberWithInherited(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::ListRepositoryTagsOutcome CodeupClient::listRepositoryTags(const ListRepositoryTagsRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
63
codeup/src/model/GetCodeCompletionRequest.cc
Normal file
63
codeup/src/model/GetCodeCompletionRequest.cc
Normal 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/GetCodeCompletionRequest.h>
|
||||
|
||||
using AlibabaCloud::Codeup::Model::GetCodeCompletionRequest;
|
||||
|
||||
GetCodeCompletionRequest::GetCodeCompletionRequest() :
|
||||
RoaServiceRequest("codeup", "2020-04-14")
|
||||
{
|
||||
setResourcePath("/api/v2/service/invoke/[ServiceName]");
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetCodeCompletionRequest::~GetCodeCompletionRequest()
|
||||
{}
|
||||
|
||||
bool GetCodeCompletionRequest::getIsEncrypted()const
|
||||
{
|
||||
return isEncrypted_;
|
||||
}
|
||||
|
||||
void GetCodeCompletionRequest::setIsEncrypted(bool isEncrypted)
|
||||
{
|
||||
isEncrypted_ = isEncrypted;
|
||||
setParameter("IsEncrypted", isEncrypted ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string GetCodeCompletionRequest::getFetchKeys()const
|
||||
{
|
||||
return fetchKeys_;
|
||||
}
|
||||
|
||||
void GetCodeCompletionRequest::setFetchKeys(const std::string& fetchKeys)
|
||||
{
|
||||
fetchKeys_ = fetchKeys;
|
||||
setParameter("FetchKeys", fetchKeys);
|
||||
}
|
||||
|
||||
std::string GetCodeCompletionRequest::getServiceName()const
|
||||
{
|
||||
return serviceName_;
|
||||
}
|
||||
|
||||
void GetCodeCompletionRequest::setServiceName(const std::string& serviceName)
|
||||
{
|
||||
serviceName_ = serviceName;
|
||||
setParameter("ServiceName", serviceName);
|
||||
}
|
||||
|
||||
83
codeup/src/model/GetCodeCompletionResult.cc
Normal file
83
codeup/src/model/GetCodeCompletionResult.cc
Normal 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/GetCodeCompletionResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Codeup;
|
||||
using namespace AlibabaCloud::Codeup::Model;
|
||||
|
||||
GetCodeCompletionResult::GetCodeCompletionResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetCodeCompletionResult::GetCodeCompletionResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetCodeCompletionResult::~GetCodeCompletionResult()
|
||||
{}
|
||||
|
||||
void GetCodeCompletionResult::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["Body"].isNull())
|
||||
result_.body = resultNode["Body"].asString();
|
||||
if(!resultNode["ClientTimestamp"].isNull())
|
||||
result_.clientTimestamp = resultNode["ClientTimestamp"].asString();
|
||||
if(!resultNode["ReceiveTimestamp"].isNull())
|
||||
result_.receiveTimestamp = resultNode["ReceiveTimestamp"].asString();
|
||||
if(!resultNode["InvokeTimestamp"].isNull())
|
||||
result_.invokeTimestamp = resultNode["InvokeTimestamp"].asString();
|
||||
if(!resultNode["FetchTimestamp"].isNull())
|
||||
result_.fetchTimestamp = resultNode["FetchTimestamp"].asString();
|
||||
if(!resultNode["RspTimestamp"].isNull())
|
||||
result_.rspTimestamp = resultNode["RspTimestamp"].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 GetCodeCompletionResult::getErrorCode()const
|
||||
{
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
std::string GetCodeCompletionResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
bool GetCodeCompletionResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
GetCodeCompletionResult::Result GetCodeCompletionResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
63
codeup/src/model/ListRepositoryMemberWithInheritedRequest.cc
Normal file
63
codeup/src/model/ListRepositoryMemberWithInheritedRequest.cc
Normal 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/ListRepositoryMemberWithInheritedRequest.h>
|
||||
|
||||
using AlibabaCloud::Codeup::Model::ListRepositoryMemberWithInheritedRequest;
|
||||
|
||||
ListRepositoryMemberWithInheritedRequest::ListRepositoryMemberWithInheritedRequest() :
|
||||
RoaServiceRequest("codeup", "2020-04-14")
|
||||
{
|
||||
setResourcePath("/api/v4/projects/[ProjectId]/all_members");
|
||||
setMethod(HttpRequest::Method::Get);
|
||||
}
|
||||
|
||||
ListRepositoryMemberWithInheritedRequest::~ListRepositoryMemberWithInheritedRequest()
|
||||
{}
|
||||
|
||||
std::string ListRepositoryMemberWithInheritedRequest::getOrganizationId()const
|
||||
{
|
||||
return organizationId_;
|
||||
}
|
||||
|
||||
void ListRepositoryMemberWithInheritedRequest::setOrganizationId(const std::string& organizationId)
|
||||
{
|
||||
organizationId_ = organizationId;
|
||||
setParameter("OrganizationId", organizationId);
|
||||
}
|
||||
|
||||
std::string ListRepositoryMemberWithInheritedRequest::getAccessToken()const
|
||||
{
|
||||
return accessToken_;
|
||||
}
|
||||
|
||||
void ListRepositoryMemberWithInheritedRequest::setAccessToken(const std::string& accessToken)
|
||||
{
|
||||
accessToken_ = accessToken;
|
||||
setParameter("AccessToken", accessToken);
|
||||
}
|
||||
|
||||
long ListRepositoryMemberWithInheritedRequest::getProjectId()const
|
||||
{
|
||||
return projectId_;
|
||||
}
|
||||
|
||||
void ListRepositoryMemberWithInheritedRequest::setProjectId(long projectId)
|
||||
{
|
||||
projectId_ = projectId;
|
||||
setParameter("ProjectId", std::to_string(projectId));
|
||||
}
|
||||
|
||||
107
codeup/src/model/ListRepositoryMemberWithInheritedResult.cc
Normal file
107
codeup/src/model/ListRepositoryMemberWithInheritedResult.cc
Normal 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/ListRepositoryMemberWithInheritedResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Codeup;
|
||||
using namespace AlibabaCloud::Codeup::Model;
|
||||
|
||||
ListRepositoryMemberWithInheritedResult::ListRepositoryMemberWithInheritedResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ListRepositoryMemberWithInheritedResult::ListRepositoryMemberWithInheritedResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ListRepositoryMemberWithInheritedResult::~ListRepositoryMemberWithInheritedResult()
|
||||
{}
|
||||
|
||||
void ListRepositoryMemberWithInheritedResult::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["AccessLevel"].isNull())
|
||||
resultObject.accessLevel = std::stoi(valueResultResultItem["AccessLevel"].asString());
|
||||
if(!valueResultResultItem["ExternUserId"].isNull())
|
||||
resultObject.externUserId = valueResultResultItem["ExternUserId"].asString();
|
||||
if(!valueResultResultItem["Id"].isNull())
|
||||
resultObject.id = std::stol(valueResultResultItem["Id"].asString());
|
||||
if(!valueResultResultItem["State"].isNull())
|
||||
resultObject.state = valueResultResultItem["State"].asString();
|
||||
if(!valueResultResultItem["AvatarUrl"].isNull())
|
||||
resultObject.avatarUrl = valueResultResultItem["AvatarUrl"].asString();
|
||||
if(!valueResultResultItem["Email"].isNull())
|
||||
resultObject.email = valueResultResultItem["Email"].asString();
|
||||
if(!valueResultResultItem["Name"].isNull())
|
||||
resultObject.name = valueResultResultItem["Name"].asString();
|
||||
if(!valueResultResultItem["Username"].isNull())
|
||||
resultObject.username = valueResultResultItem["Username"].asString();
|
||||
auto inheritedNode = value["Inherited"];
|
||||
if(!inheritedNode["Id"].isNull())
|
||||
resultObject.inherited.id = std::stol(inheritedNode["Id"].asString());
|
||||
if(!inheritedNode["Name"].isNull())
|
||||
resultObject.inherited.name = inheritedNode["Name"].asString();
|
||||
if(!inheritedNode["Path"].isNull())
|
||||
resultObject.inherited.path = inheritedNode["Path"].asString();
|
||||
if(!inheritedNode["NameWithNamespace"].isNull())
|
||||
resultObject.inherited.nameWithNamespace = inheritedNode["NameWithNamespace"].asString();
|
||||
if(!inheritedNode["PathWithNamespace"].isNull())
|
||||
resultObject.inherited.pathWithNamespace = inheritedNode["PathWithNamespace"].asString();
|
||||
if(!inheritedNode["Type"].isNull())
|
||||
resultObject.inherited.type = inheritedNode["Type"].asString();
|
||||
if(!inheritedNode["VisibilityLevel"].isNull())
|
||||
resultObject.inherited.visibilityLevel = inheritedNode["VisibilityLevel"].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 ListRepositoryMemberWithInheritedResult::getErrorCode()const
|
||||
{
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
std::string ListRepositoryMemberWithInheritedResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
bool ListRepositoryMemberWithInheritedResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
std::vector<ListRepositoryMemberWithInheritedResult::ResultItem> ListRepositoryMemberWithInheritedResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user