| | | 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 | | /// PATCH Body schema for Update Qna List |
| | | 19 | | /// </summary> |
| | | 20 | | public partial class UpdateQnaDTO |
| | | 21 | | { |
| | | 22 | | /// <summary> |
| | | 23 | | /// Initializes a new instance of the UpdateQnaDTO class. |
| | | 24 | | /// </summary> |
| | 0 | 25 | | public UpdateQnaDTO() |
| | | 26 | | { |
| | | 27 | | CustomInit(); |
| | 0 | 28 | | } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Initializes a new instance of the UpdateQnaDTO class. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <param name="id">Unique id for the Q-A</param> |
| | | 34 | | /// <param name="answer">Answer text</param> |
| | | 35 | | /// <param name="source">Source from which Q-A was indexed. eg. |
| | | 36 | | /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs</param> |
| | | 37 | | /// <param name="questions">List of questions associated with the |
| | | 38 | | /// answer.</param> |
| | | 39 | | /// <param name="metadata">List of metadata associated with the answer |
| | | 40 | | /// to be updated</param> |
| | | 41 | | /// <param name="context">Context associated with Qna to be |
| | | 42 | | /// updated.</param> |
| | 0 | 43 | | public UpdateQnaDTO(int? id = default(int?), string answer = default(string), string source = default(string), U |
| | | 44 | | { |
| | 0 | 45 | | Id = id; |
| | 0 | 46 | | Answer = answer; |
| | 0 | 47 | | Source = source; |
| | 0 | 48 | | Questions = questions; |
| | 0 | 49 | | Metadata = metadata; |
| | 0 | 50 | | Context = context; |
| | | 51 | | CustomInit(); |
| | 0 | 52 | | } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// An initialization method that performs custom operations like setting defaults |
| | | 56 | | /// </summary> |
| | | 57 | | partial void CustomInit(); |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Gets or sets unique id for the Q-A |
| | | 61 | | /// </summary> |
| | | 62 | | [JsonProperty(PropertyName = "id")] |
| | 0 | 63 | | public int? Id { get; set; } |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Gets or sets answer text |
| | | 67 | | /// </summary> |
| | | 68 | | [JsonProperty(PropertyName = "answer")] |
| | 0 | 69 | | public string Answer { get; set; } |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// Gets or sets source from which Q-A was indexed. eg. |
| | | 73 | | /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |
| | | 74 | | /// </summary> |
| | | 75 | | [JsonProperty(PropertyName = "source")] |
| | 0 | 76 | | public string Source { get; set; } |
| | | 77 | | |
| | | 78 | | /// <summary> |
| | | 79 | | /// Gets or sets list of questions associated with the answer. |
| | | 80 | | /// </summary> |
| | | 81 | | [JsonProperty(PropertyName = "questions")] |
| | 0 | 82 | | public UpdateQnaDTOQuestions Questions { get; set; } |
| | | 83 | | |
| | | 84 | | /// <summary> |
| | | 85 | | /// Gets or sets list of metadata associated with the answer to be |
| | | 86 | | /// updated |
| | | 87 | | /// </summary> |
| | | 88 | | [JsonProperty(PropertyName = "metadata")] |
| | 0 | 89 | | public UpdateQnaDTOMetadata Metadata { get; set; } |
| | | 90 | | |
| | | 91 | | /// <summary> |
| | | 92 | | /// Gets or sets context associated with Qna to be updated. |
| | | 93 | | /// </summary> |
| | | 94 | | [JsonProperty(PropertyName = "context")] |
| | 0 | 95 | | public UpdateQnaDTOContext Context { get; set; } |
| | | 96 | | |
| | | 97 | | /// <summary> |
| | | 98 | | /// Validate the object. |
| | | 99 | | /// </summary> |
| | | 100 | | /// <exception cref="ValidationException"> |
| | | 101 | | /// Thrown if validation fails |
| | | 102 | | /// </exception> |
| | | 103 | | public virtual void Validate() |
| | | 104 | | { |
| | 0 | 105 | | if (Id > 2147483647) |
| | | 106 | | { |
| | 0 | 107 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "Id", 2147483647); |
| | | 108 | | } |
| | 0 | 109 | | if (Id < 0) |
| | | 110 | | { |
| | 0 | 111 | | throw new ValidationException(ValidationRules.InclusiveMinimum, "Id", 0); |
| | | 112 | | } |
| | 0 | 113 | | if (Source != null) |
| | | 114 | | { |
| | 0 | 115 | | if (Source.Length > 300) |
| | | 116 | | { |
| | 0 | 117 | | throw new ValidationException(ValidationRules.MaxLength, "Source", 300); |
| | | 118 | | } |
| | | 119 | | } |
| | 0 | 120 | | } |
| | | 121 | | } |
| | | 122 | | } |