This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-pinpoint/source/model/EndpointResponse.cpp

299 lines
6.6 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/pinpoint/model/EndpointResponse.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Pinpoint
{
namespace Model
{
EndpointResponse::EndpointResponse() :
m_addressHasBeenSet(false),
m_applicationIdHasBeenSet(false),
m_attributesHasBeenSet(false),
m_channelType(ChannelType::NOT_SET),
m_channelTypeHasBeenSet(false),
m_cohortIdHasBeenSet(false),
m_creationDateHasBeenSet(false),
m_demographicHasBeenSet(false),
m_effectiveDateHasBeenSet(false),
m_endpointStatusHasBeenSet(false),
m_idHasBeenSet(false),
m_locationHasBeenSet(false),
m_metricsHasBeenSet(false),
m_optOutHasBeenSet(false),
m_requestIdHasBeenSet(false),
m_userHasBeenSet(false)
{
}
EndpointResponse::EndpointResponse(JsonView jsonValue) :
m_addressHasBeenSet(false),
m_applicationIdHasBeenSet(false),
m_attributesHasBeenSet(false),
m_channelType(ChannelType::NOT_SET),
m_channelTypeHasBeenSet(false),
m_cohortIdHasBeenSet(false),
m_creationDateHasBeenSet(false),
m_demographicHasBeenSet(false),
m_effectiveDateHasBeenSet(false),
m_endpointStatusHasBeenSet(false),
m_idHasBeenSet(false),
m_locationHasBeenSet(false),
m_metricsHasBeenSet(false),
m_optOutHasBeenSet(false),
m_requestIdHasBeenSet(false),
m_userHasBeenSet(false)
{
*this = jsonValue;
}
EndpointResponse& EndpointResponse::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Address"))
{
m_address = jsonValue.GetString("Address");
m_addressHasBeenSet = true;
}
if(jsonValue.ValueExists("ApplicationId"))
{
m_applicationId = jsonValue.GetString("ApplicationId");
m_applicationIdHasBeenSet = true;
}
if(jsonValue.ValueExists("Attributes"))
{
Aws::Map<Aws::String, JsonView> attributesJsonMap = jsonValue.GetObject("Attributes").GetAllObjects();
for(auto& attributesItem : attributesJsonMap)
{
Array<JsonView> listOf__stringJsonList = attributesItem.second.AsArray();
Aws::Vector<Aws::String> 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_attributes[attributesItem.first] = std::move(listOf__stringList);
}
m_attributesHasBeenSet = true;
}
if(jsonValue.ValueExists("ChannelType"))
{
m_channelType = ChannelTypeMapper::GetChannelTypeForName(jsonValue.GetString("ChannelType"));
m_channelTypeHasBeenSet = true;
}
if(jsonValue.ValueExists("CohortId"))
{
m_cohortId = jsonValue.GetString("CohortId");
m_cohortIdHasBeenSet = true;
}
if(jsonValue.ValueExists("CreationDate"))
{
m_creationDate = jsonValue.GetString("CreationDate");
m_creationDateHasBeenSet = true;
}
if(jsonValue.ValueExists("Demographic"))
{
m_demographic = jsonValue.GetObject("Demographic");
m_demographicHasBeenSet = true;
}
if(jsonValue.ValueExists("EffectiveDate"))
{
m_effectiveDate = jsonValue.GetString("EffectiveDate");
m_effectiveDateHasBeenSet = true;
}
if(jsonValue.ValueExists("EndpointStatus"))
{
m_endpointStatus = jsonValue.GetString("EndpointStatus");
m_endpointStatusHasBeenSet = true;
}
if(jsonValue.ValueExists("Id"))
{
m_id = jsonValue.GetString("Id");
m_idHasBeenSet = true;
}
if(jsonValue.ValueExists("Location"))
{
m_location = jsonValue.GetObject("Location");
m_locationHasBeenSet = true;
}
if(jsonValue.ValueExists("Metrics"))
{
Aws::Map<Aws::String, JsonView> metricsJsonMap = jsonValue.GetObject("Metrics").GetAllObjects();
for(auto& metricsItem : metricsJsonMap)
{
m_metrics[metricsItem.first] = metricsItem.second.AsDouble();
}
m_metricsHasBeenSet = true;
}
if(jsonValue.ValueExists("OptOut"))
{
m_optOut = jsonValue.GetString("OptOut");
m_optOutHasBeenSet = true;
}
if(jsonValue.ValueExists("RequestId"))
{
m_requestId = jsonValue.GetString("RequestId");
m_requestIdHasBeenSet = true;
}
if(jsonValue.ValueExists("User"))
{
m_user = jsonValue.GetObject("User");
m_userHasBeenSet = true;
}
return *this;
}
JsonValue EndpointResponse::Jsonize() const
{
JsonValue payload;
if(m_addressHasBeenSet)
{
payload.WithString("Address", m_address);
}
if(m_applicationIdHasBeenSet)
{
payload.WithString("ApplicationId", m_applicationId);
}
if(m_attributesHasBeenSet)
{
JsonValue attributesJsonMap;
for(auto& attributesItem : m_attributes)
{
Array<JsonValue> listOf__stringJsonList(attributesItem.second.size());
for(unsigned listOf__stringIndex = 0; listOf__stringIndex < listOf__stringJsonList.GetLength(); ++listOf__stringIndex)
{
listOf__stringJsonList[listOf__stringIndex].AsString(attributesItem.second[listOf__stringIndex]);
}
attributesJsonMap.WithArray(attributesItem.first, std::move(listOf__stringJsonList));
}
payload.WithObject("Attributes", std::move(attributesJsonMap));
}
if(m_channelTypeHasBeenSet)
{
payload.WithString("ChannelType", ChannelTypeMapper::GetNameForChannelType(m_channelType));
}
if(m_cohortIdHasBeenSet)
{
payload.WithString("CohortId", m_cohortId);
}
if(m_creationDateHasBeenSet)
{
payload.WithString("CreationDate", m_creationDate);
}
if(m_demographicHasBeenSet)
{
payload.WithObject("Demographic", m_demographic.Jsonize());
}
if(m_effectiveDateHasBeenSet)
{
payload.WithString("EffectiveDate", m_effectiveDate);
}
if(m_endpointStatusHasBeenSet)
{
payload.WithString("EndpointStatus", m_endpointStatus);
}
if(m_idHasBeenSet)
{
payload.WithString("Id", m_id);
}
if(m_locationHasBeenSet)
{
payload.WithObject("Location", m_location.Jsonize());
}
if(m_metricsHasBeenSet)
{
JsonValue metricsJsonMap;
for(auto& metricsItem : m_metrics)
{
metricsJsonMap.WithDouble(metricsItem.first, metricsItem.second);
}
payload.WithObject("Metrics", std::move(metricsJsonMap));
}
if(m_optOutHasBeenSet)
{
payload.WithString("OptOut", m_optOut);
}
if(m_requestIdHasBeenSet)
{
payload.WithString("RequestId", m_requestId);
}
if(m_userHasBeenSet)
{
payload.WithObject("User", m_user.Jsonize());
}
return payload;
}
} // namespace Model
} // namespace Pinpoint
} // namespace Aws