121 lines
2.2 KiB
C++
121 lines
2.2 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/pinpoint/model/DefaultPushNotificationTemplate.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
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DefaultPushNotificationTemplate::DefaultPushNotificationTemplate() :
|
|||
|
|
m_action(Action::NOT_SET),
|
|||
|
|
m_actionHasBeenSet(false),
|
|||
|
|
m_bodyHasBeenSet(false),
|
|||
|
|
m_soundHasBeenSet(false),
|
|||
|
|
m_titleHasBeenSet(false),
|
|||
|
|
m_urlHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DefaultPushNotificationTemplate::DefaultPushNotificationTemplate(JsonView jsonValue) :
|
|||
|
|
m_action(Action::NOT_SET),
|
|||
|
|
m_actionHasBeenSet(false),
|
|||
|
|
m_bodyHasBeenSet(false),
|
|||
|
|
m_soundHasBeenSet(false),
|
|||
|
|
m_titleHasBeenSet(false),
|
|||
|
|
m_urlHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DefaultPushNotificationTemplate& DefaultPushNotificationTemplate::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("Action"))
|
|||
|
|
{
|
|||
|
|
m_action = ActionMapper::GetActionForName(jsonValue.GetString("Action"));
|
|||
|
|
|
|||
|
|
m_actionHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Body"))
|
|||
|
|
{
|
|||
|
|
m_body = jsonValue.GetString("Body");
|
|||
|
|
|
|||
|
|
m_bodyHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Sound"))
|
|||
|
|
{
|
|||
|
|
m_sound = jsonValue.GetString("Sound");
|
|||
|
|
|
|||
|
|
m_soundHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Title"))
|
|||
|
|
{
|
|||
|
|
m_title = jsonValue.GetString("Title");
|
|||
|
|
|
|||
|
|
m_titleHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Url"))
|
|||
|
|
{
|
|||
|
|
m_url = jsonValue.GetString("Url");
|
|||
|
|
|
|||
|
|
m_urlHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue DefaultPushNotificationTemplate::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_actionHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Action", ActionMapper::GetNameForAction(m_action));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_bodyHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Body", m_body);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_soundHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Sound", m_sound);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_titleHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Title", m_title);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_urlHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Url", m_url);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace Pinpoint
|
|||
|
|
} // namespace Aws
|