Twileloop.JetAPI 1.1.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Twileloop.JetAPI --version 1.1.0
NuGet\Install-Package Twileloop.JetAPI -Version 1.1.0
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="Twileloop.JetAPI" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Twileloop.JetAPI --version 1.1.0
#r "nuget: Twileloop.JetAPI, 1.1.0"
#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 Twileloop.JetAPI as a Cake Addin
#addin nuget:?package=Twileloop.JetAPI&version=1.1.0

// Install Twileloop.JetAPI as a Cake Tool
#tool nuget:?package=Twileloop.JetAPI&version=1.1.0

<br /> <div align="center"> <a href="https://github.com/sangeethnandakumar/Jet API"> <img src="https://github.com/sangeethnandakumar/Twileloop.JetAPI/raw/master/Twileloop.JetAPI/logo.png" alt="Logo" width="80" height="80"> </a>

<h2 align="center"> Jet API </h2> <h4 align="center"> Free | Open-Source | Fast </h4>

<p align="center"> <b> An easy to use conveinent fluent API requester for all your personal or commercial .NET apps </b> <br /> <a href="https://twileloop.epub.readthedocs.io"><strong>Explore the docs ยป</strong></a> <br /> <br /> <a href="https://github.com/sangeethnandakumar/Twileloop.EPub/issues">Report A Bug</a> ยท <a href="https://github.com/sangeethnandakumar/Twileloop.EPub/issues">Request A Feature</a> </p>

</div>

SonarCloud

.NET

Fully Free

  • MIT Licensed
  • Fully free for personal/commercial projects without needing any commertial licenses or messes.

Feeling happy? A small coffee would be a great way to support my work. Thank you for considering it!

"Buy Me A Coffee"

<div align="center">

<h2 align="center"> DOCUMENTATION </h2> <h4 align="center"> A fully free open source cross platform fluent APIClient for your .NET application </h4>

</div>

Simple GET

var response = await new JetRequest<dynamic>()
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/posts/1");

GET ๐Ÿ š With Query Params

var response = await new JetRequest<dynamic>()
                         .WithQueries(
                             new Param("postId", 2),
                             new Param("date", "1996-10-28")
                         )
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/comments");```

GET ๐Ÿ š With Headers

var response = await new JetRequest<dynamic>()
                         .WithQueries(
                             new Param("postId", 3)
                         )
                         .WithHeaders(
                             new Param("x-request-by", "name"),
                             new Param("x-limit", 150)
                         )
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/comments");                         .ExecuteAsync("https://jsonplaceholder.typicode.com/comments");```

POST ๐Ÿ š With JSON String

var jsonString = @"{""title"":""Foo"",""bar"":""Bar"",""userid"":1}";

var response = await new JetRequest<dynamic>()
                        .Post()
                        .WithBody(
                            new RawBody(ContentType.Json, jsonString)
                        )
                        .ExecuteAsync("https://jsonplaceholder.typicode.com/posts");

PUT ๐Ÿ š With Object As JSON

var instance = new {
    Title = "Foo",
    Bar = "Bar",
    UserId = 1
};

var response = await new JetRequest<MyResponseModel>()
                        .Put()
                        .WithBody(
                            new RawBody(ContentType.Json, instance)
                        )
                        .ExecuteAsync("https://jsonplaceholder.typicode.com/posts");

GET ๐Ÿ š With Basic-Authentication

var response = await new JetRequest<MyResponseModel>()
                         .Get()
                         .WithAuthentication(new BasicAuthentication {
                             Username = "username",
                             Password = "password"
                         })
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/posts/5");

GET ๐Ÿ š With JWT Bearer-Authentication

var response = await new JetRequest<MyResponseModel>()
                         .Get()
                         .WithAuthentication(new BearerToken("<BEARER_TOKEN>"))
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/posts/5");

GET ๐Ÿ š With API_KEY Authentication

var response = await new JetRequest<MyResponseModel>()
                         .Get()
                         .WithAuthentication(new ApiKey("Api-Key", "<API_KEY>"))
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/posts/5");

PATCH ๐Ÿ š And Handle Exceptions Yourself

var response = await new JetRequest<MyResponseModel>()
                         .Patch()
                         .HandleExceptions(
                             ex => Console.WriteLine($"An exception occured. Message: {ex.Message}");
                         )
                         .ExecuteAsync("htt://jsonplaceholder.typicode.com/posts/5");

GET ๐Ÿ š With Success/Failure Captures

var response = await new JetRequest<MyResponseModel>()
                         .Get()
                         .WithCaptures(
                             successResponse => Console.WriteLine("Success");,
                             failureResponse => Console.WriteLine("Failure");
                         )
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/posts/5");

PUT ๐Ÿ š With Custom Captures Based On HTTP StatusCode

var response = await new JetRequest<MyResponseModel>()
                         .Put()
                         .WithCaptures(
                             (HttpStatusCode.OK, () => Console.WriteLine("Ok")),
                             (HttpStatusCode.NotFound, () => Console.WriteLine("Not Found")),
                             (HttpStatusCode.Unauthorized, () => Console.WriteLine("UnAuthorized")),
                             (HttpStatusCode.Forbidden, () => Console.WriteLine("Forbidden"))
                         )
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/fake");

GET ๐Ÿ š As JSON/XML/HTML or TEXT

var response = await new JetRequest<MyResponseModel>()
                          .Get()
                          .FetchAs(ContentType.XML)
                          .ExecuteAsync("https://samplexml.com/auth/demoxml.xml");

GET ๐Ÿ š And Pass Request Cookies

var response = await new JetRequest<MyResponseModel>()
                          .WithCookies(
                              new Param("Cookie1", "<CookieValue1>"),
                              new Param("Cookie2", "<CookieValue2>")
                           )
                          .FetchAs(ContentType.HTML)
                          .ExecuteAsync("https://google.com");

Listen To Events With Interceptors

Create your own intercepter by inheriting from Interceptor base class

public class CustomInterceptor : Interceptor {

        public override void OnInit() {
            Console.WriteLine("Started...");
            base.OnInit();
        }

        public override void OnRequesting(Request request) {
            Console.WriteLine("Let's modify request from interceptor");
            request.HttpClient.DefaultRequestHeaders.Add("Accept", "application/json");

            Console.WriteLine("Enough. Now start requesting...");
            base.OnRequesting(request);
        }

        public override void OnResponseReceived() {
            Console.WriteLine("Got response...");
            base.OnResponseReceived();
        }

    }

Do your stuff above. Alter anything before request goes or log result after response came etc.. Now let's attach this interceptor to JetAPI

var interceptor = new CustomInterceptor();

 var response = await new JetRequest<dynamic>()
                         .Post()
                         .WithAuthentication(new BearerToken("<BEARER_TOKEN>"))
                         .WithInterceptor(interceptor)
                         .ExecuteAsync("https://jsonplaceholder.typicode.com/posts/5");
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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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

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
2.1.0 165 6/23/2023
2.0.0 126 6/22/2023
1.1.0 205 3/15/2023
1.0.0 198 3/15/2023