Wax.Messages.Templates.Component (wax v1.1.4)

Template Components structure and management

Summary

Functions

Creats a new Body Component struct

Creats a new Button Component struct

Creats a new Header Component struct

Validates that the button parameters follow the rules and constraints of the Cloud API

Types

button_type()

@type button_type() :: :catalog | :quick_reply | :url

component_type()

@type component_type() :: :header | :body | :button

t()

@type t() :: %Wax.Messages.Templates.Component{
  index: 0..9,
  parameters: [Wax.Messages.Templates.Parameter.t()],
  sub_type: button_type(),
  type: component_type()
}

Functions

new_body(params)

@spec new_body([Wax.Messages.Templates.Parameter.t()]) :: t()

Creats a new Body Component struct

new_button(sub_type, index, params)

@spec new_button(button_type(), 0..9, [Wax.Messages.Templates.Parameter.t()]) :: t()

Creats a new Button Component struct

new_header(params)

@spec new_header([Wax.Messages.Templates.Parameter.t()]) :: t()

Creats a new Header Component struct

validate_button_params(atom, params)

@spec validate_button_params(button_type(), Keyword.t()) :: :ok | {:error, String.t()}

Validates that the button parameters follow the rules and constraints of the Cloud API