<PackageReference Include="Refit" Version="16.3.0" />

Refit

Namespace with 93 public types

Classes

 AliasAsAttribute Override the key that will be sent in the query string.
 ApiException Represents an error that occurred after a response was received from the server.
 ApiRequestException Represents an error that occurred while sending an API request before a response could be received from the server.
 ApiResponse`1 Implementation of that provides additional functionalities.
 AttachmentNameAttribute Names an attachment in a multipart request.
 AuthorizeAttribute Add the Authorize header to the request with the value of the associated parameter.
 BodyAttribute Set a parameter to be sent as the HTTP request's body.
 ByteArrayPart Allows the use of a array in a multipart form body.
 CamelCaseUrlParameterKeyFormatter Provides an implementation of that formats URL parameter keys in camelCase.
 DefaultApiExceptionFactory Default Api exception factory.
 DefaultFormUrlEncodedParameterFormatter Default form Url-encoded parameter formatter.
 DefaultUrlParameterFormatter Default Url parameter formater.
 DefaultUrlParameterKeyFormatter Default Url parameter key formatter. Does not do any formatting.
 DeleteAttribute Send the request with HTTP method 'DELETE'.
 EncodedAttribute Marks a parameter value as already URL-encoded so Refit passes it through verbatim instead of escaping it — the equivalent of Retrofit's encoded = true. Applies to path segment values (including round-tripping {**param} segments), query values, and flags. The caller becomes responsible for producing valid encoded output; malformed values are sent as-is.
 FileInfoPart Allows the use of a object in a multipart form body.
 FormField`1 Describes a single form-url-encoded field for a strongly-typed body, allowing source-generated code to flatten a form body without reflection. The getter and all naming metadata are resolved at compile time by the Refit source generator; the runtime only formats the value using the configured .
 FormObjectAttribute Marks a complex-object parameter of a [Multipart] method so its public properties are written as individual multipart/form-data text parts (one part per property) instead of the default single serialized part.
 GeneratedParameterAttributeProvider Provides the attributes declared on a parameter, keyed by attribute type. Use instead when every attribute has the same type.
 GeneratedSingleTypeParameterAttributeProvider Provides the attributes declared on a parameter when every one of them has the same type, which needs neither a dictionary nor a flattening pass. Use when the parameter carries attributes of more than one type.
 GetAttribute Send the request with HTTP method 'GET'.
 HeadAttribute Send the request with HTTP method 'HEAD'.
 HeaderAttribute Add a header to the request.
 HeaderCollectionAttribute
 HeadersAttribute Add multiple headers to the request.
 JsonContentSerializer An obsolete JSON content serializer that has been replaced by serializers in dedicated packages.
 JsonLinesContent HTTP content that writes a sequence of values as JSON Lines (newline-delimited JSON): each element is serialized with the configured and emitted on its own line.
 JsonLinesContent`1 HTTP content that writes a typed sequence as JSON Lines (newline-delimited JSON): each element is serialized with for and emitted on its own line.
 KebabCaseUrlParameterKeyFormatter Provides an implementation of that formats URL parameter keys in kebab-case.
 MultipartAttribute Send the request as multipart.
 NextLinkOriginPolicy Decides which server-supplied next-page links a paging helper may follow. A followed link is sent through the same client as every other request, so it carries that client's credentials to whatever origin the link names.
 ObjectToInferredTypesConverter ObjectToInferredTypesConverter. From https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-converters-how-to?pivots=dotnet-5-0#deserialize-inferred-types-to-object-properties.
 OptionsAttribute Send the request with HTTP method 'OPTIONS'.
 PagedAttribute Declares how a method that returns reads the items and the continuation from each page. The source generator emits the request and the paging loop, so the method is called like any other and returns the lazy sequence.
 PagedEnumerable`2 A lazily fetched sequence of pages, enumerable as items or as the API's own page objects. Every enumeration starts again from the first page and invokes the page-fetching call once per page; nothing is requested until it is enumerated.
 PageTokenAttribute Marks the parameter of a method that carries the continuation: a cursor, an offset, a page number or any other value the API takes to identify a page. The generated client sends the caller's argument with the first request and the continuation read from each page with the next one.
 PatchAttribute Send the request with HTTP method 'PATCH'.
 PathPrefixAttribute Prepends a shared route prefix to every method's relative path on the interface it decorates.
 PostAttribute Send the request with HTTP method 'POST'.
 ProblemDetails The object representing the details about a ValidationException caught by a service implementing RFC 7807.
 PropertyAttribute Stores local context on HttpRequestMessage.Options on modern .NET, or Properties on older targets, for further processing in a message handler. An explicit key overrides the parameter or interface property name.
 PutAttribute Send the request with HTTP method 'PUT'.
 QueryAttribute Controls query or form names, value formats and collection formats. The delimiter joins nested property names (default: '.').
 QueryConverterAttribute Flattens a query parameter with a hand-written instead of the source generator's declared-type walk, for shapes that are only known at runtime (an value, a polymorphic base type, a Dictionary<string, object>, and similar).
 QueryNameAttribute Renders the parameter value as a valueless query flag — a bare ?name segment with no =value — the equivalent of Retrofit's @QueryName. A collection produces one flag per element (?a&b&c); a argument (or element) is omitted. The value is rendered through like any other query value, and is URL-encoded unless the parameter also carries .
 QueryUriFormatAttribute Controls how query parameters are encoded into the request Uri.
 RefitSettings Defines various parameters on how Refit should work.
 RequestCompressionOptions The per-coding compressor settings used in place of .
 RestMethodInfo Describes a single Refit REST method and the metadata used to build its request.
 RestMethodParameterInfo Describes a parameter of a REST method.
 RestMethodParameterProperty Describes a property used as part of a REST method parameter.
 SnakeCaseUrlParameterKeyFormatter Provides an implementation of that formats URL parameter keys in snake_case.
 StreamPart Allows the use of a generic in a multipart form body.
 SystemTextJsonContentSerializer A implementing using the System.Text.Json APIs.
 SystemTextJsonQueryConverter`1 An that flattens a query parameter by walking the JsonTypeInfo of the configured , reusing a registered JsonSerializerContext so arbitrary (including polymorphic) types flatten without hand-written code. Attach it with [QueryConverter(typeof(SystemTextJsonQueryConverter<MyType>))].
 TimeoutAttribute Applies a per-call timeout, in milliseconds, to a Refit interface method.
 UrlAttribute Marks a parameter as supplying the complete, absolute request URI, dispatching the call to that URL (which may be a different host) and bypassing the client's BaseAddress. This is Refit's equivalent of Retrofit's @Url.
 ValidationApiException An ApiException that is raised according to RFC 7807, which contains problem details for validation exceptions.

Structures

 GeneratedQueryStringBuilder Appends query parameters to a relative request path without reflection, matching the escaping, ordering, null-omission and collection-format semantics of the reflection request builder. Used by source-generated request construction; the API is also callable directly by hand-written AOT-friendly clients.
 PageContinuation`1 Says whether another page follows a fetched page and, if so, which token requests it.

