91 lines
2.0 KiB
C++
91 lines
2.0 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/workdocs/model/Participants.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace WorkDocs
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
Participants::Participants() :
|
|
m_usersHasBeenSet(false),
|
|
m_groupsHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Participants::Participants(JsonView jsonValue) :
|
|
m_usersHasBeenSet(false),
|
|
m_groupsHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Participants& Participants::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Users"))
|
|
{
|
|
Array<JsonView> usersJsonList = jsonValue.GetArray("Users");
|
|
for(unsigned usersIndex = 0; usersIndex < usersJsonList.GetLength(); ++usersIndex)
|
|
{
|
|
m_users.push_back(usersJsonList[usersIndex].AsObject());
|
|
}
|
|
m_usersHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Groups"))
|
|
{
|
|
Array<JsonView> groupsJsonList = jsonValue.GetArray("Groups");
|
|
for(unsigned groupsIndex = 0; groupsIndex < groupsJsonList.GetLength(); ++groupsIndex)
|
|
{
|
|
m_groups.push_back(groupsJsonList[groupsIndex].AsObject());
|
|
}
|
|
m_groupsHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Participants::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_usersHasBeenSet)
|
|
{
|
|
Array<JsonValue> usersJsonList(m_users.size());
|
|
for(unsigned usersIndex = 0; usersIndex < usersJsonList.GetLength(); ++usersIndex)
|
|
{
|
|
usersJsonList[usersIndex].AsObject(m_users[usersIndex].Jsonize());
|
|
}
|
|
payload.WithArray("Users", std::move(usersJsonList));
|
|
|
|
}
|
|
|
|
if(m_groupsHasBeenSet)
|
|
{
|
|
Array<JsonValue> groupsJsonList(m_groups.size());
|
|
for(unsigned groupsIndex = 0; groupsIndex < groupsJsonList.GetLength(); ++groupsIndex)
|
|
{
|
|
groupsJsonList[groupsIndex].AsObject(m_groups[groupsIndex].Jsonize());
|
|
}
|
|
payload.WithArray("Groups", std::move(groupsJsonList));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace WorkDocs
|
|
} // namespace Aws
|