`function` is sort of an awkward name. I would expect something named `function` to be a function, not an object for reading a web page. How about `apiCall`?