Вызов API в angularjs.
Assume that there are 3 APIs. Each API does exactly the same task(to give you weather details) but has different endpoints as follows:
API 1: Can only be used for India. Has methods named requestWeather(), requestWeatherDataForWeek()
API 2: Can only be used for the USA. Has methods named sendRequest(), weatherDataForWeek()
API 3: Can only be used for the UK. Has methods named getWeather(), getWeatherDataForWeek().
Select the country using the drop-down.
a. Select the API according to the country. API selection is programmatic, which will be decided according to the country selected by the user.
b. Write your code such that, any API can be used without disturbing the business logic.
c. There must be a limit on the number of requests that can be sent. Throw an error if no. of requests exceed the limit.
d. It does not require HTTP calls or APIs. Just create a wrapper for API with the specified method and return some dummy values.
What I have tried:
I have tried doing it using HTTP calls or APIs. How to create a wrapper??