VitoRestbox 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package VitoRestbox --version 1.0.0
                    
NuGet\Install-Package VitoRestbox -Version 1.0.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="VitoRestbox" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VitoRestbox" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="VitoRestbox" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VitoRestbox --version 1.0.0
                    
#r "nuget: VitoRestbox, 1.0.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.
#:package VitoRestbox@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VitoRestbox&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=VitoRestbox&version=1.0.0
                    
Install as a Cake Tool

πŸ“˜ VitoRestbox

VitoRestbox is a clean, expressive HTTP request builder for .NET, designed to simplify REST API calls and enrich your application's communication with external services. Inspired by the name Vitoβ€”derived from the Latin word vita, meaning β€œlife”—this library brings clarity, vitality, and composability to your HTTP interactions.


✨ Features

βœ… Fluent, sentence-like API for building HTTP requests
βœ… Supports all HTTP verbs: GET, POST, PUT, PATCH, DELETE
βœ… Built-in JSON serialization with customizable options
βœ… Header and authentication injection
βœ… Flexible .WithHeaders(...) builder pattern
βœ… Lifecycle hooks:

  • BeforeSend for request inspection
  • AfterSend for response handling
  • OnFailure for error tracking
  • OnException for graceful fallback
    βœ… Timeout configuration with .WithTimeout(...)
    βœ… Exception control with .SuppressExceptions(...)
    βœ… Sync and async execution support
    βœ… Works seamlessly with HttpClient and DI containers

πŸš€ Quick Start

var result = await VitoRestboxRequest
    .New(httpClient)
    .To("https://api.example.com/users")
    .WithBearerToken("your-token")
    .Post(new { name = "Reza" })
    .SendAsync<UserResponse>();

🧠 Fluent Header Builder

You can inject multiple headers using chained or multiple lambdas:

.WithHeaders
(
    h => h.Add("Authorization", "Bearer xyz"),
    h => h.Add("X-Request-ID", Guid.NewGuid().ToString())
)

Or use a single chained builder:

.WithHeaders(h => h.Add("Authorization", "Bearer xyz").Add("X-Request-ID", Guid.NewGuid().ToString()))

⏱ Timeout & Exception Control

Set a timeout for the request:

.WithTimeout(15) // Timeout after 15 seconds

Suppress exceptions and handle failures manually:

.SuppressExceptions() // Prevents exceptions from being thrown

πŸ“¦ Installation

dotnet add package VitoRestbox

Or via NuGet Package Manager:

Install-Package VitoRestbox

πŸ§ͺ Testing

VitoRestbox is fully testable with xUnit, FluentAssertions, and custom HttpMessageHandler mocks. See VitoRestboxRequestTests.cs for examples.


πŸ“– Philosophy

In Latin, vita means "life"β€”and VitoRestbox aims to bring life to your API calls by making HTTP communication readable, composable, and expressive. Whether you're building microservices, SDKs, or internal tools, this library helps you express intent and outcome with precision.


πŸ‘€ Author

Reza Ghadimi
πŸ”— LinkedIn
πŸ™ GitHub Profile
πŸ“¦ VitoRestbox Repository


πŸ“„ License

MIT License


Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
1.2.0 558 9/21/2025
1.1.0 441 9/21/2025
1.0.0 254 9/19/2025