| | | 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.WebSearch.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 | | /// Defines the data and time of one or more geographic locations. |
| | | 17 | | /// </summary> |
| | | 18 | | public partial class TimeZone : SearchResultsAnswer |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// Initializes a new instance of the TimeZone class. |
| | | 22 | | /// </summary> |
| | 0 | 23 | | public TimeZone() |
| | | 24 | | { |
| | | 25 | | CustomInit(); |
| | 0 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Initializes a new instance of the TimeZone class. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <param name="primaryCityTime">The data and time, in UTC, of the |
| | | 32 | | /// geographic location specified in the query. If the query specified |
| | | 33 | | /// a specific geographic location (for example, a city), this object |
| | | 34 | | /// contains the name of the geographic location and the current date |
| | | 35 | | /// and time of the location, in UTC. If the query specified a general |
| | | 36 | | /// geographic location, such as a state or country, this object |
| | | 37 | | /// contains the date and time of the primary city or state found in |
| | | 38 | | /// the specified state or country. If the location contains additional |
| | | 39 | | /// time zones, the otherCityTimes field contains the data and time of |
| | | 40 | | /// cities or states located in the other time zones.</param> |
| | | 41 | | /// <param name="id">A String identifier.</param> |
| | | 42 | | /// <param name="webSearchUrl">The URL To Bing's search result for this |
| | | 43 | | /// item.</param> |
| | | 44 | | /// <param name="totalEstimatedMatches">The estimated number of |
| | | 45 | | /// webpages that are relevant to the query. Use this number along with |
| | | 46 | | /// the count and offset query parameters to page the results.</param> |
| | | 47 | | /// <param name="otherCityTimes">A list of dates and times of nearby |
| | | 48 | | /// time zones.</param> |
| | | 49 | | public TimeZone(TimeZoneTimeZoneInformation primaryCityTime, string id = default(string), string webSearchUrl = |
| | 0 | 50 | | : base(id, webSearchUrl, followUpQueries, queryContext, totalEstimatedMatches, isFamilyFriendly) |
| | | 51 | | { |
| | 0 | 52 | | PrimaryCityTime = primaryCityTime; |
| | 0 | 53 | | OtherCityTimes = otherCityTimes; |
| | | 54 | | CustomInit(); |
| | 0 | 55 | | } |
| | | 56 | | |
| | | 57 | | /// <summary> |
| | | 58 | | /// An initialization method that performs custom operations like setting defaults |
| | | 59 | | /// </summary> |
| | | 60 | | partial void CustomInit(); |
| | | 61 | | |
| | | 62 | | /// <summary> |
| | | 63 | | /// Gets or sets the data and time, in UTC, of the geographic location |
| | | 64 | | /// specified in the query. If the query specified a specific |
| | | 65 | | /// geographic location (for example, a city), this object contains the |
| | | 66 | | /// name of the geographic location and the current date and time of |
| | | 67 | | /// the location, in UTC. If the query specified a general geographic |
| | | 68 | | /// location, such as a state or country, this object contains the date |
| | | 69 | | /// and time of the primary city or state found in the specified state |
| | | 70 | | /// or country. If the location contains additional time zones, the |
| | | 71 | | /// otherCityTimes field contains the data and time of cities or states |
| | | 72 | | /// located in the other time zones. |
| | | 73 | | /// </summary> |
| | | 74 | | [JsonProperty(PropertyName = "primaryCityTime")] |
| | 0 | 75 | | public TimeZoneTimeZoneInformation PrimaryCityTime { get; set; } |
| | | 76 | | |
| | | 77 | | /// <summary> |
| | | 78 | | /// Gets a list of dates and times of nearby time zones. |
| | | 79 | | /// </summary> |
| | | 80 | | [JsonProperty(PropertyName = "otherCityTimes")] |
| | 0 | 81 | | public IList<TimeZoneTimeZoneInformation> OtherCityTimes { get; private set; } |
| | | 82 | | |
| | | 83 | | /// <summary> |
| | | 84 | | /// Validate the object. |
| | | 85 | | /// </summary> |
| | | 86 | | /// <exception cref="ValidationException"> |
| | | 87 | | /// Thrown if validation fails |
| | | 88 | | /// </exception> |
| | | 89 | | public override void Validate() |
| | | 90 | | { |
| | 0 | 91 | | base.Validate(); |
| | 0 | 92 | | if (PrimaryCityTime == null) |
| | | 93 | | { |
| | 0 | 94 | | throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryCityTime"); |
| | | 95 | | } |
| | 0 | 96 | | if (PrimaryCityTime != null) |
| | | 97 | | { |
| | 0 | 98 | | PrimaryCityTime.Validate(); |
| | | 99 | | } |
| | 0 | 100 | | if (OtherCityTimes != null) |
| | | 101 | | { |
| | 0 | 102 | | foreach (var element in OtherCityTimes) |
| | | 103 | | { |
| | 0 | 104 | | if (element != null) |
| | | 105 | | { |
| | 0 | 106 | | element.Validate(); |
| | | 107 | | } |
| | | 108 | | } |
| | | 109 | | } |
| | 0 | 110 | | } |
| | | 111 | | } |
| | | 112 | | } |