buoy (buoy v0.2.6)

View Source

Summary

Types

body/0

-type body() :: undefined | iodata().

buoy_opts/0

-type buoy_opts() :: #{headers => headers(), body => body(), pid => pid(), timeout => non_neg_integer()}.

buoy_resp/0

-type buoy_resp() ::
          #buoy_resp{state :: body | done,
                     body :: undefined | binary(),
                     content_length :: undefined | non_neg_integer() | chunked,
                     headers :: undefined | [binary()],
                     reason :: undefined | binary(),
                     status_code :: undefined | 100..505}.

buoy_url/0

-type buoy_url() ::
          #buoy_url{host :: host(),
                    hostname :: hostname(),
                    path :: path(),
                    port :: inet:port_number(),
                    protocol :: protocol_http()}.

error/0

-type error() :: {error, term()}.

headers/0

-type headers() :: [{iodata(), iodata()}].

host/0

-type host() :: binary().

hostname/0

-type hostname() :: binary().

method/0

-type method() :: get | head | post | put | {custom, binary()}.

path/0

-type path() :: binary().

protocol_http/0

-type protocol_http() :: http | https.

Functions

async_custom(Verb, Url, BuoyOpts)

-spec async_custom(binary(), buoy_url(), buoy_opts()) -> {ok, shackle:request_id()} | error().

async_get(Url, BuoyOpts)

-spec async_get(buoy_url(), buoy_opts()) -> {ok, shackle:request_id()} | error().

async_head(Url, BuoyOpts)

-spec async_head(buoy_url(), buoy_opts()) -> {ok, shackle:request_id()} | error().

async_post(Url, BuoyOpts)

-spec async_post(buoy_url(), buoy_opts()) -> {ok, shackle:request_id()} | error().

async_put(Url, BuoyOpts)

-spec async_put(buoy_url(), buoy_opts()) -> {ok, shackle:request_id()} | error().

async_request(Method, Buoy_url, BuoyOpts)

-spec async_request(method(), buoy_url(), buoy_opts()) -> {ok, shackle:request_id()} | error().

custom(Verb, Url, BuoyOpts)

-spec custom(binary(), buoy_url(), buoy_opts()) -> {ok, buoy_resp()} | error().

get(Url, BuoyOpts)

-spec get(buoy_url(), buoy_opts()) -> {ok, buoy_resp()} | error().

head(Url, BuoyOpts)

-spec head(buoy_url(), buoy_opts()) -> {ok, buoy_resp()} | error().

post(Url, BuoyOpts)

-spec post(buoy_url(), buoy_opts()) -> {ok, buoy_resp()} | error().

put(Url, BuoyOpts)

-spec put(buoy_url(), buoy_opts()) -> {ok, buoy_resp()} | error().

receive_response(RequestId)

-spec receive_response(shackle:request_id()) -> {ok, term()} | error().

request(Method, Buoy_url, BuoyOpts)

-spec request(method(), buoy_url(), buoy_opts()) -> {ok, buoy_resp()} | error().