public JsonPlaceholderController()
        {
            // Create client here initially and then move to creating it in Startup and passing through to controller using Dependency Injection
            IJsonPlaceholderService jsonPlaceholderService = new JsonPlaceholderHttpService("https://jsonplaceholder.typicode.com/");

            _jsonPlaceholderClient = new JsonPlaceholderClient(jsonPlaceholderService);
            // https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1
            // Then inject a logger and use to log requests
        }
 public JsonPlaceholderService(IJsonPlaceholderClient jsonPlaceholderClient)
 {
     _jsonPlaceholderClient = jsonPlaceholderClient;
 }
Example #3
0
 public AlbumsController(IJsonPlaceholderClient service, IMapper mapper)
 {
     this.service = service;
     this.mapper  = mapper;
 }
Example #4
0
 public RunpathApplicationService(IJsonPlaceholderClient jsonPlaceholderClient)
 {
     this.jsonPlaceholderClient = jsonPlaceholderClient;
 }
Example #5
0
 public PostsController(IMapper mapper, IJsonPlaceholderClient client)
 {
     this.mapper = mapper;
     this.client = client;
 }
Example #6
0
 public JsonPlaceholderController(IJsonPlaceholderClient jpClient)
 {
     _jpClient = jpClient ?? throw new ArgumentNullException(nameof(jpClient));
 }