xep0004

package
v0.54.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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"
)
View Source
const FormNamespace = "jabber:x:data"

FormNamespace specifies XEP-0004 namespace constant value.

View Source
const FormType = "FORM_TYPE"

FormType represents form type constant value.

Variables

This section is empty.

Functions

This section is empty.

Types

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
}

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

func (f Fields) ValueForField(fieldName string) string

ValueForField returns the associated value for a given field name.

func (Fields) ValueForFieldOfType

func (f Fields) ValueForFieldOfType(fieldName, typ string) string

ValueForFieldOfType returns the associated value for a given field name and type.

func (Fields) ValuesForField

func (f Fields) ValuesForField(fieldName string) []string

ValuesForField returns all associated values for a given field name.

func (Fields) ValuesForFieldOfType

func (f Fields) ValuesForFieldOfType(fieldName, typ string) []string

ValuesForFieldOfType returns all associated values for a given field name and type.

type Option

type Option struct {
	Label string
	Value string
}

Option represents an individual field option.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL