From 0c29cf4f7e2e0ff7e13aa6f481f4e9a31371897a Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Wed, 4 Dec 2024 13:43:19 +0800 Subject: [PATCH] Azure Maps TimeZone package update (#47323) * Update TimeZone SDK based on review * Update testing authentication method * Update cspell.json for Azure.Maps.TimeZones * Update code snippets and docstring * Remove file for renaming * Add TimeZoneId.cs * Update TimeZone recording settings * Update samples and README * Update member variable names * Add IanaIdData type --- .vscode/cspell.json | 6 +- .../api/Azure.Maps.TimeZone.net8.0.cs | 159 ------------------ .../api/Azure.Maps.TimeZone.netstandard2.0.cs | 159 ------------------ .../samples/MapsTimeZoneSamples.md | 56 ------ .../Azure.Maps.TimeZone/samples/README.md | 16 -- .../src/Generated/MapsTimeZoneModelFactory.cs | 145 ---------------- .../src/Generated/Models/TimeTransition.cs | 46 ----- .../src/Generated/Models/TimeZoneOptions.cs | 57 ------- .../src/Generated/Models/TimezoneId.cs | 67 -------- .../src/Models/RepresentativePoint.cs | 22 --- .../src/Models/TimeZoneOptions.cs | 13 -- .../src/properties/AssemblyInfo.cs | 7 - .../Azure.Maps.TimeZone/tests/assets.json | 6 - .../Azure.Maps.TimeZones.sln} | 20 +-- .../CHANGELOG.md | 0 .../Directory.Build.props | 0 .../README.md | 75 +++++---- .../api/Azure.Maps.TimeZones.net8.0.cs | 155 +++++++++++++++++ .../Azure.Maps.TimeZones.netstandard2.0.cs | 155 +++++++++++++++++ sdk/maps/Azure.Maps.TimeZones/assets.json | 6 + .../samples/MapsTimeZoneSamples.md | 135 +++++++++++++++ .../Azure.Maps.TimeZones/samples/README.md | 16 ++ .../src/Azure.Maps.TimeZones.csproj} | 6 +- .../src/Generated/Internal/Argument.cs | 0 .../Internal/ChangeTrackingDictionary.cs | 0 .../Generated/Internal/ChangeTrackingList.cs | 0 .../Internal/ModelSerializationExtensions.cs | 0 .../MultipartFormDataRequestContent.cs | 0 .../src/Generated/Internal/Optional.cs | 0 .../Internal/RequestContentHelper.cs | 0 .../Internal/Utf8JsonRequestContent.cs | 0 .../Generated/MapsTimeZonesModelFactory.cs | 69 ++++++++ .../AdditionalTimeZoneReturnInformation.cs | 57 +++++++ .../Models/CountryRecord.Serialization.cs | 2 +- .../src/Generated/Models/CountryRecord.cs | 2 +- .../ErrorAdditionalInfo.Serialization.cs | 2 +- .../Generated/Models/ErrorAdditionalInfo.cs | 2 +- .../Models/ErrorDetail.Serialization.cs | 2 +- .../src/Generated/Models/ErrorDetail.cs | 2 +- .../Models/ErrorResponse.Serialization.cs | 2 +- .../src/Generated/Models/ErrorResponse.cs | 2 +- .../Generated/Models/IanaId.Serialization.cs | 2 +- .../src/Generated/Models/IanaId.cs | 6 +- .../src/Generated/Models/JsonFormat.cs | 2 +- .../Models/ReferenceTime.Serialization.cs | 2 +- .../src/Generated/Models/ReferenceTime.cs | 27 +++ .../RepresentativePoint.Serialization.cs | 4 +- .../Generated/Models/RepresentativePoint.cs | 9 +- .../Models/TimeTransition.Serialization.cs | 2 +- .../src/Generated/Models/TimeTransition.cs | 27 +++ ...TimeZoneIanaVersionResult.Serialization.cs | 2 +- .../Models/TimeZoneIanaVersionResult.cs | 2 +- .../Models/TimeZoneId.Serialization.cs} | 19 +-- .../src/Generated/Models/TimeZoneId.cs | 39 +++++ .../Models/TimeZoneName.Serialization.cs} | 12 +- .../src/Generated/Models/TimeZoneName.cs} | 12 +- .../Models/TimeZoneResult.Serialization.cs} | 18 +- .../src/Generated/Models/TimeZoneResult.cs} | 16 +- .../Models/WindowsTimeZone.Serialization.cs} | 12 +- .../src/Generated/Models/WindowsTimeZone.cs} | 12 +- .../src/Generated/TimezoneRestClient.cs | 47 +++--- .../src/MapsTimeZoneClient.cs | 123 ++++++++------ .../src/MapsTimeZoneClientOptions.cs | 6 +- .../src/MapsTimeZoneModelFactory.cs | 2 +- .../AdditionalTimeZoneReturnInformation.cs | 13 ++ .../src/Models/GetTimeZoneOptions.cs} | 14 +- .../Azure.Maps.TimeZones/src/Models/IanaId.cs | 21 +++ .../src/Models/IanaIdData.cs | 20 +++ .../src/Models/JsonFormat.cs | 3 +- .../src}/Models/ReferenceTime.cs | 69 +++++--- .../src/Models/RepresentativePoint.cs | 10 ++ .../src/Models/TimeTransition.cs | 50 ++++++ .../src/Models/TimeZoneIanaVersionResult.cs | 2 +- .../src/Models/TimeZoneId.cs | 46 +++++ .../src/Models/TimeZoneName.cs} | 6 +- .../src/Models/TimeZoneResult.cs | 6 +- .../src/Models/WindowsTimeZone.cs} | 6 +- .../src/Models/WindowsTimeZoneData.cs | 20 +++ .../src/autorest.md | 2 +- .../src/properties/AssemblyInfo.cs | 7 + .../tests/Azure.Maps.TimeZones.Tests.csproj} | 2 +- .../tests/MapsTimeZoneTests.cs | 45 ++--- .../tests/Samples/README.md | 2 +- .../tests/Samples/TimeZoneClientSamples.cs | 77 +++++---- .../tests/TimeZoneClientLiveTestsBase.cs | 10 +- .../tests/TimeZoneClientTestEnvironment.cs | 2 +- 86 files changed, 1245 insertions(+), 1060 deletions(-) delete mode 100644 sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.net8.0.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.netstandard2.0.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/samples/MapsTimeZoneSamples.md delete mode 100644 sdk/maps/Azure.Maps.TimeZone/samples/README.md delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/Generated/MapsTimeZoneModelFactory.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneOptions.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/Models/RepresentativePoint.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneOptions.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/src/properties/AssemblyInfo.cs delete mode 100644 sdk/maps/Azure.Maps.TimeZone/tests/assets.json rename sdk/maps/{Azure.Maps.TimeZone/Azure.Maps.TimeZone.sln => Azure.Maps.TimeZones/Azure.Maps.TimeZones.sln} (56%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/CHANGELOG.md (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/Directory.Build.props (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/README.md (78%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.net8.0.cs create mode 100644 sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.netstandard2.0.cs create mode 100644 sdk/maps/Azure.Maps.TimeZones/assets.json create mode 100644 sdk/maps/Azure.Maps.TimeZones/samples/MapsTimeZoneSamples.md create mode 100644 sdk/maps/Azure.Maps.TimeZones/samples/README.md rename sdk/maps/{Azure.Maps.TimeZone/src/Azure.Maps.TimeZone.csproj => Azure.Maps.TimeZones/src/Azure.Maps.TimeZones.csproj} (86%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/Argument.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/ChangeTrackingDictionary.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/ChangeTrackingList.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/ModelSerializationExtensions.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/MultipartFormDataRequestContent.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/Optional.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/RequestContentHelper.cs (100%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Internal/Utf8JsonRequestContent.cs (100%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Generated/MapsTimeZonesModelFactory.cs create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/AdditionalTimeZoneReturnInformation.cs rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/CountryRecord.Serialization.cs (97%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/CountryRecord.cs (96%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs (98%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ErrorAdditionalInfo.cs (96%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ErrorDetail.Serialization.cs (99%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ErrorDetail.cs (98%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ErrorResponse.Serialization.cs (97%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ErrorResponse.cs (96%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/IanaId.Serialization.cs (98%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/IanaId.cs (85%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/JsonFormat.cs (98%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/ReferenceTime.Serialization.cs (99%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.cs rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/RepresentativePoint.Serialization.cs (95%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/RepresentativePoint.cs (74%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/TimeTransition.Serialization.cs (98%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.cs rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs (97%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/Models/TimeZoneIanaVersionResult.cs (95%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.Serialization.cs => Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.Serialization.cs} (88%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.cs rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.Serialization.cs => Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.Serialization.cs} (80%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.cs => Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.cs} (79%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.Serialization.cs => Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.Serialization.cs} (74%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.cs => Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.cs} (71%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.Serialization.cs => Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.Serialization.cs} (83%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.cs => Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.cs} (72%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Generated/TimezoneRestClient.cs (91%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/MapsTimeZoneClient.cs (76%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/MapsTimeZoneClientOptions.cs (86%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/MapsTimeZoneModelFactory.cs (90%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/AdditionalTimeZoneReturnInformation.cs rename sdk/maps/{Azure.Maps.TimeZone/src/Models/Options/TimeZoneBaseOptions.cs => Azure.Maps.TimeZones/src/Models/GetTimeZoneOptions.cs} (68%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/IanaId.cs create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/IanaIdData.cs rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Models/JsonFormat.cs (76%) rename sdk/maps/{Azure.Maps.TimeZone/src/Generated => Azure.Maps.TimeZones/src}/Models/ReferenceTime.cs (54%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/RepresentativePoint.cs create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/TimeTransition.cs rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Models/TimeZoneIanaVersionResult.cs (89%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneId.cs rename sdk/maps/{Azure.Maps.TimeZone/src/Models/TimeZoneNames.cs => Azure.Maps.TimeZones/src/Models/TimeZoneName.cs} (72%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/Models/TimeZoneResult.cs (53%) rename sdk/maps/{Azure.Maps.TimeZone/src/Models/TimeZoneWindows.cs => Azure.Maps.TimeZones/src/Models/WindowsTimeZone.cs} (54%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZoneData.cs rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/src/autorest.md (97%) create mode 100644 sdk/maps/Azure.Maps.TimeZones/src/properties/AssemblyInfo.cs rename sdk/maps/{Azure.Maps.TimeZone/tests/Azure.Maps.TimeZone.Tests.csproj => Azure.Maps.TimeZones/tests/Azure.Maps.TimeZones.Tests.csproj} (93%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/tests/MapsTimeZoneTests.cs (71%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/tests/Samples/README.md (68%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/tests/Samples/TimeZoneClientSamples.cs (72%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/tests/TimeZoneClientLiveTestsBase.cs (61%) rename sdk/maps/{Azure.Maps.TimeZone => Azure.Maps.TimeZones}/tests/TimeZoneClientTestEnvironment.cs (93%) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 60a4e21f8c976..fd9a7b0081a65 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -264,7 +264,7 @@ "Hvci" ] }, - { + { "filename": "**/sdk/computefleet/**/*.cs", "words": [ "Rdma" @@ -917,7 +917,7 @@ ] }, { - "filename": "**/sdk/maps/Azure.Maps.TimeZone/**/*.cs", + "filename": "**/sdk/maps/Azure.Maps.TimeZones/**/*.cs", "words": [ "Posix", "posix", @@ -1621,4 +1621,4 @@ } ], "allowCompoundWords": true -} +} \ No newline at end of file diff --git a/sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.net8.0.cs b/sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.net8.0.cs deleted file mode 100644 index 8fde7b27023b0..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.net8.0.cs +++ /dev/null @@ -1,159 +0,0 @@ -namespace Azure.Maps.TimeZone -{ - public partial class CountryRecord - { - internal CountryRecord() { } - public string Code { get { throw null; } } - public string Name { get { throw null; } } - } - public partial class IanaId - { - internal IanaId() { } - public string AliasOf { get { throw null; } } - public bool? HasZone1970Location { get { throw null; } } - public string Id { get { throw null; } } - public bool? IsAlias { get { throw null; } } - } - public partial class MapsTimeZoneClient - { - protected MapsTimeZoneClient() { } - public MapsTimeZoneClient(Azure.AzureKeyCredential credential) { } - public MapsTimeZoneClient(Azure.AzureKeyCredential credential, Azure.Maps.TimeZone.MapsTimeZoneClientOptions options) { } - public MapsTimeZoneClient(Azure.AzureSasCredential credential) { } - public MapsTimeZoneClient(Azure.AzureSasCredential credential, Azure.Maps.TimeZone.MapsTimeZoneClientOptions options) { } - public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId) { } - public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId, Azure.Maps.TimeZone.MapsTimeZoneClientOptions options) { } - public virtual Azure.Response> ConvertWindowsTimeZoneToIana(string windowsTimezoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> ConvertWindowsTimeZoneToIanaAsync(string windowsTimezoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> GetIanaTimeZoneIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> GetIanaTimeZoneIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetIanaVersion(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIanaVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetTimeZoneByCoordinates(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetTimeZoneByCoordinatesAsync(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetTimeZoneByID(string timezoneId, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetTimeZoneByIDAsync(string timezoneId, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> GetWindowsTimeZoneIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> GetWindowsTimeZoneIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class MapsTimeZoneClientOptions : Azure.Core.ClientOptions - { - public MapsTimeZoneClientOptions(Azure.Maps.TimeZone.MapsTimeZoneClientOptions.ServiceVersion version = Azure.Maps.TimeZone.MapsTimeZoneClientOptions.ServiceVersion.V1_0, System.Uri endpoint = null) { } - public System.Uri Endpoint { get { throw null; } set { } } - public enum ServiceVersion - { - V1_0 = 1, - } - } - public static partial class MapsTimeZoneModelFactory - { - public static Azure.Maps.TimeZone.CountryRecord CountryRecord(string name = null, string code = null) { throw null; } - public static Azure.Maps.TimeZone.IanaId IanaId(string id = null, bool? isAlias = default(bool?), string aliasOf = null, bool? hasZone1970Location = default(bool?)) { throw null; } - public static Azure.Maps.TimeZone.ReferenceTime ReferenceTime(string tag = null, string standardOffset = null, string daylightSavings = null, string wallTime = null, int? posixTzValidYear = default(int?), string posixTz = null, System.DateTimeOffset? sunrise = default(System.DateTimeOffset?), System.DateTimeOffset? sunset = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Maps.TimeZone.TimeTransition TimeTransition(string tag = null, string standardOffset = null, string daylightSavings = null, System.DateTimeOffset? utcStart = default(System.DateTimeOffset?), System.DateTimeOffset? utcEnd = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneIanaVersionResult TimeZoneIanaVersionResult(string version = null) { throw null; } - public static Azure.Maps.TimeZone.TimezoneId TimezoneId(string id = null, System.Collections.Generic.IEnumerable aliases = null, System.Collections.Generic.IEnumerable countries = null, Azure.Maps.TimeZone.Models.TimeZoneNames names = null, Azure.Maps.TimeZone.ReferenceTime referenceTime = null, Azure.Maps.TimeZone.Models.RepresentativePoint representativePoint = null, System.Collections.Generic.IEnumerable timeTransitions = null) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneInformation TimeZoneInformation(string version = null, System.DateTimeOffset? referenceUtcTimestamp = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable timeZones = null) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneNames TimeZoneNames(string iso6391LanguageCode = null, string generic = null, string standard = null, string daylight = null) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneWindows TimeZoneWindows(string windowsId = null, string territory = null, System.Collections.Generic.IEnumerable ianaIds = null) { throw null; } - } - public partial class ReferenceTime - { - internal ReferenceTime() { } - public string DaylightSavings { get { throw null; } } - public string PosixTz { get { throw null; } } - public int? PosixTzValidYear { get { throw null; } } - public string StandardOffset { get { throw null; } } - public System.DateTimeOffset? Sunrise { get { throw null; } } - public System.DateTimeOffset? Sunset { get { throw null; } } - public string Tag { get { throw null; } } - public string WallTime { get { throw null; } } - } - public partial class TimeTransition - { - internal TimeTransition() { } - public string DaylightSavings { get { throw null; } } - public string StandardOffset { get { throw null; } } - public string Tag { get { throw null; } } - public System.DateTimeOffset? UtcEnd { get { throw null; } } - public System.DateTimeOffset? UtcStart { get { throw null; } } - } - public partial class TimezoneId - { - internal TimezoneId() { } - public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Countries { get { throw null; } } - public string Id { get { throw null; } } - public Azure.Maps.TimeZone.Models.TimeZoneNames Names { get { throw null; } } - public Azure.Maps.TimeZone.ReferenceTime ReferenceTime { get { throw null; } } - public Azure.Maps.TimeZone.Models.RepresentativePoint RepresentativePoint { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TimeTransitions { get { throw null; } } - } -} -namespace Azure.Maps.TimeZone.Models -{ - public partial class RepresentativePoint - { - internal RepresentativePoint() { } - public Azure.Core.GeoJson.GeoPosition geoPosition { get { throw null; } set { } } - } - public partial class TimeZoneIanaVersionResult - { - internal TimeZoneIanaVersionResult() { } - public string Version { get { throw null; } } - } - public partial class TimeZoneInformation - { - internal TimeZoneInformation() { } - public System.DateTimeOffset? ReferenceUtcTimestamp { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TimeZones { get { throw null; } } - public string Version { get { throw null; } } - } - public partial class TimeZoneNames - { - internal TimeZoneNames() { } - public string Daylight { get { throw null; } } - public string Generic { get { throw null; } } - public string Iso6391LanguageCode { get { throw null; } } - public string Standard { get { throw null; } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct TimeZoneOptions : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public TimeZoneOptions(string value) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions All { get { throw null; } } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions None { get { throw null; } } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions Transitions { get { throw null; } } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions ZoneInfo { get { throw null; } } - public bool Equals(Azure.Maps.TimeZone.Models.TimeZoneOptions other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Maps.TimeZone.Models.TimeZoneOptions left, Azure.Maps.TimeZone.Models.TimeZoneOptions right) { throw null; } - public static implicit operator Azure.Maps.TimeZone.Models.TimeZoneOptions (string value) { throw null; } - public static bool operator !=(Azure.Maps.TimeZone.Models.TimeZoneOptions left, Azure.Maps.TimeZone.Models.TimeZoneOptions right) { throw null; } - public override string ToString() { throw null; } - } - public partial class TimeZoneWindows - { - internal TimeZoneWindows() { } - public System.Collections.Generic.IReadOnlyList IanaIds { get { throw null; } } - public string Territory { get { throw null; } } - public string WindowsId { get { throw null; } } - } -} -namespace Azure.Maps.TimeZone.Models.Options -{ - public partial class TimeZoneBaseOptions - { - public TimeZoneBaseOptions() { } - public string AcceptLanguage { get { throw null; } set { } } - public System.DateTimeOffset? DaylightSavingsTimeFrom { get { throw null; } set { } } - public int? DaylightSavingsTimeLastingYears { get { throw null; } set { } } - public Azure.Maps.TimeZone.Models.TimeZoneOptions? Options { get { throw null; } set { } } - public System.DateTimeOffset? TimeStamp { get { throw null; } set { } } - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.netstandard2.0.cs b/sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.netstandard2.0.cs deleted file mode 100644 index 8fde7b27023b0..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/api/Azure.Maps.TimeZone.netstandard2.0.cs +++ /dev/null @@ -1,159 +0,0 @@ -namespace Azure.Maps.TimeZone -{ - public partial class CountryRecord - { - internal CountryRecord() { } - public string Code { get { throw null; } } - public string Name { get { throw null; } } - } - public partial class IanaId - { - internal IanaId() { } - public string AliasOf { get { throw null; } } - public bool? HasZone1970Location { get { throw null; } } - public string Id { get { throw null; } } - public bool? IsAlias { get { throw null; } } - } - public partial class MapsTimeZoneClient - { - protected MapsTimeZoneClient() { } - public MapsTimeZoneClient(Azure.AzureKeyCredential credential) { } - public MapsTimeZoneClient(Azure.AzureKeyCredential credential, Azure.Maps.TimeZone.MapsTimeZoneClientOptions options) { } - public MapsTimeZoneClient(Azure.AzureSasCredential credential) { } - public MapsTimeZoneClient(Azure.AzureSasCredential credential, Azure.Maps.TimeZone.MapsTimeZoneClientOptions options) { } - public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId) { } - public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId, Azure.Maps.TimeZone.MapsTimeZoneClientOptions options) { } - public virtual Azure.Response> ConvertWindowsTimeZoneToIana(string windowsTimezoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> ConvertWindowsTimeZoneToIanaAsync(string windowsTimezoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> GetIanaTimeZoneIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> GetIanaTimeZoneIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetIanaVersion(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIanaVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetTimeZoneByCoordinates(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetTimeZoneByCoordinatesAsync(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetTimeZoneByID(string timezoneId, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetTimeZoneByIDAsync(string timezoneId, Azure.Maps.TimeZone.Models.Options.TimeZoneBaseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> GetWindowsTimeZoneIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> GetWindowsTimeZoneIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class MapsTimeZoneClientOptions : Azure.Core.ClientOptions - { - public MapsTimeZoneClientOptions(Azure.Maps.TimeZone.MapsTimeZoneClientOptions.ServiceVersion version = Azure.Maps.TimeZone.MapsTimeZoneClientOptions.ServiceVersion.V1_0, System.Uri endpoint = null) { } - public System.Uri Endpoint { get { throw null; } set { } } - public enum ServiceVersion - { - V1_0 = 1, - } - } - public static partial class MapsTimeZoneModelFactory - { - public static Azure.Maps.TimeZone.CountryRecord CountryRecord(string name = null, string code = null) { throw null; } - public static Azure.Maps.TimeZone.IanaId IanaId(string id = null, bool? isAlias = default(bool?), string aliasOf = null, bool? hasZone1970Location = default(bool?)) { throw null; } - public static Azure.Maps.TimeZone.ReferenceTime ReferenceTime(string tag = null, string standardOffset = null, string daylightSavings = null, string wallTime = null, int? posixTzValidYear = default(int?), string posixTz = null, System.DateTimeOffset? sunrise = default(System.DateTimeOffset?), System.DateTimeOffset? sunset = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Maps.TimeZone.TimeTransition TimeTransition(string tag = null, string standardOffset = null, string daylightSavings = null, System.DateTimeOffset? utcStart = default(System.DateTimeOffset?), System.DateTimeOffset? utcEnd = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneIanaVersionResult TimeZoneIanaVersionResult(string version = null) { throw null; } - public static Azure.Maps.TimeZone.TimezoneId TimezoneId(string id = null, System.Collections.Generic.IEnumerable aliases = null, System.Collections.Generic.IEnumerable countries = null, Azure.Maps.TimeZone.Models.TimeZoneNames names = null, Azure.Maps.TimeZone.ReferenceTime referenceTime = null, Azure.Maps.TimeZone.Models.RepresentativePoint representativePoint = null, System.Collections.Generic.IEnumerable timeTransitions = null) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneInformation TimeZoneInformation(string version = null, System.DateTimeOffset? referenceUtcTimestamp = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable timeZones = null) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneNames TimeZoneNames(string iso6391LanguageCode = null, string generic = null, string standard = null, string daylight = null) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneWindows TimeZoneWindows(string windowsId = null, string territory = null, System.Collections.Generic.IEnumerable ianaIds = null) { throw null; } - } - public partial class ReferenceTime - { - internal ReferenceTime() { } - public string DaylightSavings { get { throw null; } } - public string PosixTz { get { throw null; } } - public int? PosixTzValidYear { get { throw null; } } - public string StandardOffset { get { throw null; } } - public System.DateTimeOffset? Sunrise { get { throw null; } } - public System.DateTimeOffset? Sunset { get { throw null; } } - public string Tag { get { throw null; } } - public string WallTime { get { throw null; } } - } - public partial class TimeTransition - { - internal TimeTransition() { } - public string DaylightSavings { get { throw null; } } - public string StandardOffset { get { throw null; } } - public string Tag { get { throw null; } } - public System.DateTimeOffset? UtcEnd { get { throw null; } } - public System.DateTimeOffset? UtcStart { get { throw null; } } - } - public partial class TimezoneId - { - internal TimezoneId() { } - public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Countries { get { throw null; } } - public string Id { get { throw null; } } - public Azure.Maps.TimeZone.Models.TimeZoneNames Names { get { throw null; } } - public Azure.Maps.TimeZone.ReferenceTime ReferenceTime { get { throw null; } } - public Azure.Maps.TimeZone.Models.RepresentativePoint RepresentativePoint { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TimeTransitions { get { throw null; } } - } -} -namespace Azure.Maps.TimeZone.Models -{ - public partial class RepresentativePoint - { - internal RepresentativePoint() { } - public Azure.Core.GeoJson.GeoPosition geoPosition { get { throw null; } set { } } - } - public partial class TimeZoneIanaVersionResult - { - internal TimeZoneIanaVersionResult() { } - public string Version { get { throw null; } } - } - public partial class TimeZoneInformation - { - internal TimeZoneInformation() { } - public System.DateTimeOffset? ReferenceUtcTimestamp { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TimeZones { get { throw null; } } - public string Version { get { throw null; } } - } - public partial class TimeZoneNames - { - internal TimeZoneNames() { } - public string Daylight { get { throw null; } } - public string Generic { get { throw null; } } - public string Iso6391LanguageCode { get { throw null; } } - public string Standard { get { throw null; } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct TimeZoneOptions : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public TimeZoneOptions(string value) { throw null; } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions All { get { throw null; } } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions None { get { throw null; } } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions Transitions { get { throw null; } } - public static Azure.Maps.TimeZone.Models.TimeZoneOptions ZoneInfo { get { throw null; } } - public bool Equals(Azure.Maps.TimeZone.Models.TimeZoneOptions other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Maps.TimeZone.Models.TimeZoneOptions left, Azure.Maps.TimeZone.Models.TimeZoneOptions right) { throw null; } - public static implicit operator Azure.Maps.TimeZone.Models.TimeZoneOptions (string value) { throw null; } - public static bool operator !=(Azure.Maps.TimeZone.Models.TimeZoneOptions left, Azure.Maps.TimeZone.Models.TimeZoneOptions right) { throw null; } - public override string ToString() { throw null; } - } - public partial class TimeZoneWindows - { - internal TimeZoneWindows() { } - public System.Collections.Generic.IReadOnlyList IanaIds { get { throw null; } } - public string Territory { get { throw null; } } - public string WindowsId { get { throw null; } } - } -} -namespace Azure.Maps.TimeZone.Models.Options -{ - public partial class TimeZoneBaseOptions - { - public TimeZoneBaseOptions() { } - public string AcceptLanguage { get { throw null; } set { } } - public System.DateTimeOffset? DaylightSavingsTimeFrom { get { throw null; } set { } } - public int? DaylightSavingsTimeLastingYears { get { throw null; } set { } } - public Azure.Maps.TimeZone.Models.TimeZoneOptions? Options { get { throw null; } set { } } - public System.DateTimeOffset? TimeStamp { get { throw null; } set { } } - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/samples/MapsTimeZoneSamples.md b/sdk/maps/Azure.Maps.TimeZone/samples/MapsTimeZoneSamples.md deleted file mode 100644 index bec69f759ce4f..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/samples/MapsTimeZoneSamples.md +++ /dev/null @@ -1,56 +0,0 @@ -using Azure.Maps.TimeZone; - - -## Examples - - -### Get TimeZone By ID - -```C# Snippet:GetTimeZoneById -TimeZoneBaseOptions options = new TimeZoneBaseOptions(); -options.Options = TimeZoneOptions.All; -Response response = client.GetTimeZoneByID("Asia/Bahrain", options); -Console.WriteLine("Version: " + response.Value.Version); -Console.WriteLine("Countires: " + response.Value.TimeZones[0].Countries); -``` - -### Get TimeZone By Coordinates - -```C# Snippet:GetTimeZoneByCoordinates -TimeZoneBaseOptions options = new TimeZoneBaseOptions(); -options.Options = TimeZoneOptions.All; -GeoPosition coordinates = new GeoPosition(121.5640089, 25.0338053); -Response response = client.GetTimeZoneByCoordinates(coordinates, options); -Console.WriteLine("Names: " + response.Value.TimeZones[0].Names); -``` - -### Get Windows TimeZone Ids - -```C# Snippet:GetWindowsTimeZoneIds -Response> response = client.GetWindowsTimeZoneIds(); -Console.WriteLine("Count: " + response.Value.Count); -Console.WriteLine("WindowsId: " + response.Value[0].WindowsId); -Console.WriteLine("Territory: " + response.Value[0].Territory); -``` - -### Get Iana TimeZone Ids - -```C# Snippet:GetIanaTimeZoneIds -Response> response = client.GetIanaTimeZoneIds(); -Console.WriteLine("IsAlias: " + response.Value[0].IsAlias); -Console.WriteLine("Id: " + response.Value[0].Id); -``` - -### Get Iana Version - -```C# Snippet:GetIanaVersion -Response response = client.GetIanaVersion(); -Console.WriteLine("Version: " + response.Value.Version); -``` - -### Convert Windows TimeZone To Iana - -```C# Snippet:ConvertWindowsTimeZoneToIana -Response> response = client.ConvertWindowsTimeZoneToIana("Dateline Standard Time"); -Console.WriteLine("Id: " + response.Value[0].Id); -``` diff --git a/sdk/maps/Azure.Maps.TimeZone/samples/README.md b/sdk/maps/Azure.Maps.TimeZone/samples/README.md deleted file mode 100644 index 9b35fb264f43d..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/samples/README.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -page_type: sample -languages: -- csharp -products: -- azure -- azure-maps -name: Azure.Maps.TimeZone samples for .NET -description: Samples for the Azure.Maps.TimeZone client library. ---- - -# Azure.Maps.TimeZone Samples - -For different APIs, please refer the following samples: - -[Timezone](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/maps/Azure.Maps.TimeZone/samples/MapsTimeZoneSamples.md) diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/MapsTimeZoneModelFactory.cs b/sdk/maps/Azure.Maps.TimeZone/src/Generated/MapsTimeZoneModelFactory.cs deleted file mode 100644 index 0085f9d25aeb3..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/MapsTimeZoneModelFactory.cs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Maps.TimeZone.Models; - -namespace Azure.Maps.TimeZone -{ - /// Model factory for models. - public static partial class MapsTimeZoneModelFactory - { - /// Initializes a new instance of . - /// Version property. - /// Reference Utc Timestamp property. - /// TimeZoneId array. - /// A new instance for mocking. - public static TimeZoneInformation TimeZoneInformation(string version = null, DateTimeOffset? referenceUtcTimestamp = null, IEnumerable timeZones = null) - { - timeZones ??= new List(); - - return new TimeZoneInformation(version, referenceUtcTimestamp, timeZones?.ToList()); - } - - /// Initializes a new instance of . - /// Id property. - /// - /// An array of time zone ID aliases. Only returned when [options]=*zoneinfo* or *all*. - /// - /// Note: may be null. - /// - /// An array of country/region records. Only returned when [options]=*zoneinfo* or *all*. - /// Timezone names object. - /// Details in effect at the local time. - /// Representative point property. - /// Time zone DST transitions from [transitionsFrom] until timestamp + 1 year. - /// A new instance for mocking. - public static TimezoneId TimezoneId(string id = null, IEnumerable aliases = null, IEnumerable countries = null, TimeZoneNames names = null, ReferenceTime referenceTime = null, RepresentativePoint representativePoint = null, IEnumerable timeTransitions = null) - { - aliases ??= new List(); - countries ??= new List(); - timeTransitions ??= new List(); - - return new TimezoneId( - id, - aliases?.ToList(), - countries?.ToList(), - names, - referenceTime, - representativePoint, - timeTransitions?.ToList()); - } - - /// Initializes a new instance of . - /// country/region Name. - /// ISO-3166 2-letter country/region code for the country/region. - /// A new instance for mocking. - public static CountryRecord CountryRecord(string name = null, string code = null) - { - return new CountryRecord(name, code); - } - - /// Initializes a new instance of . - /// The ISO 639-1 language code of the Names. - /// Generic Name. - /// Standard Name. - /// Daylight Name. - /// A new instance for mocking. - public static TimeZoneNames TimeZoneNames(string iso6391LanguageCode = null, string generic = null, string standard = null, string daylight = null) - { - return new TimeZoneNames(iso6391LanguageCode, generic, standard, daylight); - } - - /// Initializes a new instance of . - /// 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. The sunrise is described in the ISO8601 format. (Only be populated if the call is byCoordinates). - /// Sunset at the given time zone as shown in the `Tag` property. The sunset is described in the ISO8601 format.(Only be populated if the call is byCoordinates). - /// A new instance for mocking. - public static ReferenceTime ReferenceTime(string tag = null, string standardOffset = null, string daylightSavings = null, string wallTime = null, int? posixTzValidYear = null, string posixTz = null, DateTimeOffset? sunrise = null, DateTimeOffset? sunset = null) - { - return new ReferenceTime( - tag, - standardOffset, - daylightSavings, - wallTime, - posixTzValidYear, - posixTz, - sunrise, - sunset); - } - - /// Initializes a new instance of . - /// Tag property. - /// StandardOffset property. - /// DaylightSavings property. - /// Start date, start time for this transition period. - /// End date, end time for this transition period. - /// A new instance for mocking. - public static TimeTransition TimeTransition(string tag = null, string standardOffset = null, string daylightSavings = null, DateTimeOffset? utcStart = null, DateTimeOffset? utcEnd = null) - { - return new TimeTransition(tag, standardOffset, daylightSavings, utcStart, utcEnd); - } - - /// Initializes a new instance of . - /// Windows Id property. - /// Territory property. - /// IanaIds array. - /// A new instance for mocking. - public static TimeZoneWindows TimeZoneWindows(string windowsId = null, string territory = null, IEnumerable ianaIds = null) - { - ianaIds ??= new List(); - - return new TimeZoneWindows(windowsId, territory, ianaIds?.ToList()); - } - - /// Initializes a new instance of . - /// Id property. - /// IsAlias property. - /// AliasOf property. - /// This attribute returns `True` if the IanaId has any country/zone associated with it. - /// A new instance for mocking. - public static IanaId IanaId(string id = null, bool? isAlias = null, string aliasOf = null, bool? hasZone1970Location = null) - { - return new IanaId(id, isAlias, aliasOf, hasZone1970Location); - } - - /// Initializes a new instance of . - /// Version property. - /// A new instance for mocking. - public static TimeZoneIanaVersionResult TimeZoneIanaVersionResult(string version = null) - { - return new TimeZoneIanaVersionResult(version); - } - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.cs b/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.cs deleted file mode 100644 index bd1b6eb4687f4..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Maps.TimeZone -{ - /// The TimeTransition. - public partial class TimeTransition - { - /// Initializes a new instance of . - internal TimeTransition() - { - } - - /// Initializes a new instance of . - /// Tag property. - /// StandardOffset property. - /// DaylightSavings property. - /// Start date, start time for this transition period. - /// End date, end time for this transition period. - internal TimeTransition(string tag, string standardOffset, string daylightSavings, DateTimeOffset? utcStart, DateTimeOffset? utcEnd) - { - Tag = tag; - StandardOffset = standardOffset; - DaylightSavings = daylightSavings; - UtcStart = utcStart; - UtcEnd = utcEnd; - } - - /// Tag property. - public string Tag { get; } - /// StandardOffset property. - public string StandardOffset { get; } - /// DaylightSavings property. - public string DaylightSavings { get; } - /// Start date, start time for this transition period. - public DateTimeOffset? UtcStart { get; } - /// End date, end time for this transition period. - public DateTimeOffset? UtcEnd { get; } - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneOptions.cs b/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneOptions.cs deleted file mode 100644 index 80a5bdfd656da..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneOptions.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Maps.TimeZone.Models -{ - /// The TimezoneOptions. - public readonly partial struct TimeZoneOptions : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public TimeZoneOptions(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "none"; - private const string ZoneInfoValue = "zoneInfo"; - private const string TransitionsValue = "transitions"; - private const string AllValue = "all"; - - /// Do not include zoneinfo or transitions in the result. - public static TimeZoneOptions None { get; } = new TimeZoneOptions(NoneValue); - /// Include additional time zone info in the result. - public static TimeZoneOptions ZoneInfo { get; } = new TimeZoneOptions(ZoneInfoValue); - /// Include transition information in the result (The number of transitions is currently capped at 250). - public static TimeZoneOptions Transitions { get; } = new TimeZoneOptions(TransitionsValue); - /// Include both zoneinfo and transitions in the result. - public static TimeZoneOptions All { get; } = new TimeZoneOptions(AllValue); - /// Determines if two values are the same. - public static bool operator ==(TimeZoneOptions left, TimeZoneOptions right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(TimeZoneOptions left, TimeZoneOptions right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator TimeZoneOptions(string value) => new TimeZoneOptions(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is TimeZoneOptions other && Equals(other); - /// - public bool Equals(TimeZoneOptions other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.cs b/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.cs deleted file mode 100644 index 38f951bd21e65..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Maps.Common; -using Azure.Maps.TimeZone.Models; - -namespace Azure.Maps.TimeZone -{ - /// The TimezoneId. - public partial class TimezoneId - { - /// Initializes a new instance of . - internal TimezoneId() - { - Aliases = new ChangeTrackingList(); - Countries = new ChangeTrackingList(); - TimeTransitions = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Id property. - /// - /// An array of time zone ID aliases. Only returned when [options]=*zoneinfo* or *all*. - /// - /// Note: may be null. - /// - /// An array of country/region records. Only returned when [options]=*zoneinfo* or *all*. - /// Timezone names object. - /// Details in effect at the local time. - /// Representative point property. - /// Time zone DST transitions from [transitionsFrom] until timestamp + 1 year. - internal TimezoneId(string id, IReadOnlyList aliases, IReadOnlyList countries, TimeZoneNames names, ReferenceTime referenceTime, RepresentativePoint representativePoint, IReadOnlyList timeTransitions) - { - Id = id; - Aliases = aliases; - Countries = countries; - Names = names; - ReferenceTime = referenceTime; - RepresentativePoint = representativePoint; - TimeTransitions = timeTransitions; - } - - /// Id property. - public string Id { get; } - /// - /// An array of time zone ID aliases. Only returned when [options]=*zoneinfo* or *all*. - /// - /// Note: may be null. - /// - public IReadOnlyList Aliases { get; } - /// An array of country/region records. Only returned when [options]=*zoneinfo* or *all*. - public IReadOnlyList Countries { get; } - /// Timezone names object. - public TimeZoneNames Names { get; } - /// Details in effect at the local time. - public ReferenceTime ReferenceTime { get; } - /// Representative point property. - public RepresentativePoint RepresentativePoint { get; } - /// Time zone DST transitions from [transitionsFrom] until timestamp + 1 year. - public IReadOnlyList TimeTransitions { get; } - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/RepresentativePoint.cs b/sdk/maps/Azure.Maps.TimeZone/src/Models/RepresentativePoint.cs deleted file mode 100644 index cd11be06f5400..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/RepresentativePoint.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; -using Azure.Core.GeoJson; - -namespace Azure.Maps.TimeZone.Models -{ - /// Representative point property. - [CodeGenModel("RepresentativePoint")] - public partial class RepresentativePoint - { - [CodeGenMember("Latitude")] - internal float? Latitude { get; } - - [CodeGenMember("Longitude")] - internal float? Longitude { get; } - - /// GeoPosition property. - public GeoPosition geoPosition { get; set; } - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneOptions.cs b/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneOptions.cs deleted file mode 100644 index 6373367c064eb..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Maps.TimeZone.Models -{ - /// Options for TimeZone Client. - [CodeGenModel("TimezoneOptions")] - public readonly partial struct TimeZoneOptions - { - } -} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/properties/AssemblyInfo.cs b/sdk/maps/Azure.Maps.TimeZone/src/properties/AssemblyInfo.cs deleted file mode 100644 index 9b803cf5bdd33..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/src/properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Runtime.CompilerServices; - -[assembly: Azure.Core.AzureResourceProviderNamespace("Azure.Maps.TimeZone")] -[assembly: InternalsVisibleTo("Azure.Maps.TimeZone.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/assets.json b/sdk/maps/Azure.Maps.TimeZone/tests/assets.json deleted file mode 100644 index 21bf78ec1522b..0000000000000 --- a/sdk/maps/Azure.Maps.TimeZone/tests/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "net", - "TagPrefix": "net/maps/Azure.Maps.TimeZone/tests", - "Tag": "net/maps/Azure.Maps.TimeZone/tests_36e0e93072" -} diff --git a/sdk/maps/Azure.Maps.TimeZone/Azure.Maps.TimeZone.sln b/sdk/maps/Azure.Maps.TimeZones/Azure.Maps.TimeZones.sln similarity index 56% rename from sdk/maps/Azure.Maps.TimeZone/Azure.Maps.TimeZone.sln rename to sdk/maps/Azure.Maps.TimeZones/Azure.Maps.TimeZones.sln index 53793e4f98e70..420b99be29676 100644 --- a/sdk/maps/Azure.Maps.TimeZone/Azure.Maps.TimeZone.sln +++ b/sdk/maps/Azure.Maps.TimeZones/Azure.Maps.TimeZones.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32526.322 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Maps.TimeZone", "src\Azure.Maps.TimeZone.csproj", "{086A5E71-2A96-4FB9-801B-A4A0A9A70C49}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Maps.TimeZones", "src\Azure.Maps.TimeZones.csproj", "{0B02F873-2C5C-4809-8549-05E54C09AE4F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Maps.TimeZone.Tests", "tests\Azure.Maps.TimeZone.Tests.csproj", "{47DEA0AC-0636-45D6-98A1-2D1A3EE6A821}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Maps.TimeZones.Tests", "tests\Azure.Maps.TimeZones.Tests.csproj", "{0F031C50-78FB-4F1C-9971-BAB522A6CA31}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,14 +13,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {086A5E71-2A96-4FB9-801B-A4A0A9A70C49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {086A5E71-2A96-4FB9-801B-A4A0A9A70C49}.Debug|Any CPU.Build.0 = Debug|Any CPU - {086A5E71-2A96-4FB9-801B-A4A0A9A70C49}.Release|Any CPU.ActiveCfg = Release|Any CPU - {086A5E71-2A96-4FB9-801B-A4A0A9A70C49}.Release|Any CPU.Build.0 = Release|Any CPU - {47DEA0AC-0636-45D6-98A1-2D1A3EE6A821}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {47DEA0AC-0636-45D6-98A1-2D1A3EE6A821}.Debug|Any CPU.Build.0 = Debug|Any CPU - {47DEA0AC-0636-45D6-98A1-2D1A3EE6A821}.Release|Any CPU.ActiveCfg = Release|Any CPU - {47DEA0AC-0636-45D6-98A1-2D1A3EE6A821}.Release|Any CPU.Build.0 = Release|Any CPU + {0B02F873-2C5C-4809-8549-05E54C09AE4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B02F873-2C5C-4809-8549-05E54C09AE4F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B02F873-2C5C-4809-8549-05E54C09AE4F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B02F873-2C5C-4809-8549-05E54C09AE4F}.Release|Any CPU.Build.0 = Release|Any CPU + {0F031C50-78FB-4F1C-9971-BAB522A6CA31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F031C50-78FB-4F1C-9971-BAB522A6CA31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F031C50-78FB-4F1C-9971-BAB522A6CA31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F031C50-78FB-4F1C-9971-BAB522A6CA31}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/maps/Azure.Maps.TimeZone/CHANGELOG.md b/sdk/maps/Azure.Maps.TimeZones/CHANGELOG.md similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/CHANGELOG.md rename to sdk/maps/Azure.Maps.TimeZones/CHANGELOG.md diff --git a/sdk/maps/Azure.Maps.TimeZone/Directory.Build.props b/sdk/maps/Azure.Maps.TimeZones/Directory.Build.props similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/Directory.Build.props rename to sdk/maps/Azure.Maps.TimeZones/Directory.Build.props diff --git a/sdk/maps/Azure.Maps.TimeZone/README.md b/sdk/maps/Azure.Maps.TimeZones/README.md similarity index 78% rename from sdk/maps/Azure.Maps.TimeZone/README.md rename to sdk/maps/Azure.Maps.TimeZones/README.md index 23b5acc64dfac..80e6051e1647c 100644 --- a/sdk/maps/Azure.Maps.TimeZone/README.md +++ b/sdk/maps/Azure.Maps.TimeZones/README.md @@ -2,7 +2,7 @@ Azure Maps TimeZone is a library which contains Azure Maps TimeZone APIs. -[Source code](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZone/src) | [API reference documentation](https://docs.microsoft.com/rest/api/maps/) | [REST API reference documentation](https://docs.microsoft.com/rest/api/maps/timezone) | [Product documentation](https://docs.microsoft.com/azure/azure-maps/) +[Source code](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZones/src) | [API reference documentation](https://docs.microsoft.com/rest/api/maps/) | [REST API reference documentation](https://docs.microsoft.com/rest/api/maps/timezone) | [Product documentation](https://docs.microsoft.com/azure/azure-maps/) ## Getting started @@ -11,7 +11,7 @@ Azure Maps TimeZone is a library which contains Azure Maps TimeZone APIs. Install the client library for .NET with [NuGet](https://www.nuget.org/): ```dotnetcli -dotnet add package Azure.Maps.TimeZone --prerelease +dotnet add package Azure.Maps.TimeZones --prerelease ``` ### Prerequisites @@ -34,7 +34,7 @@ There are 3 ways to authenticate the client: Shared key authentication, Microso * Copy `Primary Key` or `Secondary Key` under **Shared Key authentication** section ```C# Snippet:InstantiateTimeZoneClientViaSubscriptionKey -// Create a SearchClient that will authenticate through Subscription Key (Shared key) +// Create a MapsTimeZoneClient that will authenticate through Subscription Key (Shared key) AzureKeyCredential credential = new AzureKeyCredential(""); MapsTimeZoneClient client = new MapsTimeZoneClient(credential); ``` @@ -62,10 +62,9 @@ Before integrating SAS token authentication, we need to install `Azure.ResourceM ```powershell dotnet add package Azure.ResourceManager -dotnet add package Azure.ResourceManager.Maps --prerelease +dotnet add package Azure.ResourceManager.Maps ``` - And then we can get SAS token via [List Sas](https://learn.microsoft.com/rest/api/maps-management/accounts/list-sas?tabs=HTTP) API and assign it to `MapsTimeZoneClient`. In the follow code sample, we fetch a specific maps account resource, and create a SAS token for 1 day expiry time when the code is executed. ```C# Snippet:InstantiateTimeZoneClientViaSas @@ -95,7 +94,7 @@ string expiry = now.AddDays(1).ToString("O"); MapsAccountSasContent sasContent = new MapsAccountSasContent(MapsSigningKey.PrimaryKey, principalId, maxRatePerSecond, start, expiry); Response sas = mapsAccount.GetSas(sasContent); -// Create a TimeZoneClient that will authenticate via SAS token +// Create a MapsTimeZoneClient that will authenticate via SAS token AzureSasCredential sasCredential = new AzureSasCredential(sas.Value.AccountSasToken); MapsTimeZoneClient client = new MapsTimeZoneClient(sasCredential); ``` @@ -119,14 +118,16 @@ We guarantee that all client instance methods are thread-safe and independent of ## Examples -You can familiarize yourself with different APIs using our [samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZone/samples). +You can familiarize yourself with different APIs using our [samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZones/samples). ### Get TimeZone By ID ```C# Snippet:GetTimeZoneById -TimeZoneBaseOptions options = new TimeZoneBaseOptions(); -options.Options = TimeZoneOptions.All; -Response response = client.GetTimeZoneByID("Asia/Bahrain", options); +GetTimeZoneOptions options = new GetTimeZoneOptions() +{ + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All +}; +Response response = client.GetTimeZoneById("Asia/Bahrain", options); Console.WriteLine("Version: " + response.Value.Version); Console.WriteLine("Countires: " + response.Value.TimeZones[0].Countries); ``` @@ -134,57 +135,71 @@ Console.WriteLine("Countires: " + response.Value.TimeZones[0].Countries); ### Get TimeZone By Coordinates ```C# Snippet:GetTimeZoneByCoordinates -TimeZoneBaseOptions options = new TimeZoneBaseOptions(); -options.Options = TimeZoneOptions.All; +GetTimeZoneOptions options = new GetTimeZoneOptions() +{ + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All +}; GeoPosition coordinates = new GeoPosition(121.5640089, 25.0338053); -Response response = client.GetTimeZoneByCoordinates(coordinates, options); -Console.WriteLine("Names: " + response.Value.TimeZones[0].Names); +Response response = client.GetTimeZoneByCoordinates(coordinates, options); + +Console.WriteLine("Time zone for (latitude, longitude) = ({0}, {1}) is {2}: ", + coordinates.Latitude, coordinates.Longitude, + response.Value.TimeZones[0].Name.Generic); ``` ### Get Windows TimeZone Ids ```C# Snippet:GetWindowsTimeZoneIds -Response> response = client.GetWindowsTimeZoneIds(); -Console.WriteLine("Count: " + response.Value.Count); -Console.WriteLine("WindowsId: " + response.Value[0].WindowsId); -Console.WriteLine("Territory: " + response.Value[0].Territory); +Response response = client.GetWindowsTimeZoneIds(); +Console.WriteLine("Total time zones: " + response.Value.WindowsTimeZones.Count); +foreach (WindowsTimeZone timeZone in response.Value.WindowsTimeZones) +{ + Console.WriteLine("IANA Id: " + timeZone.IanaIds); + Console.WriteLine("Windows ID: " + timeZone.WindowsId); + Console.WriteLine("Territory: " + timeZone.Territory); +} ``` ### Get Iana TimeZone Ids -```C# Snippet:GetIanaTimeZoneIds -Response> response = client.GetIanaTimeZoneIds(); -Console.WriteLine("IsAlias: " + response.Value[0].IsAlias); -Console.WriteLine("Id: " + response.Value[0].Id); +```C# Snippet:GetTimeZoneIanaIds +Response response = client.GetTimeZoneIanaIds(); +if (response.Value.IanaIds[0].AliasOf != null) +{ + Console.WriteLine("It is an alias: " + response.Value.IanaIds[0].AliasOf); +} +else +{ + Console.WriteLine("It is not an alias"); +} +Console.WriteLine("IANA Id: " + response.Value.IanaIds[0].Id); ``` ### Get Iana Version ```C# Snippet:GetIanaVersion Response response = client.GetIanaVersion(); -Console.WriteLine("Version: " + response.Value.Version); +Console.WriteLine("IANA Version: " + response.Value.Version); ``` ### Convert Windows TimeZone To Iana ```C# Snippet:ConvertWindowsTimeZoneToIana -Response> response = client.ConvertWindowsTimeZoneToIana("Dateline Standard Time"); -Console.WriteLine("Id: " + response.Value[0].Id); +Response response = client.ConvertWindowsTimeZoneToIana("Dateline Standard Time"); +Console.WriteLine("IANA Id: " + response.Value.IanaIds[0].Id); ``` - ## Troubleshooting ### General When you interact with the Azure Maps services, errors returned by the service correspond to the same HTTP status codes returned for [REST API requests](https://docs.microsoft.com/rest/api/maps/timezone). -For example, if you search with an invalid coordinate, a error is returned, indicating "Bad Request".400 - +For example, if you search with an invalid coordinate, a error is returned, indicating "Bad Request". ## Next steps -* For more context and additional scenarios, please see: [detailed samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZone/samples) +* For more context and additional scenarios, please see: [detailed samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZones/samples) ## Contributing @@ -196,4 +211,4 @@ When you submit a pull request, a CLA-bot will automatically determine whether y This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact with any additional questions or comments. -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/maps/Azure.Maps.TimeZone/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/maps/Azure.Maps.TimeZones/README.png) diff --git a/sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.net8.0.cs b/sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.net8.0.cs new file mode 100644 index 0000000000000..e873ecd723807 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.net8.0.cs @@ -0,0 +1,155 @@ +namespace Azure.Maps.TimeZones +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AdditionalTimeZoneReturnInformation : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AdditionalTimeZoneReturnInformation(string value) { throw null; } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation All { get { throw null; } } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation None { get { throw null; } } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation Transitions { get { throw null; } } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation ZoneInfo { get { throw null; } } + public bool Equals(Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation left, Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation right) { throw null; } + public static implicit operator Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation (string value) { throw null; } + public static bool operator !=(Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation left, Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CountryRecord + { + internal CountryRecord() { } + public string Code { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class GetTimeZoneOptions + { + public GetTimeZoneOptions() { } + public string AcceptLanguage { get { throw null; } set { } } + public Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation? AdditionalTimeZoneReturnInformation { get { throw null; } set { } } + public System.DateTimeOffset? DaylightSavingsTimeTransitionFrom { get { throw null; } set { } } + public int? DaylightSavingsTimeTransitionInYears { get { throw null; } set { } } + public System.DateTimeOffset? TimeStamp { get { throw null; } set { } } + } + public partial class IanaId + { + internal IanaId() { } + public string AliasOf { get { throw null; } } + public bool? HasZone1970Location { get { throw null; } } + public string Id { get { throw null; } } + } + public partial class IanaIdData + { + internal IanaIdData() { } + public System.Collections.Generic.IReadOnlyList IanaIds { get { throw null; } } + } + public partial class MapsTimeZoneClient + { + protected MapsTimeZoneClient() { } + public MapsTimeZoneClient(Azure.AzureKeyCredential credential) { } + public MapsTimeZoneClient(Azure.AzureKeyCredential credential, Azure.Maps.TimeZones.MapsTimeZoneClientOptions options) { } + public MapsTimeZoneClient(Azure.AzureSasCredential credential, Azure.Maps.TimeZones.MapsTimeZoneClientOptions options = null) { } + public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId) { } + public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId, Azure.Maps.TimeZones.MapsTimeZoneClientOptions options) { } + public virtual Azure.Response ConvertWindowsTimeZoneToIana(string windowsTimeZoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConvertWindowsTimeZoneToIanaAsync(string windowsTimeZoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIanaVersion(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIanaVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTimeZoneByCoordinates(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTimeZoneByCoordinatesAsync(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTimeZoneById(string timeZoneId, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTimeZoneByIdAsync(string timeZoneId, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTimeZoneIanaIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTimeZoneIanaIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWindowsTimeZoneIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWindowsTimeZoneIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MapsTimeZoneClientOptions : Azure.Core.ClientOptions + { + public MapsTimeZoneClientOptions(Azure.Maps.TimeZones.MapsTimeZoneClientOptions.ServiceVersion version = Azure.Maps.TimeZones.MapsTimeZoneClientOptions.ServiceVersion.V1_0) { } + public System.Uri Endpoint { get { throw null; } set { } } + public enum ServiceVersion + { + V1_0 = 1, + } + } + public static partial class MapsTimeZoneModelFactory + { + } + public static partial class MapsTimeZonesModelFactory + { + public static Azure.Maps.TimeZones.CountryRecord CountryRecord(string name = null, string code = null) { throw null; } + public static Azure.Maps.TimeZones.TimeZoneIanaVersionResult TimeZoneIanaVersionResult(string version = null) { throw null; } + public static Azure.Maps.TimeZones.TimeZoneName TimeZoneName(string iso6391LanguageCode = null, string generic = null, string standard = null, string daylight = null) { throw null; } + public static Azure.Maps.TimeZones.TimeZoneResult TimeZoneResult(string version = null, System.DateTimeOffset? referenceUtcTimestamp = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable timeZones = null) { throw null; } + public static Azure.Maps.TimeZones.WindowsTimeZone WindowsTimeZone(string windowsId = null, string territory = null, System.Collections.Generic.IEnumerable ianaIds = null) { throw null; } + } + public partial class ReferenceTime + { + internal ReferenceTime() { } + public System.TimeSpan DaylightSavingsTimeSpan { get { throw null; } } + public string PosixTimeZone { get { throw null; } } + public int? PosixTimeZoneValidYear { get { throw null; } } + public System.TimeSpan StandardOffsetTimeSpan { get { throw null; } } + public System.DateTimeOffset? Sunrise { get { throw null; } } + public System.DateTimeOffset? Sunset { get { throw null; } } + public string Tag { get { throw null; } } + public System.DateTimeOffset WallTime { get { throw null; } } + } + public partial class TimeTransition + { + internal TimeTransition() { } + public System.TimeSpan DaylightSavingsTimeSpan { get { throw null; } } + public System.TimeSpan StandardOffsetTimeSpan { get { throw null; } } + public string Tag { get { throw null; } } + public System.DateTimeOffset? UtcEnd { get { throw null; } } + public System.DateTimeOffset? UtcStart { get { throw null; } } + } + public partial class TimeZoneIanaVersionResult + { + internal TimeZoneIanaVersionResult() { } + public string Version { get { throw null; } } + } + public partial class TimeZoneId + { + internal TimeZoneId() { } + public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Countries { get { throw null; } } + public string Id { get { throw null; } } + public Azure.Maps.TimeZones.TimeZoneName Name { get { throw null; } } + public Azure.Maps.TimeZones.ReferenceTime ReferenceTime { get { throw null; } } + public Azure.Core.GeoJson.GeoPosition RepresentativePoint { get { throw null; } } + public System.Collections.Generic.IReadOnlyList TimeTransitions { get { throw null; } } + } + public partial class TimeZoneName + { + internal TimeZoneName() { } + public string Daylight { get { throw null; } } + public string Generic { get { throw null; } } + public string Iso6391LanguageCode { get { throw null; } } + public string Standard { get { throw null; } } + } + public partial class TimeZoneResult + { + internal TimeZoneResult() { } + public System.DateTimeOffset? ReferenceUtcTimestamp { get { throw null; } } + public System.Collections.Generic.IReadOnlyList TimeZones { get { throw null; } } + public string Version { get { throw null; } } + } + public partial class WindowsTimeZone + { + internal WindowsTimeZone() { } + public System.Collections.Generic.IReadOnlyList IanaIds { get { throw null; } } + public string Territory { get { throw null; } } + public string WindowsId { get { throw null; } } + } + public partial class WindowsTimeZoneData + { + internal WindowsTimeZoneData() { } + public System.Collections.Generic.IReadOnlyList WindowsTimeZones { get { throw null; } } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.netstandard2.0.cs b/sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.netstandard2.0.cs new file mode 100644 index 0000000000000..e873ecd723807 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/api/Azure.Maps.TimeZones.netstandard2.0.cs @@ -0,0 +1,155 @@ +namespace Azure.Maps.TimeZones +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AdditionalTimeZoneReturnInformation : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AdditionalTimeZoneReturnInformation(string value) { throw null; } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation All { get { throw null; } } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation None { get { throw null; } } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation Transitions { get { throw null; } } + public static Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation ZoneInfo { get { throw null; } } + public bool Equals(Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation left, Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation right) { throw null; } + public static implicit operator Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation (string value) { throw null; } + public static bool operator !=(Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation left, Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CountryRecord + { + internal CountryRecord() { } + public string Code { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class GetTimeZoneOptions + { + public GetTimeZoneOptions() { } + public string AcceptLanguage { get { throw null; } set { } } + public Azure.Maps.TimeZones.AdditionalTimeZoneReturnInformation? AdditionalTimeZoneReturnInformation { get { throw null; } set { } } + public System.DateTimeOffset? DaylightSavingsTimeTransitionFrom { get { throw null; } set { } } + public int? DaylightSavingsTimeTransitionInYears { get { throw null; } set { } } + public System.DateTimeOffset? TimeStamp { get { throw null; } set { } } + } + public partial class IanaId + { + internal IanaId() { } + public string AliasOf { get { throw null; } } + public bool? HasZone1970Location { get { throw null; } } + public string Id { get { throw null; } } + } + public partial class IanaIdData + { + internal IanaIdData() { } + public System.Collections.Generic.IReadOnlyList IanaIds { get { throw null; } } + } + public partial class MapsTimeZoneClient + { + protected MapsTimeZoneClient() { } + public MapsTimeZoneClient(Azure.AzureKeyCredential credential) { } + public MapsTimeZoneClient(Azure.AzureKeyCredential credential, Azure.Maps.TimeZones.MapsTimeZoneClientOptions options) { } + public MapsTimeZoneClient(Azure.AzureSasCredential credential, Azure.Maps.TimeZones.MapsTimeZoneClientOptions options = null) { } + public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId) { } + public MapsTimeZoneClient(Azure.Core.TokenCredential credential, string clientId, Azure.Maps.TimeZones.MapsTimeZoneClientOptions options) { } + public virtual Azure.Response ConvertWindowsTimeZoneToIana(string windowsTimeZoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConvertWindowsTimeZoneToIanaAsync(string windowsTimeZoneId, string windowsTerritoryCode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIanaVersion(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIanaVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTimeZoneByCoordinates(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTimeZoneByCoordinatesAsync(Azure.Core.GeoJson.GeoPosition coordinates, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTimeZoneById(string timeZoneId, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTimeZoneByIdAsync(string timeZoneId, Azure.Maps.TimeZones.GetTimeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTimeZoneIanaIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTimeZoneIanaIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWindowsTimeZoneIds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWindowsTimeZoneIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MapsTimeZoneClientOptions : Azure.Core.ClientOptions + { + public MapsTimeZoneClientOptions(Azure.Maps.TimeZones.MapsTimeZoneClientOptions.ServiceVersion version = Azure.Maps.TimeZones.MapsTimeZoneClientOptions.ServiceVersion.V1_0) { } + public System.Uri Endpoint { get { throw null; } set { } } + public enum ServiceVersion + { + V1_0 = 1, + } + } + public static partial class MapsTimeZoneModelFactory + { + } + public static partial class MapsTimeZonesModelFactory + { + public static Azure.Maps.TimeZones.CountryRecord CountryRecord(string name = null, string code = null) { throw null; } + public static Azure.Maps.TimeZones.TimeZoneIanaVersionResult TimeZoneIanaVersionResult(string version = null) { throw null; } + public static Azure.Maps.TimeZones.TimeZoneName TimeZoneName(string iso6391LanguageCode = null, string generic = null, string standard = null, string daylight = null) { throw null; } + public static Azure.Maps.TimeZones.TimeZoneResult TimeZoneResult(string version = null, System.DateTimeOffset? referenceUtcTimestamp = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable timeZones = null) { throw null; } + public static Azure.Maps.TimeZones.WindowsTimeZone WindowsTimeZone(string windowsId = null, string territory = null, System.Collections.Generic.IEnumerable ianaIds = null) { throw null; } + } + public partial class ReferenceTime + { + internal ReferenceTime() { } + public System.TimeSpan DaylightSavingsTimeSpan { get { throw null; } } + public string PosixTimeZone { get { throw null; } } + public int? PosixTimeZoneValidYear { get { throw null; } } + public System.TimeSpan StandardOffsetTimeSpan { get { throw null; } } + public System.DateTimeOffset? Sunrise { get { throw null; } } + public System.DateTimeOffset? Sunset { get { throw null; } } + public string Tag { get { throw null; } } + public System.DateTimeOffset WallTime { get { throw null; } } + } + public partial class TimeTransition + { + internal TimeTransition() { } + public System.TimeSpan DaylightSavingsTimeSpan { get { throw null; } } + public System.TimeSpan StandardOffsetTimeSpan { get { throw null; } } + public string Tag { get { throw null; } } + public System.DateTimeOffset? UtcEnd { get { throw null; } } + public System.DateTimeOffset? UtcStart { get { throw null; } } + } + public partial class TimeZoneIanaVersionResult + { + internal TimeZoneIanaVersionResult() { } + public string Version { get { throw null; } } + } + public partial class TimeZoneId + { + internal TimeZoneId() { } + public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Countries { get { throw null; } } + public string Id { get { throw null; } } + public Azure.Maps.TimeZones.TimeZoneName Name { get { throw null; } } + public Azure.Maps.TimeZones.ReferenceTime ReferenceTime { get { throw null; } } + public Azure.Core.GeoJson.GeoPosition RepresentativePoint { get { throw null; } } + public System.Collections.Generic.IReadOnlyList TimeTransitions { get { throw null; } } + } + public partial class TimeZoneName + { + internal TimeZoneName() { } + public string Daylight { get { throw null; } } + public string Generic { get { throw null; } } + public string Iso6391LanguageCode { get { throw null; } } + public string Standard { get { throw null; } } + } + public partial class TimeZoneResult + { + internal TimeZoneResult() { } + public System.DateTimeOffset? ReferenceUtcTimestamp { get { throw null; } } + public System.Collections.Generic.IReadOnlyList TimeZones { get { throw null; } } + public string Version { get { throw null; } } + } + public partial class WindowsTimeZone + { + internal WindowsTimeZone() { } + public System.Collections.Generic.IReadOnlyList IanaIds { get { throw null; } } + public string Territory { get { throw null; } } + public string WindowsId { get { throw null; } } + } + public partial class WindowsTimeZoneData + { + internal WindowsTimeZoneData() { } + public System.Collections.Generic.IReadOnlyList WindowsTimeZones { get { throw null; } } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZones/assets.json b/sdk/maps/Azure.Maps.TimeZones/assets.json new file mode 100644 index 0000000000000..913b3bd328f5f --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/maps/Azure.Maps.TimeZones", + "Tag": "net/maps/Azure.Maps.TimeZones_057c460226" +} diff --git a/sdk/maps/Azure.Maps.TimeZones/samples/MapsTimeZoneSamples.md b/sdk/maps/Azure.Maps.TimeZones/samples/MapsTimeZoneSamples.md new file mode 100644 index 0000000000000..ae5e7d58dd04a --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/samples/MapsTimeZoneSamples.md @@ -0,0 +1,135 @@ +# TimeZone Samples + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZones#getting-started) for details. + +## Import the namespaces + +```C# Snippet:TimeZoneImportNamespaces +using Azure.Maps.TimeZones; +``` + +## Create TimeZone Client + +Before searching addresses, create a `MapsTimeZoneClient` first. Either use subscription key, Microsoft Entra or SAS token for authentication. + +Instantiate time zone client with subscription key: + +```C# Snippet:InstantiateTimeZoneClientViaSubscriptionKey +// Create a MapsTimeZoneClient that will authenticate through Subscription Key (Shared key) +AzureKeyCredential credential = new AzureKeyCredential(""); +MapsTimeZoneClient client = new MapsTimeZoneClient(credential); +``` + +Instantiate route client via Microsoft Entra authentication: + +```C# Snippet:InstantiateTimeZoneClientViaMicrosoftEntra +// Create a MapsTimeZoneClient that will authenticate through MicrosoftEntra +DefaultAzureCredential credential = new DefaultAzureCredential(); +string clientId = ""; +MapsTimeZoneClient client = new MapsTimeZoneClient(credential, clientId); +``` + +Instantiate time zone client with SAS token: + +```C# Snippet:InstantiateTimeZoneClientViaSas +// Get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// Authenticate your client +ArmClient armClient = new ArmClient(cred); + +string subscriptionId = "MyMapsSubscriptionId"; +string resourceGroupName = "MyMapsResourceGroupName"; +string accountName = "MyMapsAccountName"; + +// Get maps account resource +ResourceIdentifier mapsAccountResourceId = MapsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); +MapsAccountResource mapsAccount = armClient.GetMapsAccountResource(mapsAccountResourceId); + +// Assign SAS token information +// Every time you want to SAS token, update the principal ID, max rate, start and expiry time +string principalId = "MyManagedIdentityObjectId"; +int maxRatePerSecond = 500; + +// Set start and expiry time for the SAS token in round-trip date/time format +DateTime now = DateTime.Now; +string start = now.ToString("O"); +string expiry = now.AddDays(1).ToString("O"); + +MapsAccountSasContent sasContent = new MapsAccountSasContent(MapsSigningKey.PrimaryKey, principalId, maxRatePerSecond, start, expiry); +Response sas = mapsAccount.GetSas(sasContent); + +// Create a MapsTimeZoneClient that will authenticate via SAS token +AzureSasCredential sasCredential = new AzureSasCredential(sas.Value.AccountSasToken); +MapsTimeZoneClient client = new MapsTimeZoneClient(sasCredential); +``` + +## Examples + +### Get TimeZone By ID + +```C# Snippet:GetTimeZoneById +GetTimeZoneOptions options = new GetTimeZoneOptions() +{ + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All +}; +Response response = client.GetTimeZoneById("Asia/Bahrain", options); +Console.WriteLine("Version: " + response.Value.Version); +Console.WriteLine("Countires: " + response.Value.TimeZones[0].Countries); +``` + +### Get TimeZone By Coordinates + +```C# Snippet:GetTimeZoneByCoordinates +GetTimeZoneOptions options = new GetTimeZoneOptions() +{ + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All +}; +GeoPosition coordinates = new GeoPosition(121.5640089, 25.0338053); +Response response = client.GetTimeZoneByCoordinates(coordinates, options); + +Console.WriteLine("Time zone for (latitude, longitude) = ({0}, {1}) is {2}: ", + coordinates.Latitude, coordinates.Longitude, + response.Value.TimeZones[0].Name.Generic); +``` + +### Get Windows TimeZone Ids + +```C# Snippet:GetWindowsTimeZoneIds +Response response = client.GetWindowsTimeZoneIds(); +Console.WriteLine("Total time zones: " + response.Value.WindowsTimeZones.Count); +foreach (WindowsTimeZone timeZone in response.Value.WindowsTimeZones) +{ + Console.WriteLine("IANA Id: " + timeZone.IanaIds); + Console.WriteLine("Windows ID: " + timeZone.WindowsId); + Console.WriteLine("Territory: " + timeZone.Territory); +} +``` + +### Get Iana TimeZone Ids + +```C# Snippet:GetTimeZoneIanaIds +Response response = client.GetTimeZoneIanaIds(); +if (response.Value.IanaIds[0].AliasOf != null) +{ + Console.WriteLine("It is an alias: " + response.Value.IanaIds[0].AliasOf); +} +else +{ + Console.WriteLine("It is not an alias"); +} +Console.WriteLine("IANA Id: " + response.Value.IanaIds[0].Id); +``` + +### Get Iana Version + +```C# Snippet:GetIanaVersion +Response response = client.GetIanaVersion(); +Console.WriteLine("IANA Version: " + response.Value.Version); +``` + +### Convert Windows TimeZone To Iana + +```C# Snippet:ConvertWindowsTimeZoneToIana +Response response = client.ConvertWindowsTimeZoneToIana("Dateline Standard Time"); +Console.WriteLine("IANA Id: " + response.Value.IanaIds[0].Id); +``` diff --git a/sdk/maps/Azure.Maps.TimeZones/samples/README.md b/sdk/maps/Azure.Maps.TimeZones/samples/README.md new file mode 100644 index 0000000000000..ce104699bf3d5 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/samples/README.md @@ -0,0 +1,16 @@ +--- +page_type: sample +languages: +- csharp +products: +- azure +- azure-maps +name: Azure.Maps.TimeZones samples for .NET +description: Samples for the Azure.Maps.TimeZones client library. +--- + +# Azure.Maps.TimeZones Samples + +For different APIs, please refer the following samples: + +[Timezone](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/maps/Azure.Maps.TimeZones/samples/MapsTimeZoneSamples.md) diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Azure.Maps.TimeZone.csproj b/sdk/maps/Azure.Maps.TimeZones/src/Azure.Maps.TimeZones.csproj similarity index 86% rename from sdk/maps/Azure.Maps.TimeZone/src/Azure.Maps.TimeZone.csproj rename to sdk/maps/Azure.Maps.TimeZones/src/Azure.Maps.TimeZones.csproj index 011bbdb20d55b..c27033b4c5c24 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Azure.Maps.TimeZone.csproj +++ b/sdk/maps/Azure.Maps.TimeZones/src/Azure.Maps.TimeZones.csproj @@ -1,9 +1,9 @@  - Azure Maps Azure.Maps.TimeZone - Azure Maps Azure.Maps.TimeZone + Azure Maps Time Zone SDK + Azure Maps Azure.Maps.TimeZones 1.0.0-beta.1 - Azure;Azure Maps;Maps Azure.Maps.TimeZone + Azure;Azure Maps;Maps;Azure.Maps.TimeZones $(RequiredTargetFrameworks) $(NoWarn);AZC0012 $(RepoRoot)/sdk/maps/Azure.Maps.Common/src/ diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/Argument.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/Argument.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/Argument.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/Argument.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/ChangeTrackingDictionary.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/ChangeTrackingDictionary.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/ChangeTrackingDictionary.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/ChangeTrackingList.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/ChangeTrackingList.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/ChangeTrackingList.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/ChangeTrackingList.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/ModelSerializationExtensions.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/ModelSerializationExtensions.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/ModelSerializationExtensions.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/MultipartFormDataRequestContent.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/MultipartFormDataRequestContent.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/MultipartFormDataRequestContent.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/MultipartFormDataRequestContent.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/Optional.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/Optional.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/Optional.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/Optional.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/RequestContentHelper.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/RequestContentHelper.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/RequestContentHelper.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/RequestContentHelper.cs diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/Utf8JsonRequestContent.cs similarity index 100% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Internal/Utf8JsonRequestContent.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Internal/Utf8JsonRequestContent.cs diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Generated/MapsTimeZonesModelFactory.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/MapsTimeZonesModelFactory.cs new file mode 100644 index 0000000000000..5bc18064e7393 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/MapsTimeZonesModelFactory.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Maps.TimeZones +{ + /// Model factory for models. + public static partial class MapsTimeZonesModelFactory + { + /// Initializes a new instance of . + /// Version property. + /// Reference Utc Timestamp property. + /// TimeZoneId array. + /// A new instance for mocking. + public static TimeZoneResult TimeZoneResult(string version = null, DateTimeOffset? referenceUtcTimestamp = null, IEnumerable timeZones = null) + { + timeZones ??= new List(); + + return new TimeZoneResult(version, referenceUtcTimestamp, timeZones?.ToList()); + } + + /// Initializes a new instance of . + /// country/region Name. + /// ISO-3166 2-letter country/region code for the country/region. + /// A new instance for mocking. + public static CountryRecord CountryRecord(string name = null, string code = null) + { + return new CountryRecord(name, code); + } + + /// Initializes a new instance of . + /// The ISO 639-1 language code of the Names. + /// Generic Name. + /// Standard Name. + /// Daylight Name. + /// A new instance for mocking. + public static TimeZoneName TimeZoneName(string iso6391LanguageCode = null, string generic = null, string standard = null, string daylight = null) + { + return new TimeZoneName(iso6391LanguageCode, generic, standard, daylight); + } + + /// Initializes a new instance of . + /// Windows Id property. + /// Territory property. + /// IanaIds array. + /// A new instance for mocking. + public static WindowsTimeZone WindowsTimeZone(string windowsId = null, string territory = null, IEnumerable ianaIds = null) + { + ianaIds ??= new List(); + + return new WindowsTimeZone(windowsId, territory, ianaIds?.ToList()); + } + + /// Initializes a new instance of . + /// Version property. + /// A new instance for mocking. + public static TimeZoneIanaVersionResult TimeZoneIanaVersionResult(string version = null) + { + return new TimeZoneIanaVersionResult(version); + } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/AdditionalTimeZoneReturnInformation.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/AdditionalTimeZoneReturnInformation.cs new file mode 100644 index 0000000000000..21acb20e71e93 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/AdditionalTimeZoneReturnInformation.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Maps.TimeZones +{ + /// The TimezoneOptions. + public readonly partial struct AdditionalTimeZoneReturnInformation : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AdditionalTimeZoneReturnInformation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "none"; + private const string ZoneInfoValue = "zoneInfo"; + private const string TransitionsValue = "transitions"; + private const string AllValue = "all"; + + /// Do not include zoneinfo or transitions in the result. + public static AdditionalTimeZoneReturnInformation None { get; } = new AdditionalTimeZoneReturnInformation(NoneValue); + /// Include additional time zone info in the result. + public static AdditionalTimeZoneReturnInformation ZoneInfo { get; } = new AdditionalTimeZoneReturnInformation(ZoneInfoValue); + /// Include transition information in the result (The number of transitions is currently capped at 250). + public static AdditionalTimeZoneReturnInformation Transitions { get; } = new AdditionalTimeZoneReturnInformation(TransitionsValue); + /// Include both zoneinfo and transitions in the result. + public static AdditionalTimeZoneReturnInformation All { get; } = new AdditionalTimeZoneReturnInformation(AllValue); + /// Determines if two values are the same. + public static bool operator ==(AdditionalTimeZoneReturnInformation left, AdditionalTimeZoneReturnInformation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AdditionalTimeZoneReturnInformation left, AdditionalTimeZoneReturnInformation right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AdditionalTimeZoneReturnInformation(string value) => new AdditionalTimeZoneReturnInformation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AdditionalTimeZoneReturnInformation other && Equals(other); + /// + public bool Equals(AdditionalTimeZoneReturnInformation other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/CountryRecord.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/CountryRecord.Serialization.cs similarity index 97% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/CountryRecord.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/CountryRecord.Serialization.cs index 82cf7472207db..bdcacb99f6717 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/CountryRecord.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/CountryRecord.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { public partial class CountryRecord { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/CountryRecord.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/CountryRecord.cs similarity index 96% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/CountryRecord.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/CountryRecord.cs index 4ee1648257157..4ed1cc623ab7b 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/CountryRecord.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/CountryRecord.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// A country/region record. public partial class CountryRecord diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs similarity index 98% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs index fb2d450e9a55c..3cad0dee69184 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { internal partial class ErrorAdditionalInfo { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorAdditionalInfo.cs similarity index 96% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorAdditionalInfo.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorAdditionalInfo.cs index b03b505b4d7ed..77a35fc0dd395 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorAdditionalInfo.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorAdditionalInfo.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// The resource management error additional info. internal partial class ErrorAdditionalInfo diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorDetail.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorDetail.Serialization.cs similarity index 99% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorDetail.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorDetail.Serialization.cs index 902fd17f1e1bb..ef5621e741c80 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorDetail.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorDetail.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { internal partial class ErrorDetail { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorDetail.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorDetail.cs similarity index 98% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorDetail.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorDetail.cs index 9dd1eb2ee0104..1bda4d2492f67 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorDetail.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorDetail.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// The error detail. internal partial class ErrorDetail diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorResponse.Serialization.cs similarity index 97% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorResponse.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorResponse.Serialization.cs index 5b04ebd50c4a4..584b1e1b68aec 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorResponse.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorResponse.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { internal partial class ErrorResponse { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorResponse.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorResponse.cs similarity index 96% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorResponse.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorResponse.cs index 96f25033b7958..39f77527dc6e6 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ErrorResponse.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ErrorResponse.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). internal partial class ErrorResponse diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/IanaId.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/IanaId.Serialization.cs similarity index 98% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/IanaId.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/IanaId.Serialization.cs index d71d73bcdf3d7..97560f274a5df 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/IanaId.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/IanaId.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { public partial class IanaId { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/IanaId.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/IanaId.cs similarity index 85% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/IanaId.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/IanaId.cs index 9c817cdeebfe3..1ef423fa05074 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/IanaId.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/IanaId.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// The IanaId. public partial class IanaId @@ -30,10 +30,6 @@ internal IanaId(string id, bool? isAlias, string aliasOf, bool? hasZone1970Locat /// Id property. public string Id { get; } - /// IsAlias property. - public bool? IsAlias { get; } - /// AliasOf property. - public string AliasOf { get; } /// This attribute returns `True` if the IanaId has any country/zone associated with it. public bool? HasZone1970Location { get; } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/JsonFormat.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/JsonFormat.cs similarity index 98% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/JsonFormat.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/JsonFormat.cs index 72f5ff28cc446..23faedc7ebc5d 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/JsonFormat.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/JsonFormat.cs @@ -8,7 +8,7 @@ using System; using System.ComponentModel; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// The JsonFormat. internal readonly partial struct JsonFormat : IEquatable diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ReferenceTime.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.Serialization.cs similarity index 99% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ReferenceTime.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.Serialization.cs index 18d737727eb1b..8000eccd81f6c 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ReferenceTime.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { public partial class ReferenceTime { diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.cs new file mode 100644 index 0000000000000..701e0ded6a7b1 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/ReferenceTime.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Maps.TimeZones +{ + /// Details in effect at the local time. + public partial class ReferenceTime + { + /// Initializes a new instance of . + internal ReferenceTime() + { + } + + /// Time zone name in effect at the reference timestamp (i.e. PST or PDT depending whether Daylight Savings Time is in effect). + public string Tag { get; } + /// Sunrise at the given time zone as shown in the `Tag` property. The sunrise is described in the ISO8601 format. (Only be populated if the call is byCoordinates). + public DateTimeOffset? Sunrise { get; } + /// Sunset at the given time zone as shown in the `Tag` property. The sunset is described in the ISO8601 format.(Only be populated if the call is byCoordinates). + public DateTimeOffset? Sunset { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/RepresentativePoint.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/RepresentativePoint.Serialization.cs similarity index 95% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/RepresentativePoint.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/RepresentativePoint.Serialization.cs index 94cb3d6e40a16..488ab86d31775 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/RepresentativePoint.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/RepresentativePoint.Serialization.cs @@ -7,9 +7,9 @@ using System.Text.Json; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - public partial class RepresentativePoint + internal partial class RepresentativePoint { internal static RepresentativePoint DeserializeRepresentativePoint(JsonElement element) { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/RepresentativePoint.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/RepresentativePoint.cs similarity index 74% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/RepresentativePoint.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/RepresentativePoint.cs index 0dd8c997a9fda..a97af36c7da34 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/RepresentativePoint.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/RepresentativePoint.cs @@ -5,10 +5,10 @@ #nullable disable -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// Representative point property. - public partial class RepresentativePoint + internal partial class RepresentativePoint { /// Initializes a new instance of . internal RepresentativePoint() @@ -23,5 +23,10 @@ internal RepresentativePoint(float? latitude, float? longitude) Latitude = latitude; Longitude = longitude; } + + /// Latitude property. + public float? Latitude { get; } + /// Longitude property. + public float? Longitude { get; } } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.Serialization.cs similarity index 98% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.Serialization.cs index 8b470cd6a496a..5d2874516b304 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeTransition.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.Serialization.cs @@ -9,7 +9,7 @@ using System.Text.Json; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { public partial class TimeTransition { diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.cs new file mode 100644 index 0000000000000..6cf8c6a181c54 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeTransition.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Maps.TimeZones +{ + /// The TimeTransition. + public partial class TimeTransition + { + /// Initializes a new instance of . + internal TimeTransition() + { + } + + /// Tag property. + public string Tag { get; } + /// Start date, start time for this transition period. + public DateTimeOffset? UtcStart { get; } + /// End date, end time for this transition period. + public DateTimeOffset? UtcEnd { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs similarity index 97% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs index 59d232d93b853..0fd007cbba72c 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneIanaVersionResult.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { public partial class TimeZoneIanaVersionResult { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneIanaVersionResult.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneIanaVersionResult.cs similarity index 95% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneIanaVersionResult.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneIanaVersionResult.cs index ee5cc9b1f7e57..35a6acf7057f5 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneIanaVersionResult.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneIanaVersionResult.cs @@ -5,7 +5,7 @@ #nullable disable -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// This object is returned from a successful Timezone IANA Version call. public partial class TimeZoneIanaVersionResult diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.Serialization.cs similarity index 88% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.Serialization.cs index 2c2596a670843..3402a7cc51d24 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimezoneId.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.Serialization.cs @@ -8,13 +8,12 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Maps.Common; -using Azure.Maps.TimeZone.Models; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { - public partial class TimezoneId + public partial class TimeZoneId { - internal static TimezoneId DeserializeTimezoneId(JsonElement element) + internal static TimeZoneId DeserializeTimeZoneId(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -23,7 +22,7 @@ internal static TimezoneId DeserializeTimezoneId(JsonElement element) string id = default; IReadOnlyList aliases = default; IReadOnlyList countries = default; - TimeZoneNames names = default; + TimeZoneName names = default; ReferenceTime referenceTime = default; RepresentativePoint representativePoint = default; IReadOnlyList timeTransitions = default; @@ -68,7 +67,7 @@ internal static TimezoneId DeserializeTimezoneId(JsonElement element) { continue; } - names = TimeZoneNames.DeserializeTimeZoneNames(property.Value); + names = TimeZoneName.DeserializeTimeZoneName(property.Value); continue; } if (property.NameEquals("ReferenceTime"u8)) @@ -86,7 +85,7 @@ internal static TimezoneId DeserializeTimezoneId(JsonElement element) { continue; } - representativePoint = RepresentativePoint.DeserializeRepresentativePoint(property.Value); + representativePoint = TimeZones.RepresentativePoint.DeserializeRepresentativePoint(property.Value); continue; } if (property.NameEquals("TimeTransitions"u8)) @@ -104,7 +103,7 @@ internal static TimezoneId DeserializeTimezoneId(JsonElement element) continue; } } - return new TimezoneId( + return new TimeZoneId( id, aliases ?? new ChangeTrackingList(), countries ?? new ChangeTrackingList(), @@ -116,10 +115,10 @@ internal static TimezoneId DeserializeTimezoneId(JsonElement element) /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static TimezoneId FromResponse(Response response) + internal static TimeZoneId FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeTimezoneId(document.RootElement); + return DeserializeTimeZoneId(document.RootElement); } } } diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.cs new file mode 100644 index 0000000000000..37f5bba44d765 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneId.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Maps.Common; + +namespace Azure.Maps.TimeZones +{ + /// The TimezoneId. + public partial class TimeZoneId + { + /// Initializes a new instance of . + internal TimeZoneId() + { + Aliases = new ChangeTrackingList(); + Countries = new ChangeTrackingList(); + TimeTransitions = new ChangeTrackingList(); + } + + /// Id property. + public string Id { get; } + /// + /// An array of time zone ID aliases. Only returned when [options]=*zoneinfo* or *all*. + /// + /// Note: may be null. + /// + public IReadOnlyList Aliases { get; } + /// An array of country/region records. Only returned when [options]=*zoneinfo* or *all*. + public IReadOnlyList Countries { get; } + /// Details in effect at the local time. + public ReferenceTime ReferenceTime { get; } + /// Time zone DST transitions from [transitionsFrom] until timestamp + 1 year. + public IReadOnlyList TimeTransitions { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.Serialization.cs similarity index 80% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.Serialization.cs index fd405e12e1bfb..a2cea44ccbc64 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.Serialization.cs @@ -7,11 +7,11 @@ using System.Text.Json; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - public partial class TimeZoneNames + public partial class TimeZoneName { - internal static TimeZoneNames DeserializeTimeZoneNames(JsonElement element) + internal static TimeZoneName DeserializeTimeZoneName(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -44,15 +44,15 @@ internal static TimeZoneNames DeserializeTimeZoneNames(JsonElement element) continue; } } - return new TimeZoneNames(isO6391LanguageCode, generic, standard, daylight); + return new TimeZoneName(isO6391LanguageCode, generic, standard, daylight); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static TimeZoneNames FromResponse(Response response) + internal static TimeZoneName FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeTimeZoneNames(document.RootElement); + return DeserializeTimeZoneName(document.RootElement); } } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.cs similarity index 79% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.cs index 76dce915611ae..bc045f9f7b214 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneNames.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneName.cs @@ -5,22 +5,22 @@ #nullable disable -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// Timezone names object. - public partial class TimeZoneNames + public partial class TimeZoneName { - /// Initializes a new instance of . - internal TimeZoneNames() + /// Initializes a new instance of . + internal TimeZoneName() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The ISO 639-1 language code of the Names. /// Generic Name. /// Standard Name. /// Daylight Name. - internal TimeZoneNames(string iso6391LanguageCode, string generic, string standard, string daylight) + internal TimeZoneName(string iso6391LanguageCode, string generic, string standard, string daylight) { Iso6391LanguageCode = iso6391LanguageCode; Generic = generic; diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.Serialization.cs similarity index 74% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.Serialization.cs index 0c920e3b787a6..22d2bde8c8ee0 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.Serialization.cs @@ -10,11 +10,11 @@ using System.Text.Json; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - public partial class TimeZoneInformation + public partial class TimeZoneResult { - internal static TimeZoneInformation DeserializeTimeZoneInformation(JsonElement element) + internal static TimeZoneResult DeserializeTimeZoneResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -22,7 +22,7 @@ internal static TimeZoneInformation DeserializeTimeZoneInformation(JsonElement e } string version = default; DateTimeOffset? referenceUtcTimestamp = default; - IReadOnlyList timeZones = default; + IReadOnlyList timeZones = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Version"u8)) @@ -45,24 +45,24 @@ internal static TimeZoneInformation DeserializeTimeZoneInformation(JsonElement e { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(TimezoneId.DeserializeTimezoneId(item)); + array.Add(TimeZoneId.DeserializeTimeZoneId(item)); } timeZones = array; continue; } } - return new TimeZoneInformation(version, referenceUtcTimestamp, timeZones ?? new ChangeTrackingList()); + return new TimeZoneResult(version, referenceUtcTimestamp, timeZones ?? new ChangeTrackingList()); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static TimeZoneInformation FromResponse(Response response) + internal static TimeZoneResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeTimeZoneInformation(document.RootElement); + return DeserializeTimeZoneResult(document.RootElement); } } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.cs similarity index 71% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.cs index 18a089b02fedc..f6825227ff6ba 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneInformation.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/TimeZoneResult.cs @@ -9,22 +9,22 @@ using System.Collections.Generic; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// This object is returned from a successful Timezone By ID call or By Coordinates call. - public partial class TimeZoneInformation + public partial class TimeZoneResult { - /// Initializes a new instance of . - internal TimeZoneInformation() + /// Initializes a new instance of . + internal TimeZoneResult() { - TimeZones = new ChangeTrackingList(); + TimeZones = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Version property. /// Reference Utc Timestamp property. /// TimeZoneId array. - internal TimeZoneInformation(string version, DateTimeOffset? referenceUtcTimestamp, IReadOnlyList timeZones) + internal TimeZoneResult(string version, DateTimeOffset? referenceUtcTimestamp, IReadOnlyList timeZones) { Version = version; ReferenceUtcTimestamp = referenceUtcTimestamp; @@ -36,6 +36,6 @@ internal TimeZoneInformation(string version, DateTimeOffset? referenceUtcTimesta /// Reference Utc Timestamp property. public DateTimeOffset? ReferenceUtcTimestamp { get; } /// TimeZoneId array. - public IReadOnlyList TimeZones { get; } + public IReadOnlyList TimeZones { get; } } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.Serialization.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.Serialization.cs similarity index 83% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.Serialization.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.Serialization.cs index 94d11774a7fea..95e61dd45d7c0 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.Serialization.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.Serialization.cs @@ -9,11 +9,11 @@ using System.Text.Json; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - public partial class TimeZoneWindows + public partial class WindowsTimeZone { - internal static TimeZoneWindows DeserializeTimeZoneWindows(JsonElement element) + internal static WindowsTimeZone DeserializeWindowsTimeZone(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -49,15 +49,15 @@ internal static TimeZoneWindows DeserializeTimeZoneWindows(JsonElement element) continue; } } - return new TimeZoneWindows(windowsId, territory, ianaIds ?? new ChangeTrackingList()); + return new WindowsTimeZone(windowsId, territory, ianaIds ?? new ChangeTrackingList()); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static TimeZoneWindows FromResponse(Response response) + internal static WindowsTimeZone FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeTimeZoneWindows(document.RootElement); + return DeserializeWindowsTimeZone(document.RootElement); } } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.cs similarity index 72% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.cs index e3d04b9d20b01..bb6e00981a8f1 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/TimeZoneWindows.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/Models/WindowsTimeZone.cs @@ -8,22 +8,22 @@ using System.Collections.Generic; using Azure.Maps.Common; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// The TimezoneWindows. - public partial class TimeZoneWindows + public partial class WindowsTimeZone { - /// Initializes a new instance of . - internal TimeZoneWindows() + /// Initializes a new instance of . + internal WindowsTimeZone() { IanaIds = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Windows Id property. /// Territory property. /// IanaIds array. - internal TimeZoneWindows(string windowsId, string territory, IReadOnlyList ianaIds) + internal WindowsTimeZone(string windowsId, string territory, IReadOnlyList ianaIds) { WindowsId = windowsId; Territory = territory; diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/TimezoneRestClient.cs b/sdk/maps/Azure.Maps.TimeZones/src/Generated/TimezoneRestClient.cs similarity index 91% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/TimezoneRestClient.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Generated/TimezoneRestClient.cs index c21764207a892..55cf290ecd6cb 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/TimezoneRestClient.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Generated/TimezoneRestClient.cs @@ -13,9 +13,8 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.Maps.Common; -using Azure.Maps.TimeZone.Models; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { internal partial class TimezoneRestClient { @@ -43,7 +42,7 @@ public TimezoneRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipe _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); } - internal HttpMessage CreateGetTimezoneByIDRequest(JsonFormat format, string timezoneId, string acceptLanguage, TimeZoneOptions? options, DateTimeOffset? timeStamp, DateTimeOffset? daylightSavingsTimeFrom, int? daylightSavingsTimeLastingYears) + internal HttpMessage CreateGetTimezoneByIDRequest(JsonFormat format, string timezoneId, string acceptLanguage, AdditionalTimeZoneReturnInformation? options, DateTimeOffset? timeStamp, DateTimeOffset? daylightSavingsTimeFrom, int? daylightSavingsTimeLastingYears) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -97,7 +96,7 @@ internal HttpMessage CreateGetTimezoneByIDRequest(JsonFormat format, string time /// /// The `Get Timezone By ID` API is an HTTP `GET` request that returns current, historical, and future time zone information for the specified IANA time zone ID. /// - public async Task> GetTimezoneByIDAsync(JsonFormat format, string timezoneId, string acceptLanguage = null, TimeZoneOptions? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) + public async Task> GetTimezoneByIDAsync(JsonFormat format, string timezoneId, string acceptLanguage = null, AdditionalTimeZoneReturnInformation? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) { if (timezoneId == null) { @@ -110,9 +109,9 @@ public async Task> GetTimezoneByIDAsync(JsonFormat { case 200: { - TimeZoneInformation value = default; + TimeZoneResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TimeZoneInformation.DeserializeTimeZoneInformation(document.RootElement); + value = TimeZoneResult.DeserializeTimeZoneResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -134,7 +133,7 @@ public async Task> GetTimezoneByIDAsync(JsonFormat /// /// The `Get Timezone By ID` API is an HTTP `GET` request that returns current, historical, and future time zone information for the specified IANA time zone ID. /// - public Response GetTimezoneByID(JsonFormat format, string timezoneId, string acceptLanguage = null, TimeZoneOptions? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) + public Response GetTimezoneByID(JsonFormat format, string timezoneId, string acceptLanguage = null, AdditionalTimeZoneReturnInformation? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) { if (timezoneId == null) { @@ -147,9 +146,9 @@ public Response GetTimezoneByID(JsonFormat format, string t { case 200: { - TimeZoneInformation value = default; + TimeZoneResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TimeZoneInformation.DeserializeTimeZoneInformation(document.RootElement); + value = TimeZoneResult.DeserializeTimeZoneResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -157,7 +156,7 @@ public Response GetTimezoneByID(JsonFormat format, string t } } - internal HttpMessage CreateGetTimezoneByCoordinatesRequest(JsonFormat format, IEnumerable coordinates, string acceptLanguage, TimeZoneOptions? options, DateTimeOffset? timeStamp, DateTimeOffset? daylightSavingsTimeFrom, int? daylightSavingsTimeLastingYears) + internal HttpMessage CreateGetTimezoneByCoordinatesRequest(JsonFormat format, IEnumerable coordinates, string acceptLanguage, AdditionalTimeZoneReturnInformation? options, DateTimeOffset? timeStamp, DateTimeOffset? daylightSavingsTimeFrom, int? daylightSavingsTimeLastingYears) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -214,7 +213,7 @@ internal HttpMessage CreateGetTimezoneByCoordinatesRequest(JsonFormat format, IE /// /// The `Get Timezone By Coordinates` API is an HTTP `GET` request that 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. /// - public async Task> GetTimezoneByCoordinatesAsync(JsonFormat format, IEnumerable coordinates, string acceptLanguage = null, TimeZoneOptions? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) + public async Task> GetTimezoneByCoordinatesAsync(JsonFormat format, IEnumerable coordinates, string acceptLanguage = null, AdditionalTimeZoneReturnInformation? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) { if (coordinates == null) { @@ -227,9 +226,9 @@ public async Task> GetTimezoneByCoordinatesAsync(J { case 200: { - TimeZoneInformation value = default; + TimeZoneResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TimeZoneInformation.DeserializeTimeZoneInformation(document.RootElement); + value = TimeZoneResult.DeserializeTimeZoneResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -251,7 +250,7 @@ public async Task> GetTimezoneByCoordinatesAsync(J /// /// The `Get Timezone By Coordinates` API is an HTTP `GET` request that 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. /// - public Response GetTimezoneByCoordinates(JsonFormat format, IEnumerable coordinates, string acceptLanguage = null, TimeZoneOptions? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) + public Response GetTimezoneByCoordinates(JsonFormat format, IEnumerable coordinates, string acceptLanguage = null, AdditionalTimeZoneReturnInformation? options = null, DateTimeOffset? timeStamp = null, DateTimeOffset? daylightSavingsTimeFrom = null, int? daylightSavingsTimeLastingYears = null, CancellationToken cancellationToken = default) { if (coordinates == null) { @@ -264,9 +263,9 @@ public Response GetTimezoneByCoordinates(JsonFormat format, { case 200: { - TimeZoneInformation value = default; + TimeZoneResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TimeZoneInformation.DeserializeTimeZoneInformation(document.RootElement); + value = TimeZoneResult.DeserializeTimeZoneResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -300,7 +299,7 @@ internal HttpMessage CreateGetWindowsTimezoneIdsRequest(JsonFormat format) /// /// The `Get Windows Time Zones` API is an HTTP `GET` request that returns a full list of Windows Time Zone IDs. /// - public async Task>> GetWindowsTimezoneIdsAsync(JsonFormat format, CancellationToken cancellationToken = default) + public async Task>> GetWindowsTimezoneIdsAsync(JsonFormat format, CancellationToken cancellationToken = default) { using var message = CreateGetWindowsTimezoneIdsRequest(format); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); @@ -308,12 +307,12 @@ public async Task>> GetWindowsTimezoneId { case 200: { - IReadOnlyList value = default; + IReadOnlyList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - List array = new List(); + List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { - array.Add(TimeZoneWindows.DeserializeTimeZoneWindows(item)); + array.Add(WindowsTimeZone.DeserializeWindowsTimeZone(item)); } value = array; return Response.FromValue(value, message.Response); @@ -330,7 +329,7 @@ public async Task>> GetWindowsTimezoneId /// /// The `Get Windows Time Zones` API is an HTTP `GET` request that returns a full list of Windows Time Zone IDs. /// - public Response> GetWindowsTimezoneIds(JsonFormat format, CancellationToken cancellationToken = default) + public Response> GetWindowsTimezoneIds(JsonFormat format, CancellationToken cancellationToken = default) { using var message = CreateGetWindowsTimezoneIdsRequest(format); _pipeline.Send(message, cancellationToken); @@ -338,12 +337,12 @@ public Response> GetWindowsTimezoneIds(JsonFormat { case 200: { - IReadOnlyList value = default; + IReadOnlyList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - List array = new List(); + List array = new List(); foreach (var item in document.RootElement.EnumerateArray()) { - array.Add(TimeZoneWindows.DeserializeTimeZoneWindows(item)); + array.Add(WindowsTimeZone.DeserializeWindowsTimeZone(item)); } value = array; return Response.FromValue(value, message.Response); diff --git a/sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneClient.cs b/sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneClient.cs similarity index 76% rename from sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneClient.cs rename to sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneClient.cs index ac312e159f2d2..ce35a3fd7657b 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneClient.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneClient.cs @@ -12,9 +12,8 @@ using Azure.Core.GeoJson; using Azure.Core.Pipeline; using Azure.Maps.Common; -using Azure.Maps.TimeZone.Models.Options; -using Azure.Maps.TimeZone.Models; -namespace Azure.Maps.TimeZone + +namespace Azure.Maps.TimeZones { /// The Render service client. public partial class MapsTimeZoneClient @@ -56,7 +55,7 @@ public MapsTimeZoneClient(AzureKeyCredential credential, MapsTimeZoneClientOptio { Argument.AssertNotNull(credential, nameof(credential)); - var endpoint = options.Endpoint ?? new Uri("https://atlas.microsoft.com"); + var endpoint = options?.Endpoint ?? new Uri("https://atlas.microsoft.com"); options ??= new MapsTimeZoneClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "subscription-key")); @@ -86,7 +85,7 @@ public MapsTimeZoneClient(TokenCredential credential, string clientId, MapsTimeZ { Argument.AssertNotNull(credential, nameof(credential)); - var endpoint = options.Endpoint ?? new Uri("https://atlas.microsoft.com"); + var endpoint = options?.Endpoint ?? new Uri("https://atlas.microsoft.com"); options ??= new MapsTimeZoneClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); string[] scopes = { "https://atlas.microsoft.com/.default" }; @@ -97,26 +96,12 @@ public MapsTimeZoneClient(TokenCredential credential, string clientId, MapsTimeZ /// Initializes a new instance of MapsTimeZoneClient. /// The Shared Access Signature credential used to connect to Azure. This signature /// can be constructed using the . - public MapsTimeZoneClient(AzureSasCredential credential) - { - Argument.AssertNotNull(credential, nameof(credential)); - - var endpoint = new Uri("https://atlas.microsoft.com"); - var options = new MapsTimeZoneClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = HttpPipelineBuilder.Build(options, new MapsSasCredentialPolicy(credential)); - restClient = new TimezoneRestClient(_clientDiagnostics, _pipeline, endpoint, null, options.Version); - } - - /// Initializes a new instance of MapsTimeZoneClient. - /// The Shared Access Signature credential used to connect to Azure. This signature - /// can be constructed using the . - /// The options for configuring the client. - public MapsTimeZoneClient(AzureSasCredential credential, MapsTimeZoneClientOptions options) + /// The options for configuring the client. If options is null, default option settings will be applied. + public MapsTimeZoneClient(AzureSasCredential credential, MapsTimeZoneClientOptions options = null) { Argument.AssertNotNull(credential, nameof(credential)); - var endpoint = options.Endpoint; + var endpoint = options?.Endpoint ?? new Uri("https://atlas.microsoft.com"); options ??= new MapsTimeZoneClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, new MapsSasCredentialPolicy(credential)); @@ -141,17 +126,17 @@ internal MapsTimeZoneClient(ClientDiagnostics clientDiagnostics, HttpPipeline pi /// /// This API returns current, historical, and future time zone information for the specified IANA time zone ID. /// - /// The IANA time zone ID. + /// The IANA time zone ID. /// Contains parameters for get timezone by id. /// The cancellation token to use. - /// is null. - public virtual async Task> GetTimeZoneByIDAsync(string timezoneId, TimeZoneBaseOptions options, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> GetTimeZoneByIdAsync(string timeZoneId, GetTimeZoneOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneByID"); + using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneById"); scope.Start(); try { - return await restClient.GetTimezoneByIDAsync(JsonFormat.Json, timezoneId, options.AcceptLanguage, options?.Options, options?.TimeStamp, options?.DaylightSavingsTimeFrom, options?.DaylightSavingsTimeLastingYears, cancellationToken).ConfigureAwait(false); + return await restClient.GetTimezoneByIDAsync(JsonFormat.Json, timeZoneId, options.AcceptLanguage, options?.AdditionalTimeZoneReturnInformation, options?.TimeStamp, options?.DaylightSavingsTimeTransitionFrom, options?.DaylightSavingsTimeTransitionInYears, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -163,17 +148,17 @@ public virtual async Task> GetTimeZoneByIDAsync(st /// /// This API returns current, historical, and future time zone information for the specified IANA time zone ID. /// - /// The IANA time zone ID. + /// The IANA time zone ID. /// Contains parameters for get timezone by id. /// The cancellation token to use. - /// is null. - public virtual Response GetTimeZoneByID(string timezoneId, TimeZoneBaseOptions options, CancellationToken cancellationToken = default) + /// is null. + public virtual Response GetTimeZoneById(string timeZoneId, GetTimeZoneOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneByID"); + using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneById"); scope.Start(); try { - return restClient.GetTimezoneByID(JsonFormat.Json, timezoneId, options.AcceptLanguage, options?.Options, options?.TimeStamp, options?.DaylightSavingsTimeFrom, options?.DaylightSavingsTimeLastingYears, cancellationToken); + return restClient.GetTimezoneByID(JsonFormat.Json, timeZoneId, options.AcceptLanguage, options?.AdditionalTimeZoneReturnInformation, options?.TimeStamp, options?.DaylightSavingsTimeTransitionFrom, options?.DaylightSavingsTimeTransitionInYears, cancellationToken); } catch (Exception e) { @@ -189,7 +174,7 @@ public virtual Response GetTimeZoneByID(string timezoneId, /// Contains parameters for get timezone by id. /// The cancellation token to use. /// is null. - public virtual async Task> GetTimeZoneByCoordinatesAsync(GeoPosition coordinates, TimeZoneBaseOptions options, CancellationToken cancellationToken = default) + public virtual async Task> GetTimeZoneByCoordinatesAsync(GeoPosition coordinates, GetTimeZoneOptions options, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneByCoordinates"); scope.Start(); @@ -200,7 +185,16 @@ public virtual async Task> GetTimeZoneByCoordinate Convert.ToDouble(coordinates.Latitude, CultureInfo.InvariantCulture.NumberFormat), Convert.ToDouble(coordinates.Longitude, CultureInfo.InvariantCulture.NumberFormat) }; - return await restClient.GetTimezoneByCoordinatesAsync(JsonFormat.Json, coord, options.AcceptLanguage, options?.Options, options?.TimeStamp, options?.DaylightSavingsTimeFrom, options?.DaylightSavingsTimeLastingYears, cancellationToken).ConfigureAwait(false); + return await restClient.GetTimezoneByCoordinatesAsync( + JsonFormat.Json, + coord, + options.AcceptLanguage, + options?.AdditionalTimeZoneReturnInformation, + options?.TimeStamp, + options?.DaylightSavingsTimeTransitionFrom, + options?.DaylightSavingsTimeTransitionInYears, + cancellationToken + ).ConfigureAwait(false); } catch (Exception e) { @@ -216,7 +210,7 @@ public virtual async Task> GetTimeZoneByCoordinate /// Contains parameters for get timezone by id. /// The cancellation token to use. /// is null. - public virtual Response GetTimeZoneByCoordinates(GeoPosition coordinates, TimeZoneBaseOptions options, CancellationToken cancellationToken = default) + public virtual Response GetTimeZoneByCoordinates(GeoPosition coordinates, GetTimeZoneOptions options, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneByCoordinates"); scope.Start(); @@ -227,7 +221,16 @@ public virtual Response GetTimeZoneByCoordinates(GeoPositio Convert.ToDouble(coordinates.Latitude, CultureInfo.InvariantCulture.NumberFormat), Convert.ToDouble(coordinates.Longitude, CultureInfo.InvariantCulture.NumberFormat) }; - return restClient.GetTimezoneByCoordinates(JsonFormat.Json, coord, options.AcceptLanguage, options?.Options, options?.TimeStamp, options?.DaylightSavingsTimeFrom, options?.DaylightSavingsTimeLastingYears, cancellationToken); + return restClient.GetTimezoneByCoordinates( + JsonFormat.Json, + coord, + options.AcceptLanguage, + options?.AdditionalTimeZoneReturnInformation, + options?.TimeStamp, + options?.DaylightSavingsTimeTransitionFrom, + options?.DaylightSavingsTimeTransitionInYears, + cancellationToken + ); } catch (Exception e) { @@ -240,13 +243,15 @@ public virtual Response GetTimeZoneByCoordinates(GeoPositio /// Use to get the list of Windows Time Zone IDs. /// /// The cancellation token to use. - public virtual async Task>> GetWindowsTimeZoneIdsAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetWindowsTimeZoneIdsAsync(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetWindowsTimeZoneIds"); scope.Start(); try { - return await restClient.GetWindowsTimezoneIdsAsync(JsonFormat.Json, cancellationToken).ConfigureAwait(false); + Response> response = await restClient.GetWindowsTimezoneIdsAsync(JsonFormat.Json, cancellationToken).ConfigureAwait(false); + var value = new WindowsTimeZoneData(response.Value); + return Response.FromValue(value, response.GetRawResponse()); } catch (Exception e) { @@ -259,13 +264,15 @@ public virtual async Task>> GetWindowsTi /// Use to get the list of Windows time zone IDs. /// /// The cancellation token to use. - public virtual Response> GetWindowsTimeZoneIds(CancellationToken cancellationToken = default) + public virtual Response GetWindowsTimeZoneIds(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetWindowsTimeZoneIds"); scope.Start(); try { - return restClient.GetWindowsTimezoneIds(JsonFormat.Json, cancellationToken); + Response> response = restClient.GetWindowsTimezoneIds(JsonFormat.Json, cancellationToken); + var value = new WindowsTimeZoneData(response.Value); + return Response.FromValue(value, response.GetRawResponse()); } catch (Exception e) { @@ -281,13 +288,15 @@ public virtual Response> GetWindowsTimeZoneIds(Ca /// /// The Get IANA Time Zones API is an HTTP GET request that returns a full list of Internet Assigned Numbers Authority (IANA) time zone IDs. Updates to the IANA service are reflected in the system within one day. /// - public virtual async Task>> GetIanaTimeZoneIdsAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetTimeZoneIanaIdsAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetIanaTimeZoneIds"); + using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneIanaIds"); scope.Start(); try { - return await restClient.GetIanaTimezoneIdsAsync(JsonFormat.Json, cancellationToken).ConfigureAwait(false); + Response> response = await restClient.GetIanaTimezoneIdsAsync(JsonFormat.Json, cancellationToken).ConfigureAwait(false); + var value = new IanaIdData(response.Value); + return Response.FromValue(value, response.GetRawResponse()); } catch (Exception e) { @@ -303,13 +312,15 @@ public virtual async Task>> GetIanaTimeZoneIdsAsy /// /// The Get IANA Time Zones API is an HTTP GET request that returns a full list of Internet Assigned Numbers Authority (IANA) time zone IDs. Updates to the IANA service are reflected in the system within one day. /// - public virtual Response> GetIanaTimeZoneIds(CancellationToken cancellationToken = default) + public virtual Response GetTimeZoneIanaIds(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetIanaTimeZoneIds"); + using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.GetTimeZoneIanaIds"); scope.Start(); try { - return restClient.GetIanaTimezoneIds(JsonFormat.Json, cancellationToken); + Response> response = restClient.GetIanaTimezoneIds(JsonFormat.Json, cancellationToken); + var value = new IanaIdData(response.Value); + return Response.FromValue(value, response.GetRawResponse()); } catch (Exception e) { @@ -365,20 +376,22 @@ public virtual Response GetIanaVersion(CancellationTo /// /// Use to get the IANA ID. /// - /// The Windows time zone ID. + /// The Windows time zone ID. /// Windows Time Zone territory code. /// The cancellation token to use. - /// is null. + /// is null. /// /// The `Get Windows to IANA Time Zone` API is an HTTP `GET` request that returns a corresponding Internet Assigned Numbers Authority (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. /// - public virtual async Task>> ConvertWindowsTimeZoneToIanaAsync(string windowsTimezoneId, string windowsTerritoryCode = null, CancellationToken cancellationToken = default) + public virtual async Task> ConvertWindowsTimeZoneToIanaAsync(string windowsTimeZoneId, string windowsTerritoryCode = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.ConvertWindowsTimeZoneToIana"); scope.Start(); try { - return await restClient.ConvertWindowsTimezoneToIanaAsync(JsonFormat.Json, windowsTimezoneId, windowsTerritoryCode, cancellationToken).ConfigureAwait(false); + Response> response = await restClient.ConvertWindowsTimezoneToIanaAsync(JsonFormat.Json, windowsTimeZoneId, windowsTerritoryCode, cancellationToken).ConfigureAwait(false); + var value = new IanaIdData(response.Value); + return Response.FromValue(value, response.GetRawResponse()); } catch (Exception e) { @@ -390,20 +403,22 @@ public virtual async Task>> ConvertWindowsTimeZon /// /// Use to get the IANA ID. /// - /// The Windows time zone ID. + /// The Windows time zone ID. /// Windows Time Zone territory code. /// The cancellation token to use. - /// is null. + /// is null. /// /// The Get Windows to IANA Time Zone API is an HTTP GET request that returns a corresponding Internet Assigned Numbers Authority (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. /// - public virtual Response> ConvertWindowsTimeZoneToIana(string windowsTimezoneId, string windowsTerritoryCode = null, CancellationToken cancellationToken = default) + public virtual Response ConvertWindowsTimeZoneToIana(string windowsTimeZoneId, string windowsTerritoryCode = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MapsTimeZoneClient.ConvertWindowsTimeZoneToIana"); scope.Start(); try { - return restClient.ConvertWindowsTimezoneToIana(JsonFormat.Json, windowsTimezoneId, windowsTerritoryCode, cancellationToken); + Response> response = restClient.ConvertWindowsTimezoneToIana(JsonFormat.Json, windowsTimeZoneId, windowsTerritoryCode, cancellationToken); + var value = new IanaIdData(response.Value); + return Response.FromValue(value, response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneClientOptions.cs b/sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneClientOptions.cs similarity index 86% rename from sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneClientOptions.cs rename to sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneClientOptions.cs index 20b85f0268de4..1b2a081805190 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneClientOptions.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneClientOptions.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// Client options for MapsRenderClient. public partial class MapsTimeZoneClientOptions : Azure.Core.ClientOptions @@ -28,15 +28,13 @@ public enum ServiceVersion /// Initializes new instance of MapsTimeZoneClientOptions. /// Azure Maps TimeZone API version. - /// The endpoint for Azure Maps. - public MapsTimeZoneClientOptions(ServiceVersion version = LatestVersion, Uri endpoint = null) + public MapsTimeZoneClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { ServiceVersion.V1_0 => "1.0", _ => throw new NotSupportedException() }; - Endpoint = endpoint; } } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneModelFactory.cs b/sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneModelFactory.cs similarity index 90% rename from sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneModelFactory.cs rename to sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneModelFactory.cs index 3573a89a00c9b..041024b7ff53d 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/MapsTimeZoneModelFactory.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/MapsTimeZoneModelFactory.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// Model factory for models. [CodeGenModel("MapsTimeZoneModelFactory")] diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/AdditionalTimeZoneReturnInformation.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/AdditionalTimeZoneReturnInformation.cs new file mode 100644 index 0000000000000..4ac65195d7494 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/AdditionalTimeZoneReturnInformation.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Maps.TimeZones +{ + /// Options available for types of information returned in the result. + [CodeGenModel("TimezoneOptions")] + public readonly partial struct AdditionalTimeZoneReturnInformation + { + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/Options/TimeZoneBaseOptions.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/GetTimeZoneOptions.cs similarity index 68% rename from sdk/maps/Azure.Maps.TimeZone/src/Models/Options/TimeZoneBaseOptions.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/GetTimeZoneOptions.cs index c7b0c62674b6f..090a3979250f6 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/Options/TimeZoneBaseOptions.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/GetTimeZoneOptions.cs @@ -2,26 +2,26 @@ // Licensed under the MIT License. using System; -using Azure.Maps.TimeZone; +using Azure.Maps.TimeZones; -namespace Azure.Maps.TimeZone.Models.Options +namespace Azure.Maps.TimeZones { /// Options for TimeZone Client. - public class TimeZoneBaseOptions + public class GetTimeZoneOptions { /// Specifies the language code in which the timezone names should be returned. Please refer to Supported Languages public string AcceptLanguage { get; set; } - /// Options available for types of information returned in the result. - public TimeZoneOptions? Options { get; set; } + /// Options available for types of additional information returned in the result. + public AdditionalTimeZoneReturnInformation? AdditionalTimeZoneReturnInformation { get; set; } /// Reference time, if omitted, the API will use the machine time serving the request. public DateTimeOffset? TimeStamp { get; set; } /// The start date from which daylight savings time (DST) transitions are requested, only applies when "options" = all or "options" = transitions. - public DateTimeOffset? DaylightSavingsTimeFrom { get; set; } + public DateTimeOffset? DaylightSavingsTimeTransitionFrom { get; set; } /// The number of years from "transitionsFrom" for which DST transitions are requested, only applies when "options" = all or "options" = transitions. - public int? DaylightSavingsTimeLastingYears { get; set; } + public int? DaylightSavingsTimeTransitionInYears { get; set; } } } diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/IanaId.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/IanaId.cs new file mode 100644 index 0000000000000..9cdd6310f5a1c --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/IanaId.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.Maps.TimeZones +{ + /// The IanaId. + public partial class IanaId + { + /// IsAlias property. + internal bool? IsAlias { get; } + + /// Alias of the IANA ID. Will be null if there's no alias for the IANA ID. + public string AliasOf { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/IanaIdData.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/IanaIdData.cs new file mode 100644 index 0000000000000..2dfb07d07e2a7 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/IanaIdData.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; + +namespace Azure.Maps.TimeZones +{ + /// The Iana IDs information. + public partial class IanaIdData + { + /// Initializes a new instance of . + internal IanaIdData(IReadOnlyList ianaIds) + { + IanaIds = ianaIds; + } + + /// The list of IANA IDs. + public IReadOnlyList IanaIds { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/JsonFormat.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/JsonFormat.cs similarity index 76% rename from sdk/maps/Azure.Maps.TimeZone/src/Models/JsonFormat.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/JsonFormat.cs index 6c7c1f1c9daaf..96242d48afebe 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/JsonFormat.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/JsonFormat.cs @@ -3,10 +3,9 @@ using Azure.Core; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// The JsonFormat. - [CodeGenModel("JsonFormat")] internal readonly partial struct JsonFormat { } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ReferenceTime.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/ReferenceTime.cs similarity index 54% rename from sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ReferenceTime.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/ReferenceTime.cs index e1da6feb3784c..116afaaa83263 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Generated/Models/ReferenceTime.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/ReferenceTime.cs @@ -1,22 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; +using Azure.Core; -namespace Azure.Maps.TimeZone +namespace Azure.Maps.TimeZones { /// Details in effect at the local time. public partial class ReferenceTime { - /// Initializes a new instance of . - internal ReferenceTime() - { - } - /// Initializes a new instance of . /// 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`. @@ -29,30 +23,51 @@ internal ReferenceTime() internal ReferenceTime(string tag, string standardOffset, string daylightSavings, string wallTime, int? posixTzValidYear, string posixTz, DateTimeOffset? sunrise, DateTimeOffset? sunset) { Tag = tag; - StandardOffset = standardOffset; - DaylightSavings = daylightSavings; - WallTime = wallTime; - PosixTzValidYear = posixTzValidYear; - PosixTz = posixTz; + _standardOffset = standardOffset; + if (TimeSpan.TryParse(standardOffset, out TimeSpan StandardOffsetValue)) + { + StandardOffsetTimeSpan = StandardOffsetValue; + } + + _daylightSavings = daylightSavings; + if (TimeSpan.TryParse(daylightSavings, out TimeSpan DaylightSavingsValue)) + { + DaylightSavingsTimeSpan = DaylightSavingsValue; + } + + _wallTime = wallTime; + if (DateTimeOffset.TryParse(wallTime, out DateTimeOffset WallTimeValue)) + { + WallTime = WallTimeValue; + } + + PosixTimeZoneValidYear = posixTzValidYear; + PosixTimeZone = posixTz; Sunrise = sunrise; Sunset = sunset; } - /// Time zone name in effect at the reference timestamp (i.e. PST or PDT depending whether Daylight Savings Time is in effect). - public string Tag { get; } - /// UTC offset in effect at the `ReferenceUTCTimestamp`. - public string StandardOffset { get; } - /// Time saving in minutes in effect at the `ReferenceUTCTimestamp`. - public string DaylightSavings { get; } - /// Current wall time at the given time zone as shown in the `Tag` property. - public string WallTime { get; } + [CodeGenMember("StandardOffset")] + internal string _standardOffset { get; } + /// UTC offset in format in effect at the ReferenceUTCTimestamp. + public TimeSpan StandardOffsetTimeSpan { get; } + + [CodeGenMember("DaylightSavings")] + internal string _daylightSavings { get; } + /// Time saving in format in effect at the ReferenceUTCTimestamp. + public TimeSpan DaylightSavingsTimeSpan { get; } + + /// Current wall time at the given time zone as shown in the Tag property. + [CodeGenMember("WallTime")] + internal string _wallTime { get; } + /// Current wall time at the given time zone as shown in the Tag property. + public DateTimeOffset WallTime { get; } + /// The year this POSIX string is valid for. Note: A POSIX string will only be valid in the given year. - public int? PosixTzValidYear { get; } + [CodeGenMember("PosixTzValidYear")] + public int? PosixTimeZoneValidYear { get; } /// POSIX string used to set the time zone environment variable. - public string PosixTz { get; } - /// Sunrise at the given time zone as shown in the `Tag` property. The sunrise is described in the ISO8601 format. (Only be populated if the call is byCoordinates). - public DateTimeOffset? Sunrise { get; } - /// Sunset at the given time zone as shown in the `Tag` property. The sunset is described in the ISO8601 format.(Only be populated if the call is byCoordinates). - public DateTimeOffset? Sunset { get; } + [CodeGenMember("PosixTz")] + public string PosixTimeZone { get; } } } diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/RepresentativePoint.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/RepresentativePoint.cs new file mode 100644 index 0000000000000..450d8c38abe4b --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/RepresentativePoint.cs @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Maps.TimeZones +{ + /// Representative point property. + internal partial class RepresentativePoint + { + } +} diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeTransition.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeTransition.cs new file mode 100644 index 0000000000000..b84f11e16e813 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeTransition.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Maps.TimeZones +{ + /// The TimeTransition. + public partial class TimeTransition + { + /// Initializes a new instance of . + /// Tag property. + /// StandardOffset property. + /// DaylightSavings property. + /// Start date, start time for this transition period. + /// End date, end time for this transition period. + internal TimeTransition(string tag, string standardOffset, string daylightSavings, DateTimeOffset? utcStart, DateTimeOffset? utcEnd) + { + Tag = tag; + + _standardOffset = standardOffset; + if (TimeSpan.TryParse(standardOffset, out TimeSpan StandardOffsetValue)) + { + StandardOffsetTimeSpan = StandardOffsetValue; + } + + _daylightSavings = daylightSavings; + if (TimeSpan.TryParse(daylightSavings, out TimeSpan DaylightSavingsValue)) + { + DaylightSavingsTimeSpan = DaylightSavingsValue; + } + + UtcStart = utcStart; + UtcEnd = utcEnd; + } + + [CodeGenMember("StandardOffset")] + internal string _standardOffset { get; } + /// UTC offset in format in effect at the ReferenceUTCTimestamp. + public TimeSpan StandardOffsetTimeSpan { get; } + + [CodeGenMember("DaylightSavings")] + internal string _daylightSavings { get; } + /// Time saving in format in effect at the ReferenceUTCTimestamp. + public TimeSpan DaylightSavingsTimeSpan { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneIanaVersionResult.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneIanaVersionResult.cs similarity index 89% rename from sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneIanaVersionResult.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneIanaVersionResult.cs index dbcd556494094..c9ceb56e43aa3 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneIanaVersionResult.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneIanaVersionResult.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { /// TimeZoneIanaVersionResult for TimeZone Client. [CodeGenModel("TimezoneIanaVersionResult")] diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneId.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneId.cs new file mode 100644 index 0000000000000..3c18c875e52ca --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneId.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Globalization; +using Azure.Core; +using Azure.Core.GeoJson; + +namespace Azure.Maps.TimeZones +{ + /// The Time Zone ID. + [CodeGenModel("TimezoneId")] + public partial class TimeZoneId + { + /// Initializes a new instance of . + internal TimeZoneId(string id, IReadOnlyList aliases, IReadOnlyList countries, TimeZoneName name, ReferenceTime referenceTime, RepresentativePoint representativePoint, IReadOnlyList timeTransitions) + { + Id = id; + Aliases = aliases; + Countries = countries; + Name = name; + ReferenceTime = referenceTime; + _representativePoint = representativePoint; + if (representativePoint != null && representativePoint.Latitude != null && representativePoint.Longitude != null) + { + RepresentativePoint = new GeoPosition( + Convert.ToDouble(representativePoint.Longitude, CultureInfo.InvariantCulture.NumberFormat), + Convert.ToDouble(representativePoint.Latitude, CultureInfo.InvariantCulture.NumberFormat) + ); + } + TimeTransitions = timeTransitions; + } + + /// Representative point property. + [CodeGenMember("RepresentativePoint")] + internal RepresentativePoint _representativePoint { get; } + + /// Representative point representing a coordinate in GeoPosition format. + public GeoPosition RepresentativePoint { get; } + + /// Time zone name object. + [CodeGenMember("Names")] + public TimeZoneName Name { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneNames.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneName.cs similarity index 72% rename from sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneNames.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneName.cs index cc102ad559b38..7edf2367330c1 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneNames.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneName.cs @@ -3,11 +3,11 @@ using Azure.Core; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - /// Timezone names object. + /// Time zone name object. [CodeGenModel("TimeZoneNames")] - public partial class TimeZoneNames + public partial class TimeZoneName { /// The ISO 639-1 language code of the Names. [CodeGenMember("ISO6391LanguageCode")] diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneResult.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneResult.cs similarity index 53% rename from sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneResult.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneResult.cs index fbe0ce9aad4a2..7c2e325eeddec 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneResult.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/TimeZoneResult.cs @@ -3,11 +3,11 @@ using Azure.Core; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - /// TimeZoneResult for TimeZone Client. + /// The time zone information specific time zone. [CodeGenModel("TimezoneResult")] - public partial class TimeZoneInformation + public partial class TimeZoneResult { } } diff --git a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneWindows.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZone.cs similarity index 54% rename from sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneWindows.cs rename to sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZone.cs index 906af10226c97..096f48aeb3352 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/Models/TimeZoneWindows.cs +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZone.cs @@ -3,11 +3,11 @@ using Azure.Core; -namespace Azure.Maps.TimeZone.Models +namespace Azure.Maps.TimeZones { - /// TimeZoneWindows for TimeZone Client. + /// Windows time zone for TimeZone Client. [CodeGenModel("TimezoneWindows")] - public partial class TimeZoneWindows + public partial class WindowsTimeZone { } } diff --git a/sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZoneData.cs b/sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZoneData.cs new file mode 100644 index 0000000000000..a85a5ced3047e --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/Models/WindowsTimeZoneData.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; + +namespace Azure.Maps.TimeZones +{ + /// The Windows time zone to Iana response information. + public partial class WindowsTimeZoneData + { + /// Initializes a new instance of . + internal WindowsTimeZoneData(IReadOnlyList windowsTimeZones) + { + WindowsTimeZones = windowsTimeZones; + } + + /// The list of Windows time zones. + public IReadOnlyList WindowsTimeZones { get; } + } +} diff --git a/sdk/maps/Azure.Maps.TimeZone/src/autorest.md b/sdk/maps/Azure.Maps.TimeZones/src/autorest.md similarity index 97% rename from sdk/maps/Azure.Maps.TimeZone/src/autorest.md rename to sdk/maps/Azure.Maps.TimeZones/src/autorest.md index 8331453d65a1d..96d1b18ddcf0a 100644 --- a/sdk/maps/Azure.Maps.TimeZone/src/autorest.md +++ b/sdk/maps/Azure.Maps.TimeZones/src/autorest.md @@ -20,7 +20,7 @@ generation1-convenience-client: true model-namespace: false sync-methods: None license-header: MICROSOFT_MIT_NO_VERSION -namespace: Azure.Maps.TimeZone +namespace: Azure.Maps.TimeZones public-clients: false clear-output-folder: true data-plane: true diff --git a/sdk/maps/Azure.Maps.TimeZones/src/properties/AssemblyInfo.cs b/sdk/maps/Azure.Maps.TimeZones/src/properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..5f322d298c233 --- /dev/null +++ b/sdk/maps/Azure.Maps.TimeZones/src/properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("Azure.Maps.TimeZones")] +[assembly: InternalsVisibleTo("Azure.Maps.TimeZones.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/Azure.Maps.TimeZone.Tests.csproj b/sdk/maps/Azure.Maps.TimeZones/tests/Azure.Maps.TimeZones.Tests.csproj similarity index 93% rename from sdk/maps/Azure.Maps.TimeZone/tests/Azure.Maps.TimeZone.Tests.csproj rename to sdk/maps/Azure.Maps.TimeZones/tests/Azure.Maps.TimeZones.Tests.csproj index 1f91190db3fc6..19e7b72860de2 100644 --- a/sdk/maps/Azure.Maps.TimeZone/tests/Azure.Maps.TimeZone.Tests.csproj +++ b/sdk/maps/Azure.Maps.TimeZones/tests/Azure.Maps.TimeZones.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/MapsTimeZoneTests.cs b/sdk/maps/Azure.Maps.TimeZones/tests/MapsTimeZoneTests.cs similarity index 71% rename from sdk/maps/Azure.Maps.TimeZone/tests/MapsTimeZoneTests.cs rename to sdk/maps/Azure.Maps.TimeZones/tests/MapsTimeZoneTests.cs index 843c54230742c..0743165f5e2c3 100644 --- a/sdk/maps/Azure.Maps.TimeZone/tests/MapsTimeZoneTests.cs +++ b/sdk/maps/Azure.Maps.TimeZones/tests/MapsTimeZoneTests.cs @@ -1,15 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + using System; using System.Threading.Tasks; -using Azure.Maps.TimeZone.Models.Options; -using Azure.Maps.TimeZone.Models; -using Azure.Core.TestFramework; using NUnit.Framework; -using System.Collections.Generic; +using Azure.Core; +using Azure.Core.TestFramework; using Azure.Core.GeoJson; -namespace Azure.Maps.TimeZone.Tests +namespace Azure.Maps.TimeZones.Tests { public class MapsTimeZoneTests : TimeZoneClientLiveTestsBase { @@ -21,9 +20,11 @@ public MapsTimeZoneTests(bool isAsync) : base(isAsync) public async Task GetTimezoneByIdTest() { var client = CreateClient(); - TimeZoneBaseOptions options = new TimeZoneBaseOptions(); - options.Options = TimeZoneOptions.All; - var response = await client.GetTimeZoneByIDAsync("Asia/Bahrain", options); + GetTimeZoneOptions options = new GetTimeZoneOptions() + { + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All + }; + var response = await client.GetTimeZoneByIdAsync("Asia/Bahrain", options); Assert.AreEqual("Asia/Qatar", response.Value.TimeZones[0].Id); } @@ -31,9 +32,9 @@ public async Task GetTimezoneByIdTest() public void InvalidGetTimezoneByIdTest() { var client = CreateClient(); - TimeZoneBaseOptions options = new TimeZoneBaseOptions(); + GetTimeZoneOptions options = new GetTimeZoneOptions(); RequestFailedException ex = Assert.ThrowsAsync( - async () => await client.GetTimeZoneByIDAsync("", options)); + async () => await client.GetTimeZoneByIdAsync("", options)); Assert.AreEqual(400, ex.Status); } @@ -41,8 +42,10 @@ public void InvalidGetTimezoneByIdTest() public async Task GetTimezoneByCoordinatesTest() { var client = CreateClient(); - TimeZoneBaseOptions options = new TimeZoneBaseOptions(); - options.Options = TimeZoneOptions.All; + GetTimeZoneOptions options = new GetTimeZoneOptions() + { + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All + }; GeoPosition coordinates = new GeoPosition(121.5640089, 25.0338053); var response = await client.GetTimeZoneByCoordinatesAsync(coordinates, options); Assert.AreEqual(1, response.Value.TimeZones.Count); @@ -54,8 +57,10 @@ public void InvalidGetTimezoneByCoordinatesTest() { // "The provided coordinates in query are invalid, out of range, or not in the expected format" var client = CreateClient(); - TimeZoneBaseOptions options = new TimeZoneBaseOptions(); - options.Options = TimeZoneOptions.All; + GetTimeZoneOptions options = new GetTimeZoneOptions() + { + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All + }; GeoPosition coordinates = new GeoPosition(121.0, -100.0); RequestFailedException ex = Assert.ThrowsAsync( async () => await client.GetTimeZoneByCoordinatesAsync(coordinates, options)); @@ -67,15 +72,15 @@ public async Task GetWindowsTimezoneIdsTest() { var client = CreateClient(); var response = await client.GetWindowsTimeZoneIdsAsync(); - Assert.AreEqual(505, response.Value.Count); + Assert.AreEqual(505, response.Value.WindowsTimeZones.Count); } [RecordedTest] - public async Task GetIanaTimezoneIdsTest() + public async Task GetTimeZoneIanaIdsTest() { var client = CreateClient(); - var response = await client.GetIanaTimeZoneIdsAsync(); - Assert.AreEqual(596, response.Value.Count); + var response = await client.GetTimeZoneIanaIdsAsync(); + Assert.AreEqual(596, response.Value.IanaIds.Count); } [RecordedTest] @@ -91,8 +96,8 @@ public async Task ConvertWindowsTimezoneToIanaTest() { var client = CreateClient(); var response = await client.ConvertWindowsTimeZoneToIanaAsync("Dateline Standard Time"); - Assert.AreEqual(1, response.Value.Count); - Assert.AreEqual("Etc/GMT+12", response.Value[0].Id); + Assert.AreEqual(1, response.Value.IanaIds.Count); + Assert.AreEqual("Etc/GMT+12", response.Value.IanaIds[0].Id); } [RecordedTest] diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/Samples/README.md b/sdk/maps/Azure.Maps.TimeZones/tests/Samples/README.md similarity index 68% rename from sdk/maps/Azure.Maps.TimeZone/tests/Samples/README.md rename to sdk/maps/Azure.Maps.TimeZones/tests/Samples/README.md index f3bb0bfb59bec..2e7f462ba5add 100644 --- a/sdk/maps/Azure.Maps.TimeZone/tests/Samples/README.md +++ b/sdk/maps/Azure.Maps.TimeZones/tests/Samples/README.md @@ -1,3 +1,3 @@ Source files in this directory are written as tests from which samples are extracted. They are not intended to be viewed directly and help ensure our samples compile and work correctly. -See our [list of samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZone/samples) for more explanation about how to use this client library. +See our [list of samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/maps/Azure.Maps.TimeZones/samples) for more explanation about how to use this client library. diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/Samples/TimeZoneClientSamples.cs b/sdk/maps/Azure.Maps.TimeZones/tests/Samples/TimeZoneClientSamples.cs similarity index 72% rename from sdk/maps/Azure.Maps.TimeZone/tests/Samples/TimeZoneClientSamples.cs rename to sdk/maps/Azure.Maps.TimeZones/tests/Samples/TimeZoneClientSamples.cs index 8ba3ac25ce5a9..276afca95631e 100644 --- a/sdk/maps/Azure.Maps.TimeZone/tests/Samples/TimeZoneClientSamples.cs +++ b/sdk/maps/Azure.Maps.TimeZones/tests/Samples/TimeZoneClientSamples.cs @@ -1,27 +1,26 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Azure.Core; using System; +using Azure.Core; +using Azure.Core.GeoJson; using Azure.Core.TestFramework; -using Azure.ResourceManager.Maps.Models; -using Azure.ResourceManager.Maps; +#region Snippet:TimeZoneImportNamespaces +using Azure.Maps.TimeZones; +#endregion using Azure.ResourceManager; +using Azure.ResourceManager.Maps; +using Azure.ResourceManager.Maps.Models; using NUnit.Framework; -using Azure.Maps.TimeZone.Models.Options; -using Azure.Maps.TimeZone.Models; -using Azure.Maps.TimeZone; -using System.Collections.Generic; -using Azure.Core.GeoJson; -namespace Azure.Maps.TimeZone.Tests.Samples +namespace Azure.Maps.TimeZones.Tests.Samples { public class TimeZoneClientSamples : SamplesBase { public void TimeZoneClientViaSubscriptionKey() { #region Snippet:InstantiateTimeZoneClientViaSubscriptionKey - // Create a SearchClient that will authenticate through Subscription Key (Shared key) + // Create a MapsTimeZoneClient that will authenticate through Subscription Key (Shared key) AzureKeyCredential credential = new AzureKeyCredential(""); MapsTimeZoneClient client = new MapsTimeZoneClient(credential); #endregion @@ -66,7 +65,7 @@ public void TimeZoneClientViaSas() MapsAccountSasContent sasContent = new MapsAccountSasContent(MapsSigningKey.PrimaryKey, principalId, maxRatePerSecond, start, expiry); Response sas = mapsAccount.GetSas(sasContent); - // Create a TimeZoneClient that will authenticate via SAS token + // Create a MapsTimeZoneClient that will authenticate via SAS token AzureSasCredential sasCredential = new AzureSasCredential(sas.Value.AccountSasToken); MapsTimeZoneClient client = new MapsTimeZoneClient(sasCredential); #endregion @@ -82,9 +81,11 @@ public void GetTimeZoneById() var clientId = TestEnvironment.MapAccountClientId; var client = new MapsTimeZoneClient(TestEnvironment.Credential, clientId, clientOptions); #region Snippet:GetTimeZoneById - TimeZoneBaseOptions options = new TimeZoneBaseOptions(); - options.Options = TimeZoneOptions.All; - Response response = client.GetTimeZoneByID("Asia/Bahrain", options); + GetTimeZoneOptions options = new GetTimeZoneOptions() + { + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All + }; + Response response = client.GetTimeZoneById("Asia/Bahrain", options); Console.WriteLine("Version: " + response.Value.Version); Console.WriteLine("Countires: " + response.Value.TimeZones[0].Countries); #endregion @@ -100,11 +101,16 @@ public void GetTimeZoneByCoordinates() var clientId = TestEnvironment.MapAccountClientId; var client = new MapsTimeZoneClient(TestEnvironment.Credential, clientId, clientOptions); #region Snippet:GetTimeZoneByCoordinates - TimeZoneBaseOptions options = new TimeZoneBaseOptions(); - options.Options = TimeZoneOptions.All; + GetTimeZoneOptions options = new GetTimeZoneOptions() + { + AdditionalTimeZoneReturnInformation = AdditionalTimeZoneReturnInformation.All + }; GeoPosition coordinates = new GeoPosition(121.5640089, 25.0338053); - Response response = client.GetTimeZoneByCoordinates(coordinates, options); - Console.WriteLine("Names: " + response.Value.TimeZones[0].Names); + Response response = client.GetTimeZoneByCoordinates(coordinates, options); + + Console.WriteLine("Time zone for (latitude, longitude) = ({0}, {1}) is {2}: ", + coordinates.Latitude, coordinates.Longitude, + response.Value.TimeZones[0].Name.Generic); #endregion } @@ -118,15 +124,19 @@ public void GetWindowsTimeZoneIds() var clientId = TestEnvironment.MapAccountClientId; var client = new MapsTimeZoneClient(TestEnvironment.Credential, clientId, clientOptions); #region Snippet:GetWindowsTimeZoneIds - Response> response = client.GetWindowsTimeZoneIds(); - Console.WriteLine("Count: " + response.Value.Count); - Console.WriteLine("WindowsId: " + response.Value[0].WindowsId); - Console.WriteLine("Territory: " + response.Value[0].Territory); + Response response = client.GetWindowsTimeZoneIds(); + Console.WriteLine("Total time zones: " + response.Value.WindowsTimeZones.Count); + foreach (WindowsTimeZone timeZone in response.Value.WindowsTimeZones) + { + Console.WriteLine("IANA Id: " + timeZone.IanaIds); + Console.WriteLine("Windows ID: " + timeZone.WindowsId); + Console.WriteLine("Territory: " + timeZone.Territory); + } #endregion } [Test] - public void GetIanaTimeZoneIds() + public void GetTimeZoneIanaIds() { var clientOptions = new MapsTimeZoneClientOptions() { @@ -134,10 +144,17 @@ public void GetIanaTimeZoneIds() }; var clientId = TestEnvironment.MapAccountClientId; var client = new MapsTimeZoneClient(TestEnvironment.Credential, clientId, clientOptions); - #region Snippet:GetIanaTimeZoneIds - Response> response = client.GetIanaTimeZoneIds(); - Console.WriteLine("IsAlias: " + response.Value[0].IsAlias); - Console.WriteLine("Id: " + response.Value[0].Id); + #region Snippet:GetTimeZoneIanaIds + Response response = client.GetTimeZoneIanaIds(); + if (response.Value.IanaIds[0].AliasOf != null) + { + Console.WriteLine("It is an alias: " + response.Value.IanaIds[0].AliasOf); + } + else + { + Console.WriteLine("It is not an alias"); + } + Console.WriteLine("IANA Id: " + response.Value.IanaIds[0].Id); #endregion } @@ -152,7 +169,7 @@ public void GetIanaVersion() var client = new MapsTimeZoneClient(TestEnvironment.Credential, clientId, clientOptions); #region Snippet:GetIanaVersion Response response = client.GetIanaVersion(); - Console.WriteLine("Version: " + response.Value.Version); + Console.WriteLine("IANA Version: " + response.Value.Version); #endregion } @@ -166,8 +183,8 @@ public void ConvertWindowsTimeZoneToIana() var clientId = TestEnvironment.MapAccountClientId; var client = new MapsTimeZoneClient(TestEnvironment.Credential, clientId, clientOptions); #region Snippet:ConvertWindowsTimeZoneToIana - Response> response = client.ConvertWindowsTimeZoneToIana("Dateline Standard Time"); - Console.WriteLine("Id: " + response.Value[0].Id); + Response response = client.ConvertWindowsTimeZoneToIana("Dateline Standard Time"); + Console.WriteLine("IANA Id: " + response.Value.IanaIds[0].Id); #endregion } } diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/TimeZoneClientLiveTestsBase.cs b/sdk/maps/Azure.Maps.TimeZones/tests/TimeZoneClientLiveTestsBase.cs similarity index 61% rename from sdk/maps/Azure.Maps.TimeZone/tests/TimeZoneClientLiveTestsBase.cs rename to sdk/maps/Azure.Maps.TimeZones/tests/TimeZoneClientLiveTestsBase.cs index f31c6c44f9aab..de89d864f2df9 100644 --- a/sdk/maps/Azure.Maps.TimeZone/tests/TimeZoneClientLiveTestsBase.cs +++ b/sdk/maps/Azure.Maps.TimeZones/tests/TimeZoneClientLiveTestsBase.cs @@ -2,11 +2,12 @@ // Licensed under the MIT License. using Azure.Core.TestFramework; -using Azure.Maps.TimeZone; +using Azure.Identity; +using Azure.Maps.TimeZones; -namespace Azure.Maps.TimeZone.Tests +namespace Azure.Maps.TimeZones.Tests { - public class TimeZoneClientLiveTestsBase : RecordedTestBase + public class TimeZoneClientLiveTestsBase : RecordedTestBase { public TimeZoneClientLiveTestsBase(bool isAsync) : base(isAsync) { @@ -15,7 +16,8 @@ public TimeZoneClientLiveTestsBase(bool isAsync) : base(isAsync) protected MapsTimeZoneClient CreateClient() { return InstrumentClient(new MapsTimeZoneClient( - credential: new AzureKeyCredential(""), + credential: TestEnvironment.Credential, + clientId: TestEnvironment.MapAccountClientId, options: InstrumentClientOptions(new MapsTimeZoneClientOptions()) )); } diff --git a/sdk/maps/Azure.Maps.TimeZone/tests/TimeZoneClientTestEnvironment.cs b/sdk/maps/Azure.Maps.TimeZones/tests/TimeZoneClientTestEnvironment.cs similarity index 93% rename from sdk/maps/Azure.Maps.TimeZone/tests/TimeZoneClientTestEnvironment.cs rename to sdk/maps/Azure.Maps.TimeZones/tests/TimeZoneClientTestEnvironment.cs index dfb7df7cbee3f..63cb54eb6cbab 100644 --- a/sdk/maps/Azure.Maps.TimeZone/tests/TimeZoneClientTestEnvironment.cs +++ b/sdk/maps/Azure.Maps.TimeZones/tests/TimeZoneClientTestEnvironment.cs @@ -4,7 +4,7 @@ using System; using Azure.Core.TestFramework; -namespace Azure.Maps.TimeZone.Tests +namespace Azure.Maps.TimeZones.Tests { public class TimeZoneClientTestEnvironment : TestEnvironment {