Gravity.GoogleMaps.TimeZoneBuilder
2.0.0
dotnet add package Gravity.GoogleMaps.TimeZoneBuilder --version 2.0.0
NuGet\Install-Package Gravity.GoogleMaps.TimeZoneBuilder -Version 2.0.0
<PackageReference Include="Gravity.GoogleMaps.TimeZoneBuilder" Version="2.0.0" />
<PackageVersion Include="Gravity.GoogleMaps.TimeZoneBuilder" Version="2.0.0" />
<PackageReference Include="Gravity.GoogleMaps.TimeZoneBuilder" />
paket add Gravity.GoogleMaps.TimeZoneBuilder --version 2.0.0
#r "nuget: Gravity.GoogleMaps.TimeZoneBuilder, 2.0.0"
#:package Gravity.GoogleMaps.TimeZoneBuilder@2.0.0
#addin nuget:?package=Gravity.GoogleMaps.TimeZoneBuilder&version=2.0.0
#tool nuget:?package=Gravity.GoogleMaps.TimeZoneBuilder&version=2.0.0
π Gravity.GoogleMaps.TimeZoneBuilder
Gravity.GoogleMaps.TimeZoneBuilder is a fully type-safe, fluent, and extensible .NET URL builder for the Google Time Zone API.
It helps you generate correct and validated Time Zone API request URLs β with full IntelliSense, compile-time safety, and built-in validation for coordinates, timestamps, languages, and required parameters.
π Features
- β Fully type-safe and fluent API
- π Strong validation for latitude/longitude bounds
- β±οΈ Automatic handling of Unix timestamps from
DateTimeOffset - π Optional
languagesupport with format validation - π API key validation (can be disabled for testing)
- βοΈ Options to disable URL encoding or return only query parameters
- π§ͺ Fully unit-tested (100% coverage on builders)
π¦ Installation
dotnet add package Gravity.GoogleMaps.TimeZoneBuilder
π Documentation
The builder supports all core parameters of the Time Zone API:
- location β latitude/longitude
- timestamp β
DateTimeOffset, converted internally to Unix time - language (optional)
- key β required unless disabled in options
π Refer to the official Google Time Zone API documentation for parameter semantics and output fields.
β‘ Quick Start
var url = new TimeZoneUrlBuilder()
.AddLocation(48.8566, 2.3522)
.AddTimeStamp(DateTimeOffset.UtcNow)
.AddLanguage("fr")
.AddKey("YOUR_API_KEY")
.Build();
This will generate a fully validated Time Zone API request URL.
π§± Fluent API
Every part of the URL is constructed through intuitive, discoverable methods:
.AddLocation(latitude: 40.6892, longitude: -74.0445)
.AddTimeStamp(DateTimeOffset.UtcNow)
.AddLanguage("en")
.AddKey("my-api-key")
βοΈ Advanced Options
The builder also supports configuration options through:
.WithOptions(new TimeZoneBuilderOptions
{
DisableUrlEncoding = true,
DisableApiKeyCheck = true,
ReturnParametersOnly = false
});
Available options:
| Option | Description |
|---|---|
DisableUrlEncoding |
Leaves commas and values unescaped (useful for debugging) |
DisableApiKeyCheck |
Allows building URLs without .AddKey() (tests, mocks) |
ReturnParametersOnly |
Returns only param=value⦠without the base host |
π§ͺ Test Coverage & Reliability
The builder is fully covered by unit tests:
- βοΈ Valid & invalid coordinates
- βοΈ Valid & invalid language codes
- βοΈ Timestamp conversion
- βοΈ Missing API key handling
- βοΈ Options overrides
- βοΈ URL encoding checks
Every scenario is validated both at build-time and runtime.
π‘οΈ License
π Credits
Made with β€οΈ by GravityApps Developed & maintained by https://github.com/AntoninLolivier
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Gravity.GoogleMaps.Core (>= 1.0.0)
-
net8.0
- Gravity.GoogleMaps.Core (>= 1.0.0)
-
net9.0
- Gravity.GoogleMaps.Core (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.