Fetch_dotNET 1.0.6

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

// Install Fetch_dotNET as a Cake Tool
#tool nuget:?package=Fetch_dotNET&version=1.0.6

class Program { static async Task Main(string[] args) { Console.WriteLine("Using Fetch");

	// method: 'IsConnectedToInternet'
	Console.WriteLine("> IsConnectedToInternet");
	bool isConnected = HttpClient.IsConnectedToInternet();
	if (!isConnected) return;
	Console.WriteLine("IsConnectedToInternet: " + isConnected);

	// method: 'GetLocalIP OR GetPublicIP'
	Console.WriteLine("> GetLocalIP OR GetPublicIP");
	string myLocalIP  = HttpClient.GetLocalIP();
	string myPublicIP = HttpClient.GetPublicIP();
	Console.WriteLine("My local IP Address is " + myLocalIP);
	Console.WriteLine("My public IP Address is " + myPublicIP);

	// method: 'GetMacAddress'
	Console.WriteLine("> GetMacAddress");
	string myMAC = HttpClient.GetMacAddress();
	Console.WriteLine("My MAC Address is " + myMAC);

	// method: 'PING'
	Console.WriteLine("> PING");
	string addressPing = "http://188.213.169.36";
	//string address = "http://localhost/api/Azienda?lic_id=5383";
	var httpPingResponse = HttpClient.PingHost(addressPing);
	Console.WriteLine("response:");
	Console.WriteLine(httpPingResponse);
	DisplayResponseStatus(httpPingResponse);


	// method: 'GET'
	Console.WriteLine("> GET");
	string address = "http://localhost/api/Azienda?lic_id=5383";
	var httpResponse = HttpClient.Fetch(address);
	Console.WriteLine("response:");
	Console.WriteLine(httpResponse);
	DisplayResponseStatus(httpResponse);


	// method: 'GET'
	Console.WriteLine("> GET ASYNC");
	address = "http://localhost/api/Azienda?lic_id=5383";
	//var httpResponseAsync = HttpClient.Fetch(address, "GET");
	//var httpResponseAsync = HttpClient.Fetch(address, "GET", null, null, true);
	var httpResponseAsync = await HttpClient.FetchAsync(address);
	Console.WriteLine("response:");
	Console.WriteLine(httpResponseAsync);
	DisplayResponseStatus(httpResponseAsync);


	// method: 'POST'
	Console.WriteLine("> POST");
	string addressPost = "http://localhost/api/Appuntamenti";
	string json = "{'shop_id':8000,'read':'secondary','events':[{'app_id':0,'eventType':'draft','eventColor':'lime'}]}";
	var httpResponsePost = HttpClient.Fetch(addressPost, "POST", json);
	Console.WriteLine("response:");
	Console.WriteLine(httpResponsePost);
	DisplayResponseStatus(httpResponsePost);

	// method: 'POST'
	Console.WriteLine("> POST ASYNC");
	//var httpResponsePostAsync = HttpClient.Fetch(addressPost, "POST", json, null, true);
	var httpResponsePostAsync = await HttpClient.FetchAsync(addressPost, "POST", json);
	Console.WriteLine("response:");
	Console.WriteLine(httpResponsePostAsync);
	DisplayResponseStatus(httpResponsePostAsync);

	// method: 'POST'
	Console.WriteLine("> POST");
	var values = new NameValueCollection();
	values["product"] = "Fetch_dotNET";
	values["version"] = "1.0.0";
	values["log"] = "13/06/20 18:51:03 ERROR ParseFormUPDATE";

	string addressLog = "http://localhost/api/addLog.php";
	var httpResponsePost2 = HttpClient.Fetch(addressLog, values);
	//var httpResponsePost2 = HttpClient.Fetch(addressLog, "POST", values);
	//var httpResponsePost2 = HttpClient.Fetch(addressLog, "POST", values, true);
	Console.WriteLine("response:");
	Console.WriteLine(httpResponsePost2);
	DisplayResponseStatus(httpResponsePost2);


	// method: 'DOWNLOAD'
	Console.WriteLine("> DOWNLOAD ASYNC");
	string book = "http://localhost/books/Extjs-Release1.0.0.pdf";
	string fileName = @"C:\Users\matrix\Desktop\nuget_packages-SyncData\SyncData\Extjs-Release1.0.0.pdf";
	var httpResponseDownload = HttpClient.FetchDownloadFile(book, fileName);
	Console.WriteLine("response:");
	Console.WriteLine(httpResponseDownload);
	DisplayResponseStatus(httpResponseDownload);
}

private static void DisplayResponseStatus(HttpResponse httpResponse)
{
	// Write results
	Console.ForegroundColor = httpResponse.StatusCode == System.Net.HttpStatusCode.OK ? ConsoleColor.Green : ConsoleColor.Red;
	int statusCode = (int)httpResponse.StatusCode;
	Console.WriteLine("StatusCode: " + statusCode +" - "+ httpResponse.StatusCode);

	var tsEnded     = TimeSpan.FromTicks(httpResponse.CompleteTime.Ticks);
	var tsStarted   = TimeSpan.FromTicks(httpResponse.StartTime.Ticks);
	var durationTs  = tsEnded.Subtract(tsStarted);
	var durationstr = $"{durationTs.Hours}:{durationTs.Minutes}:{durationTs.Seconds}.{durationTs.Milliseconds}";

	var s = $"Total duration :{durationstr} ";

	Console.WriteLine(s);
	Console.ResetColor();
	Console.WriteLine(String.Empty);
}

}

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Fetch_dotNET:

Package Downloads
PushNotification_dotNET

PushNotification is a framework for Notification .NET applications. Handle Push Notifications. Across iOS, Android and UWP from a single API.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.9 706 11/3/2022
1.2.8 434 6/22/2022
1.2.7 481 11/5/2021
1.2.6 377 10/27/2021
1.2.5 557 7/25/2021
1.2.4 362 6/9/2021
1.2.3 366 3/22/2021
1.2.2 461 12/13/2020
1.2.1 491 10/24/2020
1.2.0 484 10/11/2020
1.1.1 437 8/12/2020
1.1.0 444 8/6/2020
1.0.9 540 8/6/2020
1.0.8 417 8/5/2020
1.0.7 408 8/4/2020
1.0.6 421 8/4/2020
1.0.5 485 8/3/2020
1.0.4 518 7/28/2020
1.0.3 442 7/28/2020
1.0.2 473 7/19/2020
1.0.1 438 7/19/2020
1.0.0 423 7/18/2020

Extensions on the Fetch .NetFramework.