1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/lexv2-models/model/SlotSummary.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace LexModelsV2
17 {
18 namespace Model
19 {
20
SlotSummary()21 SlotSummary::SlotSummary() :
22 m_slotIdHasBeenSet(false),
23 m_slotNameHasBeenSet(false),
24 m_descriptionHasBeenSet(false),
25 m_slotConstraint(SlotConstraint::NOT_SET),
26 m_slotConstraintHasBeenSet(false),
27 m_slotTypeIdHasBeenSet(false),
28 m_valueElicitationPromptSpecificationHasBeenSet(false),
29 m_lastUpdatedDateTimeHasBeenSet(false)
30 {
31 }
32
SlotSummary(JsonView jsonValue)33 SlotSummary::SlotSummary(JsonView jsonValue) :
34 m_slotIdHasBeenSet(false),
35 m_slotNameHasBeenSet(false),
36 m_descriptionHasBeenSet(false),
37 m_slotConstraint(SlotConstraint::NOT_SET),
38 m_slotConstraintHasBeenSet(false),
39 m_slotTypeIdHasBeenSet(false),
40 m_valueElicitationPromptSpecificationHasBeenSet(false),
41 m_lastUpdatedDateTimeHasBeenSet(false)
42 {
43 *this = jsonValue;
44 }
45
operator =(JsonView jsonValue)46 SlotSummary& SlotSummary::operator =(JsonView jsonValue)
47 {
48 if(jsonValue.ValueExists("slotId"))
49 {
50 m_slotId = jsonValue.GetString("slotId");
51
52 m_slotIdHasBeenSet = true;
53 }
54
55 if(jsonValue.ValueExists("slotName"))
56 {
57 m_slotName = jsonValue.GetString("slotName");
58
59 m_slotNameHasBeenSet = true;
60 }
61
62 if(jsonValue.ValueExists("description"))
63 {
64 m_description = jsonValue.GetString("description");
65
66 m_descriptionHasBeenSet = true;
67 }
68
69 if(jsonValue.ValueExists("slotConstraint"))
70 {
71 m_slotConstraint = SlotConstraintMapper::GetSlotConstraintForName(jsonValue.GetString("slotConstraint"));
72
73 m_slotConstraintHasBeenSet = true;
74 }
75
76 if(jsonValue.ValueExists("slotTypeId"))
77 {
78 m_slotTypeId = jsonValue.GetString("slotTypeId");
79
80 m_slotTypeIdHasBeenSet = true;
81 }
82
83 if(jsonValue.ValueExists("valueElicitationPromptSpecification"))
84 {
85 m_valueElicitationPromptSpecification = jsonValue.GetObject("valueElicitationPromptSpecification");
86
87 m_valueElicitationPromptSpecificationHasBeenSet = true;
88 }
89
90 if(jsonValue.ValueExists("lastUpdatedDateTime"))
91 {
92 m_lastUpdatedDateTime = jsonValue.GetDouble("lastUpdatedDateTime");
93
94 m_lastUpdatedDateTimeHasBeenSet = true;
95 }
96
97 return *this;
98 }
99
Jsonize() const100 JsonValue SlotSummary::Jsonize() const
101 {
102 JsonValue payload;
103
104 if(m_slotIdHasBeenSet)
105 {
106 payload.WithString("slotId", m_slotId);
107
108 }
109
110 if(m_slotNameHasBeenSet)
111 {
112 payload.WithString("slotName", m_slotName);
113
114 }
115
116 if(m_descriptionHasBeenSet)
117 {
118 payload.WithString("description", m_description);
119
120 }
121
122 if(m_slotConstraintHasBeenSet)
123 {
124 payload.WithString("slotConstraint", SlotConstraintMapper::GetNameForSlotConstraint(m_slotConstraint));
125 }
126
127 if(m_slotTypeIdHasBeenSet)
128 {
129 payload.WithString("slotTypeId", m_slotTypeId);
130
131 }
132
133 if(m_valueElicitationPromptSpecificationHasBeenSet)
134 {
135 payload.WithObject("valueElicitationPromptSpecification", m_valueElicitationPromptSpecification.Jsonize());
136
137 }
138
139 if(m_lastUpdatedDateTimeHasBeenSet)
140 {
141 payload.WithDouble("lastUpdatedDateTime", m_lastUpdatedDateTime.SecondsWithMSPrecision());
142 }
143
144 return payload;
145 }
146
147 } // namespace Model
148 } // namespace LexModelsV2
149 } // namespace Aws
150