reactiveui / refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.
https://reactiveui.github.io/refit/
MIT License
8.62k stars 746 forks source link

Generic Interface #63

Closed luizbon closed 10 years ago

luizbon commented 10 years ago

Is there any support to generic interfaces?

bennor commented 10 years ago

I don't think there is at the moment. I'm curious as to what the use case is and how you'd need it to work?

luizbon commented 10 years ago

Imagine you have the same API over and over that has only two differences:

This is common for CRUD applications working with RESTfull services

Maybe an polymorphic service that depending on your application you want to use one class on some point and another on the oder, and both access the same service. Since you normally accessing an external service, this can be real.

bennor commented 10 years ago

Okay, yeah, I can see the value. I am fairly sure that won't work at the moment and will require a bit of work to implement. If @paulcbetts isn't opposed to the idea, I'll have a crack at it over the weekend.

luizbon commented 10 years ago

I've tried to spike something, but it didn't work well, I don't have experience with expression trees. The point that I get was inside InterfaceStubGenerator on FindInterfacesToGenerate. When I have a generic interface it breaks on line 54 of InterfaceStubGenerator because the generic argument is not an IdentifierNameSyntax

Hope this helps

bennor commented 10 years ago

This is almost good to go, but I branched off #67, so I'll wait until that's merged before making a PR for this.