Versions in this module Expand all Collapse all v0 v0.1.5 Jan 27, 2022 v0.1.4 Sep 8, 2021 Changes in this version + type MiniProgramMessage struct + AppID string + PagePath string + ThumbMediaID string + Title string type WorkwxApp + func (c *WorkwxApp) SendSchoolMPNewsMessage(recipient *Recipient, articles []SchoolMPNewsMessage) error + func (c *WorkwxApp) SendSchoolMiniProgramMessage(recipient *Recipient, message MiniProgramMessage) error + func (c *WorkwxApp) SendSchoolNewsMessage(recipient *Recipient, articles []SchoolArticleMessage) error v0.1.2 Sep 7, 2021 Changes in this version + const DefaultQYAPIHost + const MsgAuditAgreeStatusAgree + const MsgAuditAgreeStatusDefaultAgree + const MsgAuditAgreeStatusDisagree + type BatchListExternalContactsResp struct + NextCursor string + Result []ExternalContactBatchInfo + type ChangeType string + const ChangeTypeAddExternalContact + const ChangeTypeAddHalfExternalContact + const ChangeTypeDelExternalContact + const ChangeTypeDelFollowUser + const ChangeTypeEditExternalContact + const ChangeTypeTransferFail + type ChatInfo struct + ChatID string + MemberUserIDs []string + Name string + OwnerUserID string + type CheckMsgAuditRoomAgreeInfo struct + AgreeStatus MsgAuditAgreeStatus + ExternalOpenID string + StatusChangeTime time.Time + type CheckMsgAuditSingleAgreeInfo struct + AgreeStatus MsgAuditAgreeStatus + StatusChangeTime time.Time + type CheckMsgAuditSingleAgreeUserInfo struct + ExternalOpenID string + UserID string + type CtorOption interface + func WithHTTPClient(client *http.Client) CtorOption + func WithQYAPIHost(host string) CtorOption + type DeptInfo struct + ID int64 + Name string + Order uint32 + ParentID int64 + type EventAddExternalContact interface + GetExternalUserID func() string + GetState func() string + GetUserID func() string + GetWelcomeCode func() string + type EventAddHalfExternalContact interface + GetExternalUserID func() string + GetState func() string + GetUserID func() string + type EventChangeExternalChat interface + GetChatID func() string + GetFailReason func() string + GetFromUserName func() string + GetToUserName func() string + type EventDelExternalContact interface + GetExternalUserID func() string + GetUserID func() string + type EventDelFollowUser interface + GetExternalUserID func() string + GetUserID func() string + type EventEditExternalContact interface + GetExternalUserID func() string + GetState func() string + GetUserID func() string + type EventSysApprovalChange interface + GetApprovalInfo func() OAApprovalInfo + type EventTransferFail interface + GetExternalUserID func() string + GetFailReason func() string + GetUserID func() string + type EventType string + const EventTypeChangeExternalChat + const EventTypeChangeExternalContact + const EventTypeSysApprovalChange + type ExternalAttr struct + Miniprogram ExternalAttrMiniprogram + Name string + Text ExternalAttrText + Type int + Web ExternalAttrWeb + type ExternalAttrMiniprogram struct + Appid string + Pagepath string + Title string + type ExternalAttrText struct + Value string + type ExternalAttrWeb struct + Title string + Url string + type ExternalContact struct + Avatar string + CorpName string + ExternalProfile ExternalProfile + ExternalUserid string + Gender UserGender + Name string + Position string + Type ExternalUserType + Unionid string + type ExternalContactBatchInfo struct + ExternalContact ExternalContact + FollowInfo FollowInfo + type ExternalContactCorpTag struct + CreateTime int + Deleted bool + ID string + Name string + Order uint32 + type ExternalContactCorpTagGroup struct + CreateTime int + Deleted bool + GroupID string + GroupName string + Order uint32 + Tag []ExternalContactCorpTag + type ExternalContactGroupChatTransferFailed struct + ChatID string + ErrCode int + ErrMsg string + type ExternalContactInfo struct + ExternalContact ExternalContact + FollowUser []FollowUser + type ExternalContactMarkTag struct + AddTag []string + ExternalUserID string + RemoveTag []string + UserID string + type ExternalContactRemark struct + Description string + ExternalUserid string + Remark string + RemarkCompany string + RemarkMobiles []string + RemarkPicMediaid string + Userid string + type ExternalContactTransferResult struct + Status ExternalContactTransferStatus + TakeoverTime time.Time + type ExternalContactTransferStatus uint8 + const ExternalContactTransferStatusExhausted + const ExternalContactTransferStatusNoData + const ExternalContactTransferStatusRefused + const ExternalContactTransferStatusSuccess + const ExternalContactTransferStatusWait + type ExternalContactUnassigned struct + DemissionTime time.Time + ExternalUserID string + HandoverUserID string + type ExternalContactUnassignedList struct + Info []ExternalContactUnassigned + IsLast bool + NextCursor string + type ExternalProfile struct + ExternalAttr []ExternalAttr + ExternalCorpName string + type ExternalUserType int + const ExternalUserTypeWeChat + const ExternalUserTypeWorkWeChat + type FollowInfo struct + TagID []string + type FollowUser struct + Tags []FollowUserTag + type FollowUserAddWay int + const FollowUserAddWayAddressBook + const FollowUserAddWayAdmin + const FollowUserAddWayCard + const FollowUserAddWayEmail + const FollowUserAddWayGroupChat + const FollowUserAddWayInternalShare + const FollowUserAddWayMobile + const FollowUserAddWayQRCode + const FollowUserAddWayThirdParty + const FollowUserAddWayUnknown + const FollowUserAddWayWeChatContact + const FollowUserAddWayWeChatFriendApply + type FollowUserInfo struct + AddWay FollowUserAddWay + Createtime int + Description string + OperUserID string + Remark string + RemarkCorpName string + RemarkMobiles []string + State string + UserID string + type FollowUserTag struct + GroupName string + TagName string + Type FollowUserTagType + type FollowUserTagType int + const FollowUserTagTypeUser + const FollowUserTagTypeWork + type GetOAApprovalInfoReq struct + Cursor int + EndTime time.Time + Filters []OAApprovalInfoFilter + Size uint32 + StartTime time.Time + type HTTPHandler struct + func NewHTTPHandler(token string, encodingAESKey string, rxMessageHandler RxMessageHandler) (*HTTPHandler, error) + func (h *HTTPHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) + type ImageMessageExtras interface + GetMediaID func() string + GetPicURL func() string + type JSCodeSession struct + CorpID string + SessionKey string + UserID string + type LinkMessageExtras interface + GetDescription func() string + GetPicURL func() string + GetTitle func() string + GetURL func() string + type LocationMessageExtras interface + GetLabel func() string + GetLatitude func() float64 + GetLongitude func() float64 + GetScale func() int + type Media struct + func NewMediaFromBuffer(filename string, buf []byte) (*Media, error) + func NewMediaFromFile(f *os.File) (*Media, error) + type MediaUploadResult struct + CreatedAt time.Time + MediaID string + Type string + type MessageType string + const MessageTypeEvent + const MessageTypeImage + const MessageTypeLink + const MessageTypeLocation + const MessageTypeText + const MessageTypeVideo + const MessageTypeVoice + type MsgAuditAgreeStatus string + type MsgAuditEdition uint8 + const MsgAuditEditionEnterprise + const MsgAuditEditionOffice + const MsgAuditEditionService + type MsgAuditGroupChat struct + Creator string + Members []MsgAuditGroupChatMember + Notice string + RoomCreateTime time.Time + RoomName string + type MsgAuditGroupChatMember struct + JoinTime time.Time + MemberID int + type OAApplyEvent struct + ApplyData OAContents + Approver []OAApprover + CreatorUserID string + Notifier []string + NotifyType *uint8 + SummaryList []OASummaryList + TemplateID string + UseTemplateApprover uint8 + type OAApprovalDetail struct + Applicant OAApprovalDetailApplicant + ApplyData OAContents + ApplyTime int + Comments []OAApprovalDetailComment + Notifier []OAApprovalDetailNotifier + SpName string + SpNo string + SpRecord []OAApprovalDetailSpRecord + SpStatus uint8 + TemplateID string + type OAApprovalDetailApplicant struct + PartyID string + UserID string + type OAApprovalDetailComment struct + CommentID string + CommentTime int + CommentTontent string + CommentUserInfo OAApprovalDetailCommentUserInfo + MediaID []string + type OAApprovalDetailCommentUserInfo struct + UserID string + type OAApprovalDetailNotifier struct + UserID string + type OAApprovalDetailSpRecord struct + ApproverAttr uint8 + Details []OAApprovalDetailSpRecordDetail + SpStatus uint8 + type OAApprovalDetailSpRecordDetail struct + Approver OAApprovalDetailSpRecordDetailApprover + MediaID []string + SpStatus uint8 + SpTime int + Speech string + type OAApprovalDetailSpRecordDetailApprover struct + UserID string + type OAApprovalInfo struct + Applicant OAApprovalInfoApplicant + ApplyTime string + Comments []OAApprovalInfoComment + Notifier OAApprovalInfoNotifier + SpName string + SpNo string + SpRecord []OAApprovalInfoSpRecord + SpStatus string + StatusChangeEvent string + TemplateID string + type OAApprovalInfoApplicant struct + Party string + UserID string + type OAApprovalInfoComment struct + Attach []string + CommentContent string + CommentID string + CommentTime string + CommentUserInfo OAApprovalInfoCommentUserInfo + type OAApprovalInfoCommentUserInfo struct + UserID string + type OAApprovalInfoFilter struct + Key OAApprovalInfoFilterKey + Value string + type OAApprovalInfoFilterKey string + const OAApprovalInfoFilterKeyCreator + const OAApprovalInfoFilterKeyDepartment + const OAApprovalInfoFilterKeySpStatus + const OAApprovalInfoFilterKeyTemplateID + type OAApprovalInfoNotifier struct + UserID string + type OAApprovalInfoSpRecord struct + ApproverAttr string + Details []OAApprovalInfoSpRecordDetail + SpStatus string + type OAApprovalInfoSpRecordDetail struct + Approver OAApprovalInfoSpRecordDetailApprover + Attach []string + SpStatus string + SpTime string + Speech string + type OAApprovalInfoSpRecordDetailApprover struct + UserID string + type OAApprover struct + Attr uint8 + UserID []string + type OAContent struct + Control OAControl + ID string + Title []OAText + Value OAContentValue + type OAContentDate struct + Timestamp string + Type string + type OAContentDateRange struct + NewBegin int + NewDuration int + NewEnd int + type OAContentDepartment struct + Name string + OpenAPIID string + type OAContentFile struct + FileID string + type OAContentFormula struct + Value string + type OAContentLocation struct + Address string + Latitude string + Longitude string + Time int + Title string + type OAContentMember struct + Name string + UserID string + type OAContentRelatedApproval struct + SpNo string + type OAContentSelector struct + Options []OAContentSelectorOption + Type string + type OAContentSelectorOption struct + Key string + type OAContentTableList struct + List []OAContent + type OAContentVacation struct + Attendance OAContentVacationAttendance + Selector OAContentSelector + type OAContentVacationAttendance struct + DateRange OAContentVacationAttendanceDateRange + Type uint8 + type OAContentVacationAttendanceDateRange struct + Type string + type OAContentValue struct + Date OAContentDate + DateRange OAContentDateRange + Departments []OAContentDepartment + Files []OAContentFile + Formula OAContentFormula + Location OAContentLocation + Members []OAContentMember + Money string + Number string + RelatedApproval []OAContentRelatedApproval + Selector OAContentSelector + Table []OAContentTableList + Text string + Vacation OAContentVacation + type OAContents struct + Contents []OAContent + type OAControl string + const OAControlAttendance + const OAControlContact + const OAControlDate + const OAControlDateRange + const OAControlFile + const OAControlFormula + const OAControlLocation + const OAControlMoney + const OAControlNumber + const OAControlRelatedApproval + const OAControlSelector + const OAControlTable + const OAControlText + const OAControlTextarea + const OAControlTips + const OAControlVacation + type OASummaryList struct + SummaryInfo []OAText + type OATemplateControl struct + Config OATemplateControlConfig + Property OATemplateControlProperty + type OATemplateControlConfig struct + Attendance OATemplateControlConfigAttendance + Contact OATemplateControlConfigContact + Date OATemplateControlConfigDate + Selector OATemplateControlConfigSelector + Table OATemplateControlConfigTable + type OATemplateControlConfigAttendance struct + DateRange OATemplateControlConfigAttendanceDateRange + Type uint8 + type OATemplateControlConfigAttendanceDateRange struct + Type string + type OATemplateControlConfigContact struct + Mode string + Type string + type OATemplateControlConfigDate struct + Type string + type OATemplateControlConfigSelector struct + Options []OATemplateControlConfigSelectorOption + Type string + type OATemplateControlConfigSelectorOption struct + Key string + Value []OAText + type OATemplateControlConfigTable struct + Children []OATemplateControl + type OATemplateControlConfigVacation struct + Item []OATemplateControlConfigVacationItem + type OATemplateControlConfigVacationItem struct + ID int + Name []OAText + type OATemplateControlProperty struct + Control OAControl + ID string + Placeholder []OAText + Require uint8 + Title []OAText + UnPrint uint8 + type OATemplateControls struct + Controls []OATemplateControl + type OATemplateDetail struct + TemplateContent OATemplateControls + TemplateNames []OAText + Vacation OATemplateControlConfigVacation + type OAText struct + Lang string + Text string + type Recipient struct + ChatID string + ParentIDs []string + PartyIDs []string + StudentIDs []string + TagIDs []string + UserIDs []string + type RxMessage struct + AgentID int64 + ChangeType ChangeType + Event EventType + FromUserID string + MsgID int64 + MsgType MessageType + SendTime time.Time + func (m *RxMessage) EventAddExternalContact() (EventAddExternalContact, bool) + func (m *RxMessage) EventAddHalfExternalContact() (EventAddHalfExternalContact, bool) + func (m *RxMessage) EventChangeExternalChat() (EventChangeExternalChat, bool) + func (m *RxMessage) EventDelExternalContact() (EventDelExternalContact, bool) + func (m *RxMessage) EventDelFollowUser() (EventDelFollowUser, bool) + func (m *RxMessage) EventEditExternalContact() (EventEditExternalContact, bool) + func (m *RxMessage) EventSysApprovalChange() (EventSysApprovalChange, bool) + func (m *RxMessage) EventTransferFail() (EventTransferFail, bool) + func (m *RxMessage) Image() (ImageMessageExtras, bool) + func (m *RxMessage) Link() (LinkMessageExtras, bool) + func (m *RxMessage) Location() (LocationMessageExtras, bool) + func (m *RxMessage) String() string + func (m *RxMessage) Text() (TextMessageExtras, bool) + func (m *RxMessage) Video() (VideoMessageExtras, bool) + func (m *RxMessage) Voice() (VoiceMessageExtras, bool) + type RxMessageHandler interface + OnIncomingMessage func(msg *RxMessage) error + type SchoolArticleMessage struct + Description string + Picurl string + Title string + Url string + type SchoolMPNewsMessage struct + Author string + Content string + ContentSourceUrl string + Digest string + ThumbMediaID string + Title string + type TaskCardBtn struct + Color string + IsBold bool + Key string + Name string + ReplaceName string + type TextMessageExtras interface + GetContent func() string + type UserDeptInfo struct + DeptID int64 + IsLeader bool + Order uint32 + type UserGender int + const UserGenderFemale + const UserGenderMale + const UserGenderUnspecified + type UserIdentityInfo struct + DeviceID string + OpenID string + UserID string + type UserInfo struct + Alias string + AvatarURL string + Departments []UserDeptInfo + Email string + Gender UserGender + IsEnabled bool + Mobile string + Name string + Position string + QRCodeURL string + Status UserStatus + Telephone string + UserID string + type UserStatus int + const UserStatusActivated + const UserStatusDeactivated + const UserStatusUnactivated + type VideoMessageExtras interface + GetMediaID func() string + GetThumbMediaID func() string + type VoiceMessageExtras interface + GetFormat func() string + GetMediaID func() string + type Workwx struct + CorpID string + func New(corpID string, opts ...CtorOption) *Workwx + func (c *Workwx) WithApp(corpSecret string, agentID int64) *WorkwxApp + type WorkwxApp struct + AgentID int64 + CorpSecret string + func (c *WorkwxApp) AddExternalContactCorpTag(req ExternalContactCorpTagGroup) ([]ExternalContactCorpTagGroup, error) + func (c *WorkwxApp) ApplyOAEvent(applyInfo OAApplyEvent) (string, error) + func (c *WorkwxApp) BatchListExternalContact(userID string, cursor string, limit int) (*BatchListExternalContactsResp, error) + func (c *WorkwxApp) CheckMsgAuditRoomAgree(roomId string) ([]CheckMsgAuditRoomAgreeInfo, error) + func (c *WorkwxApp) CheckMsgAuditSingleAgree(infos []CheckMsgAuditSingleAgreeUserInfo) ([]CheckMsgAuditSingleAgreeInfo, error) + func (c *WorkwxApp) CreateAppchat(chatInfo *ChatInfo) (chatid string, err error) + func (c *WorkwxApp) DelExternalContactCorpTag(tagID, groupID []string) error + func (c *WorkwxApp) EditExternalContactCorpTag(id, name string, order uint32) error + func (c *WorkwxApp) GetAccessTokenFunc() (string, int64, error) + func (c *WorkwxApp) GetAppchat(chatid string) (*ChatInfo, error) + func (c *WorkwxApp) GetExternalContact(externalUserid string) (*ExternalContactInfo, error) + func (c *WorkwxApp) GetJSAPITicket() (string, error) + func (c *WorkwxApp) GetJSAPITicketAgentConfig() (string, error) + func (c *WorkwxApp) GetMsgAuditGroupChat(roomID string) (*MsgAuditGroupChat, error) + func (c *WorkwxApp) GetOAApprovalDetail(spNo string) (*OAApprovalDetail, error) + func (c *WorkwxApp) GetOAApprovalInfo(req GetOAApprovalInfoReq) ([]string, error) + func (c *WorkwxApp) GetOATemplateDetail(templateID string) (*OATemplateDetail, error) + func (c *WorkwxApp) GetTransferExternalContactResult(externalUserID, handoverUserID, takeoverUserID string) (*ExternalContactTransferResult, error) + func (c *WorkwxApp) GetUser(userid string) (*UserInfo, error) + func (c *WorkwxApp) GetUserIDByMobile(mobile string) (string, error) + func (c *WorkwxApp) GetUserInfoByCode(code string) (*UserIdentityInfo, error) + func (c *WorkwxApp) JSCode2Session(jscode string) (*JSCodeSession, error) + func (c *WorkwxApp) ListAllDepts() ([]*DeptInfo, error) + func (c *WorkwxApp) ListDepts(id int64) ([]*DeptInfo, error) + func (c *WorkwxApp) ListExternalContact(userID string) ([]string, error) + func (c *WorkwxApp) ListExternalContactCorpTags(tagIDs ...string) ([]ExternalContactCorpTagGroup, error) + func (c *WorkwxApp) ListMsgAuditPermitUser(msgAuditEdition MsgAuditEdition) ([]string, error) + func (c *WorkwxApp) ListUnassignedExternalContact(pageID, pageSize uint32, cursor string) (*ExternalContactUnassignedList, error) + func (c *WorkwxApp) ListUsersByDeptID(deptID int64, fetchChild bool) ([]*UserInfo, error) + func (c *WorkwxApp) MarkExternalContactTag(userID, externalUserID string, addTag, removeTag []string) error + func (c *WorkwxApp) RemarkExternalContact(req *ExternalContactRemark) error + func (c *WorkwxApp) SendFileMessage(recipient *Recipient, mediaID string, isSafe bool) error + func (c *WorkwxApp) SendImageMessage(recipient *Recipient, mediaID string, isSafe bool) error + func (c *WorkwxApp) SendMPNewsMessage(recipient *Recipient, title string, thumbMediaID string, author string, ...) error + func (c *WorkwxApp) SendMarkdownMessage(recipient *Recipient, content string, isSafe bool) error + func (c *WorkwxApp) SendNewsMessage(recipient *Recipient, title string, description string, url string, ...) error + func (c *WorkwxApp) SendSchoolArticleMessage(recipient *Recipient, articles []SchoolArticleMessage) error + func (c *WorkwxApp) SendSchoolFileMessage(recipient *Recipient, mediaID string) error + func (c *WorkwxApp) SendSchoolImageMessage(recipient *Recipient, mediaID string) error + func (c *WorkwxApp) SendSchoolMPNewMessage(recipient *Recipient, articles []SchoolMPNewsMessage) error + func (c *WorkwxApp) SendSchoolTextMessage(recipient *Recipient, content string) error + func (c *WorkwxApp) SendSchoolVideoMessage(recipient *Recipient, mediaID string, description string, title string) error + func (c *WorkwxApp) SendSchoolVoiceMessage(recipient *Recipient, mediaID string) error + func (c *WorkwxApp) SendTaskCardMessage(recipient *Recipient, title string, description string, url string, ...) error + func (c *WorkwxApp) SendTextCardMessage(recipient *Recipient, title string, description string, url string, ...) error + func (c *WorkwxApp) SendTextMessage(recipient *Recipient, content string, isSafe bool) error + func (c *WorkwxApp) SendVideoMessage(recipient *Recipient, mediaID string, description string, title string, ...) error + func (c *WorkwxApp) SendVoiceMessage(recipient *Recipient, mediaID string, isSafe bool) error + func (c *WorkwxApp) SetAccessTokenFunc(tokenFunc func() (string, int64, error)) + func (c *WorkwxApp) SpawnAccessTokenRefresher() + func (c *WorkwxApp) SpawnAccessTokenRefresherWithContext(ctx context.Context) + func (c *WorkwxApp) SpawnJSAPITicketAgentConfigRefresher() + func (c *WorkwxApp) SpawnJSAPITicketAgentConfigRefresherWithContext(ctx context.Context) + func (c *WorkwxApp) SpawnJSAPITicketRefresher() + func (c *WorkwxApp) SpawnJSAPITicketRefresherWithContext(ctx context.Context) + func (c *WorkwxApp) TransferExternalContact(externalUserID, handoverUserID, takeoverUserID, transferSuccessMsg string) error + func (c *WorkwxApp) TransferGroupChatExternalContact(chatIDList []string, newOwner string) ([]ExternalContactGroupChatTransferFailed, error) + func (c *WorkwxApp) UploadPermanentImageMedia(media *Media) (url string, err error) + func (c *WorkwxApp) UploadTempFileMedia(media *Media) (*MediaUploadResult, error) + func (c *WorkwxApp) UploadTempImageMedia(media *Media) (*MediaUploadResult, error) + func (c *WorkwxApp) UploadTempVideoMedia(media *Media) (*MediaUploadResult, error) + func (c *WorkwxApp) UploadTempVoiceMedia(media *Media) (*MediaUploadResult, error) + type WorkwxClientError struct + Code errcodes.ErrCode + Msg string + func (e *WorkwxClientError) Error() string