response

package
v0.0.0-...-49a96a4 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadMedia

func DownloadMedia(url string, retryMaxN int, c chan accesstoken.AccessToken, writer io.Writer) ([]byte, error)

func DownloadMediaByPost

func DownloadMediaByPost(url string, retryMaxN int, c chan accesstoken.AccessToken, writer io.Writer, data []byte) ([]byte, error)

下载永久素材

func SendGetRequestWithByteResult

func SendGetRequestWithByteResult(url string, tryMaxN int, c chan accesstoken.AccessToken) ([]byte, error)

func SendPostRequestWithByteResult

func SendPostRequestWithByteResult(url string, retryMaxN int, c chan accesstoken.AccessToken, data []byte) ([]byte, error)

注意:正常情况消息,与出错情况(即errCode消息格式,)两种消息不共用同一个消息格式,在此种情况下需要用WithByteResult结尾的接口,因为要分别解析返回结果。 然而对于正常情况与出错情况共用一个消息格式,只是靠errCode == 0来区分是否出错的时候, 则以下WithByteResult结尾的接口不再适用了!因为此接口 只要发现消息体中有errCode就认为出错了!!!只返回空和错误!!!

func UploadMedia

func UploadMedia(url string, retryMaxN int, filename string, description []byte, c chan accesstoken.AccessToken, reader io.Reader) (string, error)

Types

type Response

type Response struct {
	// error fields
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
	// token fields
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
	// media fields
	Type      string `json:"type"`
	MediaId   string `json:"media_id"`
	CreatedAt int64  `json:"created_at"`
	// ticket fields
	Ticket        string `json:"ticket"`
	ExpireSeconds int64  `json:"expire_seconds"`
	QrCodeUrl     string `json:"url"`
	//template message
	TemplateId string `json:"template_id"`
	MsgId      int    `json:"msgid"`
	MassMsgId  string `json:"msg_id"`
	MsgStatus  string `json:"msg_status"`
	//long url to short url
	ShortURL string `json:"short_url"`
}

response from weixinmp when we call weixinmap`api to send or get something.

func SendGetRequest

func SendGetRequest(url string, retryMaxN int, c chan accesstoken.AccessToken) (rc *Response, err error)

func SendPostRequest

func SendPostRequest(url string, retryMaxN int, c chan accesstoken.AccessToken, data []byte) (rc *Response, err error)

适应用正常消息, 与出错消息, 共用一个消息格式时, 才可调用此接口,记得在response.Response加入返回的正常消息字段!!!

Jump to

Keyboard shortcuts

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