1 package runtime
2
3
4
5
6
7
8
9 import (
10 "encoding/json"
11 "github.com/Azure/go-autorest/autorest"
12 )
13
14
15 const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/luis/runtime"
16
17
18 type APIError struct {
19
20 StatusCode *string `json:"statusCode,omitempty"`
21
22 Message *string `json:"message,omitempty"`
23 }
24
25
26 type CompositeChildModel struct {
27
28 Type *string `json:"type,omitempty"`
29
30 Value *string `json:"value,omitempty"`
31 }
32
33
34 type CompositeEntityModel struct {
35
36 ParentType *string `json:"parentType,omitempty"`
37
38 Value *string `json:"value,omitempty"`
39
40 Children *[]CompositeChildModel `json:"children,omitempty"`
41 }
42
43
44 type EntityModel struct {
45
46 AdditionalProperties map[string]interface{} `json:""`
47
48 Entity *string `json:"entity,omitempty"`
49
50 Type *string `json:"type,omitempty"`
51
52 StartIndex *int32 `json:"startIndex,omitempty"`
53
54 EndIndex *int32 `json:"endIndex,omitempty"`
55 }
56
57
58 func (em EntityModel) MarshalJSON() ([]byte, error) {
59 objectMap := make(map[string]interface{})
60 if em.Entity != nil {
61 objectMap["entity"] = em.Entity
62 }
63 if em.Type != nil {
64 objectMap["type"] = em.Type
65 }
66 if em.StartIndex != nil {
67 objectMap["startIndex"] = em.StartIndex
68 }
69 if em.EndIndex != nil {
70 objectMap["endIndex"] = em.EndIndex
71 }
72 for k, v := range em.AdditionalProperties {
73 objectMap[k] = v
74 }
75 return json.Marshal(objectMap)
76 }
77
78
79 func (em *EntityModel) UnmarshalJSON(body []byte) error {
80 var m map[string]*json.RawMessage
81 err := json.Unmarshal(body, &m)
82 if err != nil {
83 return err
84 }
85 for k, v := range m {
86 switch k {
87 default:
88 if v != nil {
89 var additionalProperties interface{}
90 err = json.Unmarshal(*v, &additionalProperties)
91 if err != nil {
92 return err
93 }
94 if em.AdditionalProperties == nil {
95 em.AdditionalProperties = make(map[string]interface{})
96 }
97 em.AdditionalProperties[k] = additionalProperties
98 }
99 case "entity":
100 if v != nil {
101 var entity string
102 err = json.Unmarshal(*v, &entity)
103 if err != nil {
104 return err
105 }
106 em.Entity = &entity
107 }
108 case "type":
109 if v != nil {
110 var typeVar string
111 err = json.Unmarshal(*v, &typeVar)
112 if err != nil {
113 return err
114 }
115 em.Type = &typeVar
116 }
117 case "startIndex":
118 if v != nil {
119 var startIndex int32
120 err = json.Unmarshal(*v, &startIndex)
121 if err != nil {
122 return err
123 }
124 em.StartIndex = &startIndex
125 }
126 case "endIndex":
127 if v != nil {
128 var endIndex int32
129 err = json.Unmarshal(*v, &endIndex)
130 if err != nil {
131 return err
132 }
133 em.EndIndex = &endIndex
134 }
135 }
136 }
137
138 return nil
139 }
140
141
142 type EntityWithResolution struct {
143
144 Resolution interface{} `json:"resolution,omitempty"`
145
146 AdditionalProperties map[string]interface{} `json:""`
147
148 Entity *string `json:"entity,omitempty"`
149
150 Type *string `json:"type,omitempty"`
151
152 StartIndex *int32 `json:"startIndex,omitempty"`
153
154 EndIndex *int32 `json:"endIndex,omitempty"`
155 }
156
157
158 func (ewr EntityWithResolution) MarshalJSON() ([]byte, error) {
159 objectMap := make(map[string]interface{})
160 if ewr.Resolution != nil {
161 objectMap["resolution"] = ewr.Resolution
162 }
163 if ewr.Entity != nil {
164 objectMap["entity"] = ewr.Entity
165 }
166 if ewr.Type != nil {
167 objectMap["type"] = ewr.Type
168 }
169 if ewr.StartIndex != nil {
170 objectMap["startIndex"] = ewr.StartIndex
171 }
172 if ewr.EndIndex != nil {
173 objectMap["endIndex"] = ewr.EndIndex
174 }
175 for k, v := range ewr.AdditionalProperties {
176 objectMap[k] = v
177 }
178 return json.Marshal(objectMap)
179 }
180
181
182 func (ewr *EntityWithResolution) UnmarshalJSON(body []byte) error {
183 var m map[string]*json.RawMessage
184 err := json.Unmarshal(body, &m)
185 if err != nil {
186 return err
187 }
188 for k, v := range m {
189 switch k {
190 case "resolution":
191 if v != nil {
192 var resolution interface{}
193 err = json.Unmarshal(*v, &resolution)
194 if err != nil {
195 return err
196 }
197 ewr.Resolution = resolution
198 }
199 default:
200 if v != nil {
201 var additionalProperties interface{}
202 err = json.Unmarshal(*v, &additionalProperties)
203 if err != nil {
204 return err
205 }
206 if ewr.AdditionalProperties == nil {
207 ewr.AdditionalProperties = make(map[string]interface{})
208 }
209 ewr.AdditionalProperties[k] = additionalProperties
210 }
211 case "entity":
212 if v != nil {
213 var entity string
214 err = json.Unmarshal(*v, &entity)
215 if err != nil {
216 return err
217 }
218 ewr.Entity = &entity
219 }
220 case "type":
221 if v != nil {
222 var typeVar string
223 err = json.Unmarshal(*v, &typeVar)
224 if err != nil {
225 return err
226 }
227 ewr.Type = &typeVar
228 }
229 case "startIndex":
230 if v != nil {
231 var startIndex int32
232 err = json.Unmarshal(*v, &startIndex)
233 if err != nil {
234 return err
235 }
236 ewr.StartIndex = &startIndex
237 }
238 case "endIndex":
239 if v != nil {
240 var endIndex int32
241 err = json.Unmarshal(*v, &endIndex)
242 if err != nil {
243 return err
244 }
245 ewr.EndIndex = &endIndex
246 }
247 }
248 }
249
250 return nil
251 }
252
253
254 type EntityWithScore struct {
255
256 Score *float64 `json:"score,omitempty"`
257
258 AdditionalProperties map[string]interface{} `json:""`
259
260 Entity *string `json:"entity,omitempty"`
261
262 Type *string `json:"type,omitempty"`
263
264 StartIndex *int32 `json:"startIndex,omitempty"`
265
266 EndIndex *int32 `json:"endIndex,omitempty"`
267 }
268
269
270 func (ews EntityWithScore) MarshalJSON() ([]byte, error) {
271 objectMap := make(map[string]interface{})
272 if ews.Score != nil {
273 objectMap["score"] = ews.Score
274 }
275 if ews.Entity != nil {
276 objectMap["entity"] = ews.Entity
277 }
278 if ews.Type != nil {
279 objectMap["type"] = ews.Type
280 }
281 if ews.StartIndex != nil {
282 objectMap["startIndex"] = ews.StartIndex
283 }
284 if ews.EndIndex != nil {
285 objectMap["endIndex"] = ews.EndIndex
286 }
287 for k, v := range ews.AdditionalProperties {
288 objectMap[k] = v
289 }
290 return json.Marshal(objectMap)
291 }
292
293
294 func (ews *EntityWithScore) UnmarshalJSON(body []byte) error {
295 var m map[string]*json.RawMessage
296 err := json.Unmarshal(body, &m)
297 if err != nil {
298 return err
299 }
300 for k, v := range m {
301 switch k {
302 case "score":
303 if v != nil {
304 var score float64
305 err = json.Unmarshal(*v, &score)
306 if err != nil {
307 return err
308 }
309 ews.Score = &score
310 }
311 default:
312 if v != nil {
313 var additionalProperties interface{}
314 err = json.Unmarshal(*v, &additionalProperties)
315 if err != nil {
316 return err
317 }
318 if ews.AdditionalProperties == nil {
319 ews.AdditionalProperties = make(map[string]interface{})
320 }
321 ews.AdditionalProperties[k] = additionalProperties
322 }
323 case "entity":
324 if v != nil {
325 var entity string
326 err = json.Unmarshal(*v, &entity)
327 if err != nil {
328 return err
329 }
330 ews.Entity = &entity
331 }
332 case "type":
333 if v != nil {
334 var typeVar string
335 err = json.Unmarshal(*v, &typeVar)
336 if err != nil {
337 return err
338 }
339 ews.Type = &typeVar
340 }
341 case "startIndex":
342 if v != nil {
343 var startIndex int32
344 err = json.Unmarshal(*v, &startIndex)
345 if err != nil {
346 return err
347 }
348 ews.StartIndex = &startIndex
349 }
350 case "endIndex":
351 if v != nil {
352 var endIndex int32
353 err = json.Unmarshal(*v, &endIndex)
354 if err != nil {
355 return err
356 }
357 ews.EndIndex = &endIndex
358 }
359 }
360 }
361
362 return nil
363 }
364
365
366 type IntentModel struct {
367
368 Intent *string `json:"intent,omitempty"`
369
370 Score *float64 `json:"score,omitempty"`
371 }
372
373
374 type LuisResult struct {
375 autorest.Response `json:"-"`
376
377 Query *string `json:"query,omitempty"`
378
379 AlteredQuery *string `json:"alteredQuery,omitempty"`
380 TopScoringIntent *IntentModel `json:"topScoringIntent,omitempty"`
381
382 Intents *[]IntentModel `json:"intents,omitempty"`
383
384 Entities *[]EntityModel `json:"entities,omitempty"`
385
386 CompositeEntities *[]CompositeEntityModel `json:"compositeEntities,omitempty"`
387 SentimentAnalysis *Sentiment `json:"sentimentAnalysis,omitempty"`
388 ConnectedServiceResult *LuisResult `json:"connectedServiceResult,omitempty"`
389 }
390
391
392 type Sentiment struct {
393
394 Label *string `json:"label,omitempty"`
395
396 Score *float64 `json:"score,omitempty"`
397 }
398
View as plain text