You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<PackageReferenceInclude="Exhaustion"Version="1.0.0"Condition="'$(MSBuildProjectName)' != 'Exhaustion' AND '$(MSBuildProjectName)' != 'Exhaustion.Tests' AND '$(MSBuildProjectName)' != 'RestClient.Net'">
24
+
<PackageReferenceInclude="Exhaustion"Version="1.0.0"Condition="'$(MSBuildProjectName)' != 'Exhaustion' AND '$(MSBuildProjectName)' != 'Exhaustion.Tests' AND '$(MSBuildProjectName)' != 'RestClient.Net' AND '$(MSBuildProjectName)' != 'Buh'">
Built from the ground up with functional programming, type safety, and modern .NET patterns. Successor to the [original RestClient.Net](https://github.com/MelbourneDeveloper/RestClient.Net).
7
+
Built from the ground up with functional programming, type safety, and modern .NET patterns. Successor to the [original RestClient.Net](https://www.nuget.org/packages/RestClient.Net.Abstractions).
8
8
9
9
## What Makes It Different
10
10
11
11
This library is uncompromising in its approach to type safety and functional design:
12
12
-**HttpClient extensions** - Works with [HttpClient lifecycle management](https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use) via `IHttpClientFactory.CreateClient()`
13
13
-**Result types** - Explicit error handling without exceptions
14
-
-**Exhaustiveness checking** - Compile-time guarantees via [Exhaustion](https://github.com/MelbourneDeveloper/Exhaustion)
15
-
-**Functional composition** - Delegate factories, pure functions, no OOP ceremony
14
+
-**Exhaustiveness checking** - Compile-time guarantees via [Exhaustion](https://www.nuget.org/packages/Exhaustion)
15
+
-**Functional composition** - Pure functions with no interfaces
16
16
17
17
## Features
18
18
@@ -28,53 +28,130 @@ The design focuses on [discriminated unions](https://github.com/dotnet/csharplan
28
28
29
29
## Installation
30
30
31
+
Install the core package:
31
32
```bash
32
33
dotnet add package RestClient.Net
33
34
```
34
35
36
+
RestClient.Net installs the Exhaustion analyzer. Is is a Roslyn analyzer that provides compile-time exhaustiveness checking for pattern matching. Without it, you lose one of RestClient.Net's core safety guarantees.
37
+
35
38
## Usage
36
39
37
40
### Basic GET Request
38
41
39
-
The simplest way to make a GET request to JSONPlaceholder:
42
+
A complete example making a GET request to JSONPlaceholder:
C# doesn't officially support discriminated unions, but you can achieve closed type hierarchies with the [sealed modifier](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/sealed). The [Outcome package](https://www.nuget.org/packages/Outcome/) gives you a set of Result types designed for exhaustiveness checks. Until C# gains full discriminated union support, you need to add type aliases like this:
// Missing ExceptionErrorPost case - will throw at runtime if an exception occurs!
127
+
};
67
128
```
68
129
69
-
### Result Type and Type Aliases
130
+
### What Happens With Exhaustion
70
131
71
-
C# doesn't officially support discriminated unions, but you can achieve closed type hierarchies with the [sealed modifer](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/sealed). The [Outcome package](https://www.nuget.org/packages/Outcome/) gives you a set of Result types designed for exhaustiveness checks. Until C# gains full discriminated union support, you need to add type aliases like this. If you use the generator, it will generate the type aliases for you.
0 commit comments