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/DescribeIntentResult.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 #include <aws/core/AmazonWebServiceResult.h>
9 #include <aws/core/utils/StringUtils.h>
10 #include <aws/core/utils/UnreferencedParam.h>
11 
12 #include <utility>
13 
14 using namespace Aws::LexModelsV2::Model;
15 using namespace Aws::Utils::Json;
16 using namespace Aws::Utils;
17 using namespace Aws;
18 
DescribeIntentResult()19 DescribeIntentResult::DescribeIntentResult()
20 {
21 }
22 
DescribeIntentResult(const Aws::AmazonWebServiceResult<JsonValue> & result)23 DescribeIntentResult::DescribeIntentResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
24 {
25   *this = result;
26 }
27 
operator =(const Aws::AmazonWebServiceResult<JsonValue> & result)28 DescribeIntentResult& DescribeIntentResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
29 {
30   JsonView jsonValue = result.GetPayload().View();
31   if(jsonValue.ValueExists("intentId"))
32   {
33     m_intentId = jsonValue.GetString("intentId");
34 
35   }
36 
37   if(jsonValue.ValueExists("intentName"))
38   {
39     m_intentName = jsonValue.GetString("intentName");
40 
41   }
42 
43   if(jsonValue.ValueExists("description"))
44   {
45     m_description = jsonValue.GetString("description");
46 
47   }
48 
49   if(jsonValue.ValueExists("parentIntentSignature"))
50   {
51     m_parentIntentSignature = jsonValue.GetString("parentIntentSignature");
52 
53   }
54 
55   if(jsonValue.ValueExists("sampleUtterances"))
56   {
57     Array<JsonView> sampleUtterancesJsonList = jsonValue.GetArray("sampleUtterances");
58     for(unsigned sampleUtterancesIndex = 0; sampleUtterancesIndex < sampleUtterancesJsonList.GetLength(); ++sampleUtterancesIndex)
59     {
60       m_sampleUtterances.push_back(sampleUtterancesJsonList[sampleUtterancesIndex].AsObject());
61     }
62   }
63 
64   if(jsonValue.ValueExists("dialogCodeHook"))
65   {
66     m_dialogCodeHook = jsonValue.GetObject("dialogCodeHook");
67 
68   }
69 
70   if(jsonValue.ValueExists("fulfillmentCodeHook"))
71   {
72     m_fulfillmentCodeHook = jsonValue.GetObject("fulfillmentCodeHook");
73 
74   }
75 
76   if(jsonValue.ValueExists("slotPriorities"))
77   {
78     Array<JsonView> slotPrioritiesJsonList = jsonValue.GetArray("slotPriorities");
79     for(unsigned slotPrioritiesIndex = 0; slotPrioritiesIndex < slotPrioritiesJsonList.GetLength(); ++slotPrioritiesIndex)
80     {
81       m_slotPriorities.push_back(slotPrioritiesJsonList[slotPrioritiesIndex].AsObject());
82     }
83   }
84 
85   if(jsonValue.ValueExists("intentConfirmationSetting"))
86   {
87     m_intentConfirmationSetting = jsonValue.GetObject("intentConfirmationSetting");
88 
89   }
90 
91   if(jsonValue.ValueExists("intentClosingSetting"))
92   {
93     m_intentClosingSetting = jsonValue.GetObject("intentClosingSetting");
94 
95   }
96 
97   if(jsonValue.ValueExists("inputContexts"))
98   {
99     Array<JsonView> inputContextsJsonList = jsonValue.GetArray("inputContexts");
100     for(unsigned inputContextsIndex = 0; inputContextsIndex < inputContextsJsonList.GetLength(); ++inputContextsIndex)
101     {
102       m_inputContexts.push_back(inputContextsJsonList[inputContextsIndex].AsObject());
103     }
104   }
105 
106   if(jsonValue.ValueExists("outputContexts"))
107   {
108     Array<JsonView> outputContextsJsonList = jsonValue.GetArray("outputContexts");
109     for(unsigned outputContextsIndex = 0; outputContextsIndex < outputContextsJsonList.GetLength(); ++outputContextsIndex)
110     {
111       m_outputContexts.push_back(outputContextsJsonList[outputContextsIndex].AsObject());
112     }
113   }
114 
115   if(jsonValue.ValueExists("kendraConfiguration"))
116   {
117     m_kendraConfiguration = jsonValue.GetObject("kendraConfiguration");
118 
119   }
120 
121   if(jsonValue.ValueExists("botId"))
122   {
123     m_botId = jsonValue.GetString("botId");
124 
125   }
126 
127   if(jsonValue.ValueExists("botVersion"))
128   {
129     m_botVersion = jsonValue.GetString("botVersion");
130 
131   }
132 
133   if(jsonValue.ValueExists("localeId"))
134   {
135     m_localeId = jsonValue.GetString("localeId");
136 
137   }
138 
139   if(jsonValue.ValueExists("creationDateTime"))
140   {
141     m_creationDateTime = jsonValue.GetDouble("creationDateTime");
142 
143   }
144 
145   if(jsonValue.ValueExists("lastUpdatedDateTime"))
146   {
147     m_lastUpdatedDateTime = jsonValue.GetDouble("lastUpdatedDateTime");
148 
149   }
150 
151 
152 
153   return *this;
154 }
155