menu

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ButtonTypeClick ..
	ButtonTypeClick = "click"
	// ButtonTypeView ...
	ButtonTypeView = "view"
	// ButtonTypeMiniProgram ...
	ButtonTypeMiniProgram = "miniprogram"
	// ButtonTypeMediaID ...
	ButtonTypeMediaID = "media_id"
	// ButtonTypeViewLimited ...
	ButtonTypeViewLimited = "view_limited"
)

Variables

View Source
var (
	// ErrSubButtonAppend ...
	ErrSubButtonAppend = errors.New("追加按钮错误,请查查按钮类型")
	// ErrButtonType ...
	ErrButtonType = errors.New("菜单类型错误")
)

Functions

This section is empty.

Types

type Button

type Button struct {
	Type      string    `json:"type"`
	Name      string    `json:"name"`
	Key       string    `json:"key"`
	SubButton SubButton `json:"sub_button"`
}

Button 按钮

func NewButton

func NewButton() *Button

NewButton ...

func (*Button) JSON

func (b *Button) JSON() string

JSON ...

type ClickButton

type ClickButton struct {
	Type string `json:"type"`
	Name string `json:"name"`
	Key  string `json:"key"`
}

ClickButton click点击类型

func NewClickButton

func NewClickButton() *ClickButton

NewClickButton ...

type MediaIDButton

type MediaIDButton struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	MediaID string `json:"media_id"`
}

MediaIDButton 永久素材类型可以是图片、音频、视频、图文消息

func NewMediaIDButton

func NewMediaIDButton() *MediaIDButton

NewMediaIDButton ...

type Menu struct {
	// contains filtered or unexported fields
}

Menu 菜单

func NewMenu

func NewMenu(c wechat.Clienter) *Menu

NewMenu ...

func (m *Menu) Create(btns []interface{}) error

Create 创建菜单

func (m *Menu) CreateAllByMap(btns []interface{}) error

Create 创建菜单Buttons

func (m *Menu) DeleteAll() error

DeleteAll 删除全部菜单

func (m *Menu) GetAll() (*simplejson.Json, error)

GetAll 获取所有菜单

type MiniProgramButton

type MiniProgramButton struct {
	Type     string `json:"type"`
	Name     string `json:"name"`
	URL      string `json:"url"`
	AppID    string `json:"appid"`
	PagePath string `json:"pagepath"`
}

MiniProgramButton 小程序类型

func NewMiniProgramButton

func NewMiniProgramButton() *MiniProgramButton

NewMiniProgramButton ...

type SubButton

type SubButton []interface{}

SubButton ...子级按钮类型

func (*SubButton) Append

func (s *SubButton) Append(x interface{}) error

Append 添加子按钮

type ViewButton

type ViewButton struct {
	Type string `json:"type"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

ViewButton view类型

func NewViewButton

func NewViewButton() *ViewButton

NewViewButton ...

type ViewLimitedButton

type ViewLimitedButton struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	MediaID string `json:"media_id"`
}

ViewLimitedButton 小程序类型

func NewViewLimitedButton

func NewViewLimitedButton() *ViewLimitedButton

NewViewLimitedButton ...

Jump to

Keyboard shortcuts

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