| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Context associated with Qna. |
| | 21 | | /// </summary> |
| | 22 | | public partial class ContextDTO |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the ContextDTO class. |
| | 26 | | /// </summary> |
| 2 | 27 | | public ContextDTO() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 2 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the ContextDTO class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="isContextOnly">To mark if a prompt is relevant only |
| | 36 | | /// with a previous question or not. |
| | 37 | | /// true - Do not include this QnA as search result for queries without |
| | 38 | | /// context |
| | 39 | | /// false - ignores context and includes this QnA in search |
| | 40 | | /// result</param> |
| | 41 | | /// <param name="prompts">List of prompts associated with the |
| | 42 | | /// answer.</param> |
| 0 | 43 | | public ContextDTO(bool? isContextOnly = default(bool?), IList<PromptDTO> prompts = default(IList<PromptDTO>)) |
| | 44 | | { |
| 0 | 45 | | IsContextOnly = isContextOnly; |
| 0 | 46 | | Prompts = prompts; |
| | 47 | | CustomInit(); |
| 0 | 48 | | } |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// An initialization method that performs custom operations like setting defaults |
| | 52 | | /// </summary> |
| | 53 | | partial void CustomInit(); |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// Gets or sets to mark if a prompt is relevant only with a previous |
| | 57 | | /// question or not. |
| | 58 | | /// true - Do not include this QnA as search result for queries without |
| | 59 | | /// context |
| | 60 | | /// false - ignores context and includes this QnA in search result |
| | 61 | | /// </summary> |
| | 62 | | [JsonProperty(PropertyName = "isContextOnly")] |
| 0 | 63 | | public bool? IsContextOnly { get; set; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Gets or sets list of prompts associated with the answer. |
| | 67 | | /// </summary> |
| | 68 | | [JsonProperty(PropertyName = "prompts")] |
| 4 | 69 | | public IList<PromptDTO> Prompts { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Validate the object. |
| | 73 | | /// </summary> |
| | 74 | | /// <exception cref="ValidationException"> |
| | 75 | | /// Thrown if validation fails |
| | 76 | | /// </exception> |
| | 77 | | public virtual void Validate() |
| | 78 | | { |
| 0 | 79 | | if (Prompts != null) |
| | 80 | | { |
| 0 | 81 | | if (Prompts.Count > 20) |
| | 82 | | { |
| 0 | 83 | | throw new ValidationException(ValidationRules.MaxItems, "Prompts", 20); |
| | 84 | | } |
| 0 | 85 | | foreach (var element in Prompts) |
| | 86 | | { |
| 0 | 87 | | if (element != null) |
| | 88 | | { |
| 0 | 89 | | element.Validate(); |
| | 90 | | } |
| | 91 | | } |
| | 92 | | } |
| 0 | 93 | | } |
| | 94 | | } |
| | 95 | | } |