XSPACE SDK Auto Released By xiaoyan.yan,Version:1.34.9

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
This commit is contained in:
haowei.yao
2019-03-12 12:28:26 +08:00
parent a6d33574bd
commit 85e2f3ebe4
15 changed files with 849 additions and 1 deletions

125
xspace/src/XspaceClient.cc Normal file
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/xspace/XspaceClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Xspace;
using namespace AlibabaCloud::Xspace::Model;
namespace
{
const std::string SERVICE_NAME = "xspace";
}
XspaceClient::XspaceClient(const Credentials &credentials, const ClientConfiguration &configuration) :
RoaServiceClient(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, "");
}
XspaceClient::XspaceClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RoaServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
XspaceClient::XspaceClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RoaServiceClient(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, "");
}
XspaceClient::~XspaceClient()
{}
XspaceClient::QueryCustomerByIdOutcome XspaceClient::queryCustomerById(const QueryCustomerByIdRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QueryCustomerByIdOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QueryCustomerByIdOutcome(QueryCustomerByIdResult(outcome.result()));
else
return QueryCustomerByIdOutcome(outcome.error());
}
void XspaceClient::queryCustomerByIdAsync(const QueryCustomerByIdRequest& request, const QueryCustomerByIdAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, queryCustomerById(request), context);
};
asyncExecute(new Runnable(fn));
}
XspaceClient::QueryCustomerByIdOutcomeCallable XspaceClient::queryCustomerByIdCallable(const QueryCustomerByIdRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QueryCustomerByIdOutcome()>>(
[this, request]()
{
return this->queryCustomerById(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
XspaceClient::QueryCustomerByPhoneOutcome XspaceClient::queryCustomerByPhone(const QueryCustomerByPhoneRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QueryCustomerByPhoneOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QueryCustomerByPhoneOutcome(QueryCustomerByPhoneResult(outcome.result()));
else
return QueryCustomerByPhoneOutcome(outcome.error());
}
void XspaceClient::queryCustomerByPhoneAsync(const QueryCustomerByPhoneRequest& request, const QueryCustomerByPhoneAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, queryCustomerByPhone(request), context);
};
asyncExecute(new Runnable(fn));
}
XspaceClient::QueryCustomerByPhoneOutcomeCallable XspaceClient::queryCustomerByPhoneCallable(const QueryCustomerByPhoneRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QueryCustomerByPhoneOutcome()>>(
[this, request]()
{
return this->queryCustomerByPhone(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,38 @@
/*
* 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/xspace/model/QueryCustomerByIdRequest.h>
using AlibabaCloud::Xspace::Model::QueryCustomerByIdRequest;
QueryCustomerByIdRequest::QueryCustomerByIdRequest() :
RoaServiceRequest("xspace", "2017-07-20")
{}
QueryCustomerByIdRequest::~QueryCustomerByIdRequest()
{}
std::string QueryCustomerByIdRequest::getId()const
{
return id_;
}
void QueryCustomerByIdRequest::setId(const std::string& id)
{
id_ = id;
setParameter("Id", id);
}

View File

@@ -0,0 +1,99 @@
/*
* 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/xspace/model/QueryCustomerByIdResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Xspace;
using namespace AlibabaCloud::Xspace::Model;
QueryCustomerByIdResult::QueryCustomerByIdResult() :
ServiceResult()
{}
QueryCustomerByIdResult::QueryCustomerByIdResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryCustomerByIdResult::~QueryCustomerByIdResult()
{}
void QueryCustomerByIdResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["Id"].isNull())
data_.id = dataNode["Id"].asString();
if(!dataNode["Nick"].isNull())
data_.nick = dataNode["Nick"].asString();
if(!dataNode["RealName"].isNull())
data_.realName = dataNode["RealName"].asString();
if(!dataNode["Email"].isNull())
data_.email = dataNode["Email"].asString();
if(!dataNode["Phone"].isNull())
data_.phone = dataNode["Phone"].asString();
if(!dataNode["Gender"].isNull())
data_.gender = dataNode["Gender"].asString();
if(!dataNode["Photo"].isNull())
data_.photo = dataNode["Photo"].asString();
if(!dataNode["Detail"].isNull())
data_.detail = dataNode["Detail"].asString();
auto customizeFieldsNode = dataNode["CustomizeFields"];
if(!customizeFieldsNode["Cid"].isNull())
data_.customizeFields.cid = customizeFieldsNode["Cid"].asString();
if(!customizeFieldsNode["AbcUrl"].isNull())
data_.customizeFields.abcUrl = customizeFieldsNode["AbcUrl"].asString();
auto allAssociatePersonList = customizeFieldsNode["AssociatePersonList"]["AssociatePersonList"];
for (auto value : allAssociatePersonList)
data_.customizeFields.associatePersonList.push_back(value.asString());
auto allTags = dataNode["Tags"]["Tags"];
for (auto value : allTags)
data_.tags.push_back(value.asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string QueryCustomerByIdResult::getMessage()const
{
return message_;
}
QueryCustomerByIdResult::Data QueryCustomerByIdResult::getData()const
{
return data_;
}
std::string QueryCustomerByIdResult::getCode()const
{
return code_;
}
bool QueryCustomerByIdResult::getSuccess()const
{
return success_;
}

View File

@@ -0,0 +1,38 @@
/*
* 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/xspace/model/QueryCustomerByPhoneRequest.h>
using AlibabaCloud::Xspace::Model::QueryCustomerByPhoneRequest;
QueryCustomerByPhoneRequest::QueryCustomerByPhoneRequest() :
RoaServiceRequest("xspace", "2017-07-20")
{}
QueryCustomerByPhoneRequest::~QueryCustomerByPhoneRequest()
{}
std::string QueryCustomerByPhoneRequest::getPhone()const
{
return phone_;
}
void QueryCustomerByPhoneRequest::setPhone(const std::string& phone)
{
phone_ = phone;
setParameter("Phone", phone);
}

View File

@@ -0,0 +1,108 @@
/*
* 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/xspace/model/QueryCustomerByPhoneResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Xspace;
using namespace AlibabaCloud::Xspace::Model;
QueryCustomerByPhoneResult::QueryCustomerByPhoneResult() :
ServiceResult()
{}
QueryCustomerByPhoneResult::QueryCustomerByPhoneResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryCustomerByPhoneResult::~QueryCustomerByPhoneResult()
{}
void QueryCustomerByPhoneResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allData = value["Data"]["DataItem"];
for (auto value : allData)
{
DataItem dataObject;
if(!value["Detail"].isNull())
dataObject.detail = value["Detail"].asString();
if(!value["Photo"].isNull())
dataObject.photo = value["Photo"].asString();
if(!value["Id"].isNull())
dataObject.id = value["Id"].asString();
if(!value["Phone"].isNull())
dataObject.phone = value["Phone"].asString();
if(!value["Gender"].isNull())
dataObject.gender = value["Gender"].asString();
if(!value["Email"].isNull())
dataObject.email = value["Email"].asString();
if(!value["Nick"].isNull())
dataObject.nick = value["Nick"].asString();
if(!value["RealName"].isNull())
dataObject.realName = value["RealName"].asString();
auto customizeFieldsNode = value["CustomizeFields"];
if(!customizeFieldsNode["Cid"].isNull())
dataObject.customizeFields.cid = customizeFieldsNode["Cid"].asString();
if(!customizeFieldsNode["AbcUrl"].isNull())
dataObject.customizeFields.abcUrl = customizeFieldsNode["AbcUrl"].asString();
if(!customizeFieldsNode["DistributionLevel"].isNull())
dataObject.customizeFields.distributionLevel = customizeFieldsNode["DistributionLevel"].asString();
if(!customizeFieldsNode["MainAccountUid"].isNull())
dataObject.customizeFields.mainAccountUid = customizeFieldsNode["MainAccountUid"].asString();
auto allAssociatePersonList = customizeFieldsNode["AssociatePersonList"]["AssociatePersonList"];
for (auto value : allAssociatePersonList)
dataObject.customizeFields.associatePersonList.push_back(value.asString());
auto allTags = value["Tags"]["Tags"];
for (auto value : allTags)
dataObject.tags.push_back(value.asString());
data_.push_back(dataObject);
}
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string QueryCustomerByPhoneResult::getMessage()const
{
return message_;
}
std::vector<QueryCustomerByPhoneResult::DataItem> QueryCustomerByPhoneResult::getData()const
{
return data_;
}
std::string QueryCustomerByPhoneResult::getCode()const
{
return code_;
}
bool QueryCustomerByPhoneResult::getSuccess()const
{
return success_;
}