v1.0.1 Latest Latest

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 14 Imported by: 0




View Source
const (
	UploadMediaURL  string = ""
	UploadImgURL    string = ""
	GetMediaURL     string = ""
	GetHighVoiceURL string = ""


View Source
const (
	ContactsID = "qywx001" // 企业微信通讯录


View Source
const (
	ErrParamInValid string = "参数不正确"



This section is empty.


func DecodeWithCommonError

func DecodeWithCommonError(response []byte, apiName string) (err error)

DecodeWithCommonError 将返回值按照CommonError解析

func DecodeWithError

func DecodeWithError(response []byte, obj interface{}, apiName string) error

DecodeWithError 将返回值按照解析

func GetAPIDomainIP

func GetAPIDomainIP(accessToken string) ([]string, error)

GetAPIDomainIP 获取企业微信API域名IP段 参考

func GetCallBackIP

func GetCallBackIP(accessToken string) ([]string, error)

GetCallBackIP 获取企业微信回调IP地址列表 参考

func GetHighVoice

func GetHighVoice(accessToken string, mediaid string) ([]byte, error)

GetHighVoice 获取高清语音素材

func GetMedia

func GetMedia(accessToken string, mediaid string) ([]byte, error)

GetMedia 获取临时素材

func HTTPGet

func HTTPGet(uri string) ([]byte, error)

HTTPGet get 请求

func HTTPPost

func HTTPPost(uri string, data string) ([]byte, error)

HTTPPost post 请求

func PostFile

func PostFile(fieldname, filename, uri string) ([]byte, error)

PostFile 上传文件

func PostJSON

func PostJSON(uri string, obj interface{}) ([]byte, error)

PostJSON post json 数据请求

func PostJSONWithRespContentType

func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, error)

PostJSONWithRespContentType post json数据请求,且返回数据类型

func PostMultipartForm

func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)

PostMultipartForm 上传文件或其他多个字段

func PostXML

func PostXML(uri string, obj interface{}) ([]byte, error)

PostXML perform a HTTP/POST request with XML body

func PostXMLWithTLS

func PostXMLWithTLS(uri string, obj interface{}, ca, key string) ([]byte, error)

PostXMLWithTLS perform a HTTP/POST request with XML body and TLS


type APIDomainIPResp

type APIDomainIPResp struct {
	IPList []string `json:"ip_list"`

APIDomainIPResp 企业微信服务器IP返回结果

type CommonError

type CommonError struct {
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`

CommonError 微信返回的通用错误json

type MultipartFormField

type MultipartFormField struct {
	IsFile    bool
	Fieldname string
	Value     []byte
	Filename  string

MultipartFormField 保存文件或其他字段信息

type QywxConfig

type QywxConfig struct {
	CorpID  string // corpid 企业微信ID
	AgentID string // 应用ID
	Secret  string // 应用秘钥


QywxConfig 企业微信配置

type UploadImgResp

type UploadImgResp struct {
	URL string `jsong:"url"`

UploadImgResp 上传图片响应

func UploadImg

func UploadImg(accessToken string, filename string) (*UploadImgResp, error)

UploadImg 上传图片

type UploadMediaResp

type UploadMediaResp struct {
	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 上传临时素材

Jump to

Keyboard shortcuts

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