Enumerations

 BodySerializationMethod Defines methods to serialize HTTP requests' bodies.
 CollectionFormat Collection format defined in https://swagger.io/docs/specification/2-0/describing-parameters/ .
 ParameterType Specifies how a REST method parameter is treated.
 RequestBodySerializationMode Controls how Refit serializes JSON request bodies.
 RequestCompression The content coding applied to a request body before it is sent.
 StreamingContentFormat Describes how a streamed response body is framed when deserializing an .
 UrlResolutionMode Defines how Refit combines the client's base address with a method's relative URL.

Static Classes

 ApiResponseExtensions Convenience helpers for working with and .
 GeneratedPaging Runtime helpers used by source-generated methods.
 GeneratedRequestRunner Request body content creation for source-generated requests: JSON, JSON Lines, and URL-encoded forms.
 HttpRequestMessageOptions Contains Refit-defined properties on the HttpRequestMessage.Properties/Options.
 PageContinuation Creates values for a continuation selector.
 PagedEnumerable Wraps an ordinary Refit method that returns one page into a lazy sequence of pages or items. The page type stays the API's own DTO; the caller supplies the selectors that read items and the continuation from it.
 RequestBuilder Provides static methods for creating request builders for Refit interface types. This class enables the generation of strongly-typed HTTP client implementations based on interface definitions and optional settings.
 RestService Creates Refit interface implementations.
 UniqueName Builds the unique generated type name for a Refit interface. This matches the name Refit uses when registering a client with IHttpClientFactory, so it can be used to resolve or configure that same named client (for example services.AddHttpClient(UniqueName.ForType<T>())).

Abstract Classes

 ApiExceptionBase Represents an error that occurred while sending an API request.
 HttpMethodAttribute Base attribute describing the HTTP method used to send a request.
 MultipartItem Base type for multipart form items that carry a file name and optional content metadata.

Interfaces

 IApiResponse Base interface used to represent an API response.
 IApiResponse`1
 IFormUrlEncodedParameterFormatter Provides form Url-encoded parameter formatting.
 IHttpContentSerializer Provides content serialization to .
 IJsonTypeInfoContentSerializer An optional capability for an that reads and writes JSON with metadata the caller supplies for each call, such as a property of a source-generated context, instead of looking the metadata up.
 IQueryConverter`1 Flattens a query parameter value into query-string pairs by hand, for shapes the source generator cannot flatten from the declared type (an value, a polymorphic base type, a Dictionary<string, object>, and similar). Attach an implementation to a parameter with .
 IRequestBuilder Defines a method for creating a delegate that executes a REST API method with the specified parameters and returns the result.
 IRequestBuilder`1 Identifies the API interface targeted by a request builder.
 IReturnTypeAdapter`2 Adapts a deferred asynchronous HTTP call producing a into the return type surfaced by a Refit interface method. Implement this to teach Refit a new return shape (for example IObservable<T> or Result<T>).
 IStreamingContentSerializer An optional capability for an that can deserialize a response body incrementally into an . Refit uses this for interface methods that return , reading items as they arrive instead of buffering the whole response.
 ISynchronousContentDeserializer An optional capability for an that can deserialize an already-buffered response body string synchronously. Refit uses this for and , which let callers peek at an error body from inside an exception filter (catch (ApiException ex) when (ex.TryGetContentAs<Error>(out var error))), where awaiting is not allowed by the CLR.
 ISynchronousContentSerializer An optional capability for an that can serialize a request body synchronously (buffered or streamed). Refit uses this when is or , allowing the System.Text.Json source-generated fast-path to engage. The fast-path runs through the synchronous serialization primitives (SerializeToUtf8Bytes / Serialize(Utf8JsonWriter, ...)); the built-in SerializeAsync(Stream) used by JsonContent normally uses metadata and can use the fast-path for repeated small payloads.
 IUrlParameterFormatter Provides Url parameter formatting.
 IUrlParameterKeyFormatter Provides a mechanism for formatting URL parameter keys, allowing customization of key naming conventions.