xmlgen

package
v0.0.0-...-1b5bc38 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAstDoc

func BuildAstDoc(doc *Docs, d *AstDoc)

func BuildModel

func BuildModel(in *DocModel, out *Model)

func Dedup

func Dedup(arr interface{}, cond func(int) string)

func Filter

func Filter(arr interface{}, cond func(int) bool)

func GoFormatter

func GoFormatter(f *File) (err error)

func MustParseTemplates

func MustParseTemplates() *template.Template

func ParamName

func ParamName(s string) string

func ReportFile

func ReportFile(f *File)

Types

type AGICommand

type AGICommand struct {
	Name        string
	Module      string
	Syntax      *Syntax
	Synopsis    string
	Description string
	SeeAlso     []*SeeAlso
}

func (AGICommand) StructName

func (a AGICommand) StructName() string

type AgiDocModel

type AgiDocModel struct {
	Name        string            `xml:"name,attr" json:"name,omitempty"`
	Language    string            `xml:"language,attr" json:"language,omitempty"`
	Synopsis    string            `xml:"synopsis" json:"synopsis,omitempty"`
	Syntax      *SyntaxDocModel   `xml:"syntax" json:"syntax,omitempty"`
	SeeAlso     *SeeAlsoModel     `xml:"see-also" json:"seeAlso,omitempty"`
	Description *DescriptionModel `xml:"description" json:"description,omitempty"`
}

type Annotation

type Annotation interface {
	Name() string
}

type AstDoc

type AstDoc struct {
	Actions []*Type
	Events  []*Type
}

type DescriptionModel

type DescriptionModel struct {
	//Text         string            `xml:",chardata"`
	Para         []ParaRaw          `xml:"para" json:"para,omitempty"`
	EnumList     *EnumListModel     `xml:"enumlist" json:"enumList,omitempty"`
	VariableList *VariableListModel `xml:"variablelist" json:"variableList,omitempty"`
	Note         *struct {
		Text string `xml:",chardata"`
		Para struct {
			Text     string `xml:",chardata"`
			Filename string `xml:"filename"`
		} `xml:"para"`
	} `xml:"note"`
}

type DocModel

type DocModel struct {
	XMLName      xml.Name              `xml:"docs" json:"xmlName,omitempty"`
	Agi          []*AgiDocModel        `xml:"agi" json:"agi,omitempty"`
	Manager      []*ManagerActionModel `xml:"manager" json:"manager,omitempty"`
	ManagerEvent []*ManagerEventModel  `xml:"managerEvent" json:"managerEvent,omitempty"`
}

func (*DocModel) AGIModel

func (d *DocModel) AGIModel(in *AgiDocModel) *AGICommand

func (*DocModel) Description

func (d *DocModel) Description(in *DescriptionModel) string

func (*DocModel) ManagerEventModel

func (d *DocModel) ManagerEventModel(in *ManagerEventModel) *ManagerEvent

func (*DocModel) ManagerModel

func (d *DocModel) ManagerModel(in *ManagerActionModel) *ManagerAction

func (*DocModel) Parameter

func (*DocModel) Parameter(in *SyntaxParameterDocModel) *Parameter

func (*DocModel) SeeAlso

func (d *DocModel) SeeAlso(in *SeeAlsoModel) (o []*SeeAlso)

func (*DocModel) Synopsis

func (d *DocModel) Synopsis(in string) string

func (*DocModel) Syntax

func (d *DocModel) Syntax(in *SyntaxDocModel) *Syntax

type Docs

