Documentation ¶
Index ¶
- Constants
- Variables
- func Download(httpClient *http.Client, uri string, dis io.Writer) (result []byte, err error)
- func Execute(httpClient *http.Client, url string, param Parameter) (json *simplejson.Json, err error)
- func Get(httpClient *http.Client, url string, args map[string]string) (result []byte, err error)
- func GetErrorMsg(code int) string
- func NewError(buf []byte) error
- func Post(httpClient *http.Client, url, contentType string, args map[string]string) (result string, err error)
- func PostJSON(httpClient *http.Client, url string, jsonObject interface{}) (result []byte, err error)
- func Upload(httpClient *http.Client, uri, filename string, description *VideoDescription, ...) (result []byte, err error)
- type AccessTokenReply
- type Client
- func (c *Client) CustomSendImage(req *CustomImageRequest) error
- func (c *Client) CustomSendMenu(req *CustomMenuRequest) error
- func (c *Client) CustomSendNews(req *CustomNewsRequest) error
- func (c *Client) CustomSendText(req *CustomTextRequest) error
- func (c *Client) DraftAdd(req *DraftAddRequest) (*DraftAddResponse, error)
- func (c *Client) DraftGet(mediaID string) (*DraftGetResponse, error)
- func (c *Client) MaterialAddNews(reqs []*MaterialNewsRequest) (*MaterialNewsReply, error)
- func (c *Client) MaterialGetTempFile(mediaID string, dis io.Writer) (*MaterialGetTempFileReply, error)
- func (c *Client) MaterialUploadFile(filename, fileType string, description *VideoDescription, srcFile io.Reader) (*MaterialUploadFileReply, error)
- func (c *Client) MaterialUploadImg(filename string, srcFile io.Reader) (*MaterialUploadImgReply, error)
- func (c *Client) MaterialUploadTempFile(filename, fileType string, srcFile io.Reader) (*MaterialUploadTempFileReply, error)
- func (c *Client) MenuCreate(btns []interface{}) error
- func (c *Client) MenuDeleteAll() error
- func (c *Client) MenuGetAll() (*simplejson.Json, error)
- func (c *Client) OAuthCheckAccessToken(accessToken, openID string) (bool, error)
- func (c *Client) OAuthCode2Session(code string) (*OAuthCode2SessionReponse, error)
- func (c *Client) OAuthGetAccessToken(code string) (*OAuthAccessTokenReply, error)
- func (c *Client) OAuthGetUserInfo(accessToken, openID string) (*OAuthUserInfoReply, error)
- func (c *Client) OAuthRefreshToken(accessToken string) (*OAuthRefreshTokenReply, error)
- func (c *Client) QrcodeCreateLimit(req *QrcodeLimitQrcodeRequest) (*QrcodeLimitQrcodeReply, error)
- func (c *Client) QrcodeCreateTemp(req *QrcodeTempQrcodeRequest) (*QrcodeTempQrcodeReply, error)
- func (c *Client) QrcodeDownload(ticket string) ([]byte, error)
- func (c *Client) TemplateSend(req *TemplateSendRequest) error
- func (c *Client) WxaGenerateUrlLink(req *WxaGenerateUrlLinkRequest) (*WxaGenerateUrlLinkResponse, error)
- func (c *Client) WxaGenerateUrlScheme(req *WxaGenerateUrlSchemeRequest) (*WxaGenerateUrlSchemeResponse, error)
- type ClientOption
- func ClientOptionAppID(appID string) ClientOption
- func ClientOptionAppSecret(appSecret string) ClientOption
- func ClientOptionBaseURL(baseURL string) ClientOption
- func ClientOptionHttpClient(httpClient *http.Client) ClientOption
- func ClientOptionProxy(proxy bool) ClientOption
- func ClientOptionToken(token Tokener) ClientOption
- type ClientOptions
- type CustomImageData
- type CustomImageRequest
- type CustomMenuMessage
- type CustomMenuMessageListItem
- type CustomMenuRequest
- type CustomNewsData
- type CustomNewsDataArticle
- type CustomNewsRequest
- type CustomTextData
- type CustomTextRequest
- type DraftAddRequest
- type DraftAddResponse
- type DraftArticle
- type DraftGetResponse
- type DraftNewsItem
- type JsAPITicketReply
- type MaterialGetTempFileReply
- type MaterialNewsReply
- type MaterialNewsRequest
- type MaterialUploadFileReply
- type MaterialUploadImgReply
- type MaterialUploadTempFileReply
- type MenuButton
- type MenuClickButton
- type MenuMediaIDButton
- type MenuMiniProgramButton
- type MenuSubButton
- type MenuViewButton
- type MenuViewLimitedButton
- type MessageFollowAccept
- type MessageImageAccept
- type MessageImageReply
- type MessageLinkAccept
- type MessageLocationAccept
- type MessageMenuPullAccept
- type MessageMenuSkipAccept
- type MessageMusicReply
- type MessageNewsArticle
- type MessageNewsReply
- type MessageScanQRCodeFollowAccept
- type MessageScanQRCodeFollowedAccept
- type MessageShortVideoAccept
- type MessageTextAccept
- type MessageTextReply
- type MessageVideoAccept
- type MessageVideoReply
- type MessageVoiceAccept
- type MessageVoiceReply
- type OAuthAccessTokenReply
- type OAuthCode2SessionReponse
- type OAuthRefreshTokenReply
- type OAuthUserInfoReply
- type Parameter
- type QiyeClient
- func (c *QiyeClient) KfSendMessage(req *QiyeKfSendMessageRequest) (*QiyeKfSendMessageResponse, error)
- func (c *QiyeClient) KfSendMsgOnEvent(req *QiyeKfSendMsgOnEventRequest) (*QiyeKfSendMsgOnEventResponse, error)
- func (c *QiyeClient) KfSyncMessage(req *QiyeKfSyncMessageRequest) (*QiyeKfSyncMessageResponse, error)
- func (c *QiyeClient) QiyeMedialGet(mediaID string, dis io.Writer) error
- func (c *QiyeClient) QiyeMedialGetJsSdk(mediaID string, dis io.Writer) error
- func (c *QiyeClient) QiyeMedialUpload(filename string, fileType QiyeMedialType, srcFile io.Reader) (*QiyeMedialUploadResponse, error)
- type QiyeClientOption
- func QiyeClientOptionAppID(appID string) QiyeClientOption
- func QiyeClientOptionAppSecret(appSecret string) QiyeClientOption
- func QiyeClientOptionBaseURL(baseURL string) QiyeClientOption
- func QiyeClientOptionHttpClient(httpClient *http.Client) QiyeClientOption
- func QiyeClientOptionProxy(proxy bool) QiyeClientOption
- func QiyeClientOptionToken(token QiyeTokener) QiyeClientOption
- type QiyeClientOptions
- type QiyeKfSendMessageRequest
- type QiyeKfSendMessageResponse
- type QiyeKfSendMsgOnEventRequest
- type QiyeKfSendMsgOnEventResponse
- type QiyeKfSyncMessageBusinessCard
- type QiyeKfSyncMessageEvent
- type QiyeKfSyncMessageEventWechatChannels
- type QiyeKfSyncMessageFile
- type QiyeKfSyncMessageImage
- type QiyeKfSyncMessageItem
- type QiyeKfSyncMessageLink
- type QiyeKfSyncMessageLocation
- type QiyeKfSyncMessageMenu
- type QiyeKfSyncMessageMenuItem
- type QiyeKfSyncMessageMenuItemClick
- type QiyeKfSyncMessageMenuItemMiniprogram
- type QiyeKfSyncMessageMenuItemView
- type QiyeKfSyncMessageMiniprogram
- type QiyeKfSyncMessageRequest
- type QiyeKfSyncMessageResponse
- type QiyeKfSyncMessageText
- type QiyeKfSyncMessageVoice
- type QiyeMedialType
- type QiyeMedialUploadResponse
- type QiyeTokenClient
- type QiyeTokenClientFromRedisOption
- type QiyeTokenClientFromRedisOptions
- type QiyeTokenForProxy
- type QiyeTokenFromRedis
- type QiyeTokener
- type QrcodeLimitQrcodeReply
- type QrcodeLimitQrcodeRequest
- type QrcodeTempQrcodeReply
- type QrcodeTempQrcodeRequest
- type TemplateDataItem
- type TemplateMiniProgram
- type TemplateSendRequest
- type TokenClient
- type TokenClientFromRedisOption
- type TokenClientFromRedisOptions
- type TokenForProxy
- type TokenFromRedis
- type Tokener
- type VideoDescription
- type WxaGenerateUrlLinkCloudBase
- type WxaGenerateUrlLinkRequest
- type WxaGenerateUrlLinkResponse
- type WxaGenerateUrlSchemeJumpWxa
- type WxaGenerateUrlSchemeRequest
- type WxaGenerateUrlSchemeResponse
Constants ¶
const ( // MaterialTypeImage 图片(image) MaterialTypeImage = "image" // MaterialTypeVoice 语音(voice) MaterialTypeVoice = "voice" // MaterialTypeVideo 视频(video) MaterialTypeVideo = "video" // MaterialTypeThumb 缩略图(thumb) MaterialTypeThumb = "thumb" )
const ( // MenuButtonTypeClick .. MenuButtonTypeClick = "click" // MenuButtonTypeView ... MenuButtonTypeView = "view" // MenuButtonTypeMiniProgram ... MenuButtonTypeMiniProgram = "miniprogram" // MenuButtonTypeMediaID ... MenuButtonTypeMediaID = "media_id" // MenuButtonTypeViewLimited ... MenuButtonTypeViewLimited = "view_limited" )
const ( // MessageFollowEventSubscribe subscribe(订阅) MessageFollowEventSubscribe = "subscribe" // MessageFollowEventUnsubscribe unsubscribe(取消订阅) MessageFollowEventUnsubscribe = "unsubscribe" // MessageMenuEventClick 点击菜单拉取消息时的事件推送 MessageMenuEventClick = "CLICK" // MessageMenuEventView 点击菜单跳转链接时的事件推送 MessageMenuEventView = "VIEW" )
const ( // RedisAccessTokenKey ... RedisAccessTokenKey = "github.com/nilorg/go-wechat/access_token" // RedisJsAPITicketKey ... RedisJsAPITicketKey = "github.com/nilorg/go-wechat/js_api_ticket" )
const MetadataAccessTokenKey = "wechat-access-token"
MetadataAccessTokenKey Metadata wehcat AccessToken key.
const MetadataJsAPITicketKey = "wechat-js-api-ticket"
MetadataJsAPITicketKey Metadata wehcat JsAPITicketKey key.
const (
// QiyeRedisAccessTokenKey ...
QiyeRedisAccessTokenKey = "github.com/nilorg/go-wechat/qiye/access_token"
)
Variables ¶
var ( // AppID 应用Key AppID = "" // AppSecret 秘密 AppSecret = "" )
var ( // ErrMenuSubButtonAppend ... ErrMenuSubButtonAppend = errors.New("追加按钮错误,请查查按钮类型") // ErrMenuButtonType ... ErrMenuButtonType = errors.New("菜单类型错误") )
var ( // ErrMetadataNotFoundClient 元数据不存在客户端AccessToken错误 ErrMetadataNotFoundClient = errors.New("Metadata不存在客户端AccessToken") )
Functions ¶
func Execute ¶
func Execute(httpClient *http.Client, url string, param Parameter) (json *simplejson.Json, err error)
Execute 执行
func Post ¶
func Post(httpClient *http.Client, url, contentType string, args map[string]string) (result string, err error)
Post send post request.
Types ¶
type AccessTokenReply ¶
type AccessTokenReply struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` }
AccessTokenReply ...
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) (client *Client)
func (*Client) CustomSendImage ¶
func (c *Client) CustomSendImage(req *CustomImageRequest) error
SendImage 发送图片消息
func (*Client) CustomSendMenu ¶
func (c *Client) CustomSendMenu(req *CustomMenuRequest) error
SendMenu 发送菜单消息
func (*Client) CustomSendNews ¶
func (c *Client) CustomSendNews(req *CustomNewsRequest) error
SendNews 发送图文消息(点击跳转到外链) 图文消息条数限制在1条以内,注意,如果图文数超过1,则将会返回错误码45008。
func (*Client) CustomSendText ¶
func (c *Client) CustomSendText(req *CustomTextRequest) error
SendText 发送文本消息
func (*Client) DraftAdd ¶
func (c *Client) DraftAdd(req *DraftAddRequest) (*DraftAddResponse, error)
DraftAdd 新建草稿
func (*Client) DraftGet ¶
func (c *Client) DraftGet(mediaID string) (*DraftGetResponse, error)
DraftAdd 新建草稿
func (*Client) MaterialAddNews ¶
func (c *Client) MaterialAddNews(reqs []*MaterialNewsRequest) (*MaterialNewsReply, error)
AddNews 新增永久图文素材
func (*Client) MaterialGetTempFile ¶
func (c *Client) MaterialGetTempFile(mediaID string, dis io.Writer) (*MaterialGetTempFileReply, error)
GetTempFile 获取临时素材
func (*Client) MaterialUploadFile ¶
func (c *Client) MaterialUploadFile(filename, fileType string, description *VideoDescription, srcFile io.Reader) (*MaterialUploadFileReply, error)
UploadFile 新增其他类型永久素材 通过POST表单来调用接口,表单id为media,包含需要上传的素材内容,有filename、filelength、content-type等信息。请注意:图片素材将进入公众平台官网素材管理模块中的默认分组。
func (*Client) MaterialUploadImg ¶
func (c *Client) MaterialUploadImg(filename string, srcFile io.Reader) (*MaterialUploadImgReply, error)
UploadImg 上传图文消息内的图片获取URL 本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。
func (*Client) MaterialUploadTempFile ¶
func (c *Client) MaterialUploadTempFile(filename, fileType string, srcFile io.Reader) (*MaterialUploadTempFileReply, error)
UploadTempFile 新增临时素材 注意点: 1、临时素材media_id是可复用的。 2、媒体文件在微信后台保存时间为3天,即3天后media_id失效。 3、上传临时素材的格式、大小限制与公众平台官网一致。 图片(image): 2M,支持PNG\JPEG\JPG\GIF格式 语音(voice):2M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式
func (*Client) MenuGetAll ¶
func (c *Client) MenuGetAll() (*simplejson.Json, error)
MenuGetAll 获取所有菜单
func (*Client) OAuthCheckAccessToken ¶
OAuthCheckAccessToken 检查Token
func (*Client) OAuthCode2Session ¶
func (c *Client) OAuthCode2Session(code string) (*OAuthCode2SessionReponse, error)
OAuthCode2Session 小程序登录凭证校验 通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程。 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html
func (*Client) OAuthGetAccessToken ¶
func (c *Client) OAuthGetAccessToken(code string) (*OAuthAccessTokenReply, error)
OAuthGetAccessToken 获取 access_token 通过code换取网页授权access_token
func (*Client) OAuthGetUserInfo ¶
func (c *Client) OAuthGetUserInfo(accessToken, openID string) (*OAuthUserInfoReply, error)
OAuthGetUserInfo 拉取用户信息 如果网页授权作用域为snsapi_userinfo,则此时开发者可以通过access_token和openid拉取用户信息了。
func (*Client) OAuthRefreshToken ¶
func (c *Client) OAuthRefreshToken(accessToken string) (*OAuthRefreshTokenReply, error)
OAuthRefreshToken 刷新access_token 由于access_token拥有较短的有效期,当access_token超时后,可以使用refresh_token进行刷新,refresh_token有效期为30天,当refresh_token失效之后,需要用户重新授权。
func (*Client) QrcodeCreateLimit ¶
func (c *Client) QrcodeCreateLimit(req *QrcodeLimitQrcodeRequest) (*QrcodeLimitQrcodeReply, error)
QrcodeCreateLimit 生成一个永久带参数的二维码
func (*Client) QrcodeCreateTemp ¶
func (c *Client) QrcodeCreateTemp(req *QrcodeTempQrcodeRequest) (*QrcodeTempQrcodeReply, error)
QrcodeCreateTemp 生成临时带参数的二维码
func (*Client) QrcodeDownload ¶
QrcodeDownload 下载二维码
func (*Client) TemplateSend ¶
func (c *Client) TemplateSend(req *TemplateSendRequest) error
Send 发送模板消息 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html#5
func (*Client) WxaGenerateUrlLink ¶
func (c *Client) WxaGenerateUrlLink(req *WxaGenerateUrlLinkRequest) (*WxaGenerateUrlLinkResponse, error)
WxaGenerateUrlLink 生成小程序码 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-link/generateUrlLink.html
func (*Client) WxaGenerateUrlScheme ¶
func (c *Client) WxaGenerateUrlScheme(req *WxaGenerateUrlSchemeRequest) (*WxaGenerateUrlSchemeResponse, error)
WxaGenerateUrlScheme 生成小程序码 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-scheme/generateScheme.html
type ClientOption ¶
type ClientOption func(*ClientOptions)
ClientOption 为可选参数赋值的函数
func ClientOptionAppSecret ¶
func ClientOptionAppSecret(appSecret string) ClientOption
ClientOptionAppSecret ...
func ClientOptionBaseURL ¶
func ClientOptionBaseURL(baseURL string) ClientOption
ClientOptionBaseURL ...
func ClientOptionHttpClient ¶
func ClientOptionHttpClient(httpClient *http.Client) ClientOption
ClientOptionHttpClient ...
type ClientOptions ¶
type ClientOptions struct { BaseURL string Proxy bool Token Tokener AppID string AppSecret string HttpClient *http.Client }
ClientOptions 可选参数列表
func NewClientOptions ¶
func NewClientOptions(opts ...ClientOption) ClientOptions
NewClientOptions 创建可选参数
type CustomImageData ¶
type CustomImageData struct {
MediaID string `json:"media_id"` // 素材ID
}
CustomImageData 图片消息
type CustomImageRequest ¶
type CustomImageRequest struct { ToUser string `json:"touser"` // 要发送给的用户openID MsgType string `json:"msgtype"` // 消息类型 Image *CustomImageData `json:"image"` // 消息 }
CustomImageRequest 发送图片消息
func NewCustomImageRequest ¶
func NewCustomImageRequest(toUser, mediaID string) *CustomImageRequest
NewCustomImageRequest 创建发送图片消息
type CustomMenuMessage ¶
type CustomMenuMessage struct { HeadContent string `json:"head_content"` // 菜单名称 List []*CustomMenuMessageListItem `json:"list"` // 菜单项 TailContent string `json:"tail_content"` // 结语 }
CustomMenuMessage 菜单消息
type CustomMenuMessageListItem ¶
type CustomMenuMessageListItem struct { ID string `json:"id"` // ID Content string `json:"content"` // 内容 }
CustomMenuMessageListItem 菜单项
type CustomMenuRequest ¶
type CustomMenuRequest struct { ToUser string `json:"touser"` // 要发送给的用户openID MsgType string `json:"msgtype"` // 消息类型 Menus *CustomMenuMessage `json:"msgmenu"` // 菜单 }
CustomMenuRequest 菜单请求
func NewCustomMenuRequest ¶
func NewCustomMenuRequest(toUser string, msg *CustomMenuMessage) *CustomMenuRequest
NewCustomMenuRequest 发送菜单消息
type CustomNewsData ¶
type CustomNewsData struct {
Articles []*CustomNewsDataArticle `json:"articles"` // 素材ID
}
CustomNewsData 图片消息
type CustomNewsDataArticle ¶
type CustomNewsDataArticle struct { Title string `json:"title"` Description string `json:"description"` URL string `json:"url"` PicURL string `json:"picurl"` }
CustomNewsDataArticle 图文消息项
type CustomNewsRequest ¶
type CustomNewsRequest struct { ToUser string `json:"touser"` // 要发送给的用户openID MsgType string `json:"msgtype"` // 消息类型 News *CustomNewsData `json:"news"` // 消息 }
CustomNewsRequest 发送图文消息
func NewCustomNewsRequest ¶
func NewCustomNewsRequest(toUser string, article *CustomNewsDataArticle) *CustomNewsRequest
NewCustomNewsRequest 发送图文消息(点击跳转到外链) 图文消息条数限制在1条以内,注意,如果图文数超过1,则将会返回错误码45008。
type CustomTextData ¶
type CustomTextData struct {
Content string `json:"content"` // 消息内容
}
CustomTextData 文本消息
type CustomTextRequest ¶
type CustomTextRequest struct { ToUser string `json:"touser"` // 要发送给的用户openID MsgType string `json:"msgtype"` // 消息类型 Text *CustomTextData `json:"text"` // 消息 }
CustomTextRequest 发送文本消息
func NewCustomTextRequest ¶
func NewCustomTextRequest(toUser, content string) *CustomTextRequest
NewCustomTextRequest 创建发送文本消息
type DraftAddRequest ¶
type DraftAddRequest struct {
Articles []*DraftArticle `json:"articles"`
}
DraftAddRequest 新建草稿
type DraftAddResponse ¶
type DraftAddResponse struct {
MediaID string `json:"media_id"` // 上传后的获取标志,长度不固定,但不会超过 128 字符
}
DraftAddResponse 新建草稿回复
type DraftArticle ¶
type DraftArticle struct { Title string `json:"title"` // 标题 Author string `json:"author"` // 作者 Digest string `json:"digest"` // 图文消息的摘要,仅有单图文消息才有摘要,多图文此处为空。如果本字段为没有填写,则默认抓取正文前54个字。 Content string `json:"content"` // 图文消息的具体内容,支持 HTML 标签,必须少于2万字符,小于1M,且此处会去除 JS ,涉及图片 url 必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片 url 将被过滤。 ContentSourceURL string `json:"content_source_url"` // 图文消息的原文地址,即点击“阅读原文”后的URL ThumbMediaID string `json:"thumb_media_id"` // 图文消息的封面图片素材id(必须是永久MediaID) NeedOpenComment int `json:"need_open_comment"` // 是否打开评论,0不打开(默认),1打开 OnlyFansCanComment int `json:"only_fans_can_comment"` // 是否粉丝才可评论,0所有人可评论(默认),1粉丝才可评论 }
type DraftGetResponse ¶
type DraftGetResponse struct {
NewsItem []*DraftNewsItem `json:"news_item"` // 多图文消息应有多段 news_item 结构
}
DraftGetResponse 获取草稿回复
type DraftNewsItem ¶
type DraftNewsItem struct { Title string `json:"title"` // 标题 Author string `json:"author"` // 作者 Digest string `json:"digest"` // 图文消息的摘要,仅有单图文消息才有摘要,多图文此处为空。如果本字段为没有填写,则默认抓取正文前54个字。 Content string `json:"content"` // 图文消息的具体内容,支持 HTML 标签,必须少于2万字符,小于1M,且此处会去除 JS ,涉及图片 url 必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片 url 将被过滤。 ContentSourceURL string `json:"content_source_url"` // 图文消息的原文地址,即点击“阅读原文”后的URL ThumbMediaID string `json:"thumb_media_id"` // 图文消息的封面图片素材id(必须是永久MediaID) NeedOpenComment int `json:"need_open_comment"` // 是否打开评论,0不打开(默认),1打开 OnlyFansCanComment int `json:"only_fans_can_comment"` // 是否粉丝才可评论,0所有人可评论(默认),1粉丝才可评论 URL string `json:"url"` // 草稿的临时链接 }
type JsAPITicketReply ¶
JsAPITicketReply ...
type MaterialGetTempFileReply ¶
type MaterialGetTempFileReply struct {
VideoURL string `json:"video_url"` // 如果返回的是视频消息素材
}
MaterialGetTempFileReply 获取临时文件回复
type MaterialNewsReply ¶
type MaterialNewsReply struct {
MediaID string `json:"media_id"`
}
MaterialNewsReply 图文素材回复
type MaterialNewsRequest ¶
type MaterialNewsRequest struct { Title string `json:"title"` ThumbMediaID string `json:"thumb_media_id"` Author string `json:"author"` Digest string `json:"digest"` ShowCoverPic bool `json:"show_cover_pic"` Content string `json:"content"` ContentSourceURL string `json:"content_source_url"` }
MaterialNewsRequest 图文素材
type MaterialUploadFileReply ¶
type MaterialUploadFileReply struct { MediaID string `json:"media_id"` URL string `json:"url"` // 新增的图片素材的图片URL(仅新增图片素材时会返回该字段) }
MaterialUploadFileReply 上传文件回复
type MaterialUploadImgReply ¶
type MaterialUploadImgReply struct {
URL string `json:"url"`
}
MaterialUploadImgReply 上传图片回复
type MaterialUploadTempFileReply ¶
type MaterialUploadTempFileReply struct { Type string `json:"type"` // 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb,主要用于视频与音乐格式的缩略图) MediaID string `json:"media_id"` // 媒体文件上传后,获取标识 CreatedAt int64 `json:"created_at"` // 媒体文件上传时间戳 }
MaterialUploadTempFileReply 上传临时文件回复
type MenuButton ¶
type MenuButton struct { Type string `json:"type"` Name string `json:"name"` Key string `json:"key"` SubButton MenuSubButton `json:"sub_button"` }
MenuButton 按钮
type MenuClickButton ¶
type MenuClickButton struct { Type string `json:"type"` Name string `json:"name"` Key string `json:"key"` }
MenuClickButton click点击类型
type MenuMediaIDButton ¶
type MenuMediaIDButton struct { Type string `json:"type"` Name string `json:"name"` MediaID string `json:"media_id"` }
MenuMediaIDButton 永久素材类型可以是图片、音频、视频、图文消息
type MenuMiniProgramButton ¶
type MenuMiniProgramButton struct { Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` AppID string `json:"appid"` PagePath string `json:"pagepath"` }
MenuMiniProgramButton 小程序类型
func NewMenuMiniProgramButton ¶
func NewMenuMiniProgramButton() *MenuMiniProgramButton
NewMenuMiniProgramButton ...
type MenuViewButton ¶
type MenuViewButton struct { Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` }
MenuViewButton view类型
type MenuViewLimitedButton ¶
type MenuViewLimitedButton struct { Type string `json:"type"` Name string `json:"name"` MediaID string `json:"media_id"` }
MenuViewLimitedButton 小程序类型
func NewMenuViewLimitedButton ¶
func NewMenuViewLimitedButton() *MenuViewLimitedButton
NewMenuViewLimitedButton ...
type MessageFollowAccept ¶
type MessageFollowAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 消息类型,event Event cdata.CDATA `xml:"Event"` // 事件类型,subscribe(订阅)、unsubscribe(取消订阅) }
MessageFollowAccept 关注事件
func MessageFollowAcceptParse ¶
func MessageFollowAcceptParse(xmlValue []byte) *MessageFollowAccept
MessageFollowAcceptParse ...
type MessageImageAccept ¶
type MessageImageAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // image PicURL cdata.CDATA `xml:"PicUrl"` // 图片链接(由系统生成) MediaID cdata.CDATA `xml:"MediaId"` // 图片消息媒体id,可以调用多媒体文件下载接口拉取数据。 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 }
MessageImageAccept 图片消息
func MessageImageAcceptParse ¶
func MessageImageAcceptParse(xmlValue []byte) *MessageImageAccept
MessageImageAcceptParse ...
type MessageImageReply ¶
type MessageImageReply struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 接收方帐号(收到的OpenID) FromUserName cdata.CDATA `xml:"FromUserName"` // 开发者微信号 CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // image MediaID cdata.CDATA `xml:"Image>MediaId"` // 通过素材管理中的接口上传多媒体文件,得到的id。 }
MessageImageReply 图片消息
type MessageLinkAccept ¶
type MessageLinkAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 消息类型,link Title cdata.CDATA `xml:"Title"` // 消息标题 Description cdata.CDATA `xml:"Description"` // 消息描述 URL cdata.CDATA `xml:"Url"` // 消息链接 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 }
MessageLinkAccept 链接消息
func MessageLinkAcceptParse ¶
func MessageLinkAcceptParse(xmlValue []byte) *MessageLinkAccept
MessageLinkAcceptParse ...
type MessageLocationAccept ¶
type MessageLocationAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // location LocationX cdata.CDATA `xml:"Location_X"` // 地理位置维度 LocationY cdata.CDATA `xml:"Location_Y"` // 地理位置经度 Scale cdata.CDATA `xml:"Scale"` // 地图缩放大小 Label cdata.CDATA `xml:"Label"` // 地理位置信息 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 }
MessageLocationAccept 地理位置消息
func MessageLocationAcceptParse ¶
func MessageLocationAcceptParse(xmlValue []byte) *MessageLocationAccept
MessageLocationAcceptParse ...
type MessageMenuPullAccept ¶
type MessageMenuPullAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 消息类型,event Event cdata.CDATA `xml:"Event"` // 事件类型,CLICK EventKey cdata.CDATA `xml:"EventKey"` // 事件KEY值,与自定义菜单接口中KEY值对应 }
MessageMenuPullAccept 点击菜单拉取消息时的事件推送
func MessageMenuPullAcceptParse ¶
func MessageMenuPullAcceptParse(xmlValue []byte) *MessageMenuPullAccept
MessageMenuPullAcceptParse ...
type MessageMenuSkipAccept ¶
type MessageMenuSkipAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 消息类型,event Event cdata.CDATA `xml:"Event"` // 事件类型,VIEW EventKey cdata.CDATA `xml:"EventKey"` // 事件KEY值,设置的跳转URL }
MessageMenuSkipAccept 点击菜单跳转链接时的事件推送
func MessageMenuSkipAcceptParse ¶
func MessageMenuSkipAcceptParse(xmlValue []byte) *MessageMenuSkipAccept
MessageMenuSkipAcceptParse ...
type MessageMusicReply ¶
type MessageMusicReply struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 接收方帐号(收到的OpenID) FromUserName cdata.CDATA `xml:"FromUserName"` // 开发者微信号 CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // music Title cdata.CDATA `xml:"Title"` // 音乐标题 Description cdata.CDATA `xml:"Description"` // 音乐描述 MusicURL cdata.CDATA `xml:"MusicURL"` // 音乐链接 HQMusicURL cdata.CDATA `xml:"HQMusicUrl"` // 高质量音乐链接,WIFI环境优先使用该链接播放音乐 ThumbMediaID cdata.CDATA `xml:"ThumbMediaId"` // 缩略图的媒体id,通过素材管理中的接口上传多媒体文件,得到的id }
MessageMusicReply 音乐消息
type MessageNewsArticle ¶
type MessageNewsArticle struct { Title cdata.CDATA `xml:"Title"` // 图文消息标题 Description cdata.CDATA `xml:"Description"` // 图文消息描述 PicURL cdata.CDATA `xml:"PicUrl"` // 图片链接,支持JPG、PNG格式,较好的效果为大图360*200,小图200*200 URL cdata.CDATA `xml:"Url"` // 点击图文消息跳转链接 }
MessageNewsArticle ...
type MessageNewsReply ¶
type MessageNewsReply struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 接收方帐号(收到的OpenID) FromUserName cdata.CDATA `xml:"FromUserName"` // 开发者微信号 CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // news ArticleCount cdata.CDATA `xml:"ArticleCount"` // 图文消息个数,限制为8条以内 Articles []*MessageNewsArticle `xml:"Articles>item"` // 多条图文消息信息,默认第一个item为大图,注意,如果图文数超过8,则将会无响应 }
MessageNewsReply 回复图文消息
type MessageScanQRCodeFollowAccept ¶
type MessageScanQRCodeFollowAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 消息类型,event Event cdata.CDATA `xml:"Event"` // 事件类型,subscribe EventKey cdata.CDATA `xml:"EventKey"` // 事件KEY值,qrscene_为前缀,后面为二维码的参数值 Ticket cdata.CDATA `xml:"Ticket"` // 二维码的ticket,可用来换取二维码图片 }
MessageScanQRCodeFollowAccept 二维码事件,用户未关注时,进行关注后的事件推送
func MessageScanQRCodeFollowAcceptParse ¶
func MessageScanQRCodeFollowAcceptParse(xmlValue []byte) *MessageScanQRCodeFollowAccept
MessageScanQRCodeFollowAcceptParse ...
type MessageScanQRCodeFollowedAccept ¶
type MessageScanQRCodeFollowedAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 消息类型,event Event cdata.CDATA `xml:"Event"` // 事件类型,SCAN EventKey cdata.CDATA `xml:"EventKey"` // 事件KEY值,是一个32位无符号整数,即创建二维码时的二维码scene_id Ticket cdata.CDATA `xml:"Ticket"` // 二维码的ticket,可用来换取二维码图片 }
MessageScanQRCodeFollowedAccept 二维码事件,用户已关注时的事件推送
func MessageScanQRCodeFollowedAcceptParse ¶
func MessageScanQRCodeFollowedAcceptParse(xmlValue []byte) *MessageScanQRCodeFollowedAccept
MessageScanQRCodeFollowedAcceptParse ...
type MessageShortVideoAccept ¶
type MessageShortVideoAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 小视频为shortvideo MediaID cdata.CDATA `xml:"MediaId"` // 视频消息媒体id,可以调用多媒体文件下载接口拉取数据。 ThumbMediaID cdata.CDATA `xml:"ThumbMediaId"` // 视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 }
MessageShortVideoAccept 小视频消息
func MessageShortVideoAcceptParse ¶
func MessageShortVideoAcceptParse(xmlValue []byte) *MessageShortVideoAccept
MessageShortVideoAcceptParse ...
type MessageTextAccept ¶
type MessageTextAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // text Content cdata.CDATA `xml:"Content"` // 文本消息内容 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 BizMsgMenuID cdata.CDATA `xml:"bizmsgmenuid"` // 点击的菜单ID }
MessageTextAccept 文本消息
func MessageTextAcceptParse ¶
func MessageTextAcceptParse(xmlValue []byte) *MessageTextAccept
MessageTextAcceptParse ...
type MessageTextReply ¶
type MessageTextReply struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 接收方帐号(收到的OpenID) FromUserName cdata.CDATA `xml:"FromUserName"` // 开发者微信号 CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // text Content cdata.CDATA `xml:"Content"` // 回复的消息内容(换行:在content中能够换行,微信客户端就支持换行显示) }
MessageTextReply 文本消息
type MessageVideoAccept ¶
type MessageVideoAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 视频为video MediaID cdata.CDATA `xml:"MediaId"` // 视频消息媒体id,可以调用多媒体文件下载接口拉取数据。 ThumbMediaID cdata.CDATA `xml:"ThumbMediaId"` // 视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 }
MessageVideoAccept 视频消息
func MessageVideoAcceptParse ¶
func MessageVideoAcceptParse(xmlValue []byte) *MessageVideoAccept
MessageVideoAcceptParse ...
type MessageVideoReply ¶
type MessageVideoReply struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 接收方帐号(收到的OpenID) FromUserName cdata.CDATA `xml:"FromUserName"` // 开发者微信号 CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // video MediaID cdata.CDATA `xml:"Video>MediaId"` // 通过素材管理中的接口上传多媒体文件,得到的id Title cdata.CDATA `xml:"Title"` // 视频消息的标题 Description cdata.CDATA `xml:"Description"` // 视频消息的描述 }
MessageVideoReply 视频消息
type MessageVoiceAccept ¶
type MessageVoiceAccept struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 开发者微信号 FromUserName cdata.CDATA `xml:"FromUserName"` // 发送方帐号(一个OpenID) CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 语音为voice MediaID cdata.CDATA `xml:"MediaId"` // 语音消息媒体id,可以调用多媒体文件下载接口拉取数据。 Format cdata.CDATA `xml:"Format"` // 语音格式,如amr,speex等 MsgID int64 `xml:"MsgId"` // 消息id,64位整型 }
MessageVoiceAccept 语音消息
func MessageVoiceAcceptParse ¶
func MessageVoiceAcceptParse(xmlValue []byte) *MessageVoiceAccept
MessageVoiceAcceptParse ...
type MessageVoiceReply ¶
type MessageVoiceReply struct { XMLName xml.Name `xml:"xml"` ToUserName cdata.CDATA `xml:"ToUserName"` // 接收方帐号(收到的OpenID) FromUserName cdata.CDATA `xml:"FromUserName"` // 开发者微信号 CreateTime int64 `xml:"CreateTime"` // 消息创建时间 (整型) MsgType cdata.CDATA `xml:"MsgType"` // 语音,voice MediaID cdata.CDATA `xml:"Voice>MediaId"` // 通过素材管理中的接口上传多媒体文件,得到的id }
MessageVoiceReply 语音消息
type OAuthAccessTokenReply ¶
type OAuthAccessTokenReply struct { AccessToken string `json:"access_token"` // 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同 ExpiresIn int `json:"expires_in"` // access_token接口调用凭证超时时间,单位(秒) RefreshToken string `json:"refresh_token"` // 用户刷新access_token OpenID string `json:"openid"` // 用户唯一标识,请注意,在未关注公众号时,用户访问公众号的网页,也会产生一个用户和公众号唯一的OpenID Scope string `json:"scope"` // 用户授权的作用域,使用逗号(,)分隔 }
OAuthAccessTokenReply 获取Token
type OAuthCode2SessionReponse ¶
type OAuthCode2SessionReponse struct { OpenID string `json:"openid"` // 用户的唯一标识 Sessionkey string `json:"session_key"` // 会话密钥 UnionID string `json:"unionid"` // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。 }
OAuthCode2SessionReponse 小程序验证token响应
type OAuthRefreshTokenReply ¶
type OAuthRefreshTokenReply struct { AccessToken string `json:"access_token"` // 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同 ExpiresIn int `json:"expires_in"` // access_token接口调用凭证超时时间,单位(秒) RefreshToken string `json:"refresh_token"` // 用户刷新access_token OpenID string `json:"openid"` // 用户唯一标识 Scope string `json:"scope"` // 用户授权的作用域,使用逗号(,)分隔 }
OAuthRefreshTokenReply 刷新Token
type OAuthUserInfoReply ¶
type OAuthUserInfoReply struct { OpenID string `json:"openid"` // 用户的唯一标识 NickName string `json:"nickname"` // 用户昵称 Sex string `json:"sex"` // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 Province string `json:"province"` // 用户个人资料填写的省份 City string `json:"city"` // 普通用户个人资料填写的城市 Country string `json:"country"` // 国家,如中国为CN HeadimgURL string `json:"headimgurl"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。 Privilege []string `json:"privilege"` // 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) UnionID string `json:"unionid"` // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。 }
OAuthUserInfoReply 用户信息
type QiyeClient ¶
type QiyeClient struct {
// contains filtered or unexported fields
}
func NewQiyeClient ¶
func NewQiyeClient(opts ...QiyeClientOption) (client *QiyeClient)
func (*QiyeClient) KfSendMessage ¶
func (c *QiyeClient) KfSendMessage(req *QiyeKfSendMessageRequest) (*QiyeKfSendMessageResponse, error)
KfSendMessage 发送客服消息
func (*QiyeClient) KfSendMsgOnEvent ¶
func (c *QiyeClient) KfSendMsgOnEvent(req *QiyeKfSendMsgOnEventRequest) (*QiyeKfSendMsgOnEventResponse, error)
KfSendMessage 发送客服消息
func (*QiyeClient) KfSyncMessage ¶
func (c *QiyeClient) KfSyncMessage(req *QiyeKfSyncMessageRequest) (*QiyeKfSyncMessageResponse, error)
KfSyncMessage 获取客服消息
func (*QiyeClient) QiyeMedialGet ¶
func (c *QiyeClient) QiyeMedialGet(mediaID string, dis io.Writer) error
QiyeMedialGet 获取临时素材
func (*QiyeClient) QiyeMedialGetJsSdk ¶
func (c *QiyeClient) QiyeMedialGetJsSdk(mediaID string, dis io.Writer) error
QiyeMedialGetJsSdk 获取高清语音素材 可以使用本接口获取从JSSDK的uploadVoice接口上传的临时语音素材,格式为speex,16K采样率。该音频比上文的临时素材获取接口(格式为amr,8K采样率)更加清晰,适合用作语音识别等对音质要求较高的业务。
func (*QiyeClient) QiyeMedialUpload ¶
func (c *QiyeClient) QiyeMedialUpload(filename string, fileType QiyeMedialType, srcFile io.Reader) (*QiyeMedialUploadResponse, error)
QiyeMedialUpload 上传临时素材 素材上传得到media_id,该media_id仅三天内有效, media_id在同一企业内应用之间可以共享
type QiyeClientOption ¶
type QiyeClientOption func(*QiyeClientOptions)
QiyeClientOption 为可选参数赋值的函数
func QiyeClientOptionAppID ¶
func QiyeClientOptionAppID(appID string) QiyeClientOption
QiyeClientOptionAppID ...
func QiyeClientOptionAppSecret ¶
func QiyeClientOptionAppSecret(appSecret string) QiyeClientOption
QiyeClientOptionAppSecret ...
func QiyeClientOptionBaseURL ¶
func QiyeClientOptionBaseURL(baseURL string) QiyeClientOption
QiyeClientOptionBaseURL ...
func QiyeClientOptionHttpClient ¶
func QiyeClientOptionHttpClient(httpClient *http.Client) QiyeClientOption
QiyeClientOptionHttpClient ...
func QiyeClientOptionProxy ¶
func QiyeClientOptionProxy(proxy bool) QiyeClientOption
QiyeClientOptionProxy ...
func QiyeClientOptionToken ¶
func QiyeClientOptionToken(token QiyeTokener) QiyeClientOption
QiyeClientOptionToken ...
type QiyeClientOptions ¶
type QiyeClientOptions struct { BaseURL string Proxy bool Token QiyeTokener AppID string AppSecret string HttpClient *http.Client }
QiyeClientOptions 可选参数列表
func NewQiyeClientOptions ¶
func NewQiyeClientOptions(opts ...QiyeClientOption) QiyeClientOptions
NewQiyeClientOptions 创建可选参数
type QiyeKfSendMessageRequest ¶
type QiyeKfSendMessageRequest struct { ToUser string `json:"touser"` OpenKfID string `json:"open_kfid"` MsgID string `json:"msgid"` MsgType string `json:"msgtype"` Text *QiyeKfSyncMessageText `json:"text,omitempty"` // 文本消息 Image *QiyeKfSyncMessageImage `json:"image,omitempty"` // 图片消息 Voice *QiyeKfSyncMessageVoice `json:"voice,omitempty"` // 语音消息 File *QiyeKfSyncMessageFile `json:"file,omitempty"` // 文件消息 Location *QiyeKfSyncMessageLocation `json:"location,omitempty"` // 位置消息 Link *QiyeKfSyncMessageLink `json:"link,omitempty"` // 链接消息 BusinessCard *QiyeKfSyncMessageBusinessCard `json:"business_card,omitempty"` // 名片消息 Miniprogram *QiyeKfSyncMessageMiniprogram `json:"miniprogram,omitempty"` // 小程序消息 }
type QiyeKfSendMessageResponse ¶
type QiyeKfSendMessageResponse struct {
MsgID string `json:"msgid"`
}
type QiyeKfSendMsgOnEventRequest ¶
type QiyeKfSendMsgOnEventRequest struct { Code string `json:"code"` MsgID string `json:"msgid"` MsgType string `json:"msgtype"` Text *QiyeKfSyncMessageText `json:"text,omitempty"` // 文本消息 }
type QiyeKfSendMsgOnEventResponse ¶
type QiyeKfSendMsgOnEventResponse struct {
MsgID string `json:"msgid"`
}
type QiyeKfSyncMessageBusinessCard ¶
type QiyeKfSyncMessageBusinessCard struct {
UserID string `json:"userid"`
}
type QiyeKfSyncMessageEvent ¶
type QiyeKfSyncMessageEvent struct { EventType string `json:"event_type"` OpenKfID string `json:"open_kfid"` ExternalUserID string `json:"external_userid"` Scene string `json:"scene,omitempty"` SceneParam string `json:"scene_param,omitempty"` WelcomeCode string `json:"welcome_code,omitempty"` WechatChannels *QiyeKfSyncMessageEventWechatChannels `json:"wechat_channels,omitempty"` FailMsgID string `json:"fail_msgid,omitempty"` FailType int `json:"fail_type,omitempty"` ServicerUserID string `json:"servicer_userid,omitempty"` Status int `json:"status,omitempty"` ChangeType int `json:"change_type,omitempty"` OldServicerUserID string `json:"old_servicer_userid,omitempty"` NewServicerUserID string `json:"new_servicer_userid,omitempty"` MsgCode string `json:"msg_code,omitempty"` RecallMsgID string `json:"recall_msgid,omitempty"` }
type QiyeKfSyncMessageEventWechatChannels ¶
type QiyeKfSyncMessageEventWechatChannels struct {
Nickname string `json:"nickname"`
}
type QiyeKfSyncMessageFile ¶
type QiyeKfSyncMessageFile struct {
MediaID string `json:"media_id"` // 文件id
}
type QiyeKfSyncMessageImage ¶
type QiyeKfSyncMessageImage struct {
MediaID string `json:"media_id"` // 图片文件id
}
type QiyeKfSyncMessageItem ¶
type QiyeKfSyncMessageItem struct { MsgID string `json:"msgid"` // 消息ID OpenKfID string `json:"open_kfid"` // 客服帐号ID(msgtype为event,该字段不返回) ExternalUserID string `json:"external_userid"` // 客户UserID(msgtype为event,该字段不返回) SendTime int `json:"send_time"` // 消息发送时间 Origin int `json:"origin"` // 消息来源。3-微信客户发送的消息 4-系统推送的事件消息 5-接待人员在企业微信客户端发送的消息 ServicerUserID string `json:"servicer_userid"` // 从企业微信给客户发消息的接待人员userid(即仅origin为5才返回;msgtype为event,该字段不返回) MsgType string `json:"msgtype"` // 对不同的msgtype,有相应的结构描述,下面进一步说明 Text *QiyeKfSyncMessageText `json:"text,omitempty"` // 文本消息 Image *QiyeKfSyncMessageImage `json:"image,omitempty"` // 图片消息 Voice *QiyeKfSyncMessageVoice `json:"voice,omitempty"` // 语音消息 File *QiyeKfSyncMessageFile `json:"file,omitempty"` // 文件消息 Location *QiyeKfSyncMessageLocation `json:"location,omitempty"` // 位置消息 Link *QiyeKfSyncMessageLink `json:"link,omitempty"` // 链接消息 BusinessCard *QiyeKfSyncMessageBusinessCard `json:"business_card,omitempty"` // 名片消息 Miniprogram *QiyeKfSyncMessageMiniprogram `json:"miniprogram,omitempty"` // 小程序消息 Event *QiyeKfSyncMessageEvent `json:"event,omitempty"` // 事件消息 }
type QiyeKfSyncMessageLink ¶
type QiyeKfSyncMessageMenu ¶
type QiyeKfSyncMessageMenu struct { HeadContent string `json:"head_content"` List []*QiyeKfSyncMessageMenuItem `json:"list"` TailContent string `json:"tail_content"` }
type QiyeKfSyncMessageMenuItem ¶
type QiyeKfSyncMessageMenuItem struct { Type string `json:"type"` Click *QiyeKfSyncMessageMenuItemClick `json:"click,omitempty"` View *QiyeKfSyncMessageMenuItemView `json:"view,omitempty"` Miniprogram *QiyeKfSyncMessageMenuItemMiniprogram `json:"miniprogram,omitempty"` }
type QiyeKfSyncMessageRequest ¶
type QiyeKfSyncMessageRequest struct { Cursor string `json:"cursor"` // 上一次调用时返回的next_cursor,第一次拉取可以不填。若不填,从3天内最早的消息开始返回。 Token string `json:"token"` // 回调事件返回的token字段,10分钟内有效;可不填,如果不填接口有严格的频率限制。 Limit int `json:"limit"` // 期望请求的数据量,默认值和最大值都为1000。注意:可能会出现返回条数少于limit的情况,需结合返回的has_more字段判断是否继续请求。 VoiceFormat int `json:"voice_format"` // 语音消息类型,0-Amr 1-Silk,默认0。可通过该参数控制返回的语音格式,开发者可按需选择自己程序支持的一种格式 }
type QiyeKfSyncMessageResponse ¶
type QiyeKfSyncMessageResponse struct { NextCursor string `json:"next_cursor"` // 下次调用带上该值,则从当前的位置继续往后拉,以实现增量拉取。 HasMore int `json:"has_more"` // 是否还有更多数据。0-否;1-是。不能通过判断msg_list是否空来停止拉取,可能会出现has_more为1,而msg_list为空的情况 MsgList []*QiyeKfSyncMessageItem `json:"msg_list"` // 消息列表 }
type QiyeKfSyncMessageText ¶
type QiyeKfSyncMessageVoice ¶
type QiyeKfSyncMessageVoice struct {
MediaID string `json:"media_id"` // 语音文件id
}
type QiyeMedialType ¶
type QiyeMedialType string
const ( // QiyeMedialTypeImage 图片(image) QiyeMedialTypeImage QiyeMedialType = "image" // QiyeMedialTypeVoice 语音(voice) QiyeMedialTypeVoice QiyeMedialType = "voice" // QiyeMedialTypeVideo 视频(video) QiyeMedialTypeVideo QiyeMedialType = "video" // QiyeMedialTypeFile 普通文件(file) QiyeMedialTypeFile QiyeMedialType = "file" )
type QiyeMedialUploadResponse ¶
type QiyeMedialUploadResponse struct { Type QiyeMedialType `json:"type"` MediaID string `json:"media_id"` CreatedAt int64 `json:"created_at"` }
QiyeMedialUploadResponse 上传文件响应
type QiyeTokenClient ¶
type QiyeTokenClient struct { BaseURL string Proxy bool HttpClient *http.Client // contains filtered or unexported fields }
QiyeTokenClient 客户端
func NewQiyeTokenClient ¶
func NewQiyeTokenClient(appID, appSecret string) *QiyeTokenClient
NewQiyeTokenClient 创建客户端
func (*QiyeTokenClient) GetAccessToken ¶
func (c *QiyeTokenClient) GetAccessToken() string
GetAccessToken 获取 accessToken
type QiyeTokenClientFromRedisOption ¶
type QiyeTokenClientFromRedisOption func(*QiyeTokenClientFromRedisOptions)
QiyeTokenClientFromRedisOption 为可选参数赋值的函数
func QiyeClientFromRedisOptionAccessTokenKey ¶
func QiyeClientFromRedisOptionAccessTokenKey(accessTokenKey string) QiyeTokenClientFromRedisOption
QiyeClientFromRedisOptionAccessTokenKey ...
func QiyeClientFromRedisOptionRedisClient ¶
func QiyeClientFromRedisOptionRedisClient(client *redis.Client) QiyeTokenClientFromRedisOption
QiyeClientFromRedisOptionRedisClient ...
type QiyeTokenClientFromRedisOptions ¶
type QiyeTokenClientFromRedisOptions struct { RedisClient *redis.Client AccessTokenKey string }
QiyeTokenClientFromRedisOptions 可选参数列表
func NewQiyeTokenClientFromRedisOptions ¶
func NewQiyeTokenClientFromRedisOptions(opts ...QiyeTokenClientFromRedisOption) QiyeTokenClientFromRedisOptions
NewQiyeTokenClientFromRedisOptions 创建可选参数
type QiyeTokenForProxy ¶
type QiyeTokenForProxy struct { }
QiyeTokenForProxy 访问代理不需要使用QiyeToken
func (*QiyeTokenForProxy) GetAccessToken ¶
func (token *QiyeTokenForProxy) GetAccessToken() string
GetAccessQiyeToken 获取AccessToken
type QiyeTokenFromRedis ¶
type QiyeTokenFromRedis struct {
// contains filtered or unexported fields
}
QiyeTokenFromRedis 根据Redis客户端创建QiyeToken
func NewQiyeTokenFromRedis ¶
func NewQiyeTokenFromRedis(opts ...QiyeTokenClientFromRedisOption) *QiyeTokenFromRedis
NewQiyeTokenFromRedis 创建客户端
func (*QiyeTokenFromRedis) GetAccessToken ¶
func (token *QiyeTokenFromRedis) GetAccessToken() string
GetAccessQiyeToken 获取AccessQiyeToken
type QiyeTokener ¶
type QiyeTokener interface {
GetAccessToken() string
}
type QrcodeLimitQrcodeReply ¶
type QrcodeLimitQrcodeReply struct { Ticket string `json:"ticket"` // 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码。 URL string `json:"url"` // 二维码图片解析后的地址,开发者可根据该地址自行生成需要的二维码图片 }
QrcodeLimitQrcodeReply 永久二维码回复
type QrcodeLimitQrcodeRequest ¶
type QrcodeLimitQrcodeRequest struct { ActionName string `json:"action_name"` // 二维码类型,QR_SCENE为临时的整型参数值,QR_STR_SCENE为临时的字符串参数值,QR_LIMIT_SCENE为永久的整型参数值,QR_LIMIT_STR_SCENE为永久的字符串参数值 ActionInfo map[string]interface{} `json:"action_info"` // 二维码详细信息 }
QrcodeLimitQrcodeRequest 永久二维码
func NewQrcodeLimitQrcodeRequest ¶
func NewQrcodeLimitQrcodeRequest(num uint) *QrcodeLimitQrcodeRequest
NewQrcodeLimitQrcodeRequest 创建一个永久二维码 场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000)
func NewQrcodeStrLimitQrcodeRequest ¶
func NewQrcodeStrLimitQrcodeRequest(str string) *QrcodeLimitQrcodeRequest
NewQrcodeStrLimitQrcodeRequest 创建一个永久字符串二维码 场景值ID(字符串形式的ID),字符串类型,长度限制为1到64
type QrcodeTempQrcodeReply ¶
type QrcodeTempQrcodeReply struct { Ticket string `json:"ticket"` // 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码。 ExpireSeconds int `json:"expire_seconds"` // 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天)。 URL string `json:"url"` // 二维码图片解析后的地址,开发者可根据该地址自行生成需要的二维码图片 }
QrcodeTempQrcodeReply 临时二维码回复
type QrcodeTempQrcodeRequest ¶
type QrcodeTempQrcodeRequest struct { ExpireSeconds int `json:"expire_seconds"` // 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。 ActionName string `json:"action_name"` // 二维码类型,QR_SCENE为临时的整型参数值,QR_STR_SCENE为临时的字符串参数值,QR_LIMIT_SCENE为永久的整型参数值,QR_LIMIT_STR_SCENE为永久的字符串参数值 ActionInfo map[string]interface{} `json:"action_info"` // 二维码详细信息 }
QrcodeTempQrcodeRequest ,临时二维码
func NewQrcodeTempQrcodeRequest ¶
func NewQrcodeTempQrcodeRequest(num uint, expireSeconds int) *QrcodeTempQrcodeRequest
NewQrcodeTempQrcodeRequest 创建一个临时二维码 场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000)
func NewQrcodeTempStrQrcodeRequest ¶
func NewQrcodeTempStrQrcodeRequest(str string, expireSeconds int) *QrcodeTempQrcodeRequest
NewQrcodeTempStrQrcodeRequest 创建一个临时字符串二维码 场景值ID(字符串形式的ID),字符串类型,长度限制为1到64
type TemplateDataItem ¶
TemplateDataItem ...
type TemplateMiniProgram ¶
type TemplateSendRequest ¶
type TemplateSendRequest struct { ToUser string `json:"touser"` ID string `json:"template_id"` URL string `json:"url"` Data map[string]*TemplateDataItem `json:"data"` MiniProgram *TemplateMiniProgram `json:"miniprogram"` ClientMsgID string `json:"client_msg_id"` }
TemplateSendRequest 消息模板
func NewTemplateReplyInfo ¶
func NewTemplateReplyInfo(tmplID string) *TemplateSendRequest
NewTemplateReplyInfo ...
type TokenClient ¶
type TokenClient struct { BaseURL string Proxy bool HttpClient *http.Client // contains filtered or unexported fields }
TokenClient 客户端
func NewTokenClient ¶
func NewTokenClient(appID, appSecret string) *TokenClient
NewTokenClient 创建客户端
func (*TokenClient) GetAccessToken ¶
func (c *TokenClient) GetAccessToken() string
GetAccessToken 获取 accessToken
func (*TokenClient) GetJsAPITicket ¶
func (c *TokenClient) GetJsAPITicket() string
GetJsAPITicket 获取 js api ticket
type TokenClientFromRedisOption ¶
type TokenClientFromRedisOption func(*TokenClientFromRedisOptions)
TokenClientFromRedisOption 为可选参数赋值的函数
func ClientFromRedisOptionAccessTokenKey ¶
func ClientFromRedisOptionAccessTokenKey(accessTokenKey string) TokenClientFromRedisOption
ClientFromRedisOptionAccessTokenKey ...
func ClientFromRedisOptionJsAPITicketKey ¶
func ClientFromRedisOptionJsAPITicketKey(jsAPITicketKey string) TokenClientFromRedisOption
ClientFromRedisOptionJsAPITicketKey ...
func ClientFromRedisOptionRedisClient ¶
func ClientFromRedisOptionRedisClient(client *redis.Client) TokenClientFromRedisOption
ClientFromRedisOptionRedisClient ...
type TokenClientFromRedisOptions ¶
type TokenClientFromRedisOptions struct { RedisClient *redis.Client AccessTokenKey string JsAPITicketKey string }
TokenClientFromRedisOptions 可选参数列表
func NewTokenClientFromRedisOptions ¶
func NewTokenClientFromRedisOptions(opts ...TokenClientFromRedisOption) TokenClientFromRedisOptions
NewTokenClientFromRedisOptions 创建可选参数
type TokenForProxy ¶
type TokenForProxy struct { }
TokenForProxy 访问代理不需要使用Token
func (*TokenForProxy) GetAccessToken ¶
func (token *TokenForProxy) GetAccessToken() string
GetAccessToken 获取AccessToken
func (*TokenForProxy) GetJsAPITicket ¶
func (token *TokenForProxy) GetJsAPITicket() string
GetJsAPITicket 获取JsAPITicket
type TokenFromRedis ¶
type TokenFromRedis struct {
// contains filtered or unexported fields
}
TokenFromRedis 根据Redis客户端创建Token
func NewTokenFromRedis ¶
func NewTokenFromRedis(opts ...TokenClientFromRedisOption) *TokenFromRedis
NewTokenFromRedis 创建客户端
func (*TokenFromRedis) GetAccessToken ¶
func (token *TokenFromRedis) GetAccessToken() string
GetAccessToken 获取AccessToken
func (*TokenFromRedis) GetJsAPITicket ¶
func (token *TokenFromRedis) GetJsAPITicket() string
GetJsAPITicket 获取JsAPITicket
type VideoDescription ¶
type VideoDescription struct { Title string `json:"title"` // 视频素材的标题 Introduction string `json:"introduction"` // 视频素材的描述 }
VideoDescription 视频描述
type WxaGenerateUrlLinkCloudBase ¶
type WxaGenerateUrlLinkCloudBase struct { Env string `json:"env"` // 云开发环境 Domain string `json:"domain"` // 静态网站自定义域名,不填则使用默认域名 Path string `json:"path"` // 云开发静态网站 H5 页面路径,不可携带 query Query string `json:"query"` // 云开发静态网站 H5 页面 query 参数,最大 1024 个字符,只支持数字,大小写英文以及部分特殊字符:`!#$&'()*+,/:;=?@-._~%“ ResourceAppID string `json:"resource_appid"` // 第三方批量代云开发时必填,表示创建该 env 的 appid (小程序/第三方平台) }
type WxaGenerateUrlLinkRequest ¶
type WxaGenerateUrlLinkRequest struct { Path string `json:"path"` // 通过 URL Link 进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query 。path 为空时会跳转小程序主页 Query string `json:"query"` // 通过 URL Link 进入小程序时的query,最大1024个字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~% IsExpire bool `json:"is_expire"` // 默认值false。生成的 URL Link 类型,到期失效:true,永久有效:false。注意,永久有效 Link 和有效时间超过180天的到期失效 Link 的总数上限为10万个,详见获取 URL Link,生成 Link 前请仔细确认。 ExpireType int `json:"expire_type"` // 默认值0.小程序 URL Link 失效类型,失效时间:0,失效间隔天数:1 ExpireTime int64 `json:"expire_time"` // 到期失效的 URL Link 的失效时间,为 Unix 时间戳。生成的到期失效 URL Link 在该时间前有效。最长有效期为1年。expire_type 为 0 必填 ExpireInterval int `json:"expire_interval"` // 到期失效的URL Link的失效间隔天数。生成的到期失效URL Link在该间隔时间到达前有效。最长间隔天数为365天。expire_type 为 1 必填 CloudBase *WxaGenerateUrlLinkCloudBase `json:"cloud_base"` // 云开发静态网站自定义 H5 配置参数,可配置中转的云开发 H5 页面。不填默认用官方 H5 页面 EnvVersion string `json:"env_version"` // 默认值"release"。要打开的小程序版本。正式版为 "release",体验版为"trial",开发版为"develop",仅在微信外打开时生效 }
WxaGenerateUrlLinkRequest 生成小程序码
type WxaGenerateUrlLinkResponse ¶
type WxaGenerateUrlLinkResponse struct {
URLLink string `json:"url_link"` // 生成的 url link 码
}
WxaGenerateUrlLinkResponse 生成小程序码
type WxaGenerateUrlSchemeJumpWxa ¶
type WxaGenerateUrlSchemeJumpWxa struct { Path string `json:"path"` // 通过 scheme 码进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query。path 为空时会跳转小程序主页。 Query string `json:"query"` // 通过 scheme 码进入小程序时的 query,最大1024个字符,只支持数字,大小写英文以及部分特殊字符:`!#$&'()*+,/:;=?@-._~%“ EnvVersion string `json:"env_version"` // 要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop",仅在微信外打开时生效。 }
type WxaGenerateUrlSchemeRequest ¶
type WxaGenerateUrlSchemeRequest struct { JumpWxa *WxaGenerateUrlSchemeJumpWxa `json:"jump_wxa"` // 跳转到的目标小程序信息。 ExpireType int `json:"expire_type"` // 到期失效的 scheme 码失效类型,失效时间:0,失效间隔天数:1 ExpireTime int `json:"expire_time"` // 到期失效的 scheme 码的失效时间,为 Unix 时间戳。生成的到期失效 scheme 码在该时间前有效。最长有效期为30天。expire_type 为 0 时必填 ExpireInterval int `json:"expire_interval"` // 到期失效的 scheme 码的失效间隔天数。生成的到期失效 scheme 码在该间隔时间到达前有效。最长间隔天数为30天。 expire_type 为 1 时必填 }
WxaGenerateUrlSchemeRequest 生成小程序码
type WxaGenerateUrlSchemeResponse ¶
type WxaGenerateUrlSchemeResponse struct {
Openlink string `json:"openlink"` // 生成的 scheme 码
}
WxaGenerateUrlSchemeResponse 生成小程序码
Source Files ¶
- client.go
- custom.go
- draft.go
- error.go
- execute.go
- http.go
- material.go
- menu.go
- message.go
- metadata.go
- oauth.go
- qiye_client.go
- qiye_kf_message.go
- qiye_media.go
- qiye_token.go
- qiye_token_client.go
- qiye_token_client_redis_options.go
- qrcode.go
- template.go
- token.go
- token_client.go
- token_client_redis_options.go
- wxa.go