| | 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.Linq; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Prompt for an answer. |
| | 19 | | /// </summary> |
| | 20 | | public partial class PromptDTO |
| | 21 | | { |
| | 22 | | /// <summary> |
| | 23 | | /// Initializes a new instance of the PromptDTO class. |
| | 24 | | /// </summary> |
| 0 | 25 | | public PromptDTO() |
| | 26 | | { |
| | 27 | | CustomInit(); |
| 0 | 28 | | } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the PromptDTO class. |
| | 32 | | /// </summary> |
| | 33 | | /// <param name="displayOrder">Index of the prompt - used in ordering |
| | 34 | | /// of the prompts</param> |
| | 35 | | /// <param name="qnaId">Qna id corresponding to the prompt - if QnaId |
| | 36 | | /// is present, QnADTO object is ignored.</param> |
| | 37 | | /// <param name="qna">QnADTO - Either QnaId or QnADTO needs to be |
| | 38 | | /// present in a PromptDTO object</param> |
| | 39 | | /// <param name="displayText">Text displayed to represent a follow up |
| | 40 | | /// question prompt</param> |
| 0 | 41 | | public PromptDTO(int? displayOrder = default(int?), int? qnaId = default(int?), PromptDTOQna qna = default(Promp |
| | 42 | | { |
| 0 | 43 | | DisplayOrder = displayOrder; |
| 0 | 44 | | QnaId = qnaId; |
| 0 | 45 | | Qna = qna; |
| 0 | 46 | | DisplayText = displayText; |
| | 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 index of the prompt - used in ordering of the prompts |
| | 57 | | /// </summary> |
| | 58 | | [JsonProperty(PropertyName = "displayOrder")] |
| 0 | 59 | | public int? DisplayOrder { get; set; } |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Gets or sets qna id corresponding to the prompt - if QnaId is |
| | 63 | | /// present, QnADTO object is ignored. |
| | 64 | | /// </summary> |
| | 65 | | [JsonProperty(PropertyName = "qnaId")] |
| 0 | 66 | | public int? QnaId { get; set; } |
| | 67 | |
|
| | 68 | | /// <summary> |
| | 69 | | /// Gets or sets qnADTO - Either QnaId or QnADTO needs to be present in |
| | 70 | | /// a PromptDTO object |
| | 71 | | /// </summary> |
| | 72 | | [JsonProperty(PropertyName = "qna")] |
| 0 | 73 | | public PromptDTOQna Qna { get; set; } |
| | 74 | |
|
| | 75 | | /// <summary> |
| | 76 | | /// Gets or sets text displayed to represent a follow up question |
| | 77 | | /// prompt |
| | 78 | | /// </summary> |
| | 79 | | [JsonProperty(PropertyName = "displayText")] |
| 0 | 80 | | public string DisplayText { get; set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Validate the object. |
| | 84 | | /// </summary> |
| | 85 | | /// <exception cref="ValidationException"> |
| | 86 | | /// Thrown if validation fails |
| | 87 | | /// </exception> |
| | 88 | | public virtual void Validate() |
| | 89 | | { |
| 0 | 90 | | if (Qna != null) |
| | 91 | | { |
| 0 | 92 | | Qna.Validate(); |
| | 93 | | } |
| 0 | 94 | | if (DisplayText != null) |
| | 95 | | { |
| 0 | 96 | | if (DisplayText.Length > 200) |
| | 97 | | { |
| 0 | 98 | | throw new ValidationException(ValidationRules.MaxLength, "DisplayText", 200); |
| | 99 | | } |
| | 100 | | } |
| 0 | 101 | | } |
| | 102 | | } |
| | 103 | | } |