Documentation ¶
Overview ¶
Package menu 自定义菜单
Index ¶
- func AddConditional(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func Create(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func DelConditional(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func Delete(ctx *offiaccount.OffiAccount) (resp []byte, err error)
- func Get(ctx *offiaccount.OffiAccount) (resp []byte, err error)
- func GetCurrentSelfmenuInfo(ctx *offiaccount.OffiAccount) (resp []byte, err error)
- func TryMatch(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddConditional ¶
func AddConditional(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
创建个性化菜单
See: https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html
POST https://api.weixin.qq.com/cgi-bin/menu/addconditional?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/menu" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := menu.AddConditional(ctx, payload) fmt.Println(resp, err) }
Output:
func Create ¶
func Create(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
创建
创建菜单
See: https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html
POST https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/menu" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := menu.Create(ctx, payload) fmt.Println(resp, err) }
Output:
func DelConditional ¶
func DelConditional(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
删除个性化菜单
See: https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html
POST https://api.weixin.qq.com/cgi-bin/menu/delconditional?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/menu" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := menu.DelConditional(ctx, payload) fmt.Println(resp, err) }
Output:
func Delete ¶
func Delete(ctx *offiaccount.OffiAccount) (resp []byte, err error)
删除
使用接口创建自定义菜单后,开发者还可使用接口删除当前使用的自定义菜单。另请注意,在个性化菜单时,调用此接口会删除默认菜单及全部个性化菜单
See: https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Deleting_Custom-Defined_Menu.html
GET https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/menu" ) func main() { var ctx *offiaccount.OffiAccount resp, err := menu.Delete(ctx) fmt.Println(resp, err) }
Output:
func Get ¶
func Get(ctx *offiaccount.OffiAccount) (resp []byte, err error)
获取自定义菜单配置
使用接口创建自定义菜单后,开发者还可使用接口查询自定义菜单的结构。另外请注意,在设置了个性化菜单后,使用本自定义菜单查询接口可以获取默认菜单和全部个性化菜单信息
GET https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/menu" ) func main() { var ctx *offiaccount.OffiAccount resp, err := menu.Get(ctx) fmt.Println(resp, err) }
Output:
func GetCurrentSelfmenuInfo ¶
func GetCurrentSelfmenuInfo(ctx *offiaccount.OffiAccount) (resp []byte, err error)
查询
本接口将会提供公众号当前使用的自定义菜单的配置,如果公众号是通过API调用设置的菜单,则返回菜单的开发配置,而如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回运营者设置的菜单配置
See: https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Querying_Custom_Menus.html
GET https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=ACCESS_TOKEN
func TryMatch ¶
func TryMatch(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
测试个性化菜单匹配结果
See: https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html
POST https://api.weixin.qq.com/cgi-bin/menu/trymatch?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/menu" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := menu.TryMatch(ctx, payload) fmt.Println(resp, err) }
Output:
Types ¶
This section is empty.