Documentation ¶
Index ¶
- Constants
- Variables
- func NewResultError(code int, msg string) error
- type Agent
- func (a *Agent) AccessToken() (string, error)
- func (a *Agent) CallJSONApiWithAccessToken(api *fetcher.Preset, params url.Values, body interface{}, v interface{}) error
- func (a *Agent) ClientCredentialBuilder() fetcher.Command
- func (a *Agent) GetAccessToken() (string, error)
- func (a *Agent) GetDepartmentList(id string) (*[]DepartmentInfo, error)
- func (a *Agent) GetUserInfo(code string) (*Userinfo, error)
- func (a *Agent) GrantAccessToken() (string, error)
- func (a *Agent) MediaUpload(mediatype MediaType, filename string, body io.Reader) (string, error)
- func (a *Agent) NewMessage() *Message
- func (a *Agent) RefreshShared(old []byte) ([]byte, error)
- func (a *Agent) SendMessage(b *Message) (*MessageResult, error)
- func (a *Agent) SetAccessTokenGetter(f func() (string, error))
- func (a *Agent) SetAccessTokenRefresher(f func(string) (string, error))
- func (a *Agent) UploadApiWithAccessToken(api *fetcher.Preset, params url.Values, filename string, body io.Reader, ...) error
- type DepartmentInfo
- type MediaType
- type Message
- type MessageArticle
- type MessageMPArticle
- type MessageMPNews
- type MessageMarkdown
- type MessageMedia
- type MessageNews
- type MessageResult
- type MessageTaskcard
- type MessageTaskcardBtn
- type MessageText
- type MessageTextcard
- type MessageVideo
- type Userinfo
Constants ¶
View Source
const APIErrAccessTokenNotLast = 40001
View Source
const APIErrAccessTokenOutOfDate = 42001
View Source
const APIErrAccessTokenWrong = 40014
View Source
const APIErrNoPrivilege = 60011
View Source
const APIErrOauthCodeWrong = 40029
View Source
const APIErrSuccess = 0
View Source
const APIErrUserUnaccessible = 50002
View Source
const APIResultGenderFemale = "2"
View Source
const APIResultGenderMale = "1"
View Source
const MediaTypeFile = MediaType("file")
View Source
const MediaTypeImage = MediaType("image")
View Source
const MediaTypeVideo = MediaType("video")
View Source
const MediaTypeVoice = MediaType("voice")
View Source
const MsgTypeFile = "file"
View Source
const MsgTypeImage = "image"
View Source
const MsgTypeMPNews = "mpnews"
View Source
const MsgTypeMarkdown = "markdown"
View Source
const MsgTypeNews = "news"
View Source
const MsgTypeTaskcard = "taskcard"
View Source
const MsgTypeText = "text"
View Source
const MsgTypeTextcard = "textcard"
View Source
const MsgTypeVideo = "video"
View Source
const MsgTypeVoice = "voice"
Variables ¶
View Source
var Server = fetcher.MustPreset(&fetcher.ServerInfo{
URL: "https://qyapi.weixin.qq.com",
})
Functions ¶
func NewResultError ¶
Types ¶
type Agent ¶
type Agent struct { CorpID string AgentID int Secret string RemoteRefresher *fetcher.Server Client fetcher.Client // contains filtered or unexported fields }
func (*Agent) AccessToken ¶
func (*Agent) CallJSONApiWithAccessToken ¶
func (*Agent) ClientCredentialBuilder ¶
func (*Agent) GetAccessToken ¶
func (*Agent) GetDepartmentList ¶
func (a *Agent) GetDepartmentList(id string) (*[]DepartmentInfo, error)
func (*Agent) GrantAccessToken ¶
func (*Agent) MediaUpload ¶
func (*Agent) NewMessage ¶
func (*Agent) RefreshShared ¶
RefreshShared refresh shared data. New data what different from old should be returned
func (*Agent) SendMessage ¶
func (a *Agent) SendMessage(b *Message) (*MessageResult, error)
func (*Agent) SetAccessTokenGetter ¶
func (*Agent) SetAccessTokenRefresher ¶
type DepartmentInfo ¶
type Message ¶
type Message struct { ToUser *string `json:"touser"` ToParty *string `json:"toparty"` ToTag *string `json:"totag"` MsgType string `json:"msgtype"` AgentID int `json:"agentid"` Safe int `json:"safe"` Text *MessageText `json:"text"` Image *MessageMedia `json:"image"` Voice *MessageMedia `json:"voice"` File *MessageMedia `json:"file"` Video *MessageVideo `json:"video"` News *MessageNews `json:"news"` MPNews *MessageMPNews `json:"mpnews"` Textcard *MessageTextcard `json:"textcard"` Taskcard *MessageTaskcard `json:"taskcard"` Markdown *MessageMarkdown `json:"markdown"` }
func NewMessage ¶
func NewMessage() *Message
func (*Message) SetMsgType ¶
func (*Message) SetToParty ¶
type MessageArticle ¶
type MessageMPArticle ¶
type MessageMPNews ¶
type MessageMPNews struct {
Articles []*MessageMPArticle `json:"articles"`
}
type MessageMarkdown ¶
type MessageMarkdown struct {
Content string `json:"content"`
}
type MessageMedia ¶
type MessageMedia struct {
MediaID string `json:"media_id"`
}
type MessageNews ¶
type MessageNews struct {
Articles []*MessageArticle `json:"articles"`
}
type MessageResult ¶
type MessageTaskcard ¶
type MessageTaskcard struct { Title string `json:"title"` Description string `json:"description"` URL *string `json:"url"` TaskID string `json:"task_id"` Btn []*MessageTaskcardBtn `json:"btn"` }
type MessageTaskcardBtn ¶
type MessageText ¶
type MessageText struct {
Content string `json:"content"`
}
type MessageTextcard ¶
type MessageVideo ¶
Click to show internal directories.
Click to hide internal directories.