| | 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.ContentModerator.Models |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Newtonsoft.Json; |
| | 11 | | using System.Collections; |
| | 12 | | using System.Collections.Generic; |
| | 13 | | using System.Linq; |
| | 14 | |
|
| | 15 | | /// <summary> |
| | 16 | | /// Schema items of the body. |
| | 17 | | /// </summary> |
| | 18 | | public partial class CreateReviewBodyItem |
| | 19 | | { |
| | 20 | | /// <summary> |
| | 21 | | /// Initializes a new instance of the CreateReviewBodyItem class. |
| | 22 | | /// </summary> |
| 5 | 23 | | public CreateReviewBodyItem() |
| | 24 | | { |
| | 25 | | CustomInit(); |
| 5 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the CreateReviewBodyItem class. |
| | 30 | | /// </summary> |
| | 31 | | /// <param name="type">Type of the content. Possible values include: |
| | 32 | | /// 'Image', 'Text'</param> |
| | 33 | | /// <param name="content">Content to review.</param> |
| | 34 | | /// <param name="contentId">Content Identifier.</param> |
| | 35 | | /// <param name="callbackEndpoint">Optional CallbackEndpoint.</param> |
| | 36 | | /// <param name="metadata">Optional metadata details.</param> |
| 4 | 37 | | public CreateReviewBodyItem(string type, string content, string contentId, string callbackEndpoint = default(str |
| | 38 | | { |
| 4 | 39 | | Type = type; |
| 4 | 40 | | Content = content; |
| 4 | 41 | | ContentId = contentId; |
| 4 | 42 | | CallbackEndpoint = callbackEndpoint; |
| 4 | 43 | | Metadata = metadata; |
| | 44 | | CustomInit(); |
| 4 | 45 | | } |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// An initialization method that performs custom operations like setting defaults |
| | 49 | | /// </summary> |
| | 50 | | partial void CustomInit(); |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// Gets or sets type of the content. Possible values include: 'Image', |
| | 54 | | /// 'Text' |
| | 55 | | /// </summary> |
| | 56 | | [JsonProperty(PropertyName = "Type")] |
| 6 | 57 | | public string Type { get; set; } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Gets or sets content to review. |
| | 61 | | /// </summary> |
| | 62 | | [JsonProperty(PropertyName = "Content")] |
| 6 | 63 | | public string Content { get; set; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Gets or sets content Identifier. |
| | 67 | | /// </summary> |
| | 68 | | [JsonProperty(PropertyName = "ContentId")] |
| 6 | 69 | | public string ContentId { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets or sets optional CallbackEndpoint. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "CallbackEndpoint")] |
| 5 | 75 | | public string CallbackEndpoint { get; set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Gets or sets optional metadata details. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "Metadata")] |
| 7 | 81 | | public IList<CreateReviewBodyItemMetadataItem> Metadata { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Validate the object. |
| | 85 | | /// </summary> |
| | 86 | | /// <exception cref="ValidationException"> |
| | 87 | | /// Thrown if validation fails |
| | 88 | | /// </exception> |
| | 89 | | public virtual void Validate() |
| | 90 | | { |
| 1 | 91 | | if (Type == null) |
| | 92 | | { |
| 0 | 93 | | throw new ValidationException(ValidationRules.CannotBeNull, "Type"); |
| | 94 | | } |
| 1 | 95 | | if (Content == null) |
| | 96 | | { |
| 0 | 97 | | throw new ValidationException(ValidationRules.CannotBeNull, "Content"); |
| | 98 | | } |
| 1 | 99 | | if (ContentId == null) |
| | 100 | | { |
| 0 | 101 | | throw new ValidationException(ValidationRules.CannotBeNull, "ContentId"); |
| | 102 | | } |
| 1 | 103 | | if (Metadata != null) |
| | 104 | | { |
| 4 | 105 | | foreach (var element in Metadata) |
| | 106 | | { |
| 1 | 107 | | if (element != null) |
| | 108 | | { |
| 1 | 109 | | element.Validate(); |
| | 110 | | } |
| | 111 | | } |
| | 112 | | } |
| 1 | 113 | | } |
| | 114 | | } |
| | 115 | | } |