Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a client from a delegate #382

Open
smolchanovsky opened this issue Dec 16, 2021 · 0 comments
Open

Building a client from a delegate #382

smolchanovsky opened this issue Dec 16, 2021 · 0 comments

Comments

@smolchanovsky
Copy link
Member

smolchanovsky commented Dec 16, 2021

When I want to write in a functional style, I want to skip creating interfaces and use functions. However, it is now impossible to create a client without an interface.

I propose this implementation:

[GetMethod("api/entities/{id}")]
delegate Task<Entity> GetEntityAsync([RouteParam] int id);
...
var getEntityAsync = NClientGallery.Clients.GetRest()
    .For<GetEntityAsync>("https://localhost:5000")
    .Build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant