wxapi

package
v0.0.0-...-9e56641 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = client.NewClient(&parser{})

Functions

func NewContext

func NewContext(ctx context.Context, c *WXAPI) context.Context

Types

type ArticleMsg

type ArticleMsg struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	URL         string `json:"url"`
	PicURL      string `json:"picurl"`
}

ArticleMsg

type CreateTagResponse

type CreateTagResponse struct {
	Tag TagInfo `json:"tag"`
}

CreateTagResponse

type CustomService

type CustomService struct {
	KFAccount string `json:"kf_account"`
}

type Error

type Error struct {
	Code    int    `json:"errcode"`
	Message string `json:"errmsg"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) IsBusy

func (e *Error) IsBusy() bool

func (*Error) IsError

func (e *Error) IsError() bool

type GetAccessTokenResponse

type GetAccessTokenResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   string `json:"expires_in"`
}

AccessTokenResponse

type GetCallbackIPResponse

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

type GetKFListResponse

type GetKFListResponse struct {
	KFList []*KFInfo `json:"kf_list"`
}

type GetTagsResponse

type GetTagsResponse struct {
	Tags []*TagInfo `json:"tags"`
}

GetTagsResponse

type ImageMessage

type ImageMessage struct {
	MediaID string `json:"media_id"`
}

ImageMessage

type KFInfo

type KFInfo struct {
	KFAccount      string `json:"kf_account"`
	KFNick         string `json:"kf_nick"`
	KFID           string `json:"kf_id"`
	KFHeadImageURL string `json:"kf_headimgurl"`
}

type MPNewsMessage

type MPNewsMessage struct {
	MediaID string `json:"media_id"`
}

MPNewsMessage

type Message

type Message interface {
	// contains filtered or unexported methods
}

Message

type MessageType

type MessageType string
const (
	MessageTypeText            MessageType = "text"            //文本
	MessageTypeImage           MessageType = "image"           //图片
	MessageTypeVoice           MessageType = "voice"           //语音
	MessageTypeVideo           MessageType = "video"           //视频消息
	MessageTypeMusic           MessageType = "music"           //音乐消息
	MessageTypeNews            MessageType = "news"            //图文消息(点击跳转到外链)
	MessageTypeMPNews          MessageType = "mpnews"          //图文消息(点击跳转到图文消息页面)
	MessageTypeWXCard          MessageType = "wxcard"          //卡券
	MessageTypeMiniProgramPage MessageType = "miniprogrampage" //小程序
)

type MiniProgramPageMessage

type MiniProgramPageMessage struct {
	Title        string `json:"title"`
	AppID        string `json:"appid"`
	PagePath     string `json:"pagepath"`
	ThumbMediaID string `json:"thumb_media_id"`
}

MiniProgramPageMessage

type MusicMessage

type MusicMessage struct {
	Title        string `json:"title"`
	Description  string `json:"description"`
	MusicURL     string `json:"musicurl"`
	HQMusicURL   string `json:"hqmusicurl"`
	ThumbMediaID string `json:"thumb_media_id"`
}

MusicMessage

type NewsMessage

type NewsMessage struct {
	Articles []*ArticleMsg `json:"articles"`
}

NewsMessage

type OAuth2AccessTokenResponse

type OAuth2AccessTokenResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	OpenID       string `json:"openid"`
	Scope        string `json:"scope"`
}

type TagInfo

type TagInfo struct {
	ID    int    `json:"id,omitempty"`
	Name  string `json:"name"`
	Count int    `json:"count"`
}

TagInfo

type TextMessage

type TextMessage struct {
	Content string `json:"content"`
}

TextMessage

type VideoMessage

type VideoMessage struct {
	MediaID      string `json:"media_id"`
	ThumbMediaID string `json:"thumb_media_id"`
	Title        string `json:"title"`
	Description  string `json:"description"`
}

VideoMessage

type VoiceMessage

type VoiceMessage struct {
	MediaID string `json:"media_id"`
}

VoiceMessage

type WXAPI

type WXAPI struct {
	AppID     string
	AppSecret string
}

func FromContext

func FromContext(ctx context.Context) (*WXAPI, bool)

func New

func New(appid, secret string) *WXAPI

func (*WXAPI) AddKFAccount

func (wx *WXAPI) AddKFAccount(account, nickname, password string) error

AddKFAccount

func (*WXAPI) AddKFAccountRequest

func (wx *WXAPI) AddKFAccountRequest(account, nickname, password string) (*http.Request, error)

func (*WXAPI) CreateTag

func (wx *WXAPI) CreateTag(name string) (*CreateTagResponse, error)

CreateTag

func (*WXAPI) CreateTagRequest

func (wx *WXAPI) CreateTagRequest(name string) (*http.Request, error)

CreateTagRequest

func (*WXAPI) DeleteKFAccount

func (wx *WXAPI) DeleteKFAccount(account, nickname, password string) error

DeleteKFAccount

func (*WXAPI) DeleteKFAccountRequest

func (wx *WXAPI) DeleteKFAccountRequest(account, nickname, password string) (*http.Request, error)

func (*WXAPI) GetAccessTokenRequest

func (mp *WXAPI) GetAccessTokenRequest() (*http.Request, error)

AccessTokenRequest

func (*WXAPI) GetCallbackIP

func (mp *WXAPI) GetCallbackIP(accessToken string) (*GetCallbackIPResponse, error)

GetCallbackIP https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140187

func (*WXAPI) GetCallbackIPRequest

func (*WXAPI) GetCallbackIPRequest(accessToken string) (*http.Request, error)

func (*WXAPI) GetKFList

func (wx *WXAPI) GetKFList() (*GetKFListResponse, error)

func (*WXAPI) GetKFListRequest

func (wx *WXAPI) GetKFListRequest() (*http.Request, error)

func (*WXAPI) GetTags

func (wx *WXAPI) GetTags() (*GetTagsResponse, error)

GetTags

func (*WXAPI) GetTagsRequest

func (wx *WXAPI) GetTagsRequest() (*http.Request, error)

GetTagsRequest

func (*WXAPI) OAuth2AccessToken

func (mp *WXAPI) OAuth2AccessToken(code string) (*OAuth2AccessTokenResponse, error)

func (*WXAPI) OAuth2AccessTokenRequest

func (mp *WXAPI) OAuth2AccessTokenRequest(code string) (*http.Request, error)

func (*WXAPI) SendKFMessage

func (mp *WXAPI) SendKFMessage(message Message, toUser string, kfAccount string) error

SendKFMessage

func (*WXAPI) SendKFMessageRequest

func (wx *WXAPI) SendKFMessageRequest(msg Message, toUser string, kfAccount string) (*http.Request, error)

SendKFMessageRequest

func (*WXAPI) UpdateKFAccount

func (wx *WXAPI) UpdateKFAccount(account, nickname, password string) error

UpdateKFAccount

func (*WXAPI) UpdateKFAccountRequest

func (wx *WXAPI) UpdateKFAccountRequest(account, nickname, password string) (*http.Request, error)

UpdateKFAccountRequest

func (*WXAPI) UploadKFHeadImage

func (wx *WXAPI) UploadKFHeadImage(account, filename string, image io.Reader) error

func (*WXAPI) UploadKFHeadImageReqeust

func (wx *WXAPI) UploadKFHeadImageReqeust(account string, filename string, image io.Reader) (*http.Request, error)

type WXCardMessage

type WXCardMessage struct {
	CardID string `json:"card_id"`
}

WXCardMessage

Jump to

Keyboard shortcuts

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