webmachine helper functions.
Authors: Edwin Fine (efine@silentcircle.com
).
See https://github.com/basho/webmachine/wiki/Resource-Functions
for a
description of the resource functions used in this module.
config() = pl(atom(), term())
A config property list.
debug_info() = ok | {trace, filepath()}
Webmachine: possible returns from init/1.
ejson() = ejson_term()
ejson_collection() = ejson_list() | ejson_dict()
ejson_dict() = ejson_empty_dict() | [ejson_field()]
ejson_empty_dict() = [{}]
ejson_field() = {ejson_field_name(), ejson_term()}
ejson_field_name() = atom() | unicode()
ejson_list() = [ejson_term()]
ejson_scalar() = boolean() | null | number() | unicode()
ejson_term() = ejson_scalar() | ejson_collection()
filepath() = string()
json() = binary()
pl(KT, VT) = [{KT, VT}]
Property list.
unicode() = binary()
wbool_ret() = wret(boolean())
Webmachine: boolean dispatch function return type.
werr() = {error, iolist()}
Webmachine: dispatch function returns this to signal 500 error.
wiolist_ret() = wret(iolist())
Webmachine: iolist dispatch function return type.
Webmachine: dispatch functions return this.
wrq() = #wm_reqdata{}
Webmachine: request data record.
add_seps/2 | |
bad_json_error/0 | |
check_reg_lookup/1 | Check the return of the sc_push_reg_api lookup. |
config_debug/1 | Check if config contains {debug, TraceFilePath} and
return {trace, TraceFilePath} if so, ok if not. |
ejson_to_props/1 | |
enc_headers/1 | |
encode_props/1 | |
get_device_id/1 | |
get_req_hdr/2 | |
get_req_hdr/3 | |
get_svc_id/1 | |
is_debug/2 | |
is_valid_reg_req/1 | |
is_valid_service_id/2 | |
make_service_id_path/1 | |
make_service_id_url/2 | Return service/token URL as binary string. |
make_service_id_urls/2 | Create a list of binary resource URLs from the property lists to be returned. |
malformed_err/2 | |
parse_json/1 | |
pv/3 | |
sanctify/1 |
add_seps(List, Sep) -> any()
bad_json_error() -> any()
check_reg_lookup(Error) -> any()
Check the return of the sc_push_reg_api lookup
config_debug(Config::config()) -> debug_info()
Check if config contains {debug, TraceFilePath}
and
return {trace, TraceFilePath} if so, ok
if not.
ejson_to_props(EJSON) -> any()
enc_headers(T) -> any()
encode_props(Props) -> any()
get_device_id(ReqData::wrq()) -> {ok, any()} | undefined
get_req_hdr(HeaderName::string(), ReqData::wrq()) -> string() | undefined
get_req_hdr(HeaderName::string(), ReqData::wrq(), Default::string()) -> string()
get_svc_id(ReqData::wrq()) -> {ok, any()} | undefined
is_debug(ReqData::wrq(), Cfg::list()) -> boolean()
is_valid_reg_req(EJSON::ejson()) -> boolean()
is_valid_service_id(Svc, Token) -> any()
make_service_id_path(Proplist) -> any()
make_service_id_url(BaseURI, Proplist) -> any()
Return service/token URL as binary string.
make_service_id_urls(ReqData, Proplists) -> any()
Create a list of binary resource URLs from the property lists to be returned. The URLs will be urlencoded.
pv(K, PL, Def) -> any()
sanctify(PathComponent) -> any()