/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace Pinpoint { namespace Model { VoiceMessage::VoiceMessage() : m_bodyHasBeenSet(false), m_languageCodeHasBeenSet(false), m_originationNumberHasBeenSet(false), m_substitutionsHasBeenSet(false), m_voiceIdHasBeenSet(false) { } VoiceMessage::VoiceMessage(JsonView jsonValue) : m_bodyHasBeenSet(false), m_languageCodeHasBeenSet(false), m_originationNumberHasBeenSet(false), m_substitutionsHasBeenSet(false), m_voiceIdHasBeenSet(false) { *this = jsonValue; } VoiceMessage& VoiceMessage::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Body")) { m_body = jsonValue.GetString("Body"); m_bodyHasBeenSet = true; } if(jsonValue.ValueExists("LanguageCode")) { m_languageCode = jsonValue.GetString("LanguageCode"); m_languageCodeHasBeenSet = true; } if(jsonValue.ValueExists("OriginationNumber")) { m_originationNumber = jsonValue.GetString("OriginationNumber"); m_originationNumberHasBeenSet = true; } if(jsonValue.ValueExists("Substitutions")) { Aws::Map substitutionsJsonMap = jsonValue.GetObject("Substitutions").GetAllObjects(); for(auto& substitutionsItem : substitutionsJsonMap) { Aws::Utils::Array listOf__stringJsonList = substitutionsItem.second.AsArray(); Aws::Vector listOf__stringList; listOf__stringList.reserve((size_t)listOf__stringJsonList.GetLength()); for(unsigned listOf__stringIndex = 0; listOf__stringIndex < listOf__stringJsonList.GetLength(); ++listOf__stringIndex) { listOf__stringList.push_back(listOf__stringJsonList[listOf__stringIndex].AsString()); } m_substitutions[substitutionsItem.first] = std::move(listOf__stringList); } m_substitutionsHasBeenSet = true; } if(jsonValue.ValueExists("VoiceId")) { m_voiceId = jsonValue.GetString("VoiceId"); m_voiceIdHasBeenSet = true; } return *this; } JsonValue VoiceMessage::Jsonize() const { JsonValue payload; if(m_bodyHasBeenSet) { payload.WithString("Body", m_body); } if(m_languageCodeHasBeenSet) { payload.WithString("LanguageCode", m_languageCode); } if(m_originationNumberHasBeenSet) { payload.WithString("OriginationNumber", m_originationNumber); } if(m_substitutionsHasBeenSet) { JsonValue substitutionsJsonMap; for(auto& substitutionsItem : m_substitutions) { Aws::Utils::Array listOf__stringJsonList(substitutionsItem.second.size()); for(unsigned listOf__stringIndex = 0; listOf__stringIndex < listOf__stringJsonList.GetLength(); ++listOf__stringIndex) { listOf__stringJsonList[listOf__stringIndex].AsString(substitutionsItem.second[listOf__stringIndex]); } substitutionsJsonMap.WithArray(substitutionsItem.first, std::move(listOf__stringJsonList)); } payload.WithObject("Substitutions", std::move(substitutionsJsonMap)); } if(m_voiceIdHasBeenSet) { payload.WithString("VoiceId", m_voiceId); } return payload; } } // namespace Model } // namespace Pinpoint } // namespace Aws