type Docs struct {
	XMLName    xml.Name `xml:"docs"`
	Text       string   `xml:",chardata"`
	Xi         string   `xml:"xi,attr"`
	ConfigInfo []struct {
		Text        string `xml:",chardata"`
		Name        string `xml:"name,attr"`
		Language    string `xml:"language,attr"`
		Synopsis    string `xml:"synopsis"`
		Description struct {
			Text string `xml:",chardata"`
			Para []struct {
				Text     string   `xml:",chardata"`
				Emphasis []string `xml:"emphasis"`
				Literal  []string `xml:"literal"`
				Filename string   `xml:"filename"`
			} `xml:"para"`
			Warning struct {
				Text string `xml:",chardata"`
				Para struct {
					Text     string `xml:",chardata"`
					Emphasis string `xml:"emphasis"`
				} `xml:"para"`
			} `xml:"warning"`
			Note struct {
				Text string `xml:",chardata"`
				Para string `xml:"para"`
			} `xml:"note"`
			Enumlist []struct {
				Text string `xml:",chardata"`
				Enum []struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para string `xml:"para"`
				} `xml:"enum"`
			} `xml:"enumlist"`
		} `xml:"description"`
		ConfigFile struct {
			Text         string `xml:",chardata"`
			Name         string `xml:"name,attr"`
			ConfigObject []struct {
				Text         string `xml:",chardata"`
				Name         string `xml:"name,attr"`
				Synopsis     string `xml:"synopsis"`
				ConfigOption []struct {
					Text        string `xml:",chardata"`
					Name        string `xml:"name,attr"`
					Default     string `xml:"default,attr"`
					Synopsis    string `xml:"synopsis"`
					Description struct {
						Text string `xml:",chardata"`
						Para []struct {
							Text        string   `xml:",chardata"`
							Literal     []string `xml:"literal"`
							Filename    []string `xml:"filename"`
							Replaceable []string `xml:"replaceable"`
							Variable    string   `xml:"variable"`
							Emphasis    []string `xml:"emphasis"`
							Astcli      string   `xml:"astcli"`
						} `xml:"para"`
						Enumlist struct {
							Text string `xml:",chardata"`
							Enum []struct {
								Text string `xml:",chardata"`
								Name string `xml:"name,attr"`
								Para []struct {
									Text        string   `xml:",chardata"`
									Literal     []string `xml:"literal"`
									Replaceable string   `xml:"replaceable"`
									Emphasis    string   `xml:"emphasis"`
								} `xml:"para"`
								Enumlist struct {
									Text string `xml:",chardata"`
									Enum []struct {
										Text string `xml:",chardata"`
										Name string `xml:"name,attr"`
										Para string `xml:"para"`
									} `xml:"enum"`
								} `xml:"enumlist"`
								Note struct {
									Text string `xml:",chardata"`
									Para struct {
										Text    string `xml:",chardata"`
										Literal string `xml:"literal"`
									} `xml:"para"`
								} `xml:"note"`
							} `xml:"enum"`
						} `xml:"enumlist"`
						Note []struct {
							Text string `xml:",chardata"`
							Para []struct {
								Text        string   `xml:",chardata"`
								Variable    string   `xml:"variable"`
								Literal     []string `xml:"literal"`
								Replaceable []string `xml:"replaceable"`
								Filename    string   `xml:"filename"`
							} `xml:"para"`
						} `xml:"note"`
						Include struct {
							Text     string `xml:",chardata"`
							Xpointer string `xml:"xpointer,attr"`
						} `xml:"include"`
						Warning struct {
							Text string `xml:",chardata"`
							Para struct {
								Text    string `xml:",chardata"`
								Literal string `xml:"literal"`
							} `xml:"para"`
						} `xml:"warning"`
						Variablelist struct {
							Text     string `xml:",chardata"`
							Variable []struct {
								Text string `xml:",chardata"`
								Name string `xml:"name,attr"`
								Para struct {
									Text     string `xml:",chardata"`
									Variable string `xml:"variable"`
								} `xml:"para"`
							} `xml:"variable"`
						} `xml:"variablelist"`
						Example []struct {
							Text  string `xml:",chardata"`
							Title string `xml:"title,attr"`
						} `xml:"example"`
					} `xml:"description"`
					SeeAlso struct {
						Text string `xml:",chardata"`
						Ref  []struct {
							Text string `xml:",chardata"`
							Type string `xml:"type,attr"`
						} `xml:"ref"`
					} `xml:"see-also"`
					Syntax struct {
						Text      string `xml:",chardata"`
						Argsep    string `xml:"argsep,attr"`
						Parameter []struct {
							Text       string `xml:",chardata"`
							Name       string `xml:"name,attr"`
							Required   string `xml:"required,attr"`
							Para       string `xml:"para"`
							Optionlist struct {
								Text   string `xml:",chardata"`
								Option []struct {
									Text string `xml:",chardata"`
									Name string `xml:"name,attr"`
									Para string `xml:"para"`
								} `xml:"option"`
							} `xml:"optionlist"`
							Argument struct {
								Text     string `xml:",chardata"`
								Name     string `xml:"name,attr"`
								Required string `xml:"required,attr"`
								Para     string `xml:"para"`
							} `xml:"argument"`
						} `xml:"parameter"`
					} `xml:"syntax"`
				} `xml:"configOption"`
				Description struct {
					Text    string `xml:",chardata"`
					Include struct {
						Text     string `xml:",chardata"`
						Xpointer string `xml:"xpointer,attr"`
					} `xml:"include"`
					Para []struct {
						Text        string   `xml:",chardata"`
						Literal     []string `xml:"literal"`
						Replaceable []string `xml:"replaceable"`
						Emphasis    []string `xml:"emphasis"`
						Filename    string   `xml:"filename"`
					} `xml:"para"`
					Enumlist struct {
						Text string `xml:",chardata"`
						Enum []struct {
							Text string `xml:",chardata"`
							Name string `xml:"name,attr"`
							Para string `xml:"para"`
						} `xml:"enum"`
					} `xml:"enumlist"`
					Note struct {
						Text string `xml:",chardata"`
						Para struct {
							Text     string `xml:",chardata"`
							Emphasis string `xml:"emphasis"`
							Filename string `xml:"filename"`
						} `xml:"para"`
					} `xml:"note"`
				} `xml:"description"`
			} `xml:"configObject"`
		} `xml:"configFile"`
	} `xml:"configInfo"`
	Manager []struct {
		Text     string `xml:",chardata"`
		Name     string `xml:"name,attr"`
		Language string `xml:"language,attr"`
		Module   string `xml:"module,attr"`
		Synopsis string `xml:"synopsis"`
		Syntax   struct {
			Text    string `xml:",chardata"`
			Include []struct {
				Text     string `xml:",chardata"`
				Xpointer string `xml:"xpointer,attr"`
			} `xml:"include"`
			Parameter []struct {
				Text     string `xml:",chardata"`
				Name     string `xml:"name,attr"`
				Required string `xml:"required,attr"`
				Default  string `xml:"default,attr"`
				Para     []struct {
					Text        string   `xml:",chardata"`
					Replaceable []string `xml:"replaceable"`
					Literal     []string `xml:"literal"`
					Variable    string   `xml:"variable"`
					Filename    string   `xml:"filename"`
				} `xml:"para"`
				Enumlist []struct {
					Text string `xml:",chardata"`
					Enum []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
						Para struct {
							Text        string `xml:",chardata"`
							Replaceable string `xml:"replaceable"`
						} `xml:"para"`
						Note struct {
							Text string `xml:",chardata"`
							Para struct {
								Text    string `xml:",chardata"`
								Literal string `xml:"literal"`
							} `xml:"para"`
						} `xml:"note"`
						Enumlist struct {
							Text string `xml:",chardata"`
							Enum []struct {
								Text string `xml:",chardata"`
								Name string `xml:"name,attr"`
								Para []struct {
									Text    string `xml:",chardata"`
									Literal string `xml:"literal"`
								} `xml:"para"`
								Include struct {
									Text     string `xml:",chardata"`
									Xpointer string `xml:"xpointer,attr"`
								} `xml:"include"`
							} `xml:"enum"`
						} `xml:"enumlist"`
					} `xml:"enum"`
				} `xml:"enumlist"`
				Warning struct {
					Text string `xml:",chardata"`
					Para struct {
						Text     string   `xml:",chardata"`
						Variable []string `xml:"variable"`
					} `xml:"para"`
				} `xml:"warning"`
				Include struct {
					Text     string `xml:",chardata"`
					Xpointer string `xml:"xpointer,attr"`
				} `xml:"include"`
			} `xml:"parameter"`
		} `xml:"syntax"`
		Description struct {
			Text string `xml:",chardata"`
			Para []struct {
				Text        string   `xml:",chardata"`
				Variable    string   `xml:"variable"`
				Literal     []string `xml:"literal"`
				Replaceable []string `xml:"replaceable"`
			} `xml:"para"`
			Note struct {
				Text string `xml:",chardata"`
				Para struct {
					Text        string   `xml:",chardata"`
					Literal     []string `xml:"literal"`
					Replaceable []string `xml:"replaceable"`
				} `xml:"para"`
			} `xml:"note"`
			Variablelist struct {
				Text     string `xml:",chardata"`
				Variable struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para string `xml:"para"`
				} `xml:"variable"`
			} `xml:"variablelist"`
			Warning struct {
				Text string `xml:",chardata"`
				Para struct {
					Text    string `xml:",chardata"`
					Literal string `xml:"literal"`
				} `xml:"para"`
			} `xml:"warning"`
		} `xml:"description"`
		SeeAlso struct {
			Text string `xml:",chardata"`
			Ref  []struct {
				Text   string `xml:",chardata"`
				Type   string `xml:"type,attr"`
				Module string `xml:"module,attr"`
			} `xml:"ref"`
		} `xml:"see-also"`
		Responses struct {
			Text         string `xml:",chardata"`
			ListElements struct {
				Text    string `xml:",chardata"`
				Include []struct {
					Text     string `xml:",chardata"`
					Xpointer string `xml:"xpointer,attr"`
				} `xml:"include"`
				ManagerEvent struct {
					Text                 string `xml:",chardata"`
					Language             string `xml:"language,attr"`
					Name                 string `xml:"name,attr"`
					ManagerEventInstance struct {
						Text     string `xml:",chardata"`
						Class    string `xml:"class,attr"`
						Synopsis string `xml:"synopsis"`
						Syntax   struct {
							Text            string `xml:",chardata"`
							ChannelSnapshot string `xml:"channel_snapshot"`
						} `xml:"syntax"`
					} `xml:"managerEventInstance"`
				} `xml:"managerEvent"`
			} `xml:"list-elements"`
			Include struct {
				Text     string `xml:",chardata"`
				Xpointer string `xml:"xpointer,attr"`
			} `xml:"include"`
			ManagerEvent struct {
				Text                 string `xml:",chardata"`
				Name                 string `xml:"name,attr"`
				Language             string `xml:"language,attr"`
				ManagerEventInstance struct {
					Text     string `xml:",chardata"`
					Class    string `xml:"class,attr"`
					Synopsis string `xml:"synopsis"`
					Syntax   struct {
						Text      string `xml:",chardata"`
						Parameter []struct {
							Text string `xml:",chardata"`
							Name string `xml:"name,attr"`
							Para string `xml:"para"`
						} `xml:"parameter"`
						BridgeSnapshot string `xml:"bridge_snapshot"`
					} `xml:"syntax"`
				} `xml:"managerEventInstance"`
			} `xml:"managerEvent"`
		} `xml:"responses"`
	} `xml:"manager"`
	Function []struct {
		Text     string `xml:",chardata"`
		Name     string `xml:"name,attr"`
		Language string `xml:"language,attr"`
		Module   string `xml:"module,attr"`
		Synopsis string `xml:"synopsis"`
		Syntax   struct {
			Text      string `xml:",chardata"`
			Argsep    string `xml:"argsep,attr"`
			Parameter []struct {
				Text     string `xml:",chardata"`
				Name     string `xml:"name,attr"`
				Required string `xml:"required,attr"`
				Argsep   string `xml:"argsep,attr"`
				Multiple string `xml:"multiple,attr"`
				Default  string `xml:"default,attr"`
				Para     []struct {
					Text        string   `xml:",chardata"`
					Literal     []string `xml:"literal"`
					Replaceable []string `xml:"replaceable"`
					Filename    string   `xml:"filename"`
					Emphasis    string   `xml:"emphasis"`
				} `xml:"para"`
				Enumlist struct {
					Text string `xml:",chardata"`
					Enum []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
						Para []struct {
							Text        string   `xml:",chardata"`
							Replaceable []string `xml:"replaceable"`
							Literal     []string `xml:"literal"`
							Include     struct {
								Text     string `xml:",chardata"`
								Xpointer string `xml:"xpointer,attr"`
							} `xml:"include"`
							Filename string   `xml:"filename"`
							Emphasis []string `xml:"emphasis"`
						} `xml:"para"`
						Enumlist struct {
							Text string `xml:",chardata"`
							Enum []struct {
								Text string `xml:",chardata"`
								Name string `xml:"name,attr"`
								Para struct {
									Text    string `xml:",chardata"`
									Literal string `xml:"literal"`
								} `xml:"para"`
							} `xml:"enum"`
						} `xml:"enumlist"`
						Warning struct {
							Text string `xml:",chardata"`
							Para string `xml:"para"`
						} `xml:"warning"`
						Note struct {
							Text string `xml:",chardata"`
							Para string `xml:"para"`
						} `xml:"note"`
					} `xml:"enum"`
					ConfigOptionToEnum struct {
						Text    string `xml:",chardata"`
						Include struct {
							Text     string `xml:",chardata"`
							Xpointer string `xml:"xpointer,attr"`
						} `xml:"include"`
					} `xml:"configOptionToEnum"`
				} `xml:"enumlist"`
				Optionlist struct {
					Text   string `xml:",chardata"`
					Option []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
						Para []struct {
							Text        string   `xml:",chardata"`
							Literal     []string `xml:"literal"`
							Replaceable []string `xml:"replaceable"`
						} `xml:"para"`
						Argument []struct {
							Text     string `xml:",chardata"`
							Name     string `xml:"name,attr"`
							Required string `xml:"required,attr"`
							Para     string `xml:"para"`
						} `xml:"argument"`
					} `xml:"option"`
				} `xml:"optionlist"`
				Argument []struct {
					Text     string `xml:",chardata"`
					Name     string `xml:"name,attr"`
					Required string `xml:"required,attr"`
				} `xml:"argument"`
				Include struct {
					Text     string `xml:",chardata"`
					Xpointer string `xml:"xpointer,attr"`
				} `xml:"include"`
				Warning struct {
					Text string `xml:",chardata"`
					Para struct {
						Text     string   `xml:",chardata"`
						Variable []string `xml:"variable"`
					} `xml:"para"`
				} `xml:"warning"`
				Note struct {
					Text string `xml:",chardata"`
					Para string `xml:"para"`
				} `xml:"note"`
			} `xml:"parameter"`
		} `xml:"syntax"`
		Description struct {
			Text string `xml:",chardata"`
			Para []struct {
				Text        string   `xml:",chardata"`
				Replaceable []string `xml:"replaceable"`
				Literal     []string `xml:"literal"`
				Variable    []string `xml:"variable"`
				Filename    []string `xml:"filename"`
				Emphasis    string   `xml:"emphasis"`
			} `xml:"para"`
			Warning struct {
				Text string `xml:",chardata"`
				Para struct {
					Text     string   `xml:",chardata"`
					Emphasis []string `xml:"emphasis"`
					Literal  string   `xml:"literal"`
				} `xml:"para"`
			} `xml:"warning"`
			Example []struct {
				Text     string `xml:",chardata"`
				Title    string `xml:"title,attr"`
				Language string `xml:"language,attr"`
			} `xml:"example"`
			Note []struct {
				Text string `xml:",chardata"`
				Para []struct {
					Text        string   `xml:",chardata"`
					Literal     []string `xml:"literal"`
					Replaceable []string `xml:"replaceable"`
					Emphasis    []string `xml:"emphasis"`
				} `xml:"para"`
			} `xml:"note"`
			Enumlist []struct {
				Text string `xml:",chardata"`
				Enum []struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para string `xml:"para"`
				} `xml:"enum"`
			} `xml:"enumlist"`
			Include struct {
				Text     string `xml:",chardata"`
				Xpointer string `xml:"xpointer,attr"`
			} `xml:"include"`
			Variablelist struct {
				Text     string `xml:",chardata"`
				Variable struct {
					Text  string `xml:",chardata"`
					Name  string `xml:"name,attr"`
					Value []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
					} `xml:"value"`
					Para string `xml:"para"`
				} `xml:"variable"`
			} `xml:"variablelist"`
		} `xml:"description"`
		SeeAlso struct {
			Text string `xml:",chardata"`
			Ref  []struct {
				Text   string `xml:",chardata"`
				Type   string `xml:"type,attr"`
				Module string `xml:"module,attr"`
			} `xml:"ref"`
		} `xml:"see-also"`
	} `xml:"function"`
	Info []struct {
		Text     string `xml:",chardata"`
		Name     string `xml:"name,attr"`
		Language string `xml:"language,attr"`
		Tech     string `xml:"tech,attr"`
		Enumlist struct {
			Text string `xml:",chardata"`
			Enum []struct {
				Text string `xml:",chardata"`
				Name string `xml:"name,attr"`
				Para []struct {
					Text        string   `xml:",chardata"`
					Replaceable string   `xml:"replaceable"`
					Literal     []string `xml:"literal"`
				} `xml:"para"`
				Parameter []struct {
					Text     string `xml:",chardata"`
					Name     string `xml:"name,attr"`
					Required string `xml:"required,attr"`
					Para     struct {
						Text        string `xml:",chardata"`
						Replaceable string `xml:"replaceable"`
						Literal     string `xml:"literal"`
					} `xml:"para"`
					Enumlist struct {
						Text string `xml:",chardata"`
						Enum []struct {
							Text string `xml:",chardata"`
							Name string `xml:"name,attr"`
							Para []struct {
								Text    string   `xml:",chardata"`
								Literal []string `xml:"literal"`
							} `xml:"para"`
							Enumlist struct {
								Text string `xml:",chardata"`
								Enum []struct {
									Text string `xml:",chardata"`
									Name string `xml:"name,attr"`
									Para struct {
										Text    string `xml:",chardata"`
										Literal string `xml:"literal"`
									} `xml:"para"`
								} `xml:"enum"`
							} `xml:"enumlist"`
							Note struct {
								Text string `xml:",chardata"`
								Para struct {
									Text    string `xml:",chardata"`
									Literal string `xml:"literal"`
								} `xml:"para"`
							} `xml:"note"`
						} `xml:"enum"`
					} `xml:"enumlist"`
				} `xml:"parameter"`
				Enumlist struct {
					Text string `xml:",chardata"`
					Enum []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
						Para string `xml:"para"`
					} `xml:"enum"`
				} `xml:"enumlist"`
			} `xml:"enum"`
		} `xml:"enumlist"`
		Example struct {
			Text  string `xml:",chardata"`
			Title string `xml:"title,attr"`
		} `xml:"example"`
		Para struct {
			Text    string   `xml:",chardata"`
			Literal []string `xml:"literal"`
		} `xml:"para"`
	} `xml:"info"`
	Application []struct {
		Text     string `xml:",chardata"`
		Name     string `xml:"name,attr"`
		Language string `xml:"language,attr"`
		Module   string `xml:"module,attr"`
		Synopsis string `xml:"synopsis"`
		Syntax   struct {
			Text      string `xml:",chardata"`
			Argsep    string `xml:"argsep,attr"`
			Parameter []struct {
				Text      string `xml:",chardata"`
				Name      string `xml:"name,attr"`
				Required  string `xml:"required,attr"`
				Argsep    string `xml:"argsep,attr"`
				Multiple  string `xml:"multiple,attr"`
				Hasparams string `xml:"hasparams,attr"`
				Para      []struct {
					Text        string   `xml:",chardata"`
					Literal     []string `xml:"literal"`
					Directory   string   `xml:"directory"`
					Filename    string   `xml:"filename"`
					Variable    string   `xml:"variable"`
					Replaceable []string `xml:"replaceable"`
					Emphasis    string   `xml:"emphasis"`
				} `xml:"para"`
				Enumlist struct {
					Text string `xml:",chardata"`
					Enum []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
						Para string `xml:"para"`
					} `xml:"enum"`
				} `xml:"enumlist"`
				Optionlist struct {
					Text   string `xml:",chardata"`
					Option []struct {
						Text      string `xml:",chardata"`
						Name      string `xml:"name,attr"`
						Implies   string `xml:"implies,attr"`
						Argsep    string `xml:"argsep,attr"`
						Hasparams string `xml:"hasparams,attr"`
						Para      []struct {
							Text        string   `xml:",chardata"`
							Literal     []string `xml:"literal"`
							Replaceable []string `xml:"replaceable"`
							Variable    []string `xml:"variable"`
							Emphasis    []string `xml:"emphasis"`
							Filename    string   `xml:"filename"`
							Directory   string   `xml:"directory"`
						} `xml:"para"`
						Argument []struct {
							Text      string `xml:",chardata"`
							Name      string `xml:"name,attr"`
							Required  string `xml:"required,attr"`
							Hasparams string `xml:"hasparams,attr"`
							Argsep    string `xml:"argsep,attr"`
							Multiple  string `xml:"multiple,attr"`
							Para      []struct {
								Text        string   `xml:",chardata"`
								Replaceable string   `xml:"replaceable"`
								Variable    string   `xml:"variable"`
								Literal     []string `xml:"literal"`
								Filename    string   `xml:"filename"`
								Emphasis    string   `xml:"emphasis"`
							} `xml:"para"`
							Argument []struct {
								Text     string `xml:",chardata"`
								Name     string `xml:"name,attr"`
								Multiple string `xml:"multiple,attr"`
								Required string `xml:"required,attr"`
							} `xml:"argument"`
						} `xml:"argument"`
						Enumlist struct {
							Text string `xml:",chardata"`
							Enum []struct {
								Text string `xml:",chardata"`
								Name string `xml:"name,attr"`
								Para string `xml:"para"`
							} `xml:"enum"`
						} `xml:"enumlist"`
						Warning struct {
							Text string `xml:",chardata"`
							Para struct {
								Text     string   `xml:",chardata"`
								Variable []string `xml:"variable"`
							} `xml:"para"`
						} `xml:"warning"`
						Note []struct {
							Text string `xml:",chardata"`
							Para struct {
								Text        string   `xml:",chardata"`
								Literal     []string `xml:"literal"`
								Replaceable string   `xml:"replaceable"`
								Variable    string   `xml:"variable"`
							} `xml:"para"`
						} `xml:"note"`
						Variablelist struct {
							Text     string `xml:",chardata"`
							Variable []struct {
								Text string `xml:",chardata"`
								Name string `xml:"name,attr"`
								Para struct {
									Text        string   `xml:",chardata"`
									Replaceable []string `xml:"replaceable"`
								} `xml:"para"`
								Value []struct {
									Text    string `xml:",chardata"`
									Name    string `xml:"name,attr"`
									Default string `xml:"default,attr"`
								} `xml:"value"`
							} `xml:"variable"`
						} `xml:"variablelist"`
					} `xml:"option"`
				} `xml:"optionlist"`
				Argument []struct {
					Text      string `xml:",chardata"`
					Name      string `xml:"name,attr"`
					Argsep    string `xml:"argsep,attr"`
					Required  string `xml:"required,attr"`
					Multiple  string `xml:"multiple,attr"`
					Hasparams string `xml:"hasparams,attr"`
					Argument  []struct {
						Text     string `xml:",chardata"`
						Name     string `xml:"name,attr"`
						Required string `xml:"required,attr"`
						Multiple string `xml:"multiple,attr"`
					} `xml:"argument"`
					Para []struct {
						Text        string   `xml:",chardata"`
						Literal     string   `xml:"literal"`
						Replaceable []string `xml:"replaceable"`
						Filename    string   `xml:"filename"`
					} `xml:"para"`
				} `xml:"argument"`
				Warning struct {
					Text string `xml:",chardata"`
					Para struct {
						Text     string   `xml:",chardata"`
						Variable []string `xml:"variable"`
					} `xml:"para"`
				} `xml:"warning"`
				Note struct {
					Text string `xml:",chardata"`
					Para struct {
						Text        string   `xml:",chardata"`
						Replaceable []string `xml:"replaceable"`
						Emphasis    string   `xml:"emphasis"`
						Literal     string   `xml:"literal"`
					} `xml:"para"`
				} `xml:"note"`
				Include struct {
					Text     string `xml:",chardata"`
					Xpointer string `xml:"xpointer,attr"`
				} `xml:"include"`
			} `xml:"parameter"`
			Include []struct {
				Text     string `xml:",chardata"`
				Xpointer string `xml:"xpointer,attr"`
			} `xml:"include"`
		} `xml:"syntax"`
		Description struct {
			Text string `xml:",chardata"`
			Para []struct {
				Text        string   `xml:",chardata"`
				Replaceable []string `xml:"replaceable"`
				Literal     []string `xml:"literal"`
				Emphasis    string   `xml:"emphasis"`
				Filename    []string `xml:"filename"`
				Variable    []string `xml:"variable"`
				Directory   string   `xml:"directory"`
				Astcli      string   `xml:"astcli"`
			} `xml:"para"`
			Note []struct {
				Text string `xml:",chardata"`
				Para []struct {
					Text        string   `xml:",chardata"`
					Literal     []string `xml:"literal"`
					Replaceable []string `xml:"replaceable"`
					Variable    []string `xml:"variable"`
					Filename    string   `xml:"filename"`
				} `xml:"para"`
			} `xml:"note"`
			Enumlist struct {
				Text string `xml:",chardata"`
				Enum []struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para []struct {
						Text        string   `xml:",chardata"`
						Literal     []string `xml:"literal"`
						Replaceable string   `xml:"replaceable"`
						Directory   string   `xml:"directory"`
						Filename    string   `xml:"filename"`
					} `xml:"para"`
				} `xml:"enum"`
			} `xml:"enumlist"`
			Variablelist []struct {
				Text     string `xml:",chardata"`
				Variable []struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para []struct {
						Text     string   `xml:",chardata"`
						Literal  []string `xml:"literal"`
						Emphasis string   `xml:"emphasis"`
						Variable string   `xml:"variable"`
					} `xml:"para"`
					Value []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
					} `xml:"value"`
				} `xml:"variable"`
			} `xml:"variablelist"`
			Example []struct {
				Text  string `xml:",chardata"`
				Title string `xml:"title,attr"`
			} `xml:"example"`
			Warning []struct {
				Text string `xml:",chardata"`
				Para struct {
					Text     string   `xml:",chardata"`
					Literal  []string `xml:"literal"`
					Variable []string `xml:"variable"`
				} `xml:"para"`
			} `xml:"warning"`
			Include struct {
				Text     string `xml:",chardata"`
				Xpointer string `xml:"xpointer,attr"`
			} `xml:"include"`
		} `xml:"description"`
		SeeAlso struct {
			Text string `xml:",chardata"`
			Ref  []struct {
				Text   string `xml:",chardata"`
				Type   string `xml:"type,attr"`
				Module string `xml:"module,attr"`
			} `xml:"ref"`
		} `xml:"see-also"`
	} `xml:"application"`
	ManagerEvent []struct {
		Text                 string `xml:",chardata"`
		Language             string `xml:"language,attr"`
		Name                 string `xml:"name,attr"`
		ManagerEventInstance struct {
			Text     string `xml:",chardata"`
			Class    string `xml:"class,attr"`
			Synopsis string `xml:"synopsis"`
			Syntax   struct {
				Text            string `xml:",chardata"`
				ChannelSnapshot []struct {
					Text   string `xml:",chardata"`
					Prefix string `xml:"prefix,attr"`
				} `xml:"channel_snapshot"`
				Parameter []struct {
					Text     string `xml:",chardata"`
					Name     string `xml:"name,attr"`
					Required string `xml:"required,attr"`
					Multiple string `xml:"multiple,attr"`
					Para     []struct {
						Text        string   `xml:",chardata"`
						Variable    string   `xml:"variable"`
						Literal     []string `xml:"literal"`
						Replaceable []string `xml:"replaceable"`
						Include     struct {
							Text     string `xml:",chardata"`
							Xpointer string `xml:"xpointer,attr"`
						} `xml:"include"`
					} `xml:"para"`
					Note struct {
						Text string `xml:",chardata"`
						Para struct {
							Text        string   `xml:",chardata"`
							Literal     []string `xml:"literal"`
							Filename    string   `xml:"filename"`
							Replaceable string   `xml:"replaceable"`
						} `xml:"para"`
					} `xml:"note"`
					Enumlist struct {
						Text string `xml:",chardata"`
						Enum []struct {
							Text string `xml:",chardata"`
							Name string `xml:"name,attr"`
							Para []struct {
								Text    string `xml:",chardata"`
								Literal string `xml:"literal"`
							} `xml:"para"`
							Note struct {
								Text string `xml:",chardata"`
								Para struct {
									Text        string   `xml:",chardata"`
									Filename    string   `xml:"filename"`
									Literal     []string `xml:"literal"`
									Replaceable string   `xml:"replaceable"`
								} `xml:"para"`
							} `xml:"note"`
						} `xml:"enum"`
					} `xml:"enumlist"`
				} `xml:"parameter"`
				Include []struct {
					Text     string `xml:",chardata"`
					Xpointer string `xml:"xpointer,attr"`
				} `xml:"include"`
				BridgeSnapshot []struct {
					Text   string `xml:",chardata"`
					Prefix string `xml:"prefix,attr"`
				} `xml:"bridge_snapshot"`
			} `xml:"syntax"`
			SeeAlso struct {
				Text string `xml:",chardata"`
				Ref  []struct {
					Text string `xml:",chardata"`
					Type string `xml:"type,attr"`
				} `xml:"ref"`
			} `xml:"see-also"`
			Description struct {
				Text string `xml:",chardata"`
				Para []struct {
					Text        string   `xml:",chardata"`
					Literal     []string `xml:"literal"`
					Replaceable string   `xml:"replaceable"`
					Filename    string   `xml:"filename"`
				} `xml:"para"`
				Note struct {
					Text string `xml:",chardata"`
					Para struct {
						Text     string `xml:",chardata"`
						Filename string `xml:"filename"`
					} `xml:"para"`
				} `xml:"note"`
			} `xml:"description"`
		} `xml:"managerEventInstance"`
	} `xml:"managerEvent"`
	Agi []struct {
		Text     string `xml:",chardata"`
		Name     string `xml:"name,attr"`
		Language string `xml:"language,attr"`
		Synopsis string `xml:"synopsis"`
		Syntax   struct {
			Text      string `xml:",chardata"`
			Parameter []struct {
				Text     string `xml:",chardata"`
				Name     string `xml:"name,attr"`
				Required string `xml:"required,attr"`
				Para     struct {
					Text        string   `xml:",chardata"`
					Literal     string   `xml:"literal"`
					Replaceable []string `xml:"replaceable"`
					Filename    string   `xml:"filename"`
				} `xml:"para"`
				Enumlist struct {
					Text string `xml:",chardata"`
					Enum []struct {
						Text      string `xml:",chardata"`
						Name      string `xml:"name,attr"`
						Parameter struct {
							Text     string `xml:",chardata"`
							Name     string `xml:"name,attr"`
							Literal  string `xml:"literal,attr"`
							Required string `xml:"required,attr"`
						} `xml:"parameter"`
					} `xml:"enum"`
				} `xml:"enumlist"`
			} `xml:"parameter"`
		} `xml:"syntax"`
		Description struct {
			Text string `xml:",chardata"`
			Para []struct {
				Text        string   `xml:",chardata"`
				Literal     []string `xml:"literal"`
				Replaceable []string `xml:"replaceable"`
			} `xml:"para"`
			Enumlist struct {
				Text string `xml:",chardata"`
				Enum []struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para string `xml:"para"`
				} `xml:"enum"`
			} `xml:"enumlist"`
			Variablelist struct {
				Text     string `xml:",chardata"`
				Variable []struct {
					Text string `xml:",chardata"`
					Name string `xml:"name,attr"`
					Para struct {
						Text    string `xml:",chardata"`
						Literal string `xml:"literal"`
					} `xml:"para"`
					Value []struct {
						Text string `xml:",chardata"`
						Name string `xml:"name,attr"`
					} `xml:"value"`
				} `xml:"variable"`
			} `xml:"variablelist"`
		} `xml:"description"`
		SeeAlso struct {
			Text string `xml:",chardata"`
			Ref  []struct {
				Text string `xml:",chardata"`
				Type string `xml:"type,attr"`
			} `xml:"ref"`
		} `xml:"see-also"`
	} `xml:"agi"`
}

