| | 1 | | // <auto-generated> |
| | 2 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 3 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 4 | | // regenerated. |
| | 5 | | // </auto-generated> |
| | 6 | |
|
| | 7 | | namespace Microsoft.Azure.CognitiveServices.Search.EntitySearch.Models |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Newtonsoft.Json; |
| | 11 | | using System.Linq; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Defines a contractual rule for link attribution. |
| | 15 | | /// </summary> |
| | 16 | | [Newtonsoft.Json.JsonObject("ContractualRules/LinkAttribution")] |
| | 17 | | public partial class ContractualRulesLinkAttribution : ContractualRulesAttribution |
| | 18 | | { |
| | 19 | | /// <summary> |
| | 20 | | /// Initializes a new instance of the ContractualRulesLinkAttribution |
| | 21 | | /// class. |
| | 22 | | /// </summary> |
| 2 | 23 | | public ContractualRulesLinkAttribution() |
| | 24 | | { |
| | 25 | | CustomInit(); |
| 2 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the ContractualRulesLinkAttribution |
| | 30 | | /// class. |
| | 31 | | /// </summary> |
| | 32 | | /// <param name="text">The attribution text.</param> |
| | 33 | | /// <param name="url">The URL to the provider's website. Use text and |
| | 34 | | /// URL to create the hyperlink.</param> |
| | 35 | | /// <param name="targetPropertyName">The name of the field that the |
| | 36 | | /// rule applies to.</param> |
| | 37 | | /// <param name="mustBeCloseToContent">A Boolean value that determines |
| | 38 | | /// whether the contents of the rule must be placed in close proximity |
| | 39 | | /// to the field that the rule applies to. If true, the contents must |
| | 40 | | /// be placed in close proximity. If false, or this field does not |
| | 41 | | /// exist, the contents may be placed at the caller's |
| | 42 | | /// discretion.</param> |
| | 43 | | /// <param name="optionalForListDisplay">Indicates whether this |
| | 44 | | /// provider's attribution is optional.</param> |
| | 45 | | public ContractualRulesLinkAttribution(string text, string url, string targetPropertyName = default(string), boo |
| 0 | 46 | | : base(targetPropertyName, mustBeCloseToContent) |
| | 47 | | { |
| 0 | 48 | | Text = text; |
| 0 | 49 | | Url = url; |
| 0 | 50 | | OptionalForListDisplay = optionalForListDisplay; |
| | 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 the attribution text. |
| | 61 | | /// </summary> |
| | 62 | | [JsonProperty(PropertyName = "text")] |
| 0 | 63 | | public string Text { get; set; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Gets or sets the URL to the provider's website. Use text and URL to |
| | 67 | | /// create the hyperlink. |
| | 68 | | /// </summary> |
| | 69 | | [JsonProperty(PropertyName = "url")] |
| 0 | 70 | | public string Url { get; set; } |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// Gets indicates whether this provider's attribution is optional. |
| | 74 | | /// </summary> |
| | 75 | | [JsonProperty(PropertyName = "optionalForListDisplay")] |
| 0 | 76 | | public bool? OptionalForListDisplay { get; private set; } |
| | 77 | |
|
| | 78 | | /// <summary> |
| | 79 | | /// Validate the object. |
| | 80 | | /// </summary> |
| | 81 | | /// <exception cref="ValidationException"> |
| | 82 | | /// Thrown if validation fails |
| | 83 | | /// </exception> |
| | 84 | | public virtual void Validate() |
| | 85 | | { |
| 0 | 86 | | if (Text == null) |
| | 87 | | { |
| 0 | 88 | | throw new ValidationException(ValidationRules.CannotBeNull, "Text"); |
| | 89 | | } |
| 0 | 90 | | if (Url == null) |
| | 91 | | { |
| 0 | 92 | | throw new ValidationException(ValidationRules.CannotBeNull, "Url"); |
| | 93 | | } |
| 0 | 94 | | } |
| | 95 | | } |
| | 96 | | } |