RestInPeace.NewtonsoftJson 13.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RestInPeace.NewtonsoftJson --version 13.0.0                
NuGet\Install-Package RestInPeace.NewtonsoftJson -Version 13.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="RestInPeace.NewtonsoftJson" Version="13.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RestInPeace.NewtonsoftJson --version 13.0.0                
#r "nuget: RestInPeace.NewtonsoftJson, 13.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.
// Install RestInPeace.NewtonsoftJson as a Cake Addin
#addin nuget:?package=RestInPeace.NewtonsoftJson&version=13.0.0

// Install RestInPeace.NewtonsoftJson as a Cake Tool
#tool nuget:?package=RestInPeace.NewtonsoftJson&version=13.0.0                

<p align="center"> <img src='https://raw.githubusercontent.com/schlenkr/RestInPeace/master/docs/img/logo.png' alt='logo' width='300' /> </p>

RestInPeace is a .Net HTTP client library for C# and F#. It aims for describing and executing HTTP requests in convenient ways that can be used in production and interactive environments.

The design principle behind RestInPeace is:

Specify common HTTP requests in a most convenient and readable way, while still being able to access the underlying .Net Http representations for covering unusual cases.

RestInPeace is developed and maintained by @SchlenkR and @dawedawe. Feel free to leave us a message.

NuGet Badge build status

A Simple Example

An example in F#:

#r "nuget: RestInPeace"

open RestInPeace

http {
    POST "https://reqres.in/api/users"
    CacheControl "no-cache"
    body
    jsonSerialize
        {|
            name = "morpheus"
            job = "leader"
        |}
}
|> Request.send

An example in C#:

#r "nuget: RestInPeace"

using RestInPeace.CSharp;

await "https://reqres.in/api/users".Post()
    .CacheControl("no-cache")
    .Body()
    .JsonSerialize(new
        {
            name = "morpheus",
            job = "leader"
        }
    )
    .SendAsync();

Documentation

Release Notes / Migrating to new versions

GitHub

Please see RestInPeace on GitHub.

Building

.Net SDK:

You need to have the latest .Net SDK installed, which is specified in ./global.json.

Build Tasks

There is a F# build script (./build.fsx) that can be used to perform several build tasks from command line.

For common tasks, there are powershell files located in the repo root:

  • ./test.ps1: Runs all tests (sources in ./src/Tests).
    • You can pass args to this task. E.g. for executing only some tests: ./test.ps1 --filter Name~'Response Decompression'
  • ./docu.ps1: Rebuilds the RestInPeace documentation site (sources in ./src/docs).
  • ./docu-watch.ps1: Run it if you are working on the documentation sources, and want to see the result in a browser.
  • ./publish.ps1: Publishes all packages (RestInPeace and it's integration packages for Newtonsoft and FSharp.Data) to NuGet.
    • Always have a look at ./src/Directory.Build.props and keep the file up-to-date.

Credits

  • Parts of the code is taken from the HTTP utilities of FSharp.Data.
  • Credits to all critics, supporters, contributors, promoters, users, and friends.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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 is compatible.  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 is compatible.  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 is compatible. 
.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
13.1.0 139 12/25/2023
13.0.0 130 12/24/2023
12.2.0 142 12/24/2023

v13.0.0
     - There's no more StartingContext, which means:
       we give up a little bit of safety here, for the sake of pre-configuring HTTP requests
       without specifying the URL. This is a trade-off we are willing to take.

     v12.2.0
     - added HttpMethods for better composability

     v12.1.0
     - net8.0

     v12.0.0
     - #137 / #102: Change the type for RestInPeaceUrl.additionalQueryParams from obj to string
     - Removed (auto opened) Async.await and Task.map/await
     - Moved (auto opened) Async.map to RestInPeace.Helper.Async.map

     v11.1.0
     - #130 / #105: Add method for user-supplied cancellation token

     v11.0.0
     - #121 (Breaking change): Turning off debug logs in FSI (breaking change in signature / namespace)
     - #124: Support Repeating Query Parameters (thanks @DaveJohnson8080)
     - #106 (Breaking change): Allow filename metadata with other "parts" (thanks @dawedawe)
     - Breaking change: ContentTypeForPart custom operations should come after part definition
     - #104 (Breaking change): Automatic GZip response decompression per Default
     - Other breaking changes:
       - Removed `ContentTypeWithEncoding` and used optional `charset` parameter in `ContentType` overloads.
       - Renamed `byteArray` to `binary` in Dsl, DslCE and CSharp.
       - Caution (!!): Renamed `stringPart` to `textPart` and changed argument order for `name` and `value` in Dsl and DslCE.
       - Restructured types in Domain
       - `Helper` is a module instead of a namespace, and some things were moved.
       - All transformers in config are a list of transformers instead of a single item.
       - Removed `setHttpClient`. Please use `setHttpClientFactory` instead.
       - `setHttpClientFactory` takes a `Config` as input argument.

     -----------------------------
     -- Old release notes below --
     -----------------------------
     
     v7.0.0
     - #92: `expect` and `assert` pass through the original response instead of unit.

     v8.0.0
     - #93 (thanks @drhumlen): Changed content type 'text/json' to 'application/json'.
     - Http modules are always AutoOpen in both Dsl and DslCE.
     - No extra modules for builder methods.

     v8.0.1
     - #89: No more blocking requests using net5 with FSI.

     v9.0.0 / v9.0.1
     - Redefined builders (see README.md).
     - Many breaking changes (see "Migrations" sections in the docu).

     v9.0.2
     - Added JSON toArray functions
     - Fixed #99: Response.saveFile should create the directory if not present.

     v9.0.3
     - Supporting netstandard2.1 again.

     v9.0.4
     - Referenced lowest possible FSharp.Core and other referenced packages version.

     v9.0.5
     - Support for netstandard2.0.
     - New 'RestInPeace.NewtonsoftJson' integration package.
     - More JSON functions and defaults config.

     v9.0.6
     - #100 - Removed FSI print messages.

     v9.1.0
     - Fixed naming inconsistency for 'Response.deserialize...' functions.
     - More C# JSON functions.

     v9.1.1
     - Fix: Using GlobalConfig.Json.defaultJsonSerializerOptions as default for jsonSerialize.

     v9.1.2
     - Fixed #103: FSI response printing and initialization doesn't work out of the box anymore.

     v10.0.0
     - .Net 7 support (thank you @Samuel-Dufour)
     - Breaking change: Corrected typo "guessMineTypeFromPath" -> "guessMimeTypeFromPath"
     - Breaking change: Module 'Helper', 'HelperInternal' and 'HelperAutos' refactored
     - #115: Remove print messages when downloading streams
     - Printing: Separate print functions for response and request via Request.print and Response.print
     - Printing: Default request (IToRequest) printing in FSI
     - Removed net5.0 targets in all projects
     - PrintHint.printDebugMessages: Moved to RestInPeace.Helper.Fsi.logDebugMessages as a global switch
     - #113 - Config.timeoutInSeconds bug

     v10.1.0
     - #117: Escape string for query params values (by @maciej-izak - thank you)
     (!!) This can be seen as breaking change.
     - #112: Allow to add (multiple) headers (by @Samuel-Dufour - thank you)