github reactiveui/refit 2.1.0
Refit 2.1.0

latest releases: 7.0.0, 7.0.0-beta.1, 6.5.1...
9 years ago

What's New

Generic Interface Support (#70)

Thanks to @bennor, you can now define generic interfaces that apply to multiple APIs:

public interface IReallyExcitingCrudApi<T, in TKey> where T : class
{
    [Post("")]
    Task<T> Create([Body] T paylod);

    [Get("")]
    Task<List<T>> ReadAll();

    [Get("/{key}")]
    Task<T> ReadOne(TKey key);

    [Put("/{key}")]
    Task Update(TKey key, [Body]T payload);

    [Delete("/{key}")]
    Task Delete(TKey key);
}

// Later, in another part of town...
var userApi = RestService.For<IReallyExcitingCrudApi<User, string>>("http://api.example.com/users"); 
var adminApi = RestService.For<IReallyExcitingCrudApi<Admin, string>>("http://api.example.com/admins"); 

URL Parameter Formatting (#66)

Thanks to @carl-berg, types that are serialized in the URL query string can now define custom formatting, via a new RefitSettings class that is optionally passed to RestService.For.

Bug Fixes / Improvements

  • URL parameters are now no longer case-sensitive (#68, thanks @flagbug)
  • Refit Interfaces which were defined in different assemblies than where they were used will now correctly get stubs generated (#67, thanks @bennor)
  • Type aliases will now be recognized in interfaces (#62, thanks @bennor)

Don't miss a new refit release

NewReleases is sending notifications on new releases.