/** * 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::Comprehend::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; ClassifyDocumentResult::ClassifyDocumentResult() { } ClassifyDocumentResult::ClassifyDocumentResult(const Aws::AmazonWebServiceResult& result) { *this = result; } ClassifyDocumentResult& ClassifyDocumentResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Classes")) { Aws::Utils::Array classesJsonList = jsonValue.GetArray("Classes"); for(unsigned classesIndex = 0; classesIndex < classesJsonList.GetLength(); ++classesIndex) { m_classes.push_back(classesJsonList[classesIndex].AsObject()); } } if(jsonValue.ValueExists("Labels")) { Aws::Utils::Array labelsJsonList = jsonValue.GetArray("Labels"); for(unsigned labelsIndex = 0; labelsIndex < labelsJsonList.GetLength(); ++labelsIndex) { m_labels.push_back(labelsJsonList[labelsIndex].AsObject()); } } if(jsonValue.ValueExists("DocumentMetadata")) { m_documentMetadata = jsonValue.GetObject("DocumentMetadata"); } if(jsonValue.ValueExists("DocumentType")) { Aws::Utils::Array documentTypeJsonList = jsonValue.GetArray("DocumentType"); for(unsigned documentTypeIndex = 0; documentTypeIndex < documentTypeJsonList.GetLength(); ++documentTypeIndex) { m_documentType.push_back(documentTypeJsonList[documentTypeIndex].AsObject()); } } if(jsonValue.ValueExists("Errors")) { Aws::Utils::Array errorsJsonList = jsonValue.GetArray("Errors"); for(unsigned errorsIndex = 0; errorsIndex < errorsJsonList.GetLength(); ++errorsIndex) { m_errors.push_back(errorsJsonList[errorsIndex].AsObject()); } } if(jsonValue.ValueExists("Warnings")) { Aws::Utils::Array warningsJsonList = jsonValue.GetArray("Warnings"); for(unsigned warningsIndex = 0; warningsIndex < warningsJsonList.GetLength(); ++warningsIndex) { m_warnings.push_back(warningsJsonList[warningsIndex].AsObject()); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }