View Source AMI.Action (AMI v0.1.0)
Link to this section Summary
Types
AMI Action type is a map of headers and values. Values are lists because AMI protocol allows to have multiple headers with the same name.
Functions
Add new field to the Action
Create login AMI Action with given parameters.
Create new AMI Action and automatically add ActionID
Create new AMI Action with headers list. If needed to add custom ActionID and skip auto-generated ActionID it can be done here.
Convert AMI Action to string
Link to this section Types
@type t() :: map()
AMI Action type is a map of headers and values. Values are lists because AMI protocol allows to have multiple headers with the same name.
example
Example
iex> {:ok, action} = AMI.Action.new("QueueStatus")
iex> {:ok, action} = AMI.Action.add_field(action, "Queue", "Sales")
{:ok,
%{
"Action" => ["QueueStatus"],
"ActionID" => ["o3webr9ub391qq9hzdrqatztk"],
"Queue" => ["Sales"]
}}Automatically adds ActionID field if not yet exists. If it is required to
have custom ActionID then use new/2 function.
Link to this section Functions
Add new field to the Action
Create login AMI Action with given parameters.
user and passwd will be inserted in login Action and
the Action will be returned as string
Create new AMI Action and automatically add ActionID
Create new AMI Action with headers list. If needed to add custom ActionID and skip auto-generated ActionID it can be done here.
For example:
iex> AMI.Action.new("QueueStatus", [
{"ActionID", "FOO-bar1"},
{"Queue", "Sales"}
])
{:ok,
%{
"Action" => ["QueueStatus"],
"ActionID" => ["FOO-bar1"],
"Queue" => ["Sales"]
}}
Convert AMI Action to string