Documentation ¶
Index ¶
- Constants
- func DownFile(url string) ([]byte, error)
- type ArticleItem
- type ArticleUpdateWrapper
- type ArticleWrapper
- type Base
- type CommentResult
- type CommentType
- type GetComment
- type MaterialCounter
- type MaterialList
- type Media
- func (m *Media) CommentClose(mediaID string, index ...int) error
- func (m *Media) CommentDel(isReply bool, MsgID uint32, CommentID uint32, index ...uint32) error
- func (m *Media) CommentList(req *GetComment) (*CommentResult, error)
- func (m *Media) CommentMark(MsgID uint32, UserID uint32, index ...uint32) error
- func (m *Media) CommentOpen(mediaID string, index ...int) error
- func (m *Media) CommentReply(msgID uint32, commentID uint32, content string, index ...uint32) error
- func (m *Media) CommentUnmark(MsgID uint32, UserID uint32, index ...uint32) error
- func (m *Media) Delete(mediaID string) error
- func (m *Media) DeleteMsg(MsgID int, articleIndex int) error
- func (m *Media) GetMaterial(mediaID string) (*Response, error)
- func (m *Media) GetMaterialList(typ string, offset int, count int) (*MaterialList, error)
- func (m *Media) GetSendSpeed() (*Result, error)
- func (m *Media) GetTmpMaterial(mediaID string) (*Response, error)
- func (m *Media) MaterialCounter() (*MaterialCounter, error)
- func (m *Media) SendByFilter(msg *Message) (*Result, error)
- func (m *Media) SendByOpenID(msg *Message) (*Result, error)
- func (m *Media) SendPreview(msg *Message) error
- func (m *Media) SendStatus(MsgID string) (*Result, error)
- func (m *Media) SetSendSpeed(speedLevel int) error
- func (m *Media) UpdateArticle(article *ArticleWrapper) error
- func (m *Media) UploadArticle(article *ArticleWrapper) (*Result, error)
- func (m *Media) UploadImageForArticle(rawUri string) (retUrl string, err error)
- func (m *Media) UploadMaterial(name string, in io.Reader, permanent bool, typ string, ...) (*Result, error)
- func (m *Media) VideoToMessage(v *Video) (*Result, error)
- type Message
- type MpCard
- type MpImage
- type MpNews
- type MpText
- type MpVideo
- type MpVoice
- type MsgFilter
- type MsgWrapper
- type Response
- type Result
- type ToUser
- type Video
- type VideoDescription
Constants ¶
View Source
const ( TypImage = "image" TypVoice = "voice" TypVideo = "video" TypThumb = "thumb" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArticleItem ¶
type ArticleItem struct { Title string `json:"title"` ThumbMediaID string `json:"thumb_media_id"` //图文消息的封面图片素材id(必须是永久mediaID) ShowCoverPic int `json:"show_cover_pic"` //是否显示封面,0为false,即不显示,1为true,即显示 Author string `json:"author"` Digest string `json:"digest"` //图文消息的摘要,仅有单图文消息才有摘要,多图文此处为空。如果本字段为没有填写,则默认抓取正文前64个字。 Content string `json:"content"` //图文消息的具体内容,支持HTML标签,必须少于2万字符,小于1M,且此处会去除JS,涉及图片url必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片url将被过滤。 URL string `json:"url"` //图文页的URL SourceURL string `json:"content_source_url"` //图文消息的原文地址,即点击“阅读原文”后的URL //fields for uploading article Comment int `json:"need_open_comment"` //Uint32 是否打开评论,0不打开,1打开 OnlyForFan int `json:"only_fans_can_comment"` //Uint32 是否粉丝才可评论,0所有人可评论,1粉丝才可评论 }
type ArticleUpdateWrapper ¶
type ArticleUpdateWrapper struct { MediaID string `json:"media_id"` Index int `json:"index"` Article ArticleItem `json:"articles"` }
type ArticleWrapper ¶
type ArticleWrapper struct {
Articles []ArticleItem `json:"articles"`
}
type CommentResult ¶
type CommentResult struct { request.CommonError Total uint32 `json:"total"` Comments []struct { UserCommentID string `json:"user_comment_id"` OpenID string `json:"openid"` CreateTime int64 `json:"create_time"` Content string `json:"content"` Reply *struct { Content string `json:"content"` CreateTime int64 `json:"create_time"` } `json:"reply,omitempty"` } `json:"comment"` }
type CommentType ¶
type CommentType uint32
const ( CTypeBoth CommentType = 0 CTypeCommon CommentType = 1 CTypeSelected CommentType = 2 )
type GetComment ¶
type GetComment struct { MsgID uint32 `json:"msg_data_id"` Index uint32 `json:"index,omitempty"` Begin uint32 `json:"begin"` Count uint32 `json:"count"` Type CommentType `json:"type"` }
type MaterialCounter ¶
type MaterialList ¶
type MaterialList struct { Base TotalCount int `json:"total_count"` ItemCount int `json:"item_count"` Items []struct { MediaID string `json:"media_id"` UpdateTime int `json:"update_time"` //Article Content struct { Articles []ArticleItem `json:"news_item"` } `json:"content"` //Image, Voice, Video Name string `json:"name"` Url string `json:"url"` } `json:"item"` }
type Media ¶
type Media struct {
// contains filtered or unexported fields
}
func (*Media) CommentDel ¶
func (*Media) CommentList ¶
func (m *Media) CommentList(req *GetComment) (*CommentResult, error)
func (*Media) CommentMark ¶
func (*Media) CommentReply ¶
func (*Media) CommentUnmark ¶
func (*Media) GetMaterialList ¶
@typ 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news) @offset 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回 @count 返回素材的数量,取值在1到20之间 注意,这里面不支持 thumb 类型的资源,感觉是wx的坑
func (*Media) GetSendSpeed ¶
func (*Media) MaterialCounter ¶
func (m *Media) MaterialCounter() (*MaterialCounter, error)
func (*Media) SendPreview ¶
func (*Media) SetSendSpeed ¶
func (*Media) UpdateArticle ¶
func (m *Media) UpdateArticle(article *ArticleWrapper) error
func (*Media) UploadArticle ¶
func (m *Media) UploadArticle(article *ArticleWrapper) (*Result, error)
Article is the type of news in wechat development document (permanent material)
func (*Media) UploadImageForArticle ¶
used to upload pictures in the Article (to satisfy wechat requirement)
func (*Media) UploadMaterial ¶
func (m *Media) UploadMaterial(name string, in io.Reader, permanent bool, typ string, description ...VideoDescription) (*Result, error)
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格式
@name 文件名,需要带后缀 @in io.Reader 接口,读取需要上传的数据 @permanent 是否上传永久文件? true 是, false临时文件 @typ 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb):w @description 上传视频使用
type Message ¶
type Message struct { ToWxName string `json:"towxname,omitempty"` //available only in preview ToUser *ToUser `json:"touser,omitempty"` //send by openIDs, minimum number is 2 and maximum number is 10000 Filter *MsgFilter `json:"filter,omitempty"` //send by tag, is_to_all must be false MsgWrapper MsgWrapper //MpNews(article), MpText, MpVoice, MpImage, MpVideo (video should be specially handled), MpCard IgnoreReprint int `json:"send_ignore_reprint"` //图文消息被判定为转载时,是否继续群发。 1为继续群发(转载),0为停止群发。 该参数默认为0。 ClientMsgId string `json:"clientmsgid"` //使用 clientmsgid 参数,避免重复推送 // contains filtered or unexported fields }
type MpImage ¶
type MpVideo ¶
type MsgWrapper ¶
type MsgWrapper interface {
Type() string
}
type Response ¶
type Response struct { Base //temporary video result VideoUrl string `json:"video_url"` //permanent video result Title string `json:"title"` Description string `json:"description"` DownUrl string `json:"down_url"` ContentType string //News type of material News []ArticleItem `json:"news_item"` //other types of material including image,voice,thumb Filename string `json:"-"` Data []byte `json:"-"` }
type Result ¶
type Result struct { Base //upload article(news) Url string `json:"url"` Type string `json:"type"` //values: image, voice, video, thumb MediaID string `json:"media_id"` CreatedAt int64 `json:"created_at"` MsgID int `json:"msg_id"` MsgStatus string `json:"msg_status"` MsgDataID int `json:"msg_data_id"` SpeedLevel int `json:"speed"` RealSpeed int `json:"realspeed"` }
type Video ¶
type Video struct { VideoDescription MpVideo }
type VideoDescription ¶
Click to show internal directories.
Click to hide internal directories.