cert_der() = binary()
abstract datatype: client()
client_opts() = #{identity => {pkcs12_der(), password()}, follow_redirects => boolean() | non_neg_integer(), additional_root_certs => [cert_der()], use_built_in_root_certs => boolean()}
default true
err() = #{code := atom(), reason := binary()}
header() = {binary(), binary()}
method() = options | get | post | put | delete | head | trace | connect | patch
password() = binary()
pkcs12_der() = binary()
req() = #{url := url(), method := method(), headers => [header()], body => binary(), timeout => non_neg_integer()}
milliseconds
req_opts() = #{headers => [header()], body => binary(), timeout => non_neg_integer()}
milliseconds
resp() = #{status := 100..599, body := binary(), headers := [header()]}
url() = binary()
close_client/1 | Close a client and idle connections in its pool. |
get/2 | Convenience wrapper for req/2 . |
get/3 | Convenience wrapper for req/2 . |
make_client/0 | |
make_client/1 | |
post/3 | Convenience wrapper for req/2 . |
req/2 | Make a synchronous request. |
req_async/4 | Make an asynchronous request. |
start_client/1 | Equivalent to start_client(Name, #{}). |
start_client/2 | Start a client registered under Name . |
stop_client/1 | Unregisters and calls close_client/1 on a named client. |
close_client(Client::client()) -> ok
Close a client and idle connections in its pool. Returns immediately, but the connection pool will not be cleaned up until all in-flight requests for this client have returned.
You do not have to call this function, since the client will automatically be cleaned up when it is garbage collected by the VM.
Fails with reason badarg if the client has already been closed.Convenience wrapper for req/2
.
get(Client::client() | atom(), Url::url(), Opts::req_opts()) -> {ok, resp()} | {error, err()}
Convenience wrapper for req/2
.
make_client() -> client()
make_client(Opts::client_opts()) -> client()
post(Client::client() | atom(), Url::url(), Opts::req_opts()) -> {ok, resp()} | {error, err()}
Convenience wrapper for req/2
.
Make a synchronous request.
Fails with reason badarg if any argument is invalid or if the client has already been closed.Make an asynchronous request.
Sends {erqwest_response, Ref, {ok, resp()} | {error, err()}}
to Pid
.
start_client(Name::atom()) -> ok
Equivalent to start_client(Name, #{}).
start_client(Name::atom(), Opts::client_opts()) -> ok
Start a client registered under Name
. The implemenation uses
persistent_term
and is not intended for clients that will be frequently
started and stopped. For such uses see make_client/1
.
stop_client(Name::atom()) -> ok
Unregisters and calls close_client/1
on a named client. This is
potentially expensive and should not be called frequently, see start_client/2
for more details.
Generated by EDoc