Documentation ¶
Index ¶
Constants ¶
const ( // Boolean represents a 'boolean' form field. Boolean = "boolean" // Fixed represents a 'fixed' form field. Fixed = "fixed" // Hidden represents a 'hidden' form field. Hidden = "hidden" // JidMulti represents a 'jid-multi' form field. JidMulti = "jid-multi" // JidSingle represents a 'jid-single' form field. JidSingle = "jid-single" // ListMulti represents a 'list-multi' form field. ListMulti = "list-multi" // ListSingle represents a 'list-single' form field. ListSingle = "list-single" // TextMulti represents a 'text-multi' form field. TextMulti = "text-multi" // TextPrivate represents a 'text-private' form field. TextPrivate = "text-private" // TextSingle represents a 'text-single' form field. TextSingle = "text-single" )
const ( // Form represents a 'form' data form. Form = "form" // Submit represents a 'submit' data form. Submit = "submit" // Cancel represents a 'cancel' data form. Cancel = "cancel" // Result represents a 'result' data form. Result = "result" )
const ( // StringDataType datatype represents character strings in XML. StringDataType = "xs:string" // BooleanDataType represents the values of two-valued logic. BooleanDataType = "xs:boolean" // DecimalDataType represents a subset of the real numbers, which can be represented by decimal numerals. DecimalDataType = "xs:decimal" // FloatDataType is patterned after the IEEE single-precision 32-bit floating point datatype FloatDataType = "xs:float" // DoubleDataType is patterned after the IEEE double-precision 64-bit floating point datatype. DoubleDataType = "xs:double" // DurationDataType is a datatype that represents durations of time. DurationDataType = "xs:duration" // DateTimeDataType represents instants of time, optionally marked with a particular time zone offset. DateTimeDataType = "xs:dateTime" // HexBinaryDataType represents arbitrary hex-encoded binary data. HexBinaryDataType = "xs:hexBinary" // Base64BinaryDataType represents arbitrary Base64-encoded binary data Base64BinaryDataType = "xs:base64Binary" )
const FormNamespace = "jabber:x:data"
FormNamespace specifies XEP-0004 namespace constant value.
const FormType = "FORM_TYPE"
FormType represents form type constant value.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicValidator ¶ added in v0.62.0
type BasicValidator struct{}
BasicValidator represents basic validation type.
func (*BasicValidator) Element ¶ added in v0.62.0
func (v *BasicValidator) Element() stravaganza.Element
Element satisfies Validator interface.
type DataForm ¶
type DataForm struct { Type string Title string Instructions string Fields Fields Reported Fields Items []Fields }
DataForm represents a form that could be use for gathering data as well as for reporting data returned from a search.
func NewFormFromElement ¶
func NewFormFromElement(elem stravaganza.Element) (*DataForm, error)
NewFormFromElement returns a new data form entity reading it from it's XMPP representation.
func (*DataForm) Element ¶
func (f *DataForm) Element() stravaganza.Element
Element returns data form XML representation.
type Field ¶
type Field struct { Var string Required bool Type string Label string Description string Values []string Options []Option Validate *Validate }
Field represents a field of a form. The field could be used to represent a question to complete, a completed question or a data returned from a search.
func NewFieldFromElement ¶
func NewFieldFromElement(elem stravaganza.Element) (*Field, error)
NewFieldFromElement returns a new form field entity reading it from it's XML representation.
func (*Field) Element ¶
func (f *Field) Element() stravaganza.Element
Element returns form field XML representation.
type Fields ¶
type Fields []Field
Fields represent a set of form fields
func (Fields) ValueForField ¶
ValueForField returns the associated value for a given field name.
func (Fields) ValueForFieldOfType ¶
ValueForFieldOfType returns the associated value for a given field name and type.
func (Fields) ValuesForField ¶
ValuesForField returns all associated values for a given field name.
func (Fields) ValuesForFieldOfType ¶
ValuesForFieldOfType returns all associated values for a given field name and type.
type OpenValidator ¶ added in v0.62.0
type OpenValidator struct{}
OpenValidator represents open validation type.
func (*OpenValidator) Element ¶ added in v0.62.0
func (v *OpenValidator) Element() stravaganza.Element
Element satisfies Validator interface.
type RangeValidator ¶ added in v0.62.0
RangeValidator represents range validation type.
func (*RangeValidator) Element ¶ added in v0.62.0
func (v *RangeValidator) Element() stravaganza.Element
Element satisfies Validator interface.
type RegExValidator ¶ added in v0.62.0
type RegExValidator struct {
RegEx string
}
RegExValidator represents regex validation type.
func (*RegExValidator) Element ¶ added in v0.62.0
func (v *RegExValidator) Element() stravaganza.Element
Element satisfies Validator interface.
type Validate ¶ added in v0.62.0
Validate represents a field validation type.
func (*Validate) Element ¶ added in v0.62.0
func (v *Validate) Element() stravaganza.Element
Element returns validation type element representation.
type Validator ¶ added in v0.62.0
type Validator interface {
Element() stravaganza.Element
}
Validator defines validation type interface.