Documentation ¶
Index ¶
- Constants
- func CorpIdToOpenCorpId(api *token.Api, corpId string) (string, error)
- func GetAppQrCode(api *token.Api, qr QRCodeReq) (string, error)
- func GetCorpToken(corp token.Token, d data.D) (access.Token, error)
- func GetPermanentCode(corp token.Token, d data.D) (access.Token, error)
- func GetProviderToken(corp token.Token, d data.D) (access.Token, error)
- func GetSuiteToken(corp token.Token, d data.D) (access.Token, error)
- type AdminInfo
- type AdminList
- type Agent
- type AuthCorpInfo
- type AuthEvent
- type AuthInfo
- type AuthUserInfo
- type ContactEvent
- type ContactInfo
- type CustomizedAuthUrl
- type DealerCorpInfo
- type DepartmentEvent
- type DepartmentInfo
- type EventNotify
- type ExtAttr
- type LoginAgent
- type LoginAuthInfo
- type LoginDepartment
- type LoginInfo
- type Permanent
- type PermanentInfo
- type PreAuthCode
- type Privilege
- type QRCodeReq
- type RegisterCodeInfo
- type SharedFrom
- type SuiteTicketEvent
- type TagEvent
- type TagInfo
- type UserDetail3rd
- type UserInfo3rd
Constants ¶
const ( KItCreateAuth = "create_auth" KItChangeAuth = "change_auth" KItCancelAuth = "cancel_auth" KItChangeContact = "change_contact" KItResetPermanentCode = "reset_permanent_code" )
const ( KCtCreateUser = "create_user" KCtUpdateUser = "update_user" KCtDeleteUser = "delete_user" )
const ( KCtCreateParty = "create_party" KCtUpdateParty = "update_party" KCtDeleteParty = "delete_party" )
const (
KCtUpdateTag = "update_tag"
)
Variables ¶
This section is empty.
Functions ¶
func CorpIdToOpenCorpId ¶
CorpIdToOpenCorpId 明文corpid转换为加密corpid POST(HTTPS) 为更好地保护企业与用户的数据,第三方应用获取的corpid不再是明文的corpid,将升级为第三方服务商级别的加密corpid(了解更多)。第三方可以将已有的明文corpid转换为第三方的加密corpid。 请求地址:https://qyapi.weixin.qq.com/cgi-bin/service/corpid_to_opencorpid?provider_access_token=ACCESS_TOKEN
func GetAppQrCode ¶
GetAppQrCode 获取应用二维码 POST(HTTPS) 用于获取第三方应用二维码。 https://qyapi.weixin.qq.com/cgi-bin/service/get_app_qrcode?suite_access_token=SUITE_ACCESS_TOKEN
func GetCorpToken ¶
GetCorpToken 获取企业凭证 POST(HTTPS) 第三方服务商在取得企业的永久授权码后,通过此接口可以获取到企业的access_token。 获取后可通过通讯录、应用、消息等企业接口来运营这些应用。 此处获得的企业access_token与企业获取access_token拿到的token,本质上是一样的,只不过获取方式不同。 获取之后,就跟普通企业一样使用token调用API接口 https://qyapi.weixin.qq.com/cgi-bin/service/get_corp_token?suite_access_token=SUITE_ACCESS_TOKEN
func GetPermanentCode ¶
GetPermanentCode 获取企业永久授权码 POST(HTTPS)https://qyapi.weixin.qq.com/cgi-bin/service/get_permanent_code
func GetProviderToken ¶
GetProviderToken 获取服务商凭证 开发者需要缓存provider_access_token,用于后续接口的调用(注意:不能频繁调用get_provider_token接口,否则会受到频率拦截)。 当provider_access_token失效或过期时,需要重新获取。 provider_access_token的有效期通过返回的expires_in来传达,正常情况下为7200秒(2小时),有效期内重复获取返回相同结果,过期后获取会返回新的provider_access_token。 provider_access_token至少保留512字节的存储空间。 企业微信可能会出于运营需要,提前使provider_access_token失效,开发者应实现provider_access_token失效时重新获取的逻辑
func GetSuiteToken ¶
GetSuiteToken 获取第三方应用凭证 ticket suite_ticket 由于第三方服务商可能托管了大量的企业,其安全问题造成的影响会更加严重,故API中除了合法来源IP校验之外,还额外增加了suite_ticket作为安全凭证。 获取suite_access_token时,需要suite_ticket参数。suite_ticket由企业微信后台定时推送给“指令回调URL”,每十分钟更新一次,见推送suite_ticket。 suite_ticket实际有效期为30分钟,可以容错连续两次获取suite_ticket失败的情况,但是请永远使用最新接收到的suite_ticket。 通过本接口获取的suite_access_token有效期为2小时,开发者需要进行缓存,不可频繁获取。
Types ¶
type AdminList ¶
type AdminList struct {
Admins []AdminInfo `json:"admin"`
}
func GetAdminList ¶
GetAdminList 获取应用的管理员列表 POST(HTTPS) https://qyapi.weixin.qq.com/cgi-bin/service/get_admin_list?suite_access_token=SUITE_ACCESS_TOKEN
type Agent ¶
type Agent struct { AgentId int64 `json:"agentid"` Name string `json:"name"` RoundLogoUrl string `json:"round_logo_url"` SquareLogoUrl string `json:"square_logo_url"` Appid int64 `json:"appid"` AuthMode int `json:"auth_mode,omitempty"` IsCustomizedApp bool `json:"is_customized_app,omitempty"` AuthFromThirdApp bool `json:"auth_from_thirdapp,omitempty"` Privilege Privilege `json:"privilege,omitempty"` }
type AuthCorpInfo ¶
type AuthCorpInfo struct { CorpId string `json:"corpid"` CorpName string `json:"corp_name"` CorpType string `json:"corp_type"` CorpSquareLogoUrl string `json:"corp_square_logo_url"` CorpUserMax int `json:"corp_user_max"` CorpFullName string `json:"corp_full_name"` VerifiedEndTime int `json:"verified_end_time"` SubjectType int `json:"subject_type"` CorpWxqrcode string `json:"corp_wxqrcode"` CorpScale string `json:"corp_scale"` CorpIndustry string `json:"corp_industry"` CorpSubIndustry string `json:"corp_sub_industry"` }
type AuthEvent ¶ added in v1.0.16
type AuthEvent struct { AuthCode string `json:"AuthCode" xml:"AuthCode"` State string `json:"State" xml:"State"` }
AuthEvent 授权通知事件 InfoType = create_auth, change_auth, cancel_auth
type AuthUserInfo ¶
type ContactEvent ¶ added in v1.0.16
type ContactEvent struct {
ContactInfo
}
ContactEvent 成员通知事件 InfoType = change_contact, ChangeType= create_user, update_user,delete_user
type ContactInfo ¶
type ContactInfo struct { UserID string `json:"UserID" xml:"UserID"` OpenUserID string `json:"OpenUserID" xml:"OpenUserID"` Name string `json:"Name" xml:"Name"` Department []string `json:"Department" xml:"Department"` MainDepartment string `json:"MainDepartment" xml:"MainDepartment"` IsLeaderInDept []string `json:"IsLeaderInDept" xml:"IsLeaderInDept"` DirectLeader []string `json:"DirectLeader" xml:"DirectLeader"` Mobile string `json:"Mobile" xml:"Mobile"` Position string `json:"Position" xml:"Position"` Gender int `json:"Gender" xml:"Gender"` BizMail string `json:"BizMail" xml:"BizMail"` Email string `json:"Email" xml:"Email"` Avatar string `json:"Avatar" xml:"Avatar"` Alias string `json:"Alias" xml:"Alias"` Telephone string `json:"Telephone" xml:"Telephone"` ExtAttr []ExtAttr `json:"ExtAttr" xml:"ExtAttr"` }
type CustomizedAuthUrl ¶
type CustomizedAuthUrl struct { QrcodeUrl string `json:"qrcode_url"` ExpiresIn int `json:"expires_in"` }
func GetCustomizedAuthUrl ¶
func GetCustomizedAuthUrl(api *token.Api, state string, templateId []string) (*CustomizedAuthUrl, error)
GetCustomizedAuthUrl 获取带参授权链接 该API用于获取代开发自建应用授权链接,用于生成带参临时二维码。 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/service/get_customized_auth_url?provider_access_token=PROVIDER_ACCESS_TOKEN
type DealerCorpInfo ¶
type DepartmentEvent ¶ added in v1.0.16
type DepartmentEvent struct {
DepartmentInfo
}
DepartmentEvent 部门通知事件 InfoType = change_contact, ChangeType = create_party, update_party, delete_party
type DepartmentInfo ¶
type EventNotify ¶ added in v1.0.16
type LoginAgent ¶
type LoginAuthInfo ¶
type LoginAuthInfo struct {
Department []LoginDepartment `json:"department"`
}
type LoginDepartment ¶
type LoginInfo ¶
type LoginInfo struct { Usertype int `json:"usertype"` UserInfo AuthUserInfo `json:"user_info"` CorpInfo AuthCorpInfo `json:"corp_info"` Agent []LoginAgent `json:"agent"` AuthInfo LoginAuthInfo `json:"auth_info"` }
func GetLoginInfo ¶
GetLoginInfo 获取登录用户信息 [扫码授权登录] 第三方可通过如下接口,获取登录用户的信息。建议用户以返回信息中的corpid及userid为主键匹配用户 授权登录服务商的网站时,使用应用提供商的provider_access_token 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/service/get_login_info?access_token=PROVIDER_ACCESS_TOKEN
type Permanent ¶
type Permanent struct { access.PermanentAccessToken PermanentInfo }
func GetAuthInfo ¶
GetAuthInfo 获取企业授权信息 POST(HTTPS) https://qyapi.weixin.qq.com/cgi-bin/service/get_auth_info?suite_access_token=SUITE_ACCESS_TOKEN
type PermanentInfo ¶ added in v1.0.13
type PermanentInfo struct { PermanentCode string `json:"permanent_code"` DealerCorpInfo DealerCorpInfo `json:"dealer_corp_info"` AuthCorpInfo AuthCorpInfo `json:"auth_corp_info"` AuthInfo AuthInfo `json:"auth_info"` AuthUserInfo AuthUserInfo `json:"auth_user_info"` RegisterCodeInfo RegisterCodeInfo `json:"register_code_info"` State string `json:"state"` }
func (PermanentInfo) AgentId ¶ added in v1.0.20
func (p PermanentInfo) AgentId() string
func (PermanentInfo) IsCustomizedApp ¶ added in v1.0.13
func (p PermanentInfo) IsCustomizedApp() bool
IsCustomizedApp 代开发模版授权,另外接口不返回access_token字段 授权的应用信息,注意是一个数组,但仅旧的多应用套件授权时会返回多个agent,对新的单应用授权,永远只返回一个agent
type PreAuthCode ¶
func GetPreAuthCode ¶
func GetPreAuthCode(api *token.Api) (*PreAuthCode, error)
GetPreAuthCode 获取预授权码
type RegisterCodeInfo ¶
type SharedFrom ¶
type SharedFrom struct {}
type SuiteTicketEvent ¶ added in v1.0.16
type SuiteTicketEvent struct {
SuiteTicket string `json:"SuiteTicket" xml:"SuiteTicket"`
}
SuiteTicketEvent 推送suite_ticket
type TagEvent ¶ added in v1.0.16
type TagEvent struct {
TagInfo
}
TagEvent 标签通知事件 回调设置在授权应用可见范围内的标签的变更事件。由第三方应用调用接口触发的标签变更事件不回调给该应用本身。 InfoType = change_contact, ChangeType = update_tag
type TagInfo ¶
type TagInfo struct { TagId int64 `json:"TagId" json:"TagId"` AddUserItems []string `json:"AddUserItems" xml:"AddUserItems"` DelUserItems []string `json:"DelUserItems" xml:"DelUserItems"` AddPartyItems []int64 `json:"AddPartyItems" xml:"AddPartyItems"` DelPartyItems []int64 `json:"DelPartyItems" xml:"DelPartyItems"` }
type UserDetail3rd ¶
type UserDetail3rd struct { Corpid string `json:"corpid"` Userid string `json:"userid"` Name string `json:"name"` Gender string `json:"gender"` Avatar string `json:"avatar"` QrCode string `json:"qr_code"` }
func GetUserDetail3rd ¶
func GetUserDetail3rd(api *token.Api, ticket string) (*UserDetail3rd, error)
GetUserDetail3rd 获取访问用户敏感信息 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/service/auth/getuserdetail3rd?suite_access_token=SUITE_ACCESS_TOKEN
type UserInfo3rd ¶
type UserInfo3rd struct { CorpId string `json:"corpid"` Userid string `json:"userid"` UserTicket string `json:"user_ticket"` ExpiresIn int `json:"expires_in"` OpenUserid string `json:"open_userid"` }
func GetuserInfo3rd ¶
func GetuserInfo3rd(api *token.Api, code string) (*UserInfo3rd, error)
GetuserInfo3rd 获取访问用户身份 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/service/auth/getuserinfo3rd?suite_access_token=SUITE_ACCESS_TOKEN&code=CODE