type EnumListModel

type EnumListModel struct {
	//Text string      `xml:",chardata"`
	Enum []EnumModel `xml:"enum" json:"enum,omitempty"`
}

type EnumModel

type EnumModel struct {
	//Text string  `xml:",chardata"`
	Name string  `xml:"name,attr" json:"name,omitempty"`
	Para ParaRaw `xml:"para" json:"para,omitempty"`
}

type Field

type Field struct {
	Name        string
	Doc         string
	Default     string
	Required    bool
	Type        *TypeInfo
	StructTag   string
	Annotations interface{}
}

type File

type File struct {
	Name    string
	Content []byte
}

type GenerateTemplate

type GenerateTemplate struct {
	Name         string // template name.
	DeriveSource func(ctx context.Context, rootSource interface{}) interface{}
	Skip         func(ctx context.Context, source interface{}) bool   // skip condition (storage constraints or gated by a feature-flag).
	Format       func(ctx context.Context, source interface{}) string // file name format.
	FormatName   string                                               // for single
}

func (*GenerateTemplate) Generate

func (tmpl *GenerateTemplate) Generate(ctx context.Context, ge *Generator, source interface{}) (files []File, err error)

type Generator

type Generator struct {
	Files     []File
	Template  *template.Template
	Templates []TemplateGenerate
	Debug     bool
	Formatter func(file *File) error
	Loader    func() error
}

