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

Refit.RestService

public static class RestService
Creates Refit interface implementations.
public static HttpClient CreateHttpClient(string hostUrl, RefitSettings settings)

Create an HttpClient with hostUrl as the base address.

public static T For<T>(HttpClient client, IRequestBuilder<T> builder)

Generate a Refit implementation of the specified interface.

public static T For<T>(HttpClient client, RefitSettings settings)

Generate a Refit implementation of the specified interface.

public static T For<T>(HttpClient client)

Generate a Refit implementation of the specified interface.

public static T For<T>(string hostUrl, RefitSettings settings)

Generate a Refit implementation of the specified interface.

public static T For<T>(string hostUrl)

Generate a Refit implementation of the specified interface.

public static object For(Type refitInterfaceType, HttpClient client, IRequestBuilder builder)

Generate a Refit implementation of the specified interface.

public static object For(Type refitInterfaceType, HttpClient client, RefitSettings settings)

Generate a Refit implementation of the specified interface.

public static object For(Type refitInterfaceType, HttpClient client)

Generate a Refit implementation of the specified interface.

public static object For(Type refitInterfaceType, string hostUrl, RefitSettings settings)

Generate a Refit implementation of the specified interface.

public static object For(Type refitInterfaceType, string hostUrl)

Generate a Refit implementation of the specified interface.

public static T ForGenerated<T>(HttpClient client)

Create a source-generated Refit implementation without falling back to reflection.

public static T ForGenerated<T>(HttpClient client, RefitSettings settings)

Create a source-generated Refit implementation without falling back to reflection.

public static T ForGenerated<T>(string hostUrl)

Create a source-generated Refit implementation without falling back to reflection.

public static T ForGenerated<T>(string hostUrl, RefitSettings settings)

Create a source-generated Refit implementation without falling back to reflection.

public static object ForGenerated(Type refitInterfaceType, HttpClient client, RefitSettings settings)

Create a source-generated Refit implementation without falling back to reflection.

public static object ForGenerated(Type refitInterfaceType, string hostUrl, RefitSettings settings)

Create a source-generated Refit implementation without falling back to reflection.

public static T ForGenerated<T>(HttpClient client, JsonSerializerContext context)

Create a source-generated Refit implementation that reads and writes JSON with a source-generated context and never falls back to reflection.

public static T ForGenerated<T>(HttpClient client, JsonSerializerContext context, bool allowReflectionFallback)

Create a source-generated Refit implementation that reads and writes JSON with a source-generated context.

public static T ForGenerated<T>(HttpClient client, JsonSerializerContext context, RefitSettings settings)

Create a source-generated Refit implementation that keeps the settings' serializer options and adds a source-generated JSON context.

public static T ForGenerated<T>(HttpClient client, JsonSerializerContext context, RefitSettings settings, bool allowReflectionFallback)

Create a source-generated Refit implementation that keeps the settings' serializer options and adds a source-generated JSON context.

public static T ForGenerated<T>(string hostUrl, JsonSerializerContext context)

Create a source-generated Refit implementation that reads and writes JSON with a source-generated context and never falls back to reflection.

public static T ForGenerated<T>(string hostUrl, JsonSerializerContext context, bool allowReflectionFallback)

Create a source-generated Refit implementation that reads and writes JSON with a source-generated context.

public static T ForGenerated<T>(string hostUrl, JsonSerializerContext context, RefitSettings settings)

Create a source-generated Refit implementation that keeps the settings' serializer options and adds a source-generated JSON context.

public static T ForGenerated<T>(string hostUrl, JsonSerializerContext context, RefitSettings settings, bool allowReflectionFallback)

Create a source-generated Refit implementation that keeps the settings' serializer options and adds a source-generated JSON context.

public static void RegisterGeneratedFactory(Type refitInterfaceType, Func<HttpClient, IRequestBuilder, object> factory)

Registers a source-generated Refit implementation factory.

public static void RegisterGeneratedFactory<T>(Func<HttpClient, IRequestBuilder, T> factory)

Registers a source-generated Refit implementation factory.

public static void RegisterGeneratedSettingsFactory<T>(Func<HttpClient, RefitSettings, T> factory)

Registers a source-generated Refit implementation factory that does not need the reflection request builder.