telegram_bot_api_http behaviour (telegram_bot_api v2.9.0)
View SourceSummary
Types
Base URL of the HTTP(S) API endpoint. This address is used for all API requests.
Types
-type 'HttpOption'() :: {timeout, timeout()} | {connect_timeout, timeout()} | {ssl, [ssl_ls_option()]} | {autoredirect, boolean()} | {proxy_auth, {string(), string()}} | {version, 'HttpVersion'()} | {relaxed, boolean()}.
-type 'HttpVersion'() :: string().
-type http_endpoint() :: binary().
Base URL of the HTTP(S) API endpoint. This address is used for all API requests.
Examples:
<<"https://api.telegram.org">>
<<"https://mysite">>
<<"http://mysite:8081">>
<<"http://1.2.3.4:8081">>
-type http_option() :: ['HttpOption'(), ...].
-type http_port() :: pos_integer().
-type http_timeout() :: timeout().
-type ipv4() :: {0..255, 0..255, 0..255, 0..255}.
-type module_name() :: telegram_bot_api_http | atom().
-type 'OptionRequest'() :: {sync, boolean()} | {stream, 'StreamTo'()} | {body_format, 'BodyFormat'()} | {full_result, boolean()} | {headers_as_is, boolean()} | {socket_opts, [term()]} | {receiver, 'Receiver'()} | {ipv6_host_with_brackets, boolean()}.
-type option_request() :: ['OptionRequest'(), ...].
-type reply_tag() :: reference() | nonempty_improper_list(alias, reference()) | nonempty_improper_list(nonempty_improper_list(alias, reference()), term()).
-type 'StreamTo'() :: none | self | {self, once} | file:name_all().
-type ssl_ls_option() :: term().
-type state() :: #{token := binary(), http_module := module_name(), http_option := http_option(), option_request := ['OptionRequest'(), ...], http_endpoint := http_endpoint(), http_proxy => http_proxy(), _ => term()}.
Callbacks
-callback set_proxy(HttpProfile :: atom(), HttpProxy :: http_proxy()) -> ok | {error, Reason :: term()}.
-callback terminate(State :: state()) -> ok.
Functions
-spec set_proxy(HttpProfile :: atom(), HttpProxy :: http_proxy()) -> ok | {error, Reason :: term()}.
-spec terminate(State :: state()) -> ok.