func NewAGIGenerator

func NewAGIGenerator() *Generator

func NewAMIGenerator

func NewAMIGenerator() *Generator

func (*Generator) Generate

func (ge *Generator) Generate(ctx context.Context, source interface{}) (err error)

func (*Generator) Write

func (ge *Generator) Write(s WriteConfig) error

type ManagerAction

type ManagerAction struct {
	Name        string
	Synopsis    string
	Syntax      *Syntax
	Description string
	Response    *ManagerEvent
	SeeAlso     []*SeeAlso
	Responses   []*ManagerEvent
}

func (ManagerAction) StructName

func (m ManagerAction) StructName() string

type ManagerActionModel

type ManagerActionModel struct {
	Name        string               `xml:"name,attr" json:"name,omitempty"`
	Language    string               `xml:"language,attr" json:"language,omitempty"`
	Synopsis    string               `xml:"synopsis" json:"synopsis,omitempty"`
	Syntax      *SyntaxDocModel      `xml:"syntax" json:"syntax,omitempty"`
	SeeAlso     *SeeAlsoModel        `xml:"see-also" json:"seeAlso,omitempty"`
	Description *DescriptionModel    `xml:"description" json:"description,omitempty"`
	Responses   ManagerResponseModel `xml:"responses" json:"responses,omitempty"`
}

