package com.fengqi.wechat.remote;


import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient(value = "wechatClient", url = "${wechat.api}")
public interface WechatClient {

    /**
     * 获取微信的asses_token
     *
     * @return
     */
    @GetMapping("/cgi-bin/token")
    Map<String, Object> getToken(@RequestParam("grant_type") String grantType, @RequestParam("appid") String appid, @RequestParam("secret") String secret);

    @GetMapping(value = "/sns/oauth2/access_token", consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
    String getToken(@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam("code") String code, @RequestParam("grant_type") String grantType);

    @PostMapping("/cgi-bin/material/batchget_material")
    Map<String, Object> getMaterial(@RequestParam("access_token") String accessToken);

    @GetMapping("/cgi-bin/user/info")
    Map<String, Object> getUserInfo(@RequestParam("access_token") String accessToken, @RequestParam("openid") String openid, @RequestParam("lang") String lang);

}
