Skip to content

Commit

Permalink
fix(work): fix 752 (#753)
Browse files Browse the repository at this point in the history
fix cannot unmarshal object into Go struct field ExternalUser.external_contact.external_profile of
type string
  • Loading branch information
Lumiaqian authored Jan 2, 2024
1 parent 97e1af5 commit 97c9f7d
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions work/externalcontact/external_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ type ExternalUserDetailResponse struct {

// ExternalUser 外部联系人
type ExternalUser struct {
ExternalUserID string `json:"external_userid"`
Name string `json:"name"`
Avatar string `json:"avatar"`
Type int64 `json:"type"`
Gender int64 `json:"gender"`
UnionID string `json:"unionid"`
Position string `json:"position"`
CorpName string `json:"corp_name"`
CorpFullName string `json:"corp_full_name"`
ExternalProfile string `json:"external_profile"`
ExternalUserID string `json:"external_userid"`
Name string `json:"name"`
Avatar string `json:"avatar"`
Type int64 `json:"type"`
Gender int64 `json:"gender"`
UnionID string `json:"unionid"`
Position string `json:"position"`
CorpName string `json:"corp_name"`
CorpFullName string `json:"corp_full_name"`
ExternalProfile *ExternalProfile `json:"external_profile,omitempty"`
}

// FollowUser 跟进用户(指企业内部用户)
Expand Down Expand Up @@ -104,6 +104,46 @@ type WechatChannel struct {
Source int `json:"source"`
}

// ExternalProfile 外部联系人的自定义展示信息,可以有多个字段和多种类型,包括文本,网页和小程序
type ExternalProfile struct {
ExternalCorpName string `json:"external_corp_name"`
WechatChannels WechatChannels `json:"wechat_channels"`
ExternalAttr []ExternalAttr `json:"external_attr"`
}

// WechatChannels 视频号属性。须从企业绑定到企业微信的视频号中选择,可在“我的企业”页中查看绑定的视频号
type WechatChannels struct {
Nickname string `json:"nickname"`
Status int `json:"status"`
}

// ExternalAttr 属性列表,目前支持文本、网页、小程序三种类型
type ExternalAttr struct {
Type int `json:"type"`
Name string `json:"name"`
Text *Text `json:"text,omitempty"`
Web *Web `json:"web,omitempty"`
MiniProgram *MiniProgram `json:"miniprogram,omitempty"`
}

// Text 文本
type Text struct {
Value string `json:"value"`
}

// Web 网页
type Web struct {
URL string `json:"url"`
Title string `json:"title"`
}

// MiniProgram 小程序
type MiniProgram struct {
AppID string `json:"appid"`
Pagepath string `json:"pagepath"`
Title string `json:"title"`
}

// GetExternalUserDetail 获取外部联系人详情
// @see https://developer.work.weixin.qq.com/document/path/92114
func (r *Client) GetExternalUserDetail(externalUserID string, nextCursor ...string) (*ExternalUserDetailResponse, error) {
Expand Down

0 comments on commit 97c9f7d

Please sign in to comment.