type ManagerEvent

type ManagerEvent struct {
	Name     string
	Synopsis string
	Syntax   *Syntax
	SeeAlso  []*SeeAlso
}

func (ManagerEvent) StructName

func (m ManagerEvent) StructName() string

type ManagerEventInstanceModel

type ManagerEventInstanceModel struct {
	Text        string            `xml:",chardata"`
	Class       string            `xml:"class,attr"`
	Synopsis    string            `xml:"synopsis"`
	Language    string            `xml:"language,attr" json:"language,omitempty"`
	Syntax      *SyntaxDocModel   `xml:"syntax" json:"syntax,omitempty"`
	SeeAlso     *SeeAlsoModel     `xml:"see-also" json:"seeAlso,omitempty"`
	Description *DescriptionModel `xml:"description" json:"description,omitempty"`
}

type ManagerEventModel

type ManagerEventModel struct {
	Name     string                    `xml:"name,attr" json:"name,omitempty"`
	Instance ManagerEventInstanceModel `xml:"managerEventInstance"`
}

type ManagerResponseListElementModel

type ManagerResponseListElementModel struct {
	Text         string               `xml:",chardata" json:"text,omitempty"`
	ManagerEvent []*ManagerEventModel `xml:"managerEvent" json:"managerEvent,omitempty"`
}

