-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrentWeatherRequest.cs
36 lines (29 loc) · 972 Bytes
/
CurrentWeatherRequest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;
#pragma warning disable 1591
namespace Arex388.OpenWeatherMap {
public sealed class CurrentWeatherRequest :
RequestBase {
internal override string Endpoint {
get {
var parameters = new HashSet<string> {
$"units={Unit}"
};
if (Latitude.HasValue
&& Longitude.HasValue) {
parameters.Add($"lat={Latitude}");
parameters.Add($"lon={Longitude}");
}
var query = string.Join("&", parameters);
return $"weather?{query}";
}
}
/// <summary>
/// The location's latitude to query.
/// </summary>
public decimal? Latitude { get; set; }
/// <summary>
/// The location's longitude to query.
/// </summary>
public decimal? Longitude { get; set; }
}
}