Add isv interface.

This commit is contained in:
sdk-team
2020-10-20 07:51:00 +00:00
parent b98f01cab4
commit d7a89ac3dc
9 changed files with 517 additions and 0 deletions

89
emap/src/EmapClient.cc Normal file
View File

@@ -0,0 +1,89 @@
/*
* 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/emap/EmapClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Emap;
using namespace AlibabaCloud::Emap::Model;
namespace
{
const std::string SERVICE_NAME = "emap";
}
EmapClient::EmapClient(const Credentials &credentials, const ClientConfiguration &configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
EmapClient::EmapClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
EmapClient::EmapClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
EmapClient::~EmapClient()
{}
EmapClient::QueryMapInfoOpenOutcome EmapClient::queryMapInfoOpen(const QueryMapInfoOpenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QueryMapInfoOpenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QueryMapInfoOpenOutcome(QueryMapInfoOpenResult(outcome.result()));
else
return QueryMapInfoOpenOutcome(outcome.error());
}
void EmapClient::queryMapInfoOpenAsync(const QueryMapInfoOpenRequest& request, const QueryMapInfoOpenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, queryMapInfoOpen(request), context);
};
asyncExecute(new Runnable(fn));
}
EmapClient::QueryMapInfoOpenOutcomeCallable EmapClient::queryMapInfoOpenCallable(const QueryMapInfoOpenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QueryMapInfoOpenOutcome()>>(
[this, request]()
{
return this->queryMapInfoOpen(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,40 @@
/*
* 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/emap/model/QueryMapInfoOpenRequest.h>
using AlibabaCloud::Emap::Model::QueryMapInfoOpenRequest;
QueryMapInfoOpenRequest::QueryMapInfoOpenRequest() :
RpcServiceRequest("emap", "2020-10-10", "QueryMapInfoOpen")
{
setMethod(HttpRequest::Method::Post);
}
QueryMapInfoOpenRequest::~QueryMapInfoOpenRequest()
{}
long QueryMapInfoOpenRequest::getStoreId()const
{
return storeId_;
}
void QueryMapInfoOpenRequest::setStoreId(long storeId)
{
storeId_ = storeId;
setBodyParameter("StoreId", std::to_string(storeId));
}

View File

@@ -0,0 +1,100 @@
/*
* 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/emap/model/QueryMapInfoOpenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Emap;
using namespace AlibabaCloud::Emap::Model;
QueryMapInfoOpenResult::QueryMapInfoOpenResult() :
ServiceResult()
{}
QueryMapInfoOpenResult::QueryMapInfoOpenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryMapInfoOpenResult::~QueryMapInfoOpenResult()
{}
void QueryMapInfoOpenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["RenderData"].isNull())
renderData_ = value["RenderData"].asString();
if(!value["ErrorCode"].isNull())
errorCode_ = value["ErrorCode"].asString();
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
if(!value["DynamicMessage"].isNull())
dynamicMessage_ = value["DynamicMessage"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["DynamicCode"].isNull())
dynamicCode_ = value["DynamicCode"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
}
std::string QueryMapInfoOpenResult::getMessage()const
{
return message_;
}
std::string QueryMapInfoOpenResult::getRenderData()const
{
return renderData_;
}
std::string QueryMapInfoOpenResult::getDynamicCode()const
{
return dynamicCode_;
}
std::string QueryMapInfoOpenResult::getErrorCode()const
{
return errorCode_;
}
std::string QueryMapInfoOpenResult::getDynamicMessage()const
{
return dynamicMessage_;
}
std::string QueryMapInfoOpenResult::getErrorMessage()const
{
return errorMessage_;
}
std::string QueryMapInfoOpenResult::getCode()const
{
return code_;
}
bool QueryMapInfoOpenResult::getSuccess()const
{
return success_;
}