type ManagerResponseModel

type ManagerResponseModel struct {
	Text         string                           `xml:",chardata" json:"text,omitempty"`
	ListElements *ManagerResponseListElementModel `xml:"list-elements" json:"listElements,omitempty"`
	ManagerEvent *ManagerEventModel               `xml:"managerEvent" json:"managerEvent,omitempty"`
}

func (ManagerResponseModel) Events

type Model

type Model struct {
	AGICommands []*AGICommand
	Actions     []*ManagerAction
	Events      []*ManagerEvent
}

type ParaRaw

type ParaRaw struct {
	Data string `xml:",innerxml" json:"data,omitempty"`
}

ParaRaw contain ELEMENT astcli|literal|emphasis|filename|directory|replaceable|variable

type Parameter

type Parameter struct {
	RawName     string
	Name        string
	Type        string
	Default     string
	Required    bool
	Description string
}

type SeeAlso

type SeeAlso struct {
	Type string
	Name string
}

type SeeAlsoModel

type SeeAlsoModel struct {
	Ref []SeeAlsoRefModel `json:"ref,omitempty"`
}

type SeeAlsoRefModel

type SeeAlsoRefModel struct {
	Text string `xml:",chardata" json:"text,omitempty"`
	Type string `xml:"type,attr" json:"type,omitempty"`
}

