If the call to any of this functions succeed (because they where previously enabled),
the api will auto-register itself in the websocket_api_connection/http_api_connection and will return an api_id_type.
- Create class `api_base` to be base class of `api<T>`, and `typedef shared_ptr<api_base> api_ptr`
- Create function `api_base::as<T>()` to allow simple downcast to `api<T>`
- Create class `any_api` to contain an API which has been returned from the remote end, but not yet cast with `as<T>`
- `to_generic()` override allowing remote API to return `api_ptr`, thus we need not know the type of the returned API at compile time
- Allow API's to be referenced by name, if we call with a string API name in the JSON the framework calls get_api_by_name on API 1 to determine the API ID