CosmoRequests 2.2.0
See the version list below for details.
dotnet add package CosmoRequests --version 2.2.0
NuGet\Install-Package CosmoRequests -Version 2.2.0
<PackageReference Include="CosmoRequests" Version="2.2.0" />
paket add CosmoRequests --version 2.2.0
#r "nuget: CosmoRequests, 2.2.0"
// Install CosmoRequests as a Cake Addin #addin nuget:?package=CosmoRequests&version=2.2.0 // Install CosmoRequests as a Cake Tool #tool nuget:?package=CosmoRequests&version=2.2.0
CosmoRequests
Library created in order to make requests and http responses easier using the native C # class WebRequest
Provided methods
- GET
- POST
- PUT
- PATCH
- DELETE
PS:
All of them expect at least one parameter, an url. If you want, you can also pass an object data which it will be converted to JSON and included at the request, and create a RequestOption object which contains definitions to timeout, contentType, headers e etc.
How to use
string url = "https://rickandmortyapi.com/api/character/1";
CosmoResponse response = CosmoRequest.GET(url)
Console.WriteLine(response);
"id": 1,<br> "name": "Rick Sanchez",<br> "status": "Alive",<br> "species": "Human",<br> "type": "",<br> "gender": "Male",<br> "origin": { "name": "Earth (C-137)", "url": "https://rickandmortyapi.com/api/location/1" },<br> "location": { "name": "Earth (Replacement Dimension)", "url": "https://rickandmortyapi.com/api/location/20" },<br> "image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg",<br> "episode": [ "https://rickandmortyapi.com/api/episode/1", "https://rickandmortyapi.com/api/episode/2", "https://rickandmortyapi.com/api/episode/3", "https://rickandmortyapi.com/api/episode/4", "https://rickandmortyapi.com/api/episode/5", "https://rickandmortyapi.com/api/episode/6", "https://rickandmortyapi.com/api/episode/7", "https://rickandmortyapi.com/api/episode/8", "https://rickandmortyapi.com/api/episode/9", ],<br> "url": "https://rickandmortyapi.com/api/character/1",<br> "created": "2017-11-04T18:48:46.250Z"
<br>
PS: You can also see full response's request using;
CosmoResponse response = CosmoRequest.GET(url)
Console.WriteLine(response.GetResponse);
Body: {"id":1,"name":"Rick Sanchez","status":"Alive","species":"Human","type":"","gender":"Male","origin":{"name":"Earth (C-137)","url":"https://rickandmortyapi.com/api/location/1"},"location":{"name":"Earth (Replacement Dimension)","url":"https://rickandmortyapi.com/api/location/20"},"image":"https://rickandmortyapi.com/api/character/avatar/1.jpeg","episode":["https://rickandmortyapi.com/api/episode/1","https://rickandmortyapi.com/api/episode/2","https://rickandmortyapi.com/api/episode/3","https://rickandmortyapi.com/api/episode/4","https://rickandmortyapi.com/api/episode/5","https://rickandmortyapi.com/api/episode/6","https://rickandmortyapi.com/api/episode/7","https://rickandmortyapi.com/api/episode/8","https://rickandmortyapi.com/api/episode/9","https://rickandmortyapi.com/api/episode/10","https://rickandmortyapi.com/api/episode/11","https://rickandmortyapi.com/api/episode/12","https://rickandmortyapi.com/api/episode/13","https://rickandmortyapi.com/api/episode/14","https://rickandmortyapi.com/api/episode/15","https://rickandmortyapi.com/api/episode/16","https://rickandmortyapi.com/api/episode/17","https://rickandmortyapi.com/api/episode/18","https://rickandmortyapi.com/api/episode/19","https://rickandmortyapi.com/api/episode/20","https://rickandmortyapi.com/api/episode/21","https://rickandmortyapi.com/api/episode/22","https://rickandmortyapi.com/api/episode/23","https://rickandmortyapi.com/api/episode/24","https://rickandmortyapi.com/api/episode/25","https://rickandmortyapi.com/api/episode/26","https://rickandmortyapi.com/api/episode/27","https://rickandmortyapi.com/api/episode/28","https://rickandmortyapi.com/api/episode/29","https://rickandmortyapi.com/api/episode/30","https://rickandmortyapi.com/api/episode/31","https://rickandmortyapi.com/api/episode/32","https://rickandmortyapi.com/api/episode/33","https://rickandmortyapi.com/api/episode/34","https://rickandmortyapi.com/api/episode/35","https://rickandmortyapi.com/api/episode/36","https://rickandmortyapi.com/api/episode/37","https://rickandmortyapi.com/api/episode/38","https://rickandmortyapi.com/api/episode/39","https://rickandmortyapi.com/api/episode/40","https://rickandmortyapi.com/api/episode/41"],"url":"https://rickandmortyapi.com/api/character/1","created":"2017-11-04T18:48:46.250Z"} ContentEncoding: ,<br> ContentType: application/json; charset=utf-8,<br> ContentLength: 2283,<br> Cookies: System.Net.CookieCollection,<br> Headers: access-control-allow-origin: * Content-Length: 2283 Cache-Control: max-age=259200,public Content-Type: application/json; charset=utf-8 date: Wed, 14 Jul 2021 16:56:31 GMT etag: W/"8eb-Tb5YlC+lq/WbjSuXI6O6LTPN2Yw" expires: Sat, 17 Jul 2021 16:56:31 GMT server: Netlify age: 127180 x-nf-request-id: 01FAPREV4JG8B9SF9HFNMH31W0 x-powered-by: Express,<br> IsSuccessful: True,<br> ErrorMessage: ,<br> LastModified: 7/16/2021 1:16:10 AM,<br> Method: GET,<br> ProtocolVersion: 1.1,<br> ResponseUri: https://rickandmortyapi.com/api/character/1,<br> StatusCode: 200,<br> StatusDescription: OK,<br> Server: Netlify,<br> SupportsHeaders: True,<br>
<br>
You can also download file with cosmoRequests
string url = "https://orimi.com/pdf-test.pdf";
string folderDestination = @"C:\Users\wellm\Desktop\";
DownloadResponse downloadResponse = CosmoRequest.DOWNLOAD(url, folderDestination);
Console.WriteLine(downloadResponse);
{FileInfo: C:\Users\wellm\Desktop\File-2021.11.12 21-49-56-338.pdf, IsDownloadSucessful: True}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. 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. |
-
.NETCoreApp 3.1
- Newtonsoft.Json (>= 13.0.1)
-
.NETFramework 4.5
- Newtonsoft.Json (>= 13.0.1)
-
.NETFramework 4.6
- Newtonsoft.Json (>= 13.0.1)
-
.NETFramework 4.7
- Newtonsoft.Json (>= 13.0.1)
-
.NETFramework 4.8
- Newtonsoft.Json (>= 13.0.1)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.1)
-
net5.0
- Newtonsoft.Json (>= 13.0.1)
-
net6.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added new method constructor to RequestOptions that accepts proxy configurations.