Open legiosys opened 3 years ago
How about this:
[RefitClient]
public interface ISomeClient : ISome
{
}
public interface ISome
{
[Get("some")]
Task Some();
}
And you just use ISomeClient
and you will have access to all of the functions.
And you just use
ISomeClient
and you will have access to all of the functions.
In this case:
public interface ISomeEntities
{
[Get("someEntities/GetById")]
Task GetById(int id);
}
public interface IAnotherEntities
{
[Get("anotherEntities/GetById")]
Task GetById(int id);
}
public interface ISomeClient : ISomeEntities, IAnotherEntities
{}
What result will be when we call ISomeClient.GetById?
Now we solve this with Reflection:
We generate SomeClientService from interface and set for IRefitInterface properties refit generated implementations RestService.For<IRefitInterface>
Hello!
First, thanks for your work, it's realy powerfull project!
Our problem: We have for example three controllers: QueryController, ChangeController and UtilityController. We create Refit interfaces: IQueryController,.. and implement by controllers. Now, if we don't want to be wrong what method we should use, we name methods like Query_GetSmth. We create "super" interface
ISomeService : IQueryController, ChangeController, UtilityController
and use it for RestService.It wil be good to create refit client from interface like this:
And then we can call method like:
May be need add attribute like
[RestService]
that haveAttributeTargets.Interface
and then we can catch this interfaces in Source Generator:And after generate
SomeService : ISomeService
with properties likeIQueryController Query = GeneratedQueryControllerClient
.Thanks.