From 201955d9a61bb92bca67755d7f77c466c1b4d92e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 27 Jul 2021 10:52:36 +0000 Subject: [PATCH] CodeGen from PR 15386 in Azure/azure-rest-api-specs Merge a84ca586e4375cccd258fd5de4006c86f77f3266 into 552b277f9f8d2057a94dfc9c3e09c0d877c0ea30 --- .../src/Generated/ITimezoneClient.cs | 65 + .../src/Generated/ITimezoneOperations.cs | 248 ++++ .../src/Generated/Models/CountryRecord.cs | 60 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorDetail.cs | 85 ++ .../src/Generated/Models/ErrorResponse.cs | 56 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/IanaId.cs | 73 + .../Models/ReferenceTimeByCoordinates.cs | 121 ++ .../src/Generated/Models/ReferenceTimeById.cs | 103 ++ .../Generated/Models/RepresentativePoint.cs | 59 + .../src/Generated/Models/TimeTransition.cs | 82 ++ .../Generated/Models/TimeZoneByCoordinates.cs | 102 ++ .../Models/TimezoneByCoordinatesResult.cs | 70 + .../src/Generated/Models/TimezoneById.cs | 102 ++ .../Generated/Models/TimezoneByIdResult.cs | 68 + .../Generated/Models/TimezoneEnumWindow.cs | 66 + .../Models/TimezoneIanaVersionResult.cs | 51 + .../src/Generated/Models/TimezoneNames.cs | 76 + .../src/Generated/Models/TimezoneOptions.cs | 37 + .../src/Generated/SdkInfo_TimezoneClient.cs | 27 + .../src/Generated/TimezoneClient.cs | 338 +++++ .../src/Generated/TimezoneOperations.cs | 1228 +++++++++++++++++ .../Generated/TimezoneOperationsExtensions.cs | 233 ++++ 24 files changed, 3471 insertions(+) create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneClient.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneOperations.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/CountryRecord.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/IanaId.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeByCoordinates.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeById.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/RepresentativePoint.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeTransition.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeZoneByCoordinates.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByCoordinatesResult.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneById.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByIdResult.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneEnumWindow.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneIanaVersionResult.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneNames.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneOptions.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/SdkInfo_TimezoneClient.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneClient.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperations.cs create mode 100644 sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperationsExtensions.cs diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneClient.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneClient.cs new file mode 100644 index 0000000000000..ebb2a27e2da37 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneClient.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + + /// + /// Azure Maps Time Zone REST APIs + /// + public partial interface ITimezoneClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Version number of Azure Maps API. + /// + string ApiVersion { get; set; } + + /// + /// Specifies which account is intended for usage in conjunction with + /// the Azure AD security model. It represents a unique ID for the + /// Azure Maps account and can be retrieved from the Azure Maps + /// management plane Account API. To use Azure AD security in Azure + /// Maps see the following [articles](https://aka.ms/amauthdetails) for + /// guidance. + /// + string XMsClientId { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the ITimezoneOperations. + /// + ITimezoneOperations Timezone { get; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneOperations.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneOperations.cs new file mode 100644 index 0000000000000..369e89b9aab73 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/ITimezoneOperations.cs @@ -0,0 +1,248 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TimezoneOperations operations. + /// + public partial interface ITimezoneOperations + { + /// + /// __Time Zone by Id__ + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns current, historical, and future time zone + /// information for the specified IANA time zone ID. + /// + /// + /// The IANA time zone ID. + /// + /// + /// Specifies the language code in which the timezone names should be + /// returned. If no language code is provided, the response will be in + /// "EN". Please refer to [Supported + /// Languages](https://docs.microsoft.com/en-us/azure/azure-maps/supported-languages) + /// for details. + /// + /// + /// Alternatively, use alias "o". Options available for types of + /// information returned in the result. Possible values include: + /// 'none', 'zoneInfo', 'transitions', 'all' + /// + /// + /// Alternatively, use alias "stamp", or "s". Reference time, if + /// omitted, the API will use the machine time serving the request. + /// + /// + /// Alternatively, use alias "tf". The start date from which daylight + /// savings time (DST) transitions are requested, only applies when + /// "options" = all or "options" = transitions. + /// + /// + /// Alternatively, use alias "ty". The number of years from + /// "transitionsFrom" for which DST transitions are requested, only + /// applies when "options" = all or "options" = transitions. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetTimezoneByIDWithHttpMessagesAsync(string query, string acceptLanguage = default(string), string options = default(string), System.DateTime? timeStamp = default(System.DateTime?), System.DateTime? transitionsFrom = default(System.DateTime?), int? transitionsYears = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// __Time Zone by Coordinates__ + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns current, historical, and future time zone + /// information for a specified latitude-longitude pair. In addition, + /// the API provides sunset and sunrise times for a given location. + /// + /// + /// Coordinates of the point for which time zone information is + /// requested. The applicable query is specified as a comma separated + /// string composed by latitude followed by longitude e.g. + /// "47.641268,-122.125679". + /// + /// + /// Specifies the language code in which the timezone names should be + /// returned. If no language code is provided, the response will be in + /// "EN". Please refer to [Supported + /// Languages](https://docs.microsoft.com/en-us/azure/azure-maps/supported-languages) + /// for details. + /// + /// + /// Alternatively, use alias "o". Options available for types of + /// information returned in the result. Possible values include: + /// 'none', 'zoneInfo', 'transitions', 'all' + /// + /// + /// Alternatively, use alias "stamp", or "s". Reference time, if + /// omitted, the API will use the machine time serving the request. + /// + /// + /// Alternatively, use alias "tf". The start date from which daylight + /// savings time (DST) transitions are requested, only applies when + /// "options" = all or "options" = transitions. + /// + /// + /// Alternatively, use alias "ty". The number of years from + /// "transitionsFrom" for which DST transitions are requested, only + /// applies when "options" = all or "options" = transitions. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetTimezoneByCoordinatesWithHttpMessagesAsync(string query, string acceptLanguage = default(string), string options = default(string), System.DateTime? timeStamp = default(System.DateTime?), System.DateTime? transitionsFrom = default(System.DateTime?), int? transitionsYears = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// __Enumerate Windows Time Zones__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a full list of Windows Time Zone IDs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetTimezoneEnumWindowsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// __Enumerate IANA Time Zones__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a full list of IANA time zone IDs. Updates to the + /// IANA service will be reflected in the system within one day. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetTimezoneEnumIANAWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// __Time Zone IANA Version__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns the current IANA version number. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetTimezoneIANAVersionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// __Windows to IANA Time Zone__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a corresponding IANA ID, given a valid Windows + /// Time Zone ID. Multiple IANA IDs may be returned for a single + /// Windows ID. It is possible to narrow these results by adding an + /// optional territory parameter. + /// + /// + /// The Windows time zone ID. + /// + /// + /// Windows Time Zone territory code. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetTimezoneWindowsToIANAWithHttpMessagesAsync(string query, string territory = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/CountryRecord.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/CountryRecord.cs new file mode 100644 index 0000000000000..ab2bc712cfc17 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/CountryRecord.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A country record. + /// + public partial class CountryRecord + { + /// + /// Initializes a new instance of the CountryRecord class. + /// + public CountryRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CountryRecord class. + /// + /// Country Name + /// ISO-3166 2-letter country code for the + /// country. + public CountryRecord(string name = default(string), string code = default(string)) + { + Name = name; + Code = code; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets country Name + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; private set; } + + /// + /// Gets ISO-3166 2-letter country code for the country. + /// + [JsonProperty(PropertyName = "Code")] + public string Code { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..59f8f7bc2d362 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorDetail.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..9eab136c4abca --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponse.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..ac9940da34197 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponseException.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..5568e550eee41 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/IanaId.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/IanaId.cs new file mode 100644 index 0000000000000..f9c19039861d2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/IanaId.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class IanaId + { + /// + /// Initializes a new instance of the IanaId class. + /// + public IanaId() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IanaId class. + /// + /// Id property + /// IsAlias property + /// AliasOf property + /// HasZone1970Location + /// property + public IanaId(string id = default(string), bool? isAlias = default(bool?), string aliasOf = default(string), bool? hasZone1970Location = default(bool?)) + { + Id = id; + IsAlias = isAlias; + AliasOf = aliasOf; + HasZone1970Location = hasZone1970Location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id property + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets isAlias property + /// + [JsonProperty(PropertyName = "isAlias")] + public bool? IsAlias { get; private set; } + + /// + /// Gets aliasOf property + /// + [JsonProperty(PropertyName = "aliasOf")] + public string AliasOf { get; private set; } + + /// + /// Gets hasZone1970Location property + /// + [JsonProperty(PropertyName = "hasZone1970Location")] + public bool? HasZone1970Location { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeByCoordinates.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeByCoordinates.cs new file mode 100644 index 0000000000000..842e3dcf19b3f --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeByCoordinates.cs @@ -0,0 +1,121 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details in effect at the local time. + /// + public partial class ReferenceTimeByCoordinates + { + /// + /// Initializes a new instance of the ReferenceTimeByCoordinates class. + /// + public ReferenceTimeByCoordinates() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReferenceTimeByCoordinates class. + /// + /// Time zone name in effect at the reference + /// timestamp (i.e. PST or PDT depending whether Daylight Savings Time + /// is in effect). + /// UTC offset in effect at the + /// `ReferenceUTCTimestamp`. + /// Time saving in minutes in effect at + /// the `ReferenceUTCTimestamp`. + /// Current wall time at the given time zone as + /// shown in the `Tag` property. + /// The year this POSIX string is valid + /// for. Note: A POSIX string will only be valid in the given + /// year. + /// POSIX string used to set the time zone + /// environment variable. + /// Sunrise at the given time zone as shown in + /// the `Tag` property. + /// Sunset at the given time zone as shown in the + /// `Tag` property. + public ReferenceTimeByCoordinates(string tag = default(string), string standardOffset = default(string), string daylightSavings = default(string), string wallTime = default(string), int? posixTzValidYear = default(int?), string posixTz = default(string), string sunrise = default(string), string sunset = default(string)) + { + Tag = tag; + StandardOffset = standardOffset; + DaylightSavings = daylightSavings; + WallTime = wallTime; + PosixTzValidYear = posixTzValidYear; + PosixTz = posixTz; + Sunrise = sunrise; + Sunset = sunset; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets time zone name in effect at the reference timestamp (i.e. PST + /// or PDT depending whether Daylight Savings Time is in effect). + /// + [JsonProperty(PropertyName = "Tag")] + public string Tag { get; private set; } + + /// + /// Gets UTC offset in effect at the `ReferenceUTCTimestamp`. + /// + [JsonProperty(PropertyName = "StandardOffset")] + public string StandardOffset { get; private set; } + + /// + /// Gets time saving in minutes in effect at the + /// `ReferenceUTCTimestamp`. + /// + [JsonProperty(PropertyName = "DaylightSavings")] + public string DaylightSavings { get; private set; } + + /// + /// Gets current wall time at the given time zone as shown in the `Tag` + /// property. + /// + [JsonProperty(PropertyName = "WallTime")] + public string WallTime { get; private set; } + + /// + /// Gets the year this POSIX string is valid for. Note: A POSIX string + /// will only be valid in the given year. + /// + [JsonProperty(PropertyName = "PosixTzValidYear")] + public int? PosixTzValidYear { get; private set; } + + /// + /// Gets POSIX string used to set the time zone environment variable. + /// + [JsonProperty(PropertyName = "PosixTz")] + public string PosixTz { get; private set; } + + /// + /// Gets sunrise at the given time zone as shown in the `Tag` property. + /// + [JsonProperty(PropertyName = "Sunrise")] + public string Sunrise { get; private set; } + + /// + /// Gets sunset at the given time zone as shown in the `Tag` property. + /// + [JsonProperty(PropertyName = "Sunset")] + public string Sunset { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeById.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeById.cs new file mode 100644 index 0000000000000..22916550f3fb0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/ReferenceTimeById.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details in effect at the local time. + /// + public partial class ReferenceTimeById + { + /// + /// Initializes a new instance of the ReferenceTimeById class. + /// + public ReferenceTimeById() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReferenceTimeById class. + /// + /// Time zone name in effect at the reference + /// timestamp (i.e. PST or PDT depending whether Daylight Savings Time + /// is in effect). + /// UTC offset in effect at the + /// `ReferenceUTCTimestamp`. + /// Time saving in minutes in effect at + /// the `ReferenceUTCTimestamp`. + /// Current wall time at the given time zone as + /// shown in the `Tag` property. + /// The year this POSIX string is valid + /// for. Note: A POSIX string will only be valid in the given + /// year. + /// POSIX string used to set the time zone + /// environment variable. + public ReferenceTimeById(string tag = default(string), string standardOffset = default(string), string daylightSavings = default(string), string wallTime = default(string), int? posixTzValidYear = default(int?), string posixTz = default(string)) + { + Tag = tag; + StandardOffset = standardOffset; + DaylightSavings = daylightSavings; + WallTime = wallTime; + PosixTzValidYear = posixTzValidYear; + PosixTz = posixTz; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets time zone name in effect at the reference timestamp (i.e. PST + /// or PDT depending whether Daylight Savings Time is in effect). + /// + [JsonProperty(PropertyName = "Tag")] + public string Tag { get; private set; } + + /// + /// Gets UTC offset in effect at the `ReferenceUTCTimestamp`. + /// + [JsonProperty(PropertyName = "StandardOffset")] + public string StandardOffset { get; private set; } + + /// + /// Gets time saving in minutes in effect at the + /// `ReferenceUTCTimestamp`. + /// + [JsonProperty(PropertyName = "DaylightSavings")] + public string DaylightSavings { get; private set; } + + /// + /// Gets current wall time at the given time zone as shown in the `Tag` + /// property. + /// + [JsonProperty(PropertyName = "WallTime")] + public string WallTime { get; private set; } + + /// + /// Gets the year this POSIX string is valid for. Note: A POSIX string + /// will only be valid in the given year. + /// + [JsonProperty(PropertyName = "PosixTzValidYear")] + public int? PosixTzValidYear { get; private set; } + + /// + /// Gets POSIX string used to set the time zone environment variable. + /// + [JsonProperty(PropertyName = "PosixTz")] + public string PosixTz { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/RepresentativePoint.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/RepresentativePoint.cs new file mode 100644 index 0000000000000..6cdd3671e8bfc --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/RepresentativePoint.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Representative point property + /// + public partial class RepresentativePoint + { + /// + /// Initializes a new instance of the RepresentativePoint class. + /// + public RepresentativePoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RepresentativePoint class. + /// + /// Latitude property + /// Longitude property + public RepresentativePoint(double? latitude = default(double?), double? longitude = default(double?)) + { + Latitude = latitude; + Longitude = longitude; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets latitude property + /// + [JsonProperty(PropertyName = "Latitude")] + public double? Latitude { get; private set; } + + /// + /// Gets longitude property + /// + [JsonProperty(PropertyName = "Longitude")] + public double? Longitude { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeTransition.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeTransition.cs new file mode 100644 index 0000000000000..8722059e9b124 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeTransition.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class TimeTransition + { + /// + /// Initializes a new instance of the TimeTransition class. + /// + public TimeTransition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeTransition class. + /// + /// Tag property + /// StandardOffset property + /// DaylightSavings property + /// Start date, start time for this transition + /// period + /// End date, end time for this transition + /// period + public TimeTransition(string tag = default(string), string standardOffset = default(string), string daylightSavings = default(string), System.DateTime? utcStart = default(System.DateTime?), System.DateTime? utcEnd = default(System.DateTime?)) + { + Tag = tag; + StandardOffset = standardOffset; + DaylightSavings = daylightSavings; + UtcStart = utcStart; + UtcEnd = utcEnd; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets tag property + /// + [JsonProperty(PropertyName = "Tag")] + public string Tag { get; private set; } + + /// + /// Gets standardOffset property + /// + [JsonProperty(PropertyName = "StandardOffset")] + public string StandardOffset { get; private set; } + + /// + /// Gets daylightSavings property + /// + [JsonProperty(PropertyName = "DaylightSavings")] + public string DaylightSavings { get; private set; } + + /// + /// Gets start date, start time for this transition period + /// + [JsonProperty(PropertyName = "UtcStart")] + public System.DateTime? UtcStart { get; private set; } + + /// + /// Gets end date, end time for this transition period + /// + [JsonProperty(PropertyName = "UtcEnd")] + public System.DateTime? UtcEnd { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeZoneByCoordinates.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeZoneByCoordinates.cs new file mode 100644 index 0000000000000..f90667b2f8fb7 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimeZoneByCoordinates.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class TimeZoneByCoordinates + { + /// + /// Initializes a new instance of the TimeZoneByCoordinates class. + /// + public TimeZoneByCoordinates() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeZoneByCoordinates class. + /// + /// Id property + /// An array of time zone ID aliases.  Only + /// returned when [options]=*zoneinfo* or *all*. + /// + /// Note: may be null. + /// An array of country records. Only returned + /// when [options]=*zoneinfo* or *all*. + /// Time zone DST transitions from + /// [transitionsFrom] until timestamp + 1 year. + public TimeZoneByCoordinates(string id = default(string), IList aliases = default(IList), IList countries = default(IList), TimezoneNames names = default(TimezoneNames), ReferenceTimeByCoordinates referenceTime = default(ReferenceTimeByCoordinates), RepresentativePoint representativePoint = default(RepresentativePoint), IList timeTransitions = default(IList)) + { + Id = id; + Aliases = aliases; + Countries = countries; + Names = names; + ReferenceTime = referenceTime; + RepresentativePoint = representativePoint; + TimeTransitions = timeTransitions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id property + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; private set; } + + /// + /// Gets an array of time zone ID aliases.  Only returned when + /// [options]=*zoneinfo* or *all*. + /// + /// Note: may be null. + /// + [JsonProperty(PropertyName = "Aliases")] + public IList Aliases { get; private set; } + + /// + /// Gets an array of country records. Only returned when + /// [options]=*zoneinfo* or *all*. + /// + [JsonProperty(PropertyName = "Countries")] + public IList Countries { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "Names")] + public TimezoneNames Names { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ReferenceTime")] + public ReferenceTimeByCoordinates ReferenceTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "RepresentativePoint")] + public RepresentativePoint RepresentativePoint { get; set; } + + /// + /// Gets time zone DST transitions from [transitionsFrom] until + /// timestamp + 1 year. + /// + [JsonProperty(PropertyName = "TimeTransitions")] + public IList TimeTransitions { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByCoordinatesResult.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByCoordinatesResult.cs new file mode 100644 index 0000000000000..2a474d415c55b --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByCoordinatesResult.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This object is returned from a successful Timezone By Coordinates call + /// + public partial class TimezoneByCoordinatesResult + { + /// + /// Initializes a new instance of the TimezoneByCoordinatesResult + /// class. + /// + public TimezoneByCoordinatesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimezoneByCoordinatesResult + /// class. + /// + /// Version property + /// Reference Utc Timestamp + /// property + public TimezoneByCoordinatesResult(string version = default(string), System.DateTime? referenceUtcTimestamp = default(System.DateTime?), IList timeZones = default(IList)) + { + Version = version; + ReferenceUtcTimestamp = referenceUtcTimestamp; + TimeZones = timeZones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets version property + /// + [JsonProperty(PropertyName = "Version")] + public string Version { get; private set; } + + /// + /// Gets reference Utc Timestamp property + /// + [JsonProperty(PropertyName = "ReferenceUtcTimestamp")] + public System.DateTime? ReferenceUtcTimestamp { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "TimeZones")] + public IList TimeZones { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneById.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneById.cs new file mode 100644 index 0000000000000..0e4003dcc6b34 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneById.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class TimezoneById + { + /// + /// Initializes a new instance of the TimezoneById class. + /// + public TimezoneById() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimezoneById class. + /// + /// Id property + /// An array of time zone ID aliases.  Only + /// returned when [options]=*zoneinfo* or *all*. + /// + /// Note: may be null. + /// An array of country records. Only returned + /// when [options]=*zoneinfo* or *all*. + /// Time zone DST transitions from + /// [transitionsFrom] until timestamp + 1 year. + public TimezoneById(string id = default(string), IList aliases = default(IList), IList countries = default(IList), TimezoneNames names = default(TimezoneNames), ReferenceTimeById referenceTime = default(ReferenceTimeById), RepresentativePoint representativePoint = default(RepresentativePoint), IList timeTransitions = default(IList)) + { + Id = id; + Aliases = aliases; + Countries = countries; + Names = names; + ReferenceTime = referenceTime; + RepresentativePoint = representativePoint; + TimeTransitions = timeTransitions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id property + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; private set; } + + /// + /// Gets an array of time zone ID aliases.  Only returned when + /// [options]=*zoneinfo* or *all*. + /// + /// Note: may be null. + /// + [JsonProperty(PropertyName = "Aliases")] + public IList Aliases { get; private set; } + + /// + /// Gets an array of country records. Only returned when + /// [options]=*zoneinfo* or *all*. + /// + [JsonProperty(PropertyName = "Countries")] + public IList Countries { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "Names")] + public TimezoneNames Names { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ReferenceTime")] + public ReferenceTimeById ReferenceTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "RepresentativePoint")] + public RepresentativePoint RepresentativePoint { get; set; } + + /// + /// Gets time zone DST transitions from [transitionsFrom] until + /// timestamp + 1 year. + /// + [JsonProperty(PropertyName = "TimeTransitions")] + public IList TimeTransitions { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByIdResult.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByIdResult.cs new file mode 100644 index 0000000000000..9f6fc5eb905af --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneByIdResult.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This object is returned from a successful Timezone By ID call + /// + public partial class TimezoneByIdResult + { + /// + /// Initializes a new instance of the TimezoneByIdResult class. + /// + public TimezoneByIdResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimezoneByIdResult class. + /// + /// Version property + /// Reference Utc Timestamp + /// property + public TimezoneByIdResult(string version = default(string), System.DateTime? referenceUtcTimestamp = default(System.DateTime?), IList timeZones = default(IList)) + { + Version = version; + ReferenceUtcTimestamp = referenceUtcTimestamp; + TimeZones = timeZones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets version property + /// + [JsonProperty(PropertyName = "Version")] + public string Version { get; private set; } + + /// + /// Gets reference Utc Timestamp property + /// + [JsonProperty(PropertyName = "ReferenceUtcTimestamp")] + public System.DateTime? ReferenceUtcTimestamp { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "TimeZones")] + public IList TimeZones { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneEnumWindow.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneEnumWindow.cs new file mode 100644 index 0000000000000..c0c1fbc726183 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneEnumWindow.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class TimezoneEnumWindow + { + /// + /// Initializes a new instance of the TimezoneEnumWindow class. + /// + public TimezoneEnumWindow() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimezoneEnumWindow class. + /// + /// Windows Id property + /// Territory property + /// IanaIds array + public TimezoneEnumWindow(string windowsId = default(string), string territory = default(string), IList ianaIds = default(IList)) + { + WindowsId = windowsId; + Territory = territory; + IanaIds = ianaIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets windows Id property + /// + [JsonProperty(PropertyName = "WindowsId")] + public string WindowsId { get; private set; } + + /// + /// Gets territory property + /// + [JsonProperty(PropertyName = "Territory")] + public string Territory { get; private set; } + + /// + /// Gets or sets ianaIds array + /// + [JsonProperty(PropertyName = "IanaIds")] + public IList IanaIds { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneIanaVersionResult.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneIanaVersionResult.cs new file mode 100644 index 0000000000000..3e3cabaec32ec --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneIanaVersionResult.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This object is returned from a successful Timezone IANA Version call + /// + public partial class TimezoneIanaVersionResult + { + /// + /// Initializes a new instance of the TimezoneIanaVersionResult class. + /// + public TimezoneIanaVersionResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimezoneIanaVersionResult class. + /// + /// Version property + public TimezoneIanaVersionResult(string version = default(string)) + { + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets version property + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneNames.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneNames.cs new file mode 100644 index 0000000000000..28ba9f7f9c7a3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneNames.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Timezone names object. + /// + public partial class TimezoneNames + { + /// + /// Initializes a new instance of the TimezoneNames class. + /// + public TimezoneNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimezoneNames class. + /// + /// The ISO 639-1 language code of + /// the Names + /// Generic Name + /// Standard Name + /// Daylight Name + public TimezoneNames(string iSO6391LanguageCode = default(string), string generic = default(string), string standard = default(string), string daylight = default(string)) + { + ISO6391LanguageCode = iSO6391LanguageCode; + Generic = generic; + Standard = standard; + Daylight = daylight; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ISO 639-1 language code of the Names + /// + [JsonProperty(PropertyName = "ISO6391LanguageCode")] + public string ISO6391LanguageCode { get; private set; } + + /// + /// Gets generic Name + /// + [JsonProperty(PropertyName = "Generic")] + public string Generic { get; private set; } + + /// + /// Gets standard Name + /// + [JsonProperty(PropertyName = "Standard")] + public string Standard { get; private set; } + + /// + /// Gets daylight Name + /// + [JsonProperty(PropertyName = "Daylight")] + public string Daylight { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneOptions.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneOptions.cs new file mode 100644 index 0000000000000..7404eb388d34c --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/Models/TimezoneOptions.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone.Models +{ + + /// + /// Defines values for TimezoneOptions. + /// + public static class TimezoneOptions + { + /// + /// Do not include zoneinfo or transitions in the result. + /// + public const string None = "none"; + /// + /// Include additional time zone info in the result. + /// + public const string ZoneInfo = "zoneInfo"; + /// + /// Include transition information in the result (The number of + /// transitions is currently capped at 250). + /// + public const string Transitions = "transitions"; + /// + /// Include both zoneinfo and transitions in the result. + /// + public const string All = "all"; + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/SdkInfo_TimezoneClient.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/SdkInfo_TimezoneClient.cs new file mode 100644 index 0000000000000..d5e464f5ebf1c --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/SdkInfo_TimezoneClient.cs @@ -0,0 +1,27 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_TimezoneClient + { + get + { + return new Tuple[] + { + new Tuple("TimezoneClient", "Timezone", "1.0"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneClient.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneClient.cs new file mode 100644 index 0000000000000..0333ad7bd99d4 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneClient.cs @@ -0,0 +1,338 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + /// + /// Azure Maps Time Zone REST APIs + /// + public partial class TimezoneClient : ServiceClient, ITimezoneClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Version number of Azure Maps API. + /// + public string ApiVersion { get; set; } + + /// + /// Specifies which account is intended for usage in conjunction with the Azure + /// AD security model. It represents a unique ID for the Azure Maps account + /// and can be retrieved from the Azure Maps management plane Account API. To + /// use Azure AD security in Azure Maps see the following + /// [articles](https://aka.ms/amauthdetails) for guidance. + /// + public string XMsClientId { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the ITimezoneOperations. + /// + public virtual ITimezoneOperations Timezone { get; private set; } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TimezoneClient.Dispose(). False: will not dispose provided httpClient + protected TimezoneClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TimezoneClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TimezoneClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected TimezoneClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected TimezoneClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public TimezoneClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TimezoneClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public TimezoneClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public TimezoneClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public TimezoneClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TimezoneClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public TimezoneClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Timezone = new TimezoneOperations(this); + BaseUri = new System.Uri("https://atlas.microsoft.com"); + ApiVersion = "1.0"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + } + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperations.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperations.cs new file mode 100644 index 0000000000000..3432263b2b0f5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperations.cs @@ -0,0 +1,1228 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TimezoneOperations operations. + /// + public partial class TimezoneOperations : IServiceOperations, ITimezoneOperations + { + /// + /// Initializes a new instance of the TimezoneOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public TimezoneOperations(TimezoneClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the TimezoneClient + /// + public TimezoneClient Client { get; private set; } + + /// + /// __Time Zone by Id__ + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns current, historical, and future time zone information for + /// the specified IANA time zone ID. + /// + /// + /// The IANA time zone ID. + /// + /// + /// Specifies the language code in which the timezone names should be returned. + /// If no language code is provided, the response will be in "EN". Please refer + /// to [Supported + /// Languages](https://docs.microsoft.com/en-us/azure/azure-maps/supported-languages) + /// for details. + /// + /// + /// Alternatively, use alias "o". Options available for types of information + /// returned in the result. Possible values include: 'none', 'zoneInfo', + /// 'transitions', 'all' + /// + /// + /// Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + /// API will use the machine time serving the request. + /// + /// + /// Alternatively, use alias "tf". The start date from which daylight savings + /// time (DST) transitions are requested, only applies when "options" = all or + /// "options" = transitions. + /// + /// + /// Alternatively, use alias "ty". The number of years from "transitionsFrom" + /// for which DST transitions are requested, only applies when "options" = all + /// or "options" = transitions. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetTimezoneByIDWithHttpMessagesAsync(string query, string acceptLanguage = default(string), string options = default(string), System.DateTime? timeStamp = default(System.DateTime?), System.DateTime? transitionsFrom = default(System.DateTime?), int? transitionsYears = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "query"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("acceptLanguage", acceptLanguage); + tracingParameters.Add("options", options); + tracingParameters.Add("timeStamp", timeStamp); + tracingParameters.Add("transitionsFrom", transitionsFrom); + tracingParameters.Add("transitionsYears", transitionsYears); + tracingParameters.Add("format", format); + tracingParameters.Add("query", query); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimezoneByID", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "timezone/byId/{format}").ToString(); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (options != null) + { + _queryParameters.Add(string.Format("options={0}", System.Uri.EscapeDataString(options))); + } + if (timeStamp != null) + { + _queryParameters.Add(string.Format("timeStamp={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(timeStamp, Client.SerializationSettings).Trim('"')))); + } + if (transitionsFrom != null) + { + _queryParameters.Add(string.Format("transitionsFrom={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(transitionsFrom, Client.SerializationSettings).Trim('"')))); + } + if (transitionsYears != null) + { + _queryParameters.Add(string.Format("transitionsYears={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(transitionsYears, Client.SerializationSettings).Trim('"')))); + } + if (query != null) + { + _queryParameters.Add(string.Format("query={0}", System.Uri.EscapeDataString(query))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + if (acceptLanguage != null) + { + if (_httpRequest.Headers.Contains("Accept-Language")) + { + _httpRequest.Headers.Remove("Accept-Language"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept-Language", acceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// __Time Zone by Coordinates__ + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns current, historical, and future time zone information for + /// a specified latitude-longitude pair. In addition, the API provides sunset + /// and sunrise times for a given location. + /// + /// + /// Coordinates of the point for which time zone information is requested. The + /// applicable query is specified as a comma separated string composed by + /// latitude followed by longitude e.g. "47.641268,-122.125679". + /// + /// + /// Specifies the language code in which the timezone names should be returned. + /// If no language code is provided, the response will be in "EN". Please refer + /// to [Supported + /// Languages](https://docs.microsoft.com/en-us/azure/azure-maps/supported-languages) + /// for details. + /// + /// + /// Alternatively, use alias "o". Options available for types of information + /// returned in the result. Possible values include: 'none', 'zoneInfo', + /// 'transitions', 'all' + /// + /// + /// Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + /// API will use the machine time serving the request. + /// + /// + /// Alternatively, use alias "tf". The start date from which daylight savings + /// time (DST) transitions are requested, only applies when "options" = all or + /// "options" = transitions. + /// + /// + /// Alternatively, use alias "ty". The number of years from "transitionsFrom" + /// for which DST transitions are requested, only applies when "options" = all + /// or "options" = transitions. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetTimezoneByCoordinatesWithHttpMessagesAsync(string query, string acceptLanguage = default(string), string options = default(string), System.DateTime? timeStamp = default(System.DateTime?), System.DateTime? transitionsFrom = default(System.DateTime?), int? transitionsYears = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "query"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("acceptLanguage", acceptLanguage); + tracingParameters.Add("options", options); + tracingParameters.Add("timeStamp", timeStamp); + tracingParameters.Add("transitionsFrom", transitionsFrom); + tracingParameters.Add("transitionsYears", transitionsYears); + tracingParameters.Add("format", format); + tracingParameters.Add("query", query); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimezoneByCoordinates", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "timezone/byCoordinates/{format}").ToString(); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (options != null) + { + _queryParameters.Add(string.Format("options={0}", System.Uri.EscapeDataString(options))); + } + if (timeStamp != null) + { + _queryParameters.Add(string.Format("timeStamp={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(timeStamp, Client.SerializationSettings).Trim('"')))); + } + if (transitionsFrom != null) + { + _queryParameters.Add(string.Format("transitionsFrom={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(transitionsFrom, Client.SerializationSettings).Trim('"')))); + } + if (transitionsYears != null) + { + _queryParameters.Add(string.Format("transitionsYears={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(transitionsYears, Client.SerializationSettings).Trim('"')))); + } + if (query != null) + { + _queryParameters.Add(string.Format("query={0}", System.Uri.EscapeDataString(query))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + if (acceptLanguage != null) + { + if (_httpRequest.Headers.Contains("Accept-Language")) + { + _httpRequest.Headers.Remove("Accept-Language"); + } + _httpRequest.Headers.TryAddWithoutValidation("Accept-Language", acceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// __Enumerate Windows Time Zones__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a full list of Windows Time Zone IDs. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetTimezoneEnumWindowsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimezoneEnumWindows", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "timezone/enumWindows/{format}").ToString(); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// __Enumerate IANA Time Zones__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a full list of IANA time zone IDs. Updates to the IANA + /// service will be reflected in the system within one day. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetTimezoneEnumIANAWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimezoneEnumIANA", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "timezone/enumIana/{format}").ToString(); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// __Time Zone IANA Version__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns the current IANA version number. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetTimezoneIANAVersionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimezoneIANAVersion", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "timezone/ianaVersion/{format}").ToString(); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// __Windows to IANA Time Zone__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a corresponding IANA ID, given a valid Windows Time Zone + /// ID. Multiple IANA IDs may be returned for a single Windows ID. It is + /// possible to narrow these results by adding an optional territory parameter. + /// + /// + /// The Windows time zone ID. + /// + /// + /// Windows Time Zone territory code. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetTimezoneWindowsToIANAWithHttpMessagesAsync(string query, string territory = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "query"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("query", query); + tracingParameters.Add("territory", territory); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimezoneWindowsToIANA", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "timezone/windowsToIana/{format}").ToString(); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (query != null) + { + _queryParameters.Add(string.Format("query={0}", System.Uri.EscapeDataString(query))); + } + if (territory != null) + { + _queryParameters.Add(string.Format("territory={0}", System.Uri.EscapeDataString(territory))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperationsExtensions.cs b/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperationsExtensions.cs new file mode 100644 index 0000000000000..26074cd820bfa --- /dev/null +++ b/sdk/maps/Azure.Maps.Timezone/src/Generated/TimezoneOperationsExtensions.cs @@ -0,0 +1,233 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Timezone +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TimezoneOperations. + /// + public static partial class TimezoneOperationsExtensions + { + /// + /// __Time Zone by Id__ + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns current, historical, and future time zone information for + /// the specified IANA time zone ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The IANA time zone ID. + /// + /// + /// Specifies the language code in which the timezone names should be returned. + /// If no language code is provided, the response will be in "EN". Please refer + /// to [Supported + /// Languages](https://docs.microsoft.com/en-us/azure/azure-maps/supported-languages) + /// for details. + /// + /// + /// Alternatively, use alias "o". Options available for types of information + /// returned in the result. Possible values include: 'none', 'zoneInfo', + /// 'transitions', 'all' + /// + /// + /// Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + /// API will use the machine time serving the request. + /// + /// + /// Alternatively, use alias "tf". The start date from which daylight savings + /// time (DST) transitions are requested, only applies when "options" = all or + /// "options" = transitions. + /// + /// + /// Alternatively, use alias "ty". The number of years from "transitionsFrom" + /// for which DST transitions are requested, only applies when "options" = all + /// or "options" = transitions. + /// + /// + /// The cancellation token. + /// + public static async Task GetTimezoneByIDAsync(this ITimezoneOperations operations, string query, string acceptLanguage = default(string), string options = default(string), System.DateTime? timeStamp = default(System.DateTime?), System.DateTime? transitionsFrom = default(System.DateTime?), int? transitionsYears = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimezoneByIDWithHttpMessagesAsync(query, acceptLanguage, options, timeStamp, transitionsFrom, transitionsYears, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// __Time Zone by Coordinates__ + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns current, historical, and future time zone information for + /// a specified latitude-longitude pair. In addition, the API provides sunset + /// and sunrise times for a given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Coordinates of the point for which time zone information is requested. The + /// applicable query is specified as a comma separated string composed by + /// latitude followed by longitude e.g. "47.641268,-122.125679". + /// + /// + /// Specifies the language code in which the timezone names should be returned. + /// If no language code is provided, the response will be in "EN". Please refer + /// to [Supported + /// Languages](https://docs.microsoft.com/en-us/azure/azure-maps/supported-languages) + /// for details. + /// + /// + /// Alternatively, use alias "o". Options available for types of information + /// returned in the result. Possible values include: 'none', 'zoneInfo', + /// 'transitions', 'all' + /// + /// + /// Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + /// API will use the machine time serving the request. + /// + /// + /// Alternatively, use alias "tf". The start date from which daylight savings + /// time (DST) transitions are requested, only applies when "options" = all or + /// "options" = transitions. + /// + /// + /// Alternatively, use alias "ty". The number of years from "transitionsFrom" + /// for which DST transitions are requested, only applies when "options" = all + /// or "options" = transitions. + /// + /// + /// The cancellation token. + /// + public static async Task GetTimezoneByCoordinatesAsync(this ITimezoneOperations operations, string query, string acceptLanguage = default(string), string options = default(string), System.DateTime? timeStamp = default(System.DateTime?), System.DateTime? transitionsFrom = default(System.DateTime?), int? transitionsYears = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimezoneByCoordinatesWithHttpMessagesAsync(query, acceptLanguage, options, timeStamp, transitionsFrom, transitionsYears, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// __Enumerate Windows Time Zones__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a full list of Windows Time Zone IDs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetTimezoneEnumWindowsAsync(this ITimezoneOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimezoneEnumWindowsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// __Enumerate IANA Time Zones__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a full list of IANA time zone IDs. Updates to the IANA + /// service will be reflected in the system within one day. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetTimezoneEnumIANAAsync(this ITimezoneOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimezoneEnumIANAWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// __Time Zone IANA Version__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns the current IANA version number. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetTimezoneIANAVersionAsync(this ITimezoneOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimezoneIANAVersionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// __Windows to IANA Time Zone__ + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This API returns a corresponding IANA ID, given a valid Windows Time Zone + /// ID. Multiple IANA IDs may be returned for a single Windows ID. It is + /// possible to narrow these results by adding an optional territory parameter. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Windows time zone ID. + /// + /// + /// Windows Time Zone territory code. + /// + /// + /// The cancellation token. + /// + public static async Task> GetTimezoneWindowsToIANAAsync(this ITimezoneOperations operations, string query, string territory = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimezoneWindowsToIANAWithHttpMessagesAsync(query, territory, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}