| | 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 | | /// Contains list of QnAs to be updated |
| | 19 | | /// </summary> |
| | 20 | | public partial class UpdateKbOperationDTO |
| | 21 | | { |
| | 22 | | /// <summary> |
| | 23 | | /// Initializes a new instance of the UpdateKbOperationDTO class. |
| | 24 | | /// </summary> |
| 0 | 25 | | public UpdateKbOperationDTO() |
| | 26 | | { |
| | 27 | | CustomInit(); |
| 0 | 28 | | } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the UpdateKbOperationDTO class. |
| | 32 | | /// </summary> |
| | 33 | | /// <param name="add">An instance of CreateKbInputDTO for add |
| | 34 | | /// operation</param> |
| | 35 | | /// <param name="delete">An instance of DeleteKbContentsDTO for delete |
| | 36 | | /// Operation</param> |
| | 37 | | /// <param name="update">An instance of UpdateKbContentsDTO for Update |
| | 38 | | /// Operation</param> |
| | 39 | | /// <param name="enableHierarchicalExtraction">Enable hierarchical |
| | 40 | | /// extraction of Q-A from files and urls. The value set during KB |
| | 41 | | /// creation will be used if this field is not present.</param> |
| | 42 | | /// <param name="defaultAnswerUsedForExtraction">Text string to be used |
| | 43 | | /// as the answer in any Q-A which has no extracted answer from the |
| | 44 | | /// document but has a hierarchy. Required when |
| | 45 | | /// EnableHierarchicalExtraction field is set to True.</param> |
| 0 | 46 | | public UpdateKbOperationDTO(UpdateKbOperationDTOAdd add = default(UpdateKbOperationDTOAdd), UpdateKbOperationDTO |
| | 47 | | { |
| 0 | 48 | | Add = add; |
| 0 | 49 | | Delete = delete; |
| 0 | 50 | | Update = update; |
| 0 | 51 | | EnableHierarchicalExtraction = enableHierarchicalExtraction; |
| 0 | 52 | | DefaultAnswerUsedForExtraction = defaultAnswerUsedForExtraction; |
| | 53 | | CustomInit(); |
| 0 | 54 | | } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// An initialization method that performs custom operations like setting defaults |
| | 58 | | /// </summary> |
| | 59 | | partial void CustomInit(); |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Gets or sets an instance of CreateKbInputDTO for add operation |
| | 63 | | /// </summary> |
| | 64 | | [JsonProperty(PropertyName = "add")] |
| 0 | 65 | | public UpdateKbOperationDTOAdd Add { get; set; } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets an instance of DeleteKbContentsDTO for delete |
| | 69 | | /// Operation |
| | 70 | | /// </summary> |
| | 71 | | [JsonProperty(PropertyName = "delete")] |
| 0 | 72 | | public UpdateKbOperationDTODelete Delete { get; set; } |
| | 73 | |
|
| | 74 | | /// <summary> |
| | 75 | | /// Gets or sets an instance of UpdateKbContentsDTO for Update |
| | 76 | | /// Operation |
| | 77 | | /// </summary> |
| | 78 | | [JsonProperty(PropertyName = "update")] |
| 0 | 79 | | public UpdateKbOperationDTOUpdate Update { get; set; } |
| | 80 | |
|
| | 81 | | /// <summary> |
| | 82 | | /// Gets or sets enable hierarchical extraction of Q-A from files and |
| | 83 | | /// urls. The value set during KB creation will be used if this field |
| | 84 | | /// is not present. |
| | 85 | | /// </summary> |
| | 86 | | [JsonProperty(PropertyName = "enableHierarchicalExtraction")] |
| 0 | 87 | | public bool? EnableHierarchicalExtraction { get; set; } |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Gets or sets text string to be used as the answer in any Q-A which |
| | 91 | | /// has no extracted answer from the document but has a hierarchy. |
| | 92 | | /// Required when EnableHierarchicalExtraction field is set to True. |
| | 93 | | /// </summary> |
| | 94 | | [JsonProperty(PropertyName = "defaultAnswerUsedForExtraction")] |
| 0 | 95 | | public string DefaultAnswerUsedForExtraction { 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 (DefaultAnswerUsedForExtraction != null) |
| | 106 | | { |
| 0 | 107 | | if (DefaultAnswerUsedForExtraction.Length > 300) |
| | 108 | | { |
| 0 | 109 | | throw new ValidationException(ValidationRules.MaxLength, "DefaultAnswerUsedForExtraction", 300); |
| | 110 | | } |
| 0 | 111 | | if (DefaultAnswerUsedForExtraction.Length < 1) |
| | 112 | | { |
| 0 | 113 | | throw new ValidationException(ValidationRules.MinLength, "DefaultAnswerUsedForExtraction", 1); |
| | 114 | | } |
| | 115 | | } |
| 0 | 116 | | } |
| | 117 | | } |
| | 118 | | } |