TorontoWeatherSir 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TorontoWeatherSir --version 1.0.1                
NuGet\Install-Package TorontoWeatherSir -Version 1.0.1                
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="TorontoWeatherSir" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TorontoWeatherSir --version 1.0.1                
#r "nuget: TorontoWeatherSir, 1.0.1"                
#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 TorontoWeatherSir as a Cake Addin
#addin nuget:?package=TorontoWeatherSir&version=1.0.1

// Install TorontoWeatherSir as a Cake Tool
#tool nuget:?package=TorontoWeatherSir&version=1.0.1                

TorontoWeather

The TorontoWeather project contains a WeatherService class that fetches weather information for Toronto using the Open-Meteo API. This service retrieves daily maximum and minimum temperatures for Toronto and formats the results as a string.

Features

  • Fetches weather data asynchronously using the Open-Meteo API.
  • Retrieves both daily maximum and minimum temperatures for Toronto.
  • Parses the JSON response with Newtonsoft.Json (JObject) for easier data manipulation.

Requirements

  • .NET 5 or later.
  • Internet access to fetch data from the Open-Meteo API.
  • Newtonsoft.Json for JSON parsing.

Getting Started

Install Dependencies

Before using the WeatherService class, ensure that your project includes the necessary dependencies. Install Newtonsoft.Json via NuGet:

dotnet add package Newtonsoft.Json

### Example Usage

using System;
using System.Threading.Tasks;

namespace TorontoWeather
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var weatherService = new WeatherService();
            var weatherData = await weatherService.GetTorontoWeatherAsync();

            Console.WriteLine($"Toronto Weather Data:\n{weatherData}");
        }
    }
}

###How It Works
WeatherService Constructor: Initializes the HttpClient used to send HTTP requests.

GetTorontoWeatherAsync() Method:

Constructs the URL with the appropriate query parameters for latitude, longitude, daily max and min temperature, and timezone.
Sends an asynchronous GET request to fetch weather data in JSON format.
Returns a formatted string with the dates and corresponding maximum temperatures.
ExtractMaxTemperaturesAndDays() Method:

Extracts the daily maximum temperatures and the corresponding days from the parsed JSON response.
Builds a formatted string that displays each day along with its maximum temperature in Celsius.

###Sample Output
Toronto Weather Data:
2024-11-08: 12.3°C
2024-11-09: 13.5°C
2024-11-10: 14.6°C
2024-11-11: 15.2°C
2024-11-12: 16.1°C

###API Details
The service uses the Open-Meteo API to fetch weather data. Specifically, it requests:

latitude: 43.7 (Toronto's latitude).
longitude: -79.42 (Toronto's longitude).
daily: temperature_2m_max, temperature_2m_min (daily maximum and minimum temperature).
timezone: America/Toronto (to get the weather data in the Toronto timezone).
For more information on the Open-Meteo API, visit the Open-Meteo Documentation.

###Contributing
Contributions are welcome! If you have suggestions or improvements for this service, feel free to fork this repository and submit a pull request.

###License
This project is licensed under the MIT License - see the LICENSE file for details.


This `README.md` provides a detailed explanation of the updated `WeatherService`, highlighting the ability to fetch both daily maximum and minimum temperatures for Toronto, and gives example usage, expected output, and more. Let me know if you need further modifications!


Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TorontoWeatherSir:

Package Downloads
TorontoWeatherA3287

Package that provides weather data for Toronto using Open-Meteo API :)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 85 11/8/2024
1.0.1 59 11/8/2024
1.0.0 71 11/8/2024

first version