Documentation ¶
Index ¶
- Constants
- func DecodeWithCommonError(response []byte, apiName string) (err error)
- func DecodeWithError(response []byte, obj interface{}, apiName string) error
- func GetAPIDomainIP(accessToken string) ([]string, error)
- func GetCallBackIP(accessToken string) ([]string, error)
- func GetHighVoice(accessToken string, mediaid string) ([]byte, error)
- func GetMedia(accessToken string, mediaid string) ([]byte, error)
- func HTTPGet(uri string) ([]byte, error)
- func HTTPPost(uri string, data string) ([]byte, error)
- func PostFile(fieldname, filename, uri string) ([]byte, error)
- func PostJSON(uri string, obj interface{}) ([]byte, error)
- func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, error)
- func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)
- func PostXML(uri string, obj interface{}) ([]byte, error)
- func PostXMLWithTLS(uri string, obj interface{}, ca, key string) ([]byte, error)
- type APIDomainIPResp
- type CommonError
- type MultipartFormField
- type QywxConfig
- type UploadImgResp
- type UploadMediaResp
Constants ¶
const ( UploadMediaURL string = "https://qyapi.weixin.qq.com/cgi-bin/media/upload" UploadImgURL string = "https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg" GetMediaURL string = "https://qyapi.weixin.qq.com/cgi-bin/media/get" GetHighVoiceURL string = "https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk" )
参考https://work.weixin.qq.com/api/doc/90000/90135/91054
const (
ContactsID = "qywx001" // 企业微信通讯录
)
企业微信中一些应用没有agentid,这里设置常量
const (
ErrParamInValid string = "参数不正确"
)
常用的错误
Variables ¶
This section is empty.
Functions ¶
func DecodeWithCommonError ¶
DecodeWithCommonError 将返回值按照CommonError解析
func DecodeWithError ¶
DecodeWithError 将返回值按照解析
func GetAPIDomainIP ¶
GetAPIDomainIP 获取企业微信API域名IP段 参考https://open.work.weixin.qq.com/api/doc/90000/90135/92520
func GetCallBackIP ¶
GetCallBackIP 获取企业微信回调IP地址列表 参考https://open.work.weixin.qq.com/api/doc/90000/90135/90930#3.3%20%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84ip%E6%AE%B5
func GetHighVoice ¶
GetHighVoice 获取高清语音素材 https://work.weixin.qq.com/api/doc/90000/90135/90255
func GetMedia ¶
GetMedia 获取临时素材 https://work.weixin.qq.com/api/doc/90000/90135/90254
func PostJSONWithRespContentType ¶
PostJSONWithRespContentType post json数据请求,且返回数据类型
func PostMultipartForm ¶
func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)
PostMultipartForm 上传文件或其他多个字段
Types ¶
type APIDomainIPResp ¶
type APIDomainIPResp struct { CommonError IPList []string `json:"ip_list"` }
APIDomainIPResp 企业微信服务器IP返回结果
type CommonError ¶
CommonError 微信返回的通用错误json
type MultipartFormField ¶
MultipartFormField 保存文件或其他字段信息
type QywxConfig ¶
type QywxConfig struct { CorpID string // corpid 企业微信ID AgentID string // 应用ID Secret string // 应用秘钥 }
QywxConfig 企业微信配置
type UploadImgResp ¶
type UploadImgResp struct { CommonError URL string `jsong:"url"` }
UploadImgResp 上传图片响应
func UploadImg ¶
func UploadImg(accessToken string, filename string) (*UploadImgResp, error)
UploadImg 上传图片 https://work.weixin.qq.com/api/doc/90000/90135/90256
type UploadMediaResp ¶
type UploadMediaResp struct { CommonError Type string `json:"type"` MediaID string `json:"media_id"` CreatedAt string `json:"created_at"` }
UploadMediaResp 上传临时素材响应
func UploadMedia ¶
func UploadMedia(accessToken string, mediaType string, filename string) (*UploadMediaResp, error)
UploadMedia 上传临时素材 https://work.weixin.qq.com/api/doc/90000/90135/90253