View Source PhxJsonRpc.Router.Context behaviour (Phoenix JSON RPC v0.4.0)
Context that provides access to the stored route list, jsonrpc version and schema.
Link to this section 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.
Link to this section 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
Link to this section 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.
Link to this section Functions
Builds new context.
examples
Examples
iex> PhxJsonRpc.Router.Context.build(Context, %{"is_rpc" => true})
%PhxJsonRpc.Router.Context{
instance: Context,
meta_data: %{"is_rpc" => true}
}