| | 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.CustomImageSearch.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 | | /// The top-level response that represents a failed request. |
| | 17 | | /// </summary> |
| | 18 | | public partial class ErrorResponse : Response |
| | 19 | | { |
| | 20 | | /// <summary> |
| | 21 | | /// Initializes a new instance of the ErrorResponse class. |
| | 22 | | /// </summary> |
| 0 | 23 | | public ErrorResponse() |
| | 24 | | { |
| | 25 | | CustomInit(); |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the ErrorResponse class. |
| | 30 | | /// </summary> |
| | 31 | | /// <param name="errors">A list of errors that describe the reasons why |
| | 32 | | /// the request failed.</param> |
| | 33 | | /// <param name="id">A String identifier.</param> |
| | 34 | | /// <param name="readLink">The URL that returns this resource.</param> |
| | 35 | | /// <param name="webSearchUrl">The URL To Bing's search result for this |
| | 36 | | /// item.</param> |
| | 37 | | public ErrorResponse(IList<Error> errors, string id = default(string), string readLink = default(string), string |
| 0 | 38 | | : base(id, readLink, webSearchUrl) |
| | 39 | | { |
| 0 | 40 | | Errors = errors; |
| | 41 | | CustomInit(); |
| 0 | 42 | | } |
| | 43 | |
|
| | 44 | | /// <summary> |
| | 45 | | /// An initialization method that performs custom operations like setting defaults |
| | 46 | | /// </summary> |
| | 47 | | partial void CustomInit(); |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// Gets or sets a list of errors that describe the reasons why the |
| | 51 | | /// request failed. |
| | 52 | | /// </summary> |
| | 53 | | [JsonProperty(PropertyName = "errors")] |
| 0 | 54 | | public IList<Error> Errors { get; set; } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// Validate the object. |
| | 58 | | /// </summary> |
| | 59 | | /// <exception cref="ValidationException"> |
| | 60 | | /// Thrown if validation fails |
| | 61 | | /// </exception> |
| | 62 | | public virtual void Validate() |
| | 63 | | { |
| 0 | 64 | | if (Errors == null) |
| | 65 | | { |
| 0 | 66 | | throw new ValidationException(ValidationRules.CannotBeNull, "Errors"); |
| | 67 | | } |
| 0 | 68 | | if (Errors != null) |
| | 69 | | { |
| 0 | 70 | | foreach (var element in Errors) |
| | 71 | | { |
| 0 | 72 | | if (element != null) |
| | 73 | | { |
| 0 | 74 | | element.Validate(); |
| | 75 | | } |
| | 76 | | } |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | | } |
| | 80 | | } |