codegen

package
v0.0.0-...-4eefaf5 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGenerator

func NewGenerator(packageName, operationsPrefix string) *generator

Types

type Command

type Command struct {
	Id               string             `json:"id"`
	CommandName      *string            `json:"commandName,omitempty"`
	FriendlyName     string             `json:"friendlyName"`
	Text             string             `json:"text"`
	Description      string             `json:"description"`
	Parameters       []CommandParameter `json:"parameters,omitempty"`
	Response         *Response          `json:"response,omitempty"`
	InlineParameters *bool              `json:"inline,omitempty"`
}

func (Command) EnumValues

func (c Command) EnumValues() map[string]any

func (Command) Imports

func (c Command) Imports() Imports

func (Command) Name

func (c Command) Name() string

func (Command) ParameterGoType

func (c Command) ParameterGoType(p CommandParameter) string

func (Command) Params

func (c Command) Params() (res Params)

func (Command) RequestType

func (c Command) RequestType() Type

func (Command) ResponseGoType

func (c Command) ResponseGoType(p ResponseElement) string

func (Command) ReturnType

func (c Command) ReturnType() Type

func (Command) ReturnTypeDefinitions

func (c Command) ReturnTypeDefinitions() (res []Type)

func (Command) Returns

func (c Command) Returns() Returns

func (Command) Types

func (c Command) Types() (res Types)

type CommandParameter

type CommandParameter struct {
	Type          CommandParameterType `json:"type"`
	Name          string               `json:"name"`
	Id            string               `json:"id"`
	DisplayMember []string             `json:"displayMember,omitempty"`
	ValueMember   []any                `json:"valueMember,omitempty"`
	FixedValue    *string              `json:"fixedValue"`
}

func (CommandParameter) IsMapNameType

func (p CommandParameter) IsMapNameType() bool

type CommandParameterType

type CommandParameterType string
const (
	CommandParameterTypeString CommandParameterType = "Text"
	CommandParameterTypeInt    CommandParameterType = "Number"
	CommandParameterTypeEnum   CommandParameterType = "Combo"
)

func (CommandParameterType) String

func (c CommandParameterType) String() string

type Import

type Import struct {
	Alias       string
	PackagePath string
}

func (Import) String

func (i Import) String() string

type Imports

type Imports map[string]Import

func (*Imports) Add

func (i *Imports) Add(alias, pkgPath string)

type Param

type Param struct {
	Name       string
	Type       string
	FixedValue *string
}

func (Param) AsRequestAssignment

func (p Param) AsRequestAssignment() string

type Params

type Params []Param

func (Params) AsNamedArgsWithTypes

func (p Params) AsNamedArgsWithTypes() string

type Response

type Response []ResponseElement

type ResponseElement

type ResponseElement struct {
	Type ResponseItemType `json:"type"`
	// ListType is only applicable for ResponseItemTypeList and can be used to optionally define the type of list.
	// it has no effect when Members is given (ListType will be implicitly an object), as well as when ValueMember is
	// provided (ListType will be an Enum).
	ListType ResponseItemListType `json:"listType,omitempty"`
	Name     string               `json:"name"`
	Id       string               `json:"id"`

	// Only filled for ResponseItemTypeEnum
	DisplayMember []string `json:"displayMember,omitempty"`
	ValueMember   []any    `json:"valueMember,omitempty"`

	// Only filled for ResponseItemTypeList
	Members []ResponseElement `json:"members,omitempty"`
}

type ResponseItemListType

type ResponseItemListType string
const (
	ResponseItemListTypeString ResponseItemListType = "Text"
)

type ResponseItemType

type ResponseItemType string
const (
	ResponseItemTypeString  ResponseItemType = "Text"
	ResponseItemTypeInt     ResponseItemType = "Number"
	ResponseItemTypeEnum    ResponseItemType = "Combo"
	ResponseItemTypeList    ResponseItemType = "List"
	ResponseItemTypeComplex ResponseItemType = "Complex"
	ResponseItemTypeBool    ResponseItemType = "Bool"
	ResponseItemTypeTime    ResponseItemType = "Time"
)

func (ResponseItemType) String

func (c ResponseItemType) String() string

type Return

type Return struct {
	Type string
}

type Returns

type Returns []Type

func (Returns) String

func (r Returns) String() string

type Type

type Type struct {
	Name        string
	AliasedType string
	IsPointer   bool
	Members     []TypeMember
	FixedValue  *string
}

func (Type) AsTypeDefinition

func (t Type) AsTypeDefinition() string

func (Type) AsTypeReference

func (t Type) AsTypeReference() string

type TypeMember

type TypeMember struct {
	Name string
	Type any
	Json *string
}

func (TypeMember) EnumName

func (t TypeMember) EnumName() string

func (TypeMember) JsonName

func (t TypeMember) JsonName() string

type Types

type Types []Type

Jump to

Keyboard shortcuts

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