Pass server object into API objects

This avoids using the global $wp_json_server, which helps with internal routing
and usage of the API functions.