Engrid.Weather
1.1.0-rc.22101816
This is a prerelease version of Engrid.Weather.
dotnet add package Engrid.Weather --version 1.1.0-rc.22101816
NuGet\Install-Package Engrid.Weather -Version 1.1.0-rc.22101816
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Engrid.Weather" Version="1.1.0-rc.22101816" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Engrid.Weather --version 1.1.0-rc.22101816
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Engrid.Weather, 1.1.0-rc.22101816"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Engrid.Weather as a Cake Addin #addin nuget:?package=Engrid.Weather&version=1.1.0-rc.22101816&prerelease // Install Engrid.Weather as a Cake Tool #tool nuget:?package=Engrid.Weather&version=1.1.0-rc.22101816&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
中
Engrid.Weather
云谷天气服务组件
使用方式
添加服务注册
protected override void ConfigXXX(IServiceCollection services)
{
services.AddWeatherExtensions();
}
添加json配置节点
{
"WeatherAPI": {
"provider": "HeFengAPI",
"cityCode": "101030100",
"key": "302e8eaa49b14cdf9c273ca51c29bfb0",
"urlNow": "https://devapi.qweather.com/v7/weather/now",
"url3d": "https://devapi.qweather.com/v7/weather/3d",
"url7d": "https://devapi.qweather.com/v7/weather/7d",
"url24h": "https://devapi.qweather.com/v7/weather/24h",
"urlNowAir": "https://devapi.qweather.com/v7/air/now",
"urlLookup": "https://geoapi.qweather.com/v2/city/lookup"
}
}
添加配置文件
internal static IHostBuilder CreateHostBuilder(string buildType, string[] args)
{
return ....CreateHostBuilderDefaults(buildType, args,
configBuilder =>
{
configBuilder.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("Config/Weather.json",false,true)
.AddCommandLine(args) //添加对命令参数的支持
;
},
...);
}
例子
[Route("api/[controller]/[action]")]
[ApiController]
public class ValuesController : ControllerBase
{
/// <summary>
/// 天气测试101030100
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
[HttpGet]
public WeatherNow GetTestWeather([FromQuery]WeatherQuery query)
{
return WeatherServices.GetWeatherInstance().GetNow(query);
}
/// <summary>
/// 获取城市测试
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
[HttpGet]
public WeatherLocation GetTestGeoAPI([FromQuery] WeatherQuery query)
{
return WeatherServices.GetWeatherInstance().GetLookup(query);
}
/// <summary>
/// 天气测试101030100
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
[HttpGet]
public WeatherHourly Get24H([FromQuery] WeatherQuery query)
{
return WeatherServices.GetWeatherInstance().Get24H(query);
}
/// <summary>
/// 天气测试101030100
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
[HttpGet]
public WeatherDaily Get3D([FromQuery] WeatherQuery query)
{
return WeatherServices.GetWeatherInstance().Get3D(query);
}
/// <summary>
/// 天气测试101030100
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
[HttpGet]
public WeatherDaily Get7D([FromQuery] WeatherQuery query)
{
return WeatherServices.GetWeatherInstance().Get7D(query);
}
/// <summary>
/// 天气测试101030100
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
[HttpGet]
public WeatherAir GetNowAir([FromQuery] WeatherQuery query)
{
return WeatherServices.GetWeatherInstance().GetNowAir(query);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- WindNight.Extension (>= 1.0.3.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.0-rc.22101816 | 116 | 10/18/2022 |
1.0.2-beta.22101103 | 104 | 10/11/2022 |
1.0.1-beta.22101102 | 107 | 10/11/2022 |
0.0.1-beta.22101101 | 113 | 10/11/2022 |