type Syntax

type Syntax struct {
	Params  []*Parameter
	Missing bool
}

func (Syntax) HasRequiredParam

func (d Syntax) HasRequiredParam() bool

type SyntaxDocModel

type SyntaxDocModel struct {
	Parameter       []SyntaxParameterDocModel `xml:"parameter" json:"parameter,omitempty"`
	ChannelSnapshot []struct {
		Text   string `xml:",chardata"`
		Prefix string `xml:"prefix,attr"`
	} `xml:"channel_snapshot"`
	BridgeSnapshot []struct {
		Text   string `xml:",chardata"`
		Prefix string `xml:"prefix,attr"`
	} `xml:"bridge_snapshot"`
}

type SyntaxParameterDocModel

type SyntaxParameterDocModel struct {
	Name     string         `xml:"name,attr" json:"name,omitempty"`
	Required bool           `xml:"required,attr" json:"required,omitempty"`
	Para     ParaRaw        `xml:"para" json:"para,omitempty"`
	EnumList *EnumListModel `xml:"enumlist" json:"enumList,omitempty"`

	Note *struct {
		Text string `xml:",chardata"`
		Para struct {
			Text        string   `xml:",chardata"`
			Literal     []string `xml:"literal"`
			Filename    string   `xml:"filename"`
			Replaceable string   `xml:"replaceable"`
		} `xml:"para"`
	} `xml:"note"`
}

type TemplateGenerate

type TemplateGenerate interface {
	Generate(ctx context.Context, ge *Generator, source interface{}) ([]File, error)
}

type Type

type Type struct {
	Name   string
	Doc    string
	Fields []*Field
}

type TypeInfo

type TypeInfo struct {
	Type string
}

func (*TypeInfo) String

func (ti *TypeInfo) String() string

type VariableListModel

type VariableListModel struct {
	Variable []VariableListVariableModel `xml:"variable" json:"variable,omitempty"`
}

type VariableListVariableModel

type VariableListVariableModel struct {
	Name  string                           `xml:"name,attr" json:"name,omitempty"`
	Para  ParaRaw                          `xml:"para" json:"para,omitempty"`
	Value []VariableListVariableValueModel `xml:"value" json:"value,omitempty"`
}

type VariableListVariableValueModel

type VariableListVariableValueModel struct {
	Text string `xml:",chardata" json:"text,omitempty"`
	Name string `xml:"name,attr" json:"name,omitempty"`
}

type WriteConfig

type WriteConfig struct {
	Target string
	DryRun bool
}

Jump to

Keyboard shortcuts

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