Universal.Operative.Sdk.Http 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Universal.Operative.Sdk.Http --version 1.0.0
                    
NuGet\Install-Package Universal.Operative.Sdk.Http -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="Universal.Operative.Sdk.Http" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Universal.Operative.Sdk.Http" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Universal.Operative.Sdk.Http" />
                    
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 Universal.Operative.Sdk.Http --version 1.0.0
                    
#r "nuget: Universal.Operative.Sdk.Http, 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 Universal.Operative.Sdk.Http@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=Universal.Operative.Sdk.Http&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Universal.Operative.Sdk.Http&version=1.0.0
                    
Install as a Cake Tool

About

Universal.Operative.Sdk.Http adds HttpServiceClientProxyTool<TServiceClient, TArgs>, a Universal.Operative.Sdk.Tools.HttpProxyTool<TArgs> that sends its request through an existing Universal.Common.Net.Http.HttpServiceClient instead of a plain HttpClient.

Use this instead of Universal.Operative.Sdk.Tools.HttpClientProxyTool<TArgs> when a HttpServiceClient for the target API already exists (and is possibly used outside the tool-call path too) — auth injection and success/failure handling then live once, in that HttpServiceClient's own PreProcessHttpRequestMessageAsync/HandleSuccessStatusCodeAsync/HandleNonSuccessStatusCodeAsync overrides, rather than being re-implemented on the tool.

How to Use

Installation

dotnet add package Universal.Operative.Sdk.Http

Usage

using Universal.Common.Net.Http;
using Universal.Operative.Sdk.Http;

public sealed class ExampleServiceClient : HttpServiceClient
{
    private readonly string _token;
    public ExampleServiceClient(string token) => _token = token;

    protected override Task PreProcessHttpRequestMessageAsync(HttpRequestMessage request, CancellationToken ct)
    {
        request.Headers.Authorization = new("Bearer", _token);
        return Task.CompletedTask;
    }
}

public sealed class ExampleTool(ExampleServiceClient client) : HttpServiceClientProxyTool<ExampleServiceClient, ExampleTool.Args>
{
    protected override ExampleServiceClient ServiceClient { get; } = client;

    public override string Name => "example";
    public override ToolDefinition Definition { get; } = /* ... */;

    protected override Task<HttpRequestMessage> BuildRequestAsync(Args args, CancellationToken ct)
        => Task.FromResult(new HttpRequestMessage(new HttpMethod(args.Method), $"https://api.example.com{args.Path}"));

    public sealed record Args(string Method, string Path);
}

BuildRequestAsync only needs to shape the request (URI, method, body) — auth is applied by ServiceClient itself before the send, and FormatResponseAsync (inherited from HttpProxyTool<TArgs>, override to customize) turns the response into a ToolResult afterward.

License

Free for noncommercial use under the Universal.Operative Noncommercial License. Source is closed; commercial use requires a separate license from Andrew Ong.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on Universal.Operative.Sdk.Http:

Package Downloads
Universal.Operative.Sdk.Slack

Slack Web API tool for the Universal.Operative.Sdk.

Universal.Operative.Sdk.Discord

Discord REST API tool for the Universal.Operative.Sdk.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 189 9/1/2026
1.3.0 154 8/26/2026
1.2.0 204 8/12/2026
1.1.1 128 8/5/2026
1.1.0 203 7/28/2026
1.0.0 137 7/27/2026

Initial release.