Skip to content
Nuvyntra Labs
All packages

HTTP & APIs

Plugin.Maui.HttpForge

Source-generated typed REST client — Refit-shaped, MauiEssentials-aligned

Current NuGet 1.1.1

A type-safe, source-generated HTTP REST client for .NET MAUI on Android, iOS, Mac Catalyst, and Windows. Declare the API as a C# interface; HttpForge generates the HttpClient implementation at compile time.

Install

dotnet add package Plugin.Maui.HttpForge

Package ID: Plugin.Maui.HttpForge

Plugin.Maui.* restores from GitHub Packages. Add the org feed first — see Use nuvyntralabs GitHub Packages from a C# project.

Overview

Plugin.Maui.HttpForge is the contract layer: declare GET/POST/PUT/DELETE/PATCH/HEAD as a C# interface and the source generator emits the HttpClient implementation — no runtime reflection request builder. 1.1.0 adds the Refit-parity request surface (query objects, collection formats, naming presets, [Timeout]/[Url]/[PathPrefix], optional segments, [QueryName]/[FormObject], IAsyncEnumerable streaming, request compression, and AuthorizationHeaderValueGetter) plus optional Testing, Newtonsoft.Json, and XML packages. It is a MauiEssentials-shaped subset of Refit for Android, iOS, Mac Catalyst, and Windows, not a drop-in Refit replacement. Retry, cache, token refresh, and resumable uploads stay on ApiResilience, ApiCache, SecureSession, and SmartUpload; AddHttpForgeClient returns IHttpClientBuilder so those handlers chain on the same client.

Current release

  • 1.1.1. Current nuget.org pack. The 1.1 request surface is unchanged.
  • 1.1.0. Refit-parity request surface: query objects, collection formats (Multi / Csv / Ssv / Tsv / Pipes), camel/snake/kebab keys, [Timeout] / [Url] / [PathPrefix], optional {id?} segments, [QueryName], [FormObject], IAsyncEnumerable streaming (JSON Lines / SSE), request-body gzip/brotli, and AuthorizationHeaderValueGetter (attach only; absolute URI).
  • Optional packages: Plugin.Maui.HttpForge.Testing, Plugin.Maui.HttpForge.NewtonsoftJson, and Plugin.Maui.HttpForge.Xml. Compile-time diagnostics are now HFG001–HFG010. Reflection fallback stays out of scope.

Full upgrade map for the 3 September 2026 hardening wave: Hardened plugin releases.

Capabilities

  • Interface + [Get] / [Post] / [Put] / [Delete] / [Patch] / [Head] compiled to HttpClient calls.
  • Path parameters, [AliasAs], [Query], query objects, collection formats, camel/snake/kebab keys, [QueryName], [Body], [Header] / [Headers], CancellationToken.
  • [Timeout], [Url], [PathPrefix], and optional route segments ({id?}).
  • Multipart uploads with StreamPart, ByteArrayPart, FileInfoPart, and [FormObject].
  • IAsyncEnumerable<T> streaming (JSON Lines or SSE) and request-body gzip/brotli.
  • AuthorizationHeaderValueGetter attaches a token; 401 refresh stays on SecureSession or ApiResilience.
  • Task<IApiResponse<T>> for non-throwing 4xx/5xx; ApiException vs ApiRequestException.
  • System.Text.Json by default; optional JsonSerializerContext for AOT; Newtonsoft.Json and XML as optional packages.
  • UseHttpForge(), AddHttpForgeClient<T>(), or RestService.For<T>() without the host.
  • Compose ApiResilience, ApiCache, SecureSession, and SmartUpload on IHttpClientBuilder.
  • Plugin.Maui.HttpForge.Testing stubs. Compile-time diagnostics HFG001–HFG010. Generated-only — no reflection fallback.

Documentation

Discussion

Comment on Plugin.Maui.HttpForge. The thread lives on this component's GitHub repository (nuvyntralabs/Plugin.Maui.HttpForge). Sign in with GitHub — Giscus uses Discussions, Utterances uses Issues.

Related in HTTP & APIs