FluentRestSharp 1.0.6

dotnet add package FluentRestSharp --version 1.0.6
NuGet\Install-Package FluentRestSharp -Version 1.0.6
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="FluentRestSharp" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FluentRestSharp --version 1.0.6
#r "nuget: FluentRestSharp, 1.0.6"
#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 FluentRestSharp as a Cake Addin
#addin nuget:?package=FluentRestSharp&version=1.0.6

// Install FluentRestSharp as a Cake Tool
#tool nuget:?package=FluentRestSharp&version=1.0.6

FluentRestShrap

介绍

使用restsharp二次封装,实现便捷发送请求

安装教程

nuget 搜索FluentRestSharp

使用说明
  1. 功能介绍 将restsharp类库二次封装,实现通过流式调用。大部分api和原生使用无异。
  2. 核心类介绍 (1) FluentClient //内部维护一个RestClient对象
var client=new FluentClient();
var request= client.AddCookie(string name, string value, string path, string domain)//添加cookie
      .AddDefaultHeader(string name, string value)//添加默认请求头
      .AddDefaultParameter(string name, string value)//添加默认form参数
      .AddDefaultQueryParameter(string name, string value)//添加默认query参数
      .AddDefaultUrlSegment(string name, string value)//添加请求路径默认占位符参数
      .UseAuthenticator(IAuthenticator authenticator)//添加认证器
      .BuildClient(string baseUrl);//client构造完毕,转到request请求构造
(2) FluentRequest //内部维护一个RestRequest对象
var result=request
            .Get()//post,delete,put,patch等声明请求方式
            .AddBodyData<T>(T bodyData, BodyType type = BodyType.Json)//添加body数据,默认json形式,枚举参数可选xml格式
            .AddFile(string name, string filePath, string contentType = null) //使用文件地址形式添加文件
            .AddFile(string name, byte[] file, string fileName, string contentType = null)//使用byte[]形式上传文件
            .AddHeader(string key, string value) //添加请求头
            .AddParameter(string key, string value)//添加form参数
            .AddQueryParameter(string key, string value)//添加url请求参数
(3) FluentResult //client执行request的结果由此类处理
result.GetResponse();//获取restsharp完整请求
result.GetContent();//获取请求内的content数据
result.GetResult<TResult>();//获取返回数据内data 并转为泛型
result.DownloadStream();//流形式下载文件
result.DownloadBytes();//byte[]形式下载
以上方法都有异步实现
(4) 简单调用
var result= serviceProvider.GetService<IFluentClient>()
            .BuildClient("http://www.baidu.com")
            .Get()
            .BuildRequest()
            .GetResponse();
                    
      

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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. 
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.0.6 248 10/25/2023
1.0.5 351 1/16/2023
1.0.4 308 12/14/2022
1.0.3 309 12/13/2022
1.0.2 286 12/13/2022
1.0.1 323 9/29/2022
1.0.0 300 9/29/2022

1.升级restsharp版本 根据新版本restsharp调整接口