Applying Single Responsibility Principle when calling a remote Web API
Introduction A requirement of a certain client was as follows Call a third-party web API from an ASP.NET MVC Controller The calling of the web API should work as follows Check if the token sent with the call is valid if the token is not valid, generate a new token and update a database field where token is stored send the token with the call to authorize the request operation This requirement was asked by the customer shortly after completing a course talking about software architecture and design principles. So it was the first practical implementing of the principles learned Implementation The design of the solution tried to stick to the Single Responsibility Principle. So when splitting the requirements above into business classes, it resulted in The responsibility of the controller action method is to call the API only.It has nothing to do with Creating an http client object Check if the authorization parameters are passed The responsibility of the class calling the API only is...