VOOZH about

URL: https://www.nuget.org/packages/SweetMeSoft.Connectivity

⇱ NuGet Gallery | SweetMeSoft.Connectivity 1.10.130




👁 Image
SweetMeSoft.Connectivity 1.10.130

dotnet add package SweetMeSoft.Connectivity --version 1.10.130
 
 
NuGet\Install-Package SweetMeSoft.Connectivity -Version 1.10.130
 
 
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="SweetMeSoft.Connectivity" Version="1.10.130" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SweetMeSoft.Connectivity" Version="1.10.130" />
 
Directory.Packages.props
<PackageReference Include="SweetMeSoft.Connectivity" />
 
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 SweetMeSoft.Connectivity --version 1.10.130
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SweetMeSoft.Connectivity, 1.10.130"
 
 
#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 SweetMeSoft.Connectivity@1.10.130
 
 
#: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=SweetMeSoft.Connectivity&version=1.10.130
 
Install as a Cake Addin
#tool nuget:?package=SweetMeSoft.Connectivity&version=1.10.130
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SweetMeSoft.Connectivity

Library to simplify and standardize requests to APIs and web services.

Description

SweetMeSoft.Connectivity is a library for .NET Standard 2.1 that provides an ApiReq class as a wrapper over HttpClient. Its goal is to facilitate making HTTP requests (GET, POST, PUT, DELETE), handling different content types, cookie management and response deserialization in a structured and reusable way.

Features

  • HttpClient Wrapper: Abstracts the complexity of HttpClient into a simpler API.
  • HTTP Methods Support: Implements GET, POST, PUT and DELETE.
  • Content Handling: Supports application/json, application/x-www-form-urlencoded and multipart/form-data.
  • Generic Classes: Uses GenericReq<T> for requests and GenericRes<T> for responses, allowing strong typing.
  • Cookie Management: Automatically manages cookies between requests.
  • File Download: Includes a DownloadFile method to get files as a StreamFile.
  • Singleton Pattern: Provides a single instance through ApiReq.Instance for easy access.

Dependencies

Installation

dotnet add package SweetMeSoft.Connectivity

Usage

The library is used through the singleton instance ApiReq.Instance.

GenericReq<T>: The Request

This object is used to configure all request details.

Property Type Description
Url string Required. The endpoint URL.
Data T The object with data to send in the request body (for POST and PUT).
HeaderType HeaderType The content type (json, xwwwunlercoded, formdata).
Authentication Authentication Object to configure authentication (e.g. Bearer Token).
Cookies string Cookies to send in the request.
Headers HttpHeaders Additional HTTP headers.
AdditionalParams List<KeyValuePair<string, string>> Additional parameters for xwwwunlercoded.

GenericRes<T>: The Response

This object contains the request result.

Property Type Description
Object T The deserialized response object (if the request was successful).
HttpResponse HttpResponseMessage The original HTTP response.
Error ErrorDetails Error details (if the request failed).
Cookies string The cookies received in the response.
IsSuccess bool Indicates if the request was successful (true/false).

Example: GET Request

// Define the expected response model
public class User
{
 public int Id { get; set; }
 public string Name { get; set; }
}

// Make the request
var response = await ApiReq.Instance.Get<User>("https://api.example.com/users/1");

if (response.IsSuccess)
{
 User user = response.Object;
 // ... use the 'user' object
}
else
{
 // ... handle the error with response.Error
}

Example: POST Request

// Define the request model
public class CreateUserInput
{
 public string Name { get; set; }
 public string Email { get; set; }
}

// Define the response model
public class CreateUserOutput
{
 public int Id { get; set; }
 public string CreatedAt { get; set; }
}

// Prepare the request
var requestData = new CreateUserInput { Name = "John Doe", Email = "john.doe@example.com" };
var request = new GenericReq<CreateUserInput>
{
 Url = "https://api.example.com/users",
 Data = requestData,
 HeaderType = HeaderType.json // or xwwwunlercoded, formdata
};

// Make the request
var response = await ApiReq.Instance.Post<CreateUserInput, CreateUserOutput>(request);

if (response.IsSuccess)
{
 CreateUserOutput newUser = response.Object;
 // ...
}

License

This project is under the MIT license.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 netstandard2.1 is compatible. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SweetMeSoft.Connectivity:

Package Downloads
SweetMeSoft.Mobile.Base

SweetMeSoft Mobile MAUI Base Library is a compilation of different utils for MAUI apps

SweetMeSoft.Uno.Base

SweetMeSoft Uno Base Library is a compilation of different utils for UNO Platform apps

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.10.130 248 2/19/2026
1.10.129 531 9/17/2025
1.10.128 573 2/20/2025
1.10.127 269 1/30/2025
1.10.126 351 8/22/2024
1.10.125 285 7/23/2024
1.10.124 319 7/23/2024
1.10.123 277 7/19/2024
1.10.122 370 5/20/2024
1.10.121 512 3/2/2024
1.10.120 302 2/12/2024
1.10.119 296 2/8/2024
1.10.118 331 11/23/2023
1.10.116 253 11/3/2023
1.10.115 271 9/14/2023
1.10.114 299 8/25/2023
1.10.113 309 8/23/2023
1.10.112 259 8/22/2023
Loading failed