Supported ChatApp for SDK.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2020-07-30 Version: 1.36.545
|
||||
- Supported ChatApp for SDK.
|
||||
|
||||
2020-07-30 Version: 1.36.544
|
||||
- Generated 2020-06-29 for `alinlp`.
|
||||
|
||||
|
||||
86
cams/CMakeLists.txt
Normal file
86
cams/CMakeLists.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
|
||||
set(cams_public_header
|
||||
include/alibabacloud/cams/CamsClient.h
|
||||
include/alibabacloud/cams/CamsExport.h )
|
||||
|
||||
set(cams_public_header_model
|
||||
include/alibabacloud/cams/model/SendMessageRequest.h
|
||||
include/alibabacloud/cams/model/SendMessageResult.h )
|
||||
|
||||
set(cams_src
|
||||
src/CamsClient.cc
|
||||
src/model/SendMessageRequest.cc
|
||||
src/model/SendMessageResult.cc )
|
||||
|
||||
add_library(cams ${LIB_TYPE}
|
||||
${cams_public_header}
|
||||
${cams_public_header_model}
|
||||
${cams_src})
|
||||
|
||||
set_target_properties(cams
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}cams
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(cams
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_CAMS_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(cams
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(cams
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(cams
|
||||
jsoncpp)
|
||||
target_include_directories(cams
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(cams
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(cams
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(cams
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(cams
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${cams_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cams)
|
||||
install(FILES ${cams_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cams/model)
|
||||
install(TARGETS cams
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
54
cams/include/alibabacloud/cams/CamsClient.h
Normal file
54
cams/include/alibabacloud/cams/CamsClient.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CAMS_CAMSCLIENT_H_
|
||||
#define ALIBABACLOUD_CAMS_CAMSCLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "CamsExport.h"
|
||||
#include "model/SendMessageRequest.h"
|
||||
#include "model/SendMessageResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cams
|
||||
{
|
||||
class ALIBABACLOUD_CAMS_EXPORT CamsClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::SendMessageResult> SendMessageOutcome;
|
||||
typedef std::future<SendMessageOutcome> SendMessageOutcomeCallable;
|
||||
typedef std::function<void(const CamsClient*, const Model::SendMessageRequest&, const SendMessageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SendMessageAsyncHandler;
|
||||
|
||||
CamsClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
CamsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
CamsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~CamsClient();
|
||||
SendMessageOutcome sendMessage(const Model::SendMessageRequest &request)const;
|
||||
void sendMessageAsync(const Model::SendMessageRequest& request, const SendMessageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
SendMessageOutcomeCallable sendMessageCallable(const Model::SendMessageRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_CAMS_CAMSCLIENT_H_
|
||||
32
cams/include/alibabacloud/cams/CamsExport.h
Normal file
32
cams/include/alibabacloud/cams/CamsExport.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CAMS_CAMSEXPORT_H_
|
||||
#define ALIBABACLOUD_CAMS_CAMSEXPORT_H_
|
||||
|
||||
#include <alibabacloud/core/Global.h>
|
||||
|
||||
#if defined(ALIBABACLOUD_SHARED)
|
||||
# if defined(ALIBABACLOUD_CAMS_LIBRARY)
|
||||
# define ALIBABACLOUD_CAMS_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||
# else
|
||||
# define ALIBABACLOUD_CAMS_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define ALIBABACLOUD_CAMS_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // !ALIBABACLOUD_CAMS_CAMSEXPORT_H_
|
||||
75
cams/include/alibabacloud/cams/model/SendMessageRequest.h
Normal file
75
cams/include/alibabacloud/cams/model/SendMessageRequest.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CAMS_MODEL_SENDMESSAGEREQUEST_H_
|
||||
#define ALIBABACLOUD_CAMS_MODEL_SENDMESSAGEREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/cams/CamsExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cams
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CAMS_EXPORT SendMessageRequest : public RpcServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
SendMessageRequest();
|
||||
~SendMessageRequest();
|
||||
|
||||
long getResourceOwnerId()const;
|
||||
void setResourceOwnerId(long resourceOwnerId);
|
||||
std::string getTemplateBodyParams()const;
|
||||
void setTemplateBodyParams(const std::string& templateBodyParams);
|
||||
std::string getType()const;
|
||||
void setType(const std::string& type);
|
||||
std::string getAccessKeyId()const;
|
||||
void setAccessKeyId(const std::string& accessKeyId);
|
||||
std::string getChannelType()const;
|
||||
void setChannelType(const std::string& channelType);
|
||||
std::string getFrom()const;
|
||||
void setFrom(const std::string& from);
|
||||
std::string getResourceOwnerAccount()const;
|
||||
void setResourceOwnerAccount(const std::string& resourceOwnerAccount);
|
||||
long getOwnerId()const;
|
||||
void setOwnerId(long ownerId);
|
||||
std::string getTo()const;
|
||||
void setTo(const std::string& to);
|
||||
std::string getTemplateCode()const;
|
||||
void setTemplateCode(const std::string& templateCode);
|
||||
|
||||
private:
|
||||
long resourceOwnerId_;
|
||||
std::string templateBodyParams_;
|
||||
std::string type_;
|
||||
std::string accessKeyId_;
|
||||
std::string channelType_;
|
||||
std::string from_;
|
||||
std::string resourceOwnerAccount_;
|
||||
long ownerId_;
|
||||
std::string to_;
|
||||
std::string templateCode_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CAMS_MODEL_SENDMESSAGEREQUEST_H_
|
||||
61
cams/include/alibabacloud/cams/model/SendMessageResult.h
Normal file
61
cams/include/alibabacloud/cams/model/SendMessageResult.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CAMS_MODEL_SENDMESSAGERESULT_H_
|
||||
#define ALIBABACLOUD_CAMS_MODEL_SENDMESSAGERESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/cams/CamsExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cams
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CAMS_EXPORT SendMessageResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Module
|
||||
{
|
||||
std::string toId;
|
||||
std::string fromId;
|
||||
std::string messageId;
|
||||
};
|
||||
|
||||
|
||||
SendMessageResult();
|
||||
explicit SendMessageResult(const std::string &payload);
|
||||
~SendMessageResult();
|
||||
Module getModule()const;
|
||||
std::string getResultMessage()const;
|
||||
std::string getResultCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
Module module_;
|
||||
std::string resultMessage_;
|
||||
std::string resultCode_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CAMS_MODEL_SENDMESSAGERESULT_H_
|
||||
89
cams/src/CamsClient.cc
Normal file
89
cams/src/CamsClient.cc
Normal 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/cams/CamsClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Cams;
|
||||
using namespace AlibabaCloud::Cams::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "cams";
|
||||
}
|
||||
|
||||
CamsClient::CamsClient(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, "cams");
|
||||
}
|
||||
|
||||
CamsClient::CamsClient(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, "cams");
|
||||
}
|
||||
|
||||
CamsClient::CamsClient(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, "cams");
|
||||
}
|
||||
|
||||
CamsClient::~CamsClient()
|
||||
{}
|
||||
|
||||
CamsClient::SendMessageOutcome CamsClient::sendMessage(const SendMessageRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return SendMessageOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return SendMessageOutcome(SendMessageResult(outcome.result()));
|
||||
else
|
||||
return SendMessageOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CamsClient::sendMessageAsync(const SendMessageRequest& request, const SendMessageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, sendMessage(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CamsClient::SendMessageOutcomeCallable CamsClient::sendMessageCallable(const SendMessageRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<SendMessageOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->sendMessage(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
139
cams/src/model/SendMessageRequest.cc
Normal file
139
cams/src/model/SendMessageRequest.cc
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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/cams/model/SendMessageRequest.h>
|
||||
|
||||
using AlibabaCloud::Cams::Model::SendMessageRequest;
|
||||
|
||||
SendMessageRequest::SendMessageRequest() :
|
||||
RpcServiceRequest("cams", "2020-06-06", "SendMessage")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
SendMessageRequest::~SendMessageRequest()
|
||||
{}
|
||||
|
||||
long SendMessageRequest::getResourceOwnerId()const
|
||||
{
|
||||
return resourceOwnerId_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setResourceOwnerId(long resourceOwnerId)
|
||||
{
|
||||
resourceOwnerId_ = resourceOwnerId;
|
||||
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getTemplateBodyParams()const
|
||||
{
|
||||
return templateBodyParams_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setTemplateBodyParams(const std::string& templateBodyParams)
|
||||
{
|
||||
templateBodyParams_ = templateBodyParams;
|
||||
setParameter("TemplateBodyParams", templateBodyParams);
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getType()const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setType(const std::string& type)
|
||||
{
|
||||
type_ = type;
|
||||
setParameter("Type", type);
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getAccessKeyId()const
|
||||
{
|
||||
return accessKeyId_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setAccessKeyId(const std::string& accessKeyId)
|
||||
{
|
||||
accessKeyId_ = accessKeyId;
|
||||
setParameter("AccessKeyId", accessKeyId);
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getChannelType()const
|
||||
{
|
||||
return channelType_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setChannelType(const std::string& channelType)
|
||||
{
|
||||
channelType_ = channelType;
|
||||
setParameter("ChannelType", channelType);
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getFrom()const
|
||||
{
|
||||
return from_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setFrom(const std::string& from)
|
||||
{
|
||||
from_ = from;
|
||||
setParameter("From", from);
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getResourceOwnerAccount()const
|
||||
{
|
||||
return resourceOwnerAccount_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
|
||||
{
|
||||
resourceOwnerAccount_ = resourceOwnerAccount;
|
||||
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
|
||||
}
|
||||
|
||||
long SendMessageRequest::getOwnerId()const
|
||||
{
|
||||
return ownerId_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setOwnerId(long ownerId)
|
||||
{
|
||||
ownerId_ = ownerId;
|
||||
setParameter("OwnerId", std::to_string(ownerId));
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getTo()const
|
||||
{
|
||||
return to_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setTo(const std::string& to)
|
||||
{
|
||||
to_ = to;
|
||||
setParameter("To", to);
|
||||
}
|
||||
|
||||
std::string SendMessageRequest::getTemplateCode()const
|
||||
{
|
||||
return templateCode_;
|
||||
}
|
||||
|
||||
void SendMessageRequest::setTemplateCode(const std::string& templateCode)
|
||||
{
|
||||
templateCode_ = templateCode;
|
||||
setParameter("TemplateCode", templateCode);
|
||||
}
|
||||
|
||||
70
cams/src/model/SendMessageResult.cc
Normal file
70
cams/src/model/SendMessageResult.cc
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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/cams/model/SendMessageResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Cams;
|
||||
using namespace AlibabaCloud::Cams::Model;
|
||||
|
||||
SendMessageResult::SendMessageResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
SendMessageResult::SendMessageResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
SendMessageResult::~SendMessageResult()
|
||||
{}
|
||||
|
||||
void SendMessageResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto moduleNode = value["Module"];
|
||||
if(!moduleNode["FromId"].isNull())
|
||||
module_.fromId = moduleNode["FromId"].asString();
|
||||
if(!moduleNode["ToId"].isNull())
|
||||
module_.toId = moduleNode["ToId"].asString();
|
||||
if(!moduleNode["MessageId"].isNull())
|
||||
module_.messageId = moduleNode["MessageId"].asString();
|
||||
if(!value["ResultCode"].isNull())
|
||||
resultCode_ = value["ResultCode"].asString();
|
||||
if(!value["ResultMessage"].isNull())
|
||||
resultMessage_ = value["ResultMessage"].asString();
|
||||
|
||||
}
|
||||
|
||||
SendMessageResult::Module SendMessageResult::getModule()const
|
||||
{
|
||||
return module_;
|
||||
}
|
||||
|
||||
std::string SendMessageResult::getResultMessage()const
|
||||
{
|
||||
return resultMessage_;
|
||||
}
|
||||
|
||||
std::string SendMessageResult::getResultCode()const
|
||||
{
|
||||
return resultCode_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user