/** * 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::LexRuntimeV2::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("sessionId")) { m_sessionId = jsonValue.GetString("sessionId"); } if(jsonValue.ValueExists("messages")) { Aws::Utils::Array messagesJsonList = jsonValue.GetArray("messages"); for(unsigned messagesIndex = 0; messagesIndex < messagesJsonList.GetLength(); ++messagesIndex) { m_messages.push_back(messagesJsonList[messagesIndex].AsObject()); } } if(jsonValue.ValueExists("interpretations")) { Aws::Utils::Array interpretationsJsonList = jsonValue.GetArray("interpretations"); for(unsigned interpretationsIndex = 0; interpretationsIndex < interpretationsJsonList.GetLength(); ++interpretationsIndex) { m_interpretations.push_back(interpretationsJsonList[interpretationsIndex].AsObject()); } } if(jsonValue.ValueExists("sessionState")) { m_sessionState = jsonValue.GetObject("sessionState"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }