View Source PhxJsonRpc.Router.Context behaviour (Phoenix JSON RPC v0.6.0)
Context that provides access to the stored route list, jsonrpc version and schema.
Summary
Types
Type represents the list of user-defined middleware.
Type represents the list of available routes.
Type represents structure for the rpc context.
Callbacks
Returns the pre-resolved json-schema.
Returns maximum size of the batch.
Returns the middleware group.
Returns the otp application name.
Returns the pre-defined list of routes.
Returns the json rpc version number.
Functions
Builds new context.
Types
@type middleware_list() :: [module()]
Type represents the list of user-defined middleware.
@type route_list() :: [{atom(), PhxJsonRpc.Router.MetaData.t()}]
Type represents the list of available routes.
Type represents structure for the rpc context.
- :instance is typically the self-link
- :meta_data, if present, is a map, containing user-defined params
Callbacks
@callback get_json_schema() :: map()
Returns the pre-resolved json-schema.
@callback get_max_batch_size() :: pos_integer()
Returns maximum size of the batch.
@callback get_middleware() :: middleware_list()
Returns the middleware group.
@callback get_otp_app() :: atom()
Returns the otp application name.
@callback get_routes() :: route_list()
Returns the pre-defined list of routes.
@callback get_version() :: binary()
Returns the json rpc version number.
Functions
Builds new context.
Examples
iex> PhxJsonRpc.Router.Context.build(Context, %{"is_rpc" => true})
%PhxJsonRpc.Router.Context{
instance: Context,
meta_data: %{"is_rpc" => true}
}