Fetch_dotNET 1.0.2

There is a newer version of this package available.
See the version list below for details.
Install-Package Fetch_dotNET -Version 1.0.2
dotnet add package Fetch_dotNET --version 1.0.2
<PackageReference Include="Fetch_dotNET" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fetch_dotNET --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fetch_dotNET, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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.2

// Install Fetch_dotNET as a Cake Tool
#tool nuget:?package=Fetch_dotNET&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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: '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);
}

}

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.7 181 11/5/2021
1.2.6 144 10/27/2021
1.2.5 180 7/25/2021
1.2.4 136 6/9/2021
1.2.3 158 3/22/2021
1.2.2 221 12/13/2020
1.2.1 260 10/24/2020
1.2.0 259 10/11/2020
1.1.1 207 8/12/2020
1.1.0 202 8/6/2020
1.0.9 291 8/6/2020
1.0.8 181 8/5/2020
1.0.7 189 8/4/2020
1.0.6 187 8/4/2020
1.0.5 254 8/3/2020
1.0.4 277 7/28/2020
1.0.3 199 7/28/2020
1.0.2 245 7/19/2020
1.0.1 201 7/19/2020
1.0.0 194 7/18/2020

Extensions on the Fetch .NetFramework.