ExMicrosoftBot.Client (ex_microsoftbot v3.0.0)
This module contains low-level functions for interacting with the Bot Framework API.
For most use-cases and a friendlier API, each of the individual endpoints' client modules should be used instead:
Still, this module exports functions that can help perform arbitrary, pre-authorized API calls, for example for fetching assets or calling new endpoints that this library hasn't implemented yet.
Link to this section Summary
Functions
Returns the headers required for an authorized JSON request to the BotFramework API.
DELETEs the given URI with an authorized request & standard options, logging the result.
Helper that deserializes a request response using the given deserializing
function if the given response
has a successful status. Otherwise, returns
an error tuple instead.
GETs the given URI with an authorized request & standard options, logging the result.
Returns an options Keyword for request functions. Merges the default options
(from config) with the given extra
.
POSTs the given body to the given URI with an authorized request & standard options, logging the result.
PUTs the given body to the given URI with an authorized request & standard options, logging the result.
Link to this section Types
error_type()
Specs
Link to this section Functions
authed_headers(uri)
Specs
Returns the headers required for an authorized JSON request to the BotFramework API.
delete(url, extra_opts \\ [])
Specs
delete(url :: String.t(), extra_opts :: keyword()) :: HTTPoison.Response.t()
DELETEs the given URI with an authorized request & standard options, logging the result.
deserialize_response(arg, deserialize_fn)
Specs
deserialize_response( response :: HTTPoison.Response.t(), (String.t() -> deserialized) ) :: {:ok, deserialized | String.t()} | {:error, integer(), String.t()} when deserialized: any()
Helper that deserializes a request response using the given deserializing
function if the given response
has a successful status. Otherwise, returns
an error tuple instead.
The deserializing function is skipped when there is no body; an empty string is returned instead.
get(url, extra_opts \\ [])
Specs
get(url :: String.t(), extra_opts :: keyword()) :: HTTPoison.Response.t()
GETs the given URI with an authorized request & standard options, logging the result.
opts(extra \\ [])
Specs
Returns an options Keyword for request functions. Merges the default options
(from config) with the given extra
.
post(url, body, extra_opts \\ [])
Specs
post(url :: String.t(), body :: String.t() | map(), extra_opts :: keyword()) :: HTTPoison.Response.t()
POSTs the given body to the given URI with an authorized request & standard options, logging the result.
If a map, the body is JSON encoded before POSTing. Will raise if encoding fails.
put(url, body, extra_opts \\ [])
Specs
put(url :: String.t(), body :: String.t() | map(), extra_opts :: keyword()) :: HTTPoison.Response.t()
PUTs the given body to the given URI with an authorized request & standard options, logging the result.
If a map, the body is JSON encoded before PUTing. Will raise if encoding fails.