/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::LexRuntimeService::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetSessionResult::GetSessionResult() { } GetSessionResult::GetSessionResult(const Aws::AmazonWebServiceResult& result) { *this = result; } GetSessionResult& GetSessionResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("recentIntentSummaryView")) { Aws::Utils::Array recentIntentSummaryViewJsonList = jsonValue.GetArray("recentIntentSummaryView"); for(unsigned recentIntentSummaryViewIndex = 0; recentIntentSummaryViewIndex < recentIntentSummaryViewJsonList.GetLength(); ++recentIntentSummaryViewIndex) { m_recentIntentSummaryView.push_back(recentIntentSummaryViewJsonList[recentIntentSummaryViewIndex].AsObject()); } } if(jsonValue.ValueExists("sessionAttributes")) { Aws::Map sessionAttributesJsonMap = jsonValue.GetObject("sessionAttributes").GetAllObjects(); for(auto& sessionAttributesItem : sessionAttributesJsonMap) { m_sessionAttributes[sessionAttributesItem.first] = sessionAttributesItem.second.AsString(); } } if(jsonValue.ValueExists("sessionId")) { m_sessionId = jsonValue.GetString("sessionId"); } if(jsonValue.ValueExists("dialogAction")) { m_dialogAction = jsonValue.GetObject("dialogAction"); } if(jsonValue.ValueExists("activeContexts")) { Aws::Utils::Array activeContextsJsonList = jsonValue.GetArray("activeContexts"); for(unsigned activeContextsIndex = 0; activeContextsIndex < activeContextsJsonList.GetLength(); ++activeContextsIndex) { m_activeContexts.push_back(activeContextsJsonList[activeContextsIndex].AsObject()); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }