Documentation ¶
Overview ¶
Package form is an implementation of XEP-0004: Data Forms.
BE ADVISED: This API is unstable and subject to change.
Index ¶
- Constants
- type Data
- type Field
- func Boolean(id string, o ...Option) Field
- func Fixed(o ...Option) Field
- func Hidden(id string, o ...Option) Field
- func Instructions(s string) Field
- func JID(id string, o ...Option) Field
- func JIDMulti(id string, o ...Option) Field
- func ListMulti(id string, o ...Option) Field
- func ListSingle(id string, o ...Option) Field
- func TextMulti(id string, o ...Option) Field
- func TextPrivate(id string, o ...Option) Field
- func TextSingle(id string, o ...Option) Field
- func Title(s string) Field
- type Option
Constants ¶
const NS = "jabber:x:data"
NS is the data forms namespace.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data represents a data form.
func (*Data) MarshalXML ¶
MarshalXML satisfies the xml.Marshaler interface for *Data.
type Field ¶
type Field func(*Data)
An Field is used to define the behavior and appearance of a data form.
func Boolean ¶
Boolean fields enable an entity to gather or provide an either-or choice between two options.
func Fixed ¶
Fixed is intended for data description (e.g., human-readable text such as "section" headers) rather than data gathering or provision.
func Hidden ¶
Hidden fields are not shown by the form-submitting entity, but instead are returned, generally unmodified, with the form.
func Instructions ¶
Instructions adds new textual instructions to the form. Multiple uses of the option result in multiple sets of instructions.
func ListSingle ¶
ListSingle enables an entity to gather or provide a single entry from a list.
func TextPrivate ¶
TextPrivate enables an entity to gather or provide a line of text that should be obscured in the submitting entities interface (eg. with multiple asterisks).
func TextSingle ¶
TextSingle enables an entity to gather or provide a line of text.
type Option ¶
type Option func(*field)
A Option is used to define the behavior and appearance of a form field.
var ( // Required flags the field as required in order for the form to be considered // valid. Required Option = required )
func Desc ¶
Desc provides a natural-language description of the field, intended for presentation in a user-agent (e.g., as a "tool-tip", help button, or explanatory text provided near the field). Desc should not contain newlines (the \n and \r characters), since layout is the responsibility of a user agent. However, it does nothing to prevent them from being added.
func ListField ¶
ListField is one of the values in a list. It has no effect on any non-list field type.
func Value ¶
Value defines the default value for the field (according to the form-processing entity) in a data form of type "form", the data provided by a form-submitting entity in a data form of type "submit", or a data result in a data form of type "result". Fields of type ListMulti, JidMulti, TextMulti, and Hidden may contain more than one Value; all other field types will only use the first Value.