All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lujian.weixin.mp.api.menu.MpMenuApi Maven / Gradle / Ivy

The newest version!
package org.lujian.weixin.mp.api.menu;

import lombok.val;
import org.lujian.weixin.common.exception.ApiException;
import org.lujian.weixin.common.model.ApiResult;
import org.lujian.weixin.mp.api.MpApi;
import org.lujian.weixin.mp.api.menu.model.Menu;
import org.lujian.weixin.mp.api.menu.model.UserId;
import org.lujian.weixin.mp.api.menu.model.button.Button;
import org.lujian.weixin.mp.api.menu.model.response.GetCurrentSelfMenuInfoResponse;
import org.lujian.weixin.mp.api.menu.model.response.GetMenuResponse;
import org.lujian.weixin.mp.api.menu.model.MenuId;

import java.util.List;

/**
 * 自定义菜单接口调用
 * https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html
 *
 * @author lujian
 */
public class MpMenuApi extends MpApi {

    /**
     * 创建菜单
     *
     * @param menu
     * @throws ApiException
     */
    public void create(String menu) throws ApiException {
        val url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";
        this.weiXinReqService.post(url, menu, ApiResult.class);
    }

    /**
     * 创建菜单
     *
     * @param menu
     * @throws ApiException
     */
    public void create(Menu menu) throws ApiException {
        val url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";
        this.weiXinReqService.post(url, menu, ApiResult.class);
    }

    /**
     * 创建菜单
     *
     * @param buttons
     * @throws ApiException
     */
    public void create(List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy