1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/mturk-requester/model/ListWorkerBlocksResult.h> 7 #include <aws/core/utils/json/JsonSerializer.h> 8 #include <aws/core/AmazonWebServiceResult.h> 9 #include <aws/core/utils/StringUtils.h> 10 #include <aws/core/utils/UnreferencedParam.h> 11 12 #include <utility> 13 14 using namespace Aws::MTurk::Model; 15 using namespace Aws::Utils::Json; 16 using namespace Aws::Utils; 17 using namespace Aws; 18 ListWorkerBlocksResult()19ListWorkerBlocksResult::ListWorkerBlocksResult() : 20 m_numResults(0) 21 { 22 } 23 ListWorkerBlocksResult(const Aws::AmazonWebServiceResult<JsonValue> & result)24ListWorkerBlocksResult::ListWorkerBlocksResult(const Aws::AmazonWebServiceResult<JsonValue>& result) : 25 m_numResults(0) 26 { 27 *this = result; 28 } 29 operator =(const Aws::AmazonWebServiceResult<JsonValue> & result)30ListWorkerBlocksResult& ListWorkerBlocksResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result) 31 { 32 JsonView jsonValue = result.GetPayload().View(); 33 if(jsonValue.ValueExists("NextToken")) 34 { 35 m_nextToken = jsonValue.GetString("NextToken"); 36 37 } 38 39 if(jsonValue.ValueExists("NumResults")) 40 { 41 m_numResults = jsonValue.GetInteger("NumResults"); 42 43 } 44 45 if(jsonValue.ValueExists("WorkerBlocks")) 46 { 47 Array<JsonView> workerBlocksJsonList = jsonValue.GetArray("WorkerBlocks"); 48 for(unsigned workerBlocksIndex = 0; workerBlocksIndex < workerBlocksJsonList.GetLength(); ++workerBlocksIndex) 49 { 50 m_workerBlocks.push_back(workerBlocksJsonList[workerBlocksIndex].AsObject()); 51 } 52 } 53 54 55 56 return *this; 57 } 58