diff --git a/VERSION b/VERSION index 99f100612..934a553b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.2102 \ No newline at end of file +1.36.2103 \ No newline at end of file diff --git a/lingmou/CMakeLists.txt b/lingmou/CMakeLists.txt index 016f7e3b6..c6eb3cc6b 100644 --- a/lingmou/CMakeLists.txt +++ b/lingmou/CMakeLists.txt @@ -21,13 +21,21 @@ set(lingmou_public_header include/alibabacloud/lingmou/LingMouExport.h ) set(lingmou_public_header_model + include/alibabacloud/lingmou/model/CloseChatInstanceSessionsRequest.h + include/alibabacloud/lingmou/model/CloseChatInstanceSessionsResult.h include/alibabacloud/lingmou/model/CreateChatSessionRequest.h - include/alibabacloud/lingmou/model/CreateChatSessionResult.h ) + include/alibabacloud/lingmou/model/CreateChatSessionResult.h + include/alibabacloud/lingmou/model/QueryChatInstanceSessionsRequest.h + include/alibabacloud/lingmou/model/QueryChatInstanceSessionsResult.h ) set(lingmou_src src/LingMouClient.cc + src/model/CloseChatInstanceSessionsRequest.cc + src/model/CloseChatInstanceSessionsResult.cc src/model/CreateChatSessionRequest.cc - src/model/CreateChatSessionResult.cc ) + src/model/CreateChatSessionResult.cc + src/model/QueryChatInstanceSessionsRequest.cc + src/model/QueryChatInstanceSessionsResult.cc ) add_library(lingmou ${LIB_TYPE} ${lingmou_public_header} diff --git a/lingmou/include/alibabacloud/lingmou/LingMouClient.h b/lingmou/include/alibabacloud/lingmou/LingMouClient.h index dfe5db5ef..7709ecb29 100644 --- a/lingmou/include/alibabacloud/lingmou/LingMouClient.h +++ b/lingmou/include/alibabacloud/lingmou/LingMouClient.h @@ -22,8 +22,12 @@ #include #include #include "LingMouExport.h" +#include "model/CloseChatInstanceSessionsRequest.h" +#include "model/CloseChatInstanceSessionsResult.h" #include "model/CreateChatSessionRequest.h" #include "model/CreateChatSessionResult.h" +#include "model/QueryChatInstanceSessionsRequest.h" +#include "model/QueryChatInstanceSessionsResult.h" namespace AlibabaCloud @@ -33,17 +37,29 @@ namespace AlibabaCloud class ALIBABACLOUD_LINGMOU_EXPORT LingMouClient : public RoaServiceClient { public: + typedef Outcome CloseChatInstanceSessionsOutcome; + typedef std::future CloseChatInstanceSessionsOutcomeCallable; + typedef std::function&)> CloseChatInstanceSessionsAsyncHandler; typedef Outcome CreateChatSessionOutcome; typedef std::future CreateChatSessionOutcomeCallable; typedef std::function&)> CreateChatSessionAsyncHandler; + typedef Outcome QueryChatInstanceSessionsOutcome; + typedef std::future QueryChatInstanceSessionsOutcomeCallable; + typedef std::function&)> QueryChatInstanceSessionsAsyncHandler; LingMouClient(const Credentials &credentials, const ClientConfiguration &configuration); LingMouClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); LingMouClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); ~LingMouClient(); + CloseChatInstanceSessionsOutcome closeChatInstanceSessions(const Model::CloseChatInstanceSessionsRequest &request)const; + void closeChatInstanceSessionsAsync(const Model::CloseChatInstanceSessionsRequest& request, const CloseChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CloseChatInstanceSessionsOutcomeCallable closeChatInstanceSessionsCallable(const Model::CloseChatInstanceSessionsRequest& request) const; CreateChatSessionOutcome createChatSession(const Model::CreateChatSessionRequest &request)const; void createChatSessionAsync(const Model::CreateChatSessionRequest& request, const CreateChatSessionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CreateChatSessionOutcomeCallable createChatSessionCallable(const Model::CreateChatSessionRequest& request) const; + QueryChatInstanceSessionsOutcome queryChatInstanceSessions(const Model::QueryChatInstanceSessionsRequest &request)const; + void queryChatInstanceSessionsAsync(const Model::QueryChatInstanceSessionsRequest& request, const QueryChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + QueryChatInstanceSessionsOutcomeCallable queryChatInstanceSessionsCallable(const Model::QueryChatInstanceSessionsRequest& request) const; private: std::shared_ptr endpointProvider_; diff --git a/lingmou/include/alibabacloud/lingmou/model/CloseChatInstanceSessionsRequest.h b/lingmou/include/alibabacloud/lingmou/model/CloseChatInstanceSessionsRequest.h new file mode 100644 index 000000000..7e675bb7d --- /dev/null +++ b/lingmou/include/alibabacloud/lingmou/model/CloseChatInstanceSessionsRequest.h @@ -0,0 +1,45 @@ +/* + * 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_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSREQUEST_H_ +#define ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace LingMou { +namespace Model { +class ALIBABACLOUD_LINGMOU_EXPORT CloseChatInstanceSessionsRequest : public RoaServiceRequest { +public: + CloseChatInstanceSessionsRequest(); + ~CloseChatInstanceSessionsRequest(); + std::string getInstanceId() const; + void setInstanceId(const std::string &instanceId); + std::string getSessionIds() const; + void setSessionIds(const std::string &sessionIds); + +private: + std::string instanceId_; + std::string sessionIds_; +}; +} // namespace Model +} // namespace LingMou +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSREQUEST_H_ diff --git a/lingmou/include/alibabacloud/lingmou/model/CloseChatInstanceSessionsResult.h b/lingmou/include/alibabacloud/lingmou/model/CloseChatInstanceSessionsResult.h new file mode 100644 index 000000000..0a5b278f5 --- /dev/null +++ b/lingmou/include/alibabacloud/lingmou/model/CloseChatInstanceSessionsResult.h @@ -0,0 +1,67 @@ +/* + * 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_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSRESULT_H_ +#define ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace LingMou + { + namespace Model + { + class ALIBABACLOUD_LINGMOU_EXPORT CloseChatInstanceSessionsResult : public ServiceResult + { + public: + struct DataItem + { + long createdAt; + std::string sessionId; + long mainAccountId; + }; + + + CloseChatInstanceSessionsResult(); + explicit CloseChatInstanceSessionsResult(const std::string &payload); + ~CloseChatInstanceSessionsResult(); + std::vector getdata()const; + std::string getRequestId()const; + std::string getMessage()const; + int getHttpStatusCode()const; + std::string getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::vector data_; + std::string requestId_; + std::string message_; + int httpStatusCode_; + std::string code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSRESULT_H_ \ No newline at end of file diff --git a/lingmou/include/alibabacloud/lingmou/model/QueryChatInstanceSessionsRequest.h b/lingmou/include/alibabacloud/lingmou/model/QueryChatInstanceSessionsRequest.h new file mode 100644 index 000000000..fe014db0c --- /dev/null +++ b/lingmou/include/alibabacloud/lingmou/model/QueryChatInstanceSessionsRequest.h @@ -0,0 +1,45 @@ +/* + * 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_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSREQUEST_H_ +#define ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace LingMou { +namespace Model { +class ALIBABACLOUD_LINGMOU_EXPORT QueryChatInstanceSessionsRequest : public RoaServiceRequest { +public: + QueryChatInstanceSessionsRequest(); + ~QueryChatInstanceSessionsRequest(); + std::string getInstanceId() const; + void setInstanceId(const std::string &instanceId); + std::string getSessionIds() const; + void setSessionIds(const std::string &sessionIds); + +private: + std::string instanceId_; + std::string sessionIds_; +}; +} // namespace Model +} // namespace LingMou +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSREQUEST_H_ diff --git a/lingmou/include/alibabacloud/lingmou/model/QueryChatInstanceSessionsResult.h b/lingmou/include/alibabacloud/lingmou/model/QueryChatInstanceSessionsResult.h new file mode 100644 index 000000000..65c06d993 --- /dev/null +++ b/lingmou/include/alibabacloud/lingmou/model/QueryChatInstanceSessionsResult.h @@ -0,0 +1,67 @@ +/* + * 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_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSRESULT_H_ +#define ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace LingMou + { + namespace Model + { + class ALIBABACLOUD_LINGMOU_EXPORT QueryChatInstanceSessionsResult : public ServiceResult + { + public: + struct DataItem + { + long createdAt; + std::string sessionId; + long mainAccountId; + }; + + + QueryChatInstanceSessionsResult(); + explicit QueryChatInstanceSessionsResult(const std::string &payload); + ~QueryChatInstanceSessionsResult(); + std::vector getdata()const; + std::string getRequestId()const; + std::string getMessage()const; + int getHttpStatusCode()const; + std::string getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::vector data_; + std::string requestId_; + std::string message_; + int httpStatusCode_; + std::string code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSRESULT_H_ \ No newline at end of file diff --git a/lingmou/src/LingMouClient.cc b/lingmou/src/LingMouClient.cc index cae77ea51..6b506fa17 100644 --- a/lingmou/src/LingMouClient.cc +++ b/lingmou/src/LingMouClient.cc @@ -51,6 +51,42 @@ LingMouClient::LingMouClient(const std::string & accessKeyId, const std::string LingMouClient::~LingMouClient() {} +LingMouClient::CloseChatInstanceSessionsOutcome LingMouClient::closeChatInstanceSessions(const CloseChatInstanceSessionsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CloseChatInstanceSessionsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CloseChatInstanceSessionsOutcome(CloseChatInstanceSessionsResult(outcome.result())); + else + return CloseChatInstanceSessionsOutcome(outcome.error()); +} + +void LingMouClient::closeChatInstanceSessionsAsync(const CloseChatInstanceSessionsRequest& request, const CloseChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, closeChatInstanceSessions(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +LingMouClient::CloseChatInstanceSessionsOutcomeCallable LingMouClient::closeChatInstanceSessionsCallable(const CloseChatInstanceSessionsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->closeChatInstanceSessions(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + LingMouClient::CreateChatSessionOutcome LingMouClient::createChatSession(const CreateChatSessionRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -87,3 +123,39 @@ LingMouClient::CreateChatSessionOutcomeCallable LingMouClient::createChatSession return task->get_future(); } +LingMouClient::QueryChatInstanceSessionsOutcome LingMouClient::queryChatInstanceSessions(const QueryChatInstanceSessionsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return QueryChatInstanceSessionsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return QueryChatInstanceSessionsOutcome(QueryChatInstanceSessionsResult(outcome.result())); + else + return QueryChatInstanceSessionsOutcome(outcome.error()); +} + +void LingMouClient::queryChatInstanceSessionsAsync(const QueryChatInstanceSessionsRequest& request, const QueryChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, queryChatInstanceSessions(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +LingMouClient::QueryChatInstanceSessionsOutcomeCallable LingMouClient::queryChatInstanceSessionsCallable(const QueryChatInstanceSessionsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->queryChatInstanceSessions(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/lingmou/src/model/CloseChatInstanceSessionsRequest.cc b/lingmou/src/model/CloseChatInstanceSessionsRequest.cc new file mode 100644 index 000000000..96fc2fe22 --- /dev/null +++ b/lingmou/src/model/CloseChatInstanceSessionsRequest.cc @@ -0,0 +1,46 @@ +/* + * 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 + +using AlibabaCloud::LingMou::Model::CloseChatInstanceSessionsRequest; + +CloseChatInstanceSessionsRequest::CloseChatInstanceSessionsRequest() + : RoaServiceRequest("lingmou", "2025-05-27") { + setResourcePath("/openapi/chat/instances/[instanceId]/sessions/close"}; + setMethod(HttpRequest::Method::Put); +} + +CloseChatInstanceSessionsRequest::~CloseChatInstanceSessionsRequest() {} + +std::string CloseChatInstanceSessionsRequest::getInstanceId() const { + return instanceId_; +} + +void CloseChatInstanceSessionsRequest::setInstanceId(const std::string &instanceId) { + instanceId_ = instanceId; + setParameter(std::string("instanceId"), instanceId); +} + +std::string CloseChatInstanceSessionsRequest::getSessionIds() const { + return sessionIds_; +} + +void CloseChatInstanceSessionsRequest::setSessionIds(const std::string &sessionIds) { + sessionIds_ = sessionIds; + setBodyParameter(std::string("sessionIds"), sessionIds); +} + diff --git a/lingmou/src/model/CloseChatInstanceSessionsResult.cc b/lingmou/src/model/CloseChatInstanceSessionsResult.cc new file mode 100644 index 000000000..d1520589a --- /dev/null +++ b/lingmou/src/model/CloseChatInstanceSessionsResult.cc @@ -0,0 +1,96 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::LingMou; +using namespace AlibabaCloud::LingMou::Model; + +CloseChatInstanceSessionsResult::CloseChatInstanceSessionsResult() : + ServiceResult() +{} + +CloseChatInstanceSessionsResult::CloseChatInstanceSessionsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +CloseChatInstanceSessionsResult::~CloseChatInstanceSessionsResult() +{} + +void CloseChatInstanceSessionsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto alldataNode = value["data"]["dataItem"]; + for (auto valuedatadataItem : alldataNode) + { + DataItem dataObject; + if(!valuedatadataItem["sessionId"].isNull()) + dataObject.sessionId = valuedatadataItem["sessionId"].asString(); + if(!valuedatadataItem["mainAccountId"].isNull()) + dataObject.mainAccountId = std::stol(valuedatadataItem["mainAccountId"].asString()); + if(!valuedatadataItem["createdAt"].isNull()) + dataObject.createdAt = std::stol(valuedatadataItem["createdAt"].asString()); + data_.push_back(dataObject); + } + if(!value["requestId"].isNull()) + requestId_ = value["requestId"].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(); + if(!value["httpStatusCode"].isNull()) + httpStatusCode_ = std::stoi(value["httpStatusCode"].asString()); + +} + +std::vector CloseChatInstanceSessionsResult::getdata()const +{ + return data_; +} + +std::string CloseChatInstanceSessionsResult::getRequestId()const +{ + return requestId_; +} + +std::string CloseChatInstanceSessionsResult::getMessage()const +{ + return message_; +} + +int CloseChatInstanceSessionsResult::getHttpStatusCode()const +{ + return httpStatusCode_; +} + +std::string CloseChatInstanceSessionsResult::getCode()const +{ + return code_; +} + +bool CloseChatInstanceSessionsResult::getSuccess()const +{ + return success_; +} + diff --git a/lingmou/src/model/QueryChatInstanceSessionsRequest.cc b/lingmou/src/model/QueryChatInstanceSessionsRequest.cc new file mode 100644 index 000000000..d15ebeb3c --- /dev/null +++ b/lingmou/src/model/QueryChatInstanceSessionsRequest.cc @@ -0,0 +1,46 @@ +/* + * 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 + +using AlibabaCloud::LingMou::Model::QueryChatInstanceSessionsRequest; + +QueryChatInstanceSessionsRequest::QueryChatInstanceSessionsRequest() + : RoaServiceRequest("lingmou", "2025-05-27") { + setResourcePath("/openapi/chat/instances/[instanceId]/sessions"}; + setMethod(HttpRequest::Method::Get); +} + +QueryChatInstanceSessionsRequest::~QueryChatInstanceSessionsRequest() {} + +std::string QueryChatInstanceSessionsRequest::getInstanceId() const { + return instanceId_; +} + +void QueryChatInstanceSessionsRequest::setInstanceId(const std::string &instanceId) { + instanceId_ = instanceId; + setParameter(std::string("instanceId"), instanceId); +} + +std::string QueryChatInstanceSessionsRequest::getSessionIds() const { + return sessionIds_; +} + +void QueryChatInstanceSessionsRequest::setSessionIds(const std::string &sessionIds) { + sessionIds_ = sessionIds; + setParameter(std::string("sessionIds"), sessionIds); +} + diff --git a/lingmou/src/model/QueryChatInstanceSessionsResult.cc b/lingmou/src/model/QueryChatInstanceSessionsResult.cc new file mode 100644 index 000000000..94ab2315f --- /dev/null +++ b/lingmou/src/model/QueryChatInstanceSessionsResult.cc @@ -0,0 +1,96 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::LingMou; +using namespace AlibabaCloud::LingMou::Model; + +QueryChatInstanceSessionsResult::QueryChatInstanceSessionsResult() : + ServiceResult() +{} + +QueryChatInstanceSessionsResult::QueryChatInstanceSessionsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +QueryChatInstanceSessionsResult::~QueryChatInstanceSessionsResult() +{} + +void QueryChatInstanceSessionsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto alldataNode = value["data"]["dataItem"]; + for (auto valuedatadataItem : alldataNode) + { + DataItem dataObject; + if(!valuedatadataItem["sessionId"].isNull()) + dataObject.sessionId = valuedatadataItem["sessionId"].asString(); + if(!valuedatadataItem["mainAccountId"].isNull()) + dataObject.mainAccountId = std::stol(valuedatadataItem["mainAccountId"].asString()); + if(!valuedatadataItem["createdAt"].isNull()) + dataObject.createdAt = std::stol(valuedatadataItem["createdAt"].asString()); + data_.push_back(dataObject); + } + if(!value["requestId"].isNull()) + requestId_ = value["requestId"].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(); + if(!value["httpStatusCode"].isNull()) + httpStatusCode_ = std::stoi(value["httpStatusCode"].asString()); + +} + +std::vector QueryChatInstanceSessionsResult::getdata()const +{ + return data_; +} + +std::string QueryChatInstanceSessionsResult::getRequestId()const +{ + return requestId_; +} + +std::string QueryChatInstanceSessionsResult::getMessage()const +{ + return message_; +} + +int QueryChatInstanceSessionsResult::getHttpStatusCode()const +{ + return httpStatusCode_; +} + +std::string QueryChatInstanceSessionsResult::getCode()const +{ + return code_; +} + +bool QueryChatInstanceSessionsResult::getSuccess()const +{ + return success_; +} +