I developed an ASP.Net web api with about 80 different api calls.
I would like to create a dynamic web api client, allowing the application code to remain simple and the "web api client layer" to be reusable (without the need of creating 80 different methods).
I would expect the web api client to look something like this:
public dynamic WebApi(string method, params object[] list)
{
// Setting the api request by the input...
// Calling the web api...
// Handling the results...
}
I'd expect the apps using it to look something like this:
List<Stations> stations = WebApi("GetStationsByCompany", companyId);
Now i feel like this is a very common use case so i shouldn't be developing it myself, however i couldn't find any examples for this scenario online (for .Net Framework).
How should i create a dynamic web api client? What is the best practice for it?