z_fetch (zotonic_core v1.0.0-rc.11)
Link to this section Summary
Functions
Fetch data from an URL. Return the data as a data url.
Map (http) errors to readable format.
Fetch data from an URL. Let modules change the fetch options.
Perform a request and data from an URL. Let modules change the fetch options.
Fetch JSON data from an URL. Let modules change the fetch options. On success, the returned body is parsed with jsxrecord and returned.
Perform a request and fetch JSON data from an URL. Let modules change the fetch options. On success, the returned body is parsed with jsxrecord and returned.
Fetch data from an URL. Let modules change the fetch options.
Fetch the metadata from an URL. Let modules change the fetch options.
Link to this section Functions
Link to this function
as_data_url(Url, Options, Context)
-spec as_data_url(string() | binary() | undefined, z_url_fetch:options(), z:context()) -> {ok, binary()} | {error, term()}.
Link to this function
error_msg(S4xx, Context)
-spec error_msg(integer() | {error, term()}, z:context()) -> binary().
Link to this function
fetch(Url, Options, Context)
-spec fetch(Url, Options, Context) -> z_url_fetch:fetch_result() when Url :: string() | binary(), Options :: z_url_fetch:options(), Context :: z:context().
Link to this function
fetch(Method, Url, Payload, Options, Context)
-spec fetch(Method, Url, Payload, Options, Context) -> Result when Method :: get | post | delete | put, Url :: string() | binary(), Payload :: list() | binary() | map(), Options :: z_url_fetch:options(), Context :: z:context(), Result :: z_url_fetch:fetch_result().
Link to this function
fetch_json(Url, Options, Context)
-spec fetch_json(Url, Options, Context) -> {ok, JSON} | {error, term()} when Url :: string() | binary(), Options :: z_url_fetch:options(), Context :: z:context(), JSON :: term().
Link to this function
fetch_json(Method, Url, Payload, Options, Context)
-spec fetch_json(Method, Url, Payload, Options, Context) -> Result when Method :: get | post | delete | put, Url :: string() | binary(), Payload :: list() | binary() | map(), Options :: z_url_fetch:options(), Context :: z:context(), Result :: {ok, term()} | {error, term()}.
Link to this function
fetch_partial(Url, Options, Context)
-spec fetch_partial(Url, Options, Context) -> z_url_fetch:fetch_result() when Url :: string() | binary(), Options :: z_url_fetch:options(), Context :: z:context().
Link to this function
metadata(Url, Options, Context)
-spec metadata(string() | binary(), z_url_fetch:options(), z:context()) -> {ok, z_url_metadata:metadata()} | {error, term()}.