service

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Zlib Imports: 10 Imported by: 0

README

服务商

Documentation

Index

Constants

View Source
const (
	KItCreateAuth         = "create_auth"
	KItChangeAuth         = "change_auth"
	KItCancelAuth         = "cancel_auth"
	KItChangeContact      = "change_contact"
	KItShareAgentChange   = "share_agent_change"
	KItResetPermanentCode = "reset_permanent_code"
)
View Source
const (
	KCtCreateUser = "create_user"
	KCtUpdateUser = "update_user"
	KCtDeleteUser = "delete_user"
)
View Source
const (
	KCtCreateParty = "create_party"
	KCtUpdateParty = "update_party"
	KCtDeleteParty = "delete_party"
)
View Source
const (
	KLICUnlicensed = "unlicensed_notify" //接口许可失效通知
	KLICPaySuccess = "license_pay_success"
)
View Source
const (
	KECChangeExternalContact = "change_external_contact"

	KECAddExternalContact     = "add_external_contact"      //添加企业客户事件
	KECEditExternalContact    = "edit_external_contact"     //编辑企业客户事件
	KECAddHalfExternalContact = "add_half_external_contact" //外部联系人免验证添加成员事件
	KECDeleteExternalContact  = "del_external_contact"      //删除企业客户事件
	KECDeleteFollowUser       = "del_follow_user"           //删除跟进成员事件
	KECTransferFail           = "transfer_fail"             //客户接替失败事件
)

客户事件通知

View Source
const (
	KECChangeExternalChat = "change_external_chat"

	KECCreate  = "create"
	KECUpdate  = "update"
	KECDismiss = "dismiss"
	KECDelete  = "delete"
	KECShuffle = "shuffle" //重排 for tag
)
View Source
const (
	KCtUpdateTag = "update_tag"
)
View Source
const (
	KECChangeExternalTag = "change_external_tag"
)
View Source
const (
	KLICAutoActive = "auto_activate"
)
View Source
const (
	KLICRefund = "license_refund"
)

Variables

This section is empty.

Functions

func CorpIdToOpenCorpId

func CorpIdToOpenCorpId(api *token.Api, corpId string) (string, error)

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 GetAgentPermissions added in v1.8.5

func GetAgentPermissions(api *token.Api) ([]string, error)

GetAgentPermissions 获取应用权限详情 该API用于获取代开发应用或第三方应用用户授权的权限详情。 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/agent/get_permissions?access_token=ACCESS_TOKEN 权限说明: https://developer.work.weixin.qq.com/document/path/99052

func GetAppQRCode added in v1.8.5

func GetAppQRCode(api *token.Api, qr QRCodeReq) (string, error)

GetAppQRCode 获取应用二维码 POST(HTTPS) 用于获取第三方应用二维码。 要求第三方应用是已上线的第三方应用,不能是代应用 https://qyapi.weixin.qq.com/cgi-bin/service/get_app_qrcode?suite_access_token=SUITE_ACCESS_TOKEN

func GetCorpToken

func GetCorpToken(corp token.Token, d data.D) (access.Token, error)

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

func GetPermanentCode(corp token.Token, d data.D) (access.Token, error)

GetPermanentCode 获取企业永久授权码 POST(HTTPS)https://qyapi.weixin.qq.com/cgi-bin/service/get_permanent_code

func GetProviderToken

func GetProviderToken(corp token.Token, d data.D) (access.Token, error)

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

func GetSuiteToken(corp token.Token, d data.D) (access.Token, error)

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小时,开发者需要进行缓存,不可频繁获取。

func LICActiveAccount added in v1.0.23

func LICActiveAccount(api *token.Api, corpId string, active ActiveCode) error

LICActiveAccount 激活帐号 下单购买帐号并支付完成之后,先调用获取订单中的帐号列表接口获取到帐号激活码,然后可以调用该接口将激活码绑定到某个企业员工,以对其激活相应的平台服务能力。 1. 一个userid允许激活一个基础帐号以及一个互通帐号。 2. 若userid已激活,使用同类型的激活码来激活后,则绑定关系变为新激活码,新激活码有效时长自动叠加上旧激活码剩余时长,同时旧激活码失效。 3. 为了避免服务商调用出错,多个同类型的激活码累加后的有效期不可超过5年,否则接口报错701030。 4.为了避免服务商调用出错,只有当旧的激活码的剩余使用小于等于20天,才可以使用新的同类型的激活码进行激活并续期 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/active_account?provider_access_token=ACCESS_TOKEN

func LICGetAutoActiveStatue added in v1.0.23

func LICGetAutoActiveStatue(api *token.Api, corpId string) (int, error)

LICGetAutoActiveStatue 查询企业的许可自动激活状态 服务商可以调用该接口查询授权企业的许可自动激活状态。

请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/get_auto_active_status?provider_access_token=ACCESS_TOKEN

func LICSetAutoActiveStatus added in v1.0.23

func LICSetAutoActiveStatus(api *token.Api, corpId string, status int) error

LICSetAutoActiveStatus 设置企业的许可自动激活状态 设置企业的许可自动激活状态 服务商可以调用该接口设置授权企业的许可自动激活状态。设置为自动激活后,对应授权企业的员工使用服务商应用时,接口许可表现为自动激活。

请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/set_auto_active_status?provider_access_token=ACCESS_TOKEN

func LICancelOrder added in v1.8.4

func LICancelOrder(api *token.Api, corpId, orderId string) error

LICancelOrder 取消订单 取消接口许可购买和续费订单,只可取消未支付且未失效的订单。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/cancel_order?provider_access_token=ACCESS_TOKEN

func LICreateOrder added in v1.8.4

func LICreateOrder(api *token.Api, order *Order) (string, error)

LICreateOrder 下单购买帐号 服务商下单为企业购买新的帐号,可以同时购买基础帐号与互通帐号。下单之后,需要到服务商管理端发起支付,支付完成之后,订单才能生效。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/create_new_order?provider_access_token=ACCESS_TOKEN

func LISubmitOrderJob added in v1.8.4

func LISubmitOrderJob(api *token.Api, order *SubOrder) (string, error)

LISubmitOrderJob 提交续期订单 创建续期任务之后,需要调用该接口,以提交订单任务。注意,提交之后,需要到服务商管理端发起支付,支付完成之后,订单才能生效。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/submit_order_job?provider_access_token=ACCESS_TOKEN

func SetSessionInfo added in v1.8.5

func SetSessionInfo(api *token.Api, preAuthCode string, sessionInfo SessionInfo) error

SetSessionInfo 设置授权配置 该接口可对某次授权进行配置。可支持测试模式(应用未发布时)。 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/service/set_session_info?suite_access_token=SUITE_ACCESS_TOKEN

Types

type Account added in v1.0.23

type Account struct {
	ActiveCode string `json:"active_code,omitempty"`
	Userid     string `json:"userid"`
	Type       int    `json:"type"`
}

type AccountCount added in v1.0.23

type AccountCount struct {
	BaseCount            int `json:"base_count"`
	ExternalContactCount int `json:"external_contact_count"`
}

type AccountDuration added in v1.0.23

type AccountDuration struct {
	Months int `json:"months"`
	Days   int `json:"days"`
}

type AccountList added in v1.8.4

type AccountList struct {
	ActiveCode         string `json:"ActiveCode" xml:"ActiveCode"`
	UserId             string `json:"UserId" xml:"UserId"`
	PreviousActiveCode string `json:"PreviousActiveCode" xml:"PreviousActiveCode"`
	ExpireTime         int64  `json:"ExpireTime" xml:"ExpireTime"`
	Type               int    `json:"Type" xml:"Type"`
	PreviousStatus     int    `json:"PreviousStatus" xml:"PreviousStatus"`
}

type AccountListResult added in v1.0.34

type AccountListResult struct {
	NextCursor  string    `json:"next_cursor"`
	HasMore     int       `json:"has_more"`
	AccountList []Account `json:"account_list"`
}

func LIOrderAccountList added in v1.8.4

func LIOrderAccountList(api *token.Api, orderId string, cursor Cursor) (*AccountListResult, error)

LIOrderAccountList 获取订单中的帐号列表 查询指定订单下的平台能力服务帐号列表。若为购买帐号的订单或者存量企业的版本付费迁移订单,则返回帐号激活码列表;若为续期帐号的订单,则返回续期帐号的成员列表。注意,若是购买帐号的订单,则仅订单支付完成时,系统才会生成帐号,故支付完成之前,该接口不会返回帐号激活码。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/list_order_account?provider_access_token=ACCESS_TOKEN

type ActiveCode added in v1.0.23

type ActiveCode struct {
	ActiveCode string `json:"active_code"`
	Userid     string `json:"userid,omitempty"`
	Type       int    `json:"type,omitempty"`
}

type ActiveCodeResult added in v1.0.23

type ActiveCodeResult struct {
	ActiveCode string `json:"active_code"`
	Userid     string `json:"userid"`
	Errcode    int32  `json:"errcode"`
}

func LICBatchActiveAccount added in v1.0.23

func LICBatchActiveAccount(api *token.Api, corpId string, codes []ActiveCode) ([]*ActiveCodeResult, error)

LICBatchActiveAccount 批量激活帐号 可在一次请求里为一个企业的多个成员激活许可帐号,便于服务商批量化处理。

1.一个userid允许激活一个基础帐号以及一个互通帐号。 2. 若userid已激活,使用同类型的激活码来激活后,则绑定关系变为新激活码,新激活码有效时长自动叠加上旧激活码剩余时长,同时旧激活码失效。 3. 为了避免服务商调用出错,多个同类型的激活码累加后的有效期不可超过5年,否则接口报错701030。 4.为了避免服务商调用出错,只有当旧的激活码的剩余使用小于等于20天,才可以使用新的同类型的激活码进行激活并续期 5. 单次激活的员工数量不超过1000 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/batch_active_account?provider_access_token=ACCESS_TOKEN

type ActiveDetail added in v1.0.23

type ActiveDetail struct {
	ActiveInfo
	MergeInfo MergeInfo `json:"merge_info"`
}

func LICActiveCodeDetail added in v1.0.23

func LICActiveCodeDetail(api *token.Api, corpId, activeCode string) (*ActiveDetail, error)

LICActiveCodeDetail 获取激活码详情 查询某个帐号激活码的状态以及激活绑定情况。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/get_active_info_by_code?provider_access_token=ACCESS_TOKEN

type ActiveInfo added in v1.0.23

type ActiveInfo struct {
	ActiveCode string `json:"active_code"`
	Type       int    `json:"type"`
	Status     int    `json:"status"`
	Userid     string `json:"userid"`
	CreateTime int64  `json:"create_time"`
	ActiveTime int64  `json:"active_time"`
	ExpireTime int64  `json:"expire_time"`
}

type ActiveNotify added in v1.0.34

type ActiveNotify struct {
	AuthCorpId    string        `json:"AuthCorpId" xml:"AuthCorpId"`
	ServiceCorpId string        `json:"ServiceCorpId" xml:"ServiceCorpId"`
	Scene         string        `json:"Scene" xml:"Scene"`
	AccountList   []AccountList `json:"AccountList" xml:"AccountList"`
}

ActiveNotify 自动激活回调通知 InfoType = auto_activate

type ActiveUser added in v1.0.23

type ActiveUser struct {
	ActiveStatus   int          `json:"active_status"`
	ActiveInfoList []ActiveInfo `json:"active_info_list"`
}

func LICGetActiveByUser added in v1.0.23

func LICGetActiveByUser(api *token.Api, corpId, userId string) (*ActiveUser, error)

LICGetActiveByUser 获取成员的激活详情 查询某个企业成员的激活情况。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/get_active_info_by_user?provider_access_token=ACCESS_TOKEN return ActiveUser

type AdminInfo

type AdminInfo struct {
	Userid     string `json:"userid"`
	OpenUserid string `json:"open_userid,omitempty"`
	AuthType   int    `json:"auth_type"`
}

type AdminList

type AdminList struct {
	Admins []AdminInfo `json:"admin"`
}

func GetAdminList

func GetAdminList(api *token.Api, authCorpId string, agentId int64) (*AdminList, error)

GetAdminList 获取应用的管理员列表 第三方服务商可以用此接口获取授权企业中某个第三方应用的管理员列表(不包括外部管理员),以便服务商在用户进入应用主页之后根据是否管理员身份做权限的区分。 该应用必须与SUITE_ACCESS_TOKEN对应的suiteid对应,否则没权限查看 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"` //旧的多应用套件中的对应应用id,新开发者请忽略
	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"`
	SharedFrom       SharedFrom `json:"shared_from"`
}

type AppLicense added in v1.0.23

type AppLicense struct {
	LicenseStatus int       `json:"license_status"`
	TrailInfo     TrailInfo `json:"trail_info"`
}

func LICGetAppInfo added in v1.0.23

func LICGetAppInfo(api *token.Api, corpId, suiteId, appid string) (*AppLicense, error)

LICGetAppInfo 获取应用的接口许可状态 服务商可获取某个授权企业的应用接口许可试用期,免费试用期为企业首次安装应用后的90天。 appid (旧的多应用套件中的应用id,新开发者请忽略) 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/get_app_license_info?provider_access_token=ACCESS_TOKEN

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   int64  `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 AuthInfo

type AuthInfo struct {
	Agent []Agent `json:"agent"`
}

type AuthNotify

type AuthNotify struct {
	SuiteId    string `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
	AuthCode   string `json:"AuthCode" xml:"AuthCode"`
	State      string `json:"State" xml:"State"`
}

AuthNotify 授权通知事件 InfoType = create_auth, change_auth, cancel_auth

type AuthUserInfo

type AuthUserInfo struct {
	Userid     string `json:"userid"`
	OpenUserid string `json:"open_userid"`
	Name       string `json:"name"`
	Avatar     string `json:"avatar"`
}

type BatchActiveDetailResult added in v1.0.34

type BatchActiveDetailResult struct {
	List     []ActiveDetail `json:"active_info_list"`
	Invalids []string       `json:"invalid_active_code_list"`
}

func LICBatchActiveCodeDetail added in v1.0.34

func LICBatchActiveCodeDetail(api *token.Api, corpId string, codes []string) (*BatchActiveDetailResult, error)

LICBatchActiveCodeDetail 批量获取激活码详情 批量查询帐号激活码的状态以及激活绑定情况。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/batch_get_active_info_by_code?provider_access_token=ACCESS_TOKEN

type Buy added in v1.8.4

type Buy struct {
	SubOrderId       string          `json:"sub_order_id"`
	CorpId           string          `json:"corpid"`
	AccountCount     AccountCount    `json:"account_count"`
	AccountDuration  AccountDuration `json:"account_duration"`
	AutoActiveStatus int             `json:"auto_active_status"`
}

type ContactNotify

type ContactNotify struct {
	SuiteId        string         `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId     string         `json:"AuthCorpId" xml:"AuthCorpId"`
	UserID         string         `json:"UserID" xml:"UserID"`
	OpenUserID     string         `json:"OpenUserID" xml:"OpenUserID"`
	Name           string         `json:"Name" xml:"Name"`
	Mobile         string         `json:"Mobile" xml:"Mobile"`
	Position       string         `json:"Position" xml:"Position"`
	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"`
	Gender         int            `json:"Gender" xml:"Gender"`
	MainDepartment int64          `json:"MainDepartment" xml:"MainDepartment"`
	Department     []int64        `json:"Department" xml:"Department"`
	IsLeaderInDept []int          `json:"IsLeaderInDept" xml:"IsLeaderInDept"`
	DirectLeader   []string       `json:"DirectLeader" xml:"DirectLeader"`
	ExtAttribute   []ExtAttribute `json:"ExtAttr" xml:"ExtAttr"`
}

type ContactTagNotify added in v1.0.56

type ContactTagNotify struct {
	SuiteId       string   `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId    string   `json:"AuthCorpId" xml:"AuthCorpId"`
	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 Cursor added in v1.0.23

type Cursor struct {
	Limit  int    `json:"limit"`
	Cursor string `json:"cursor"`
}

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用于获取代开发自建应用授权链接,用于生成带参临时二维码。 可用来生成二维码的授权url,需要开发者自行生成为二维码 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/service/get_customized_auth_url?provider_access_token=PROVIDER_ACCESS_TOKEN

type DealerCorpInfo

type DealerCorpInfo struct {
	CorpId   string `json:"corpid"`
	CorpName string `json:"corp_name"`
}

type DepartmentNotify

type DepartmentNotify struct {
	SuiteId    string `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
	Name       string `json:"Name" xml:"Name"`
	Id         int64  `json:"Id" xml:"Id"`
	ParentId   int64  `json:"ParentId" xml:"ParentId"`
	Order      int    `json:"Order" xml:"Order"`
}

DepartmentNotify 部门通知事件内容

type ExtAttribute added in v1.0.37

type ExtAttribute struct {
	Name string `json:"Name" xml:"Name"`
	Type int    `json:"Type" xml:"Type"`
}

type ExternalChatNotify added in v1.0.56

type ExternalChatNotify struct {
	SuiteId      string `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId   string `json:"AuthCorpId" xml:"AuthCorpId"`
	ChatId       string `json:"ChatId" xml:"ChatId"`
	UpdateDetail string `json:"UpdateDetail" xml:"UpdateDetail"`
	JoinScene    string `json:"JoinScene" xml:"JoinScene"`
	QuitScene    string `json:"QuitScene" xml:"QuitScene"`
	MemChangeCnt string `json:"MemChangeCnt" xml:"MemChangeCnt"`
}

type ExternalContactNotify added in v1.0.56

type ExternalContactNotify struct {
	SuiteId        string `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId     string `json:"AuthCorpId" xml:"AuthCorpId"`
	UserID         string `json:"UserID" xml:"UserID"`
	ExternalUserID string `json:"ExternalUserID" xml:"ExternalUserID"`
	State          string `json:"State" xml:"State"` //添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
	WelcomeCode    string `json:"WelcomeCode" xml:"WelcomeCode"`
	FailReason     string `json:"FailReason" xml:"FailReason"` //transfer_fail
}

type ExternalTagNotify added in v1.0.56

type ExternalTagNotify struct {
	SuiteId    string `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
	Id         string `json:"Id" xml:"Id"`
	TagType    string `json:"TagType" xml:"TagType"`
}

type InvalidAccount added in v1.0.23

type InvalidAccount struct {
	Errcode int32  `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	Userid  string `json:"userid"`
	Type    int    `json:"type"`
}

type ListCond added in v1.0.23

type ListCond struct {
	CorpId    string `json:"corpid"`
	StartTime int64  `json:"start_time"`
	EndTime   int64  `json:"end_time"`
	Cursor
}

type LoginAgent

type LoginAgent struct {
	AgentId  int64 `json:"agentid"`
	AuthType int   `json:"auth_type"`
}

type LoginAuthInfo

type LoginAuthInfo struct {
	Department []LoginDepartment `json:"department"`
}

type LoginDepartment

type LoginDepartment struct {
	Id       int64 `json:"id"`
	Writable bool  `json:"writable"`
}

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

func GetLoginInfo(api *token.Api, authCode string) (*LoginInfo, error)

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 MergeInfo added in v1.0.23

type MergeInfo struct {
	ToActiveCode   string `json:"to_active_code"`
	FromActiveCode string `json:"from_active_code"`
}

type Order added in v1.0.23

type Order struct {
	CorpId          string          `json:"corpid"`
	BuyerUserId     string          `json:"buyer_userid"`
	AccountCount    AccountCount    `json:"account_count"`
	AccountDuration AccountDuration `json:"account_duration"`
}

type OrderDetail added in v1.0.23

type OrderDetail struct {
	CorpId          string          `json:"corpid"`
	OrderId         string          `json:"order_id"`
	OrderType       int             `json:"order_type"`
	OrderStatus     int             `json:"order_status"`
	Price           int             `json:"price"`
	CreateTime      int64           `json:"create_time"`
	PayTime         int64           `json:"pay_time"`
	AccountCount    AccountCount    `json:"account_count"`
	AccountDuration AccountDuration `json:"account_duration"`
}

func LIGetOrderDetail added in v1.8.4

func LIGetOrderDetail(api *token.Api, orderId string) (*OrderDetail, error)

LIGetOrderDetail 获取订单详情 查询某个订单的详情,包括订单的状态、基础帐号个数、互通帐号个数、帐号购买时长等。注意,该接口不返回订单中的帐号激活码列表或者续期的帐号成员列表,请调用获取订单中的帐号列表接口以获取帐号列表。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/get_order?provider_access_token=ACCESS_TOKEN

type OrderInfo added in v1.0.23

type OrderInfo struct {
	OrderId   string `json:"order_id"`
	OrderType int    `json:"order_type"`
}

type OrderListResult added in v1.0.23

type OrderListResult struct {
	NextCursor string      `json:"next_cursor"`
	HasMore    int         `json:"has_more"`
	OrderList  []OrderInfo `json:"order_list"`
}

func LIGetOrderList added in v1.8.4

func LIGetOrderList(api *token.Api, cond *ListCond) (*OrderListResult, error)

LIGetOrderList 获取订单列表 服务商查询自己某段时间内的平台能力服务订单列表 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/list_order?provider_access_token=ACCESS_TOKEN

type OrderRefundNotify added in v1.0.37

type OrderRefundNotify struct {
	AuthCorpId    string `json:"AuthCorpId" xml:"AuthCorpId"`
	ServiceCorpId string `json:"ServiceCorpId" xml:"ServiceCorpId"`
	OrderId       string `json:"OrderId" xml:"OrderId"`
	OrderStatus   int    `json:"OrderStatus" xml:"OrderStatus"`
}

OrderRefundNotify 退款结果通知 InfoType = license_refund

type OrderSuccessNotify added in v1.0.37

type OrderSuccessNotify struct {
	AuthCorpId    string `json:"AuthCorpId" xml:"AuthCorpId"`
	ServiceCorpId string `json:"ServiceCorpId" xml:"ServiceCorpId"`
	OrderId       string `json:"OrderId" xml:"OrderId"`
	BuyerUserId   string `json:"BuyerUserId" xml:"BuyerUserId"`
}

OrderSuccessNotify 订单支付成功 InfoType = license_pay_success

type Permanent

type Permanent struct {
	access.PermanentAccessToken
	PermanentInfo
}

func GetAuthInfo

func GetAuthInfo(api *token.Api, authCorpId, permanentCode string) (*Permanent, error)

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) Agent added in v1.8.5

func (p PermanentInfo) Agent() Agent

func (PermanentInfo) AgentId added in v1.0.20

func (p PermanentInfo) AgentId() string

func (PermanentInfo) AgentName added in v1.8.5

func (p PermanentInfo) AgentName() string

func (PermanentInfo) IsCustomizedApp added in v1.0.13

func (p PermanentInfo) IsCustomizedApp() bool

IsCustomizedApp 是否为代开发自建应用,另外接口不返回access_token字段 授权的应用信息,注意是一个数组,但仅旧的多应用套件授权时会返回多个agent,对新的单应用授权,永远只返回一个agent

type PreAuthCode

type PreAuthCode struct {
	Code      string `json:"pre_auth_code"`
	ExpiresIn int64  `json:"expires_in"`
}

func GetPreAuthCode

func GetPreAuthCode(api *token.Api) (*PreAuthCode, error)

GetPreAuthCode 获取预授权码

type Privilege

type Privilege struct {
	Level      int      `json:"level"`
	AllowParty []int64  `json:"allow_party"`
	AllowUser  []string `json:"allow_user"`
	AllowTag   []int64  `json:"allow_tag"`
	ExtraParty []int64  `json:"extra_party"`
	ExtraUser  []string `json:"extra_user"`
	ExtraTag   []int64  `json:"extra_tag"`
}

Privilege Level 1:通讯录基本信息只读 3:通讯录全部信息读写 4:单个基本信息只读

type QRCodeReq

type QRCodeReq struct {
	SuiteId    string `json:"suite_id"` //第三方应用id
	State      string `json:"state"`    //state值,用于区分不同的安装渠道,可以填写a-zA-Z0-9,长度不可超过32个字节,默认为空。扫应用带参二维码授权安装后,获取企业永久授权码接口会返回该state值
	Appid      int64  `json:"appid,omitempty"`
	Style      int    `json:"style"`       //二维码样式选项,默认为不带说明外框小尺寸。0:带说明外框的二维码,适合于实体物料,1:带说明外框的二维码,适合于屏幕类,2:不带说明外框(小尺寸),3:不带说明外框(中尺寸),4:不带说明外框(大尺寸)。具体样式与服务商管理端获取到的应用二维码样式一一对应,参见下文二维码样式说明
	ResultType int    `json:"result_type"` //结果返回方式,默认为返回二维码图片buffer。1:二维码图片buffer,2:二维码图片url
}

type ReOrder added in v1.0.23

type ReOrder struct {
	CorpId      string    `json:"corpid"`
	Jobid       string    `json:"jobid"`
	AccountList []Account `json:"account_list"`
}

type ReOrderResult added in v1.0.23

type ReOrderResult struct {
	Jobid              string           `json:"jobid"`
	InvalidAccountList []InvalidAccount `json:"invalid_account_list"`
}

func LICreateNewOrderJob added in v1.8.4

func LICreateNewOrderJob(api *token.Api, buyList []Buy, JobId string) (*ReOrderResult, error)

LICreateNewOrderJob 创建多企业新购任务

func LICreateRenewOrderJob added in v1.8.4

func LICreateRenewOrderJob(api *token.Api, order *ReOrder) (*ReOrderResult, error)

LICreateRenewOrderJob 创建续期任务 在同一个订单里,首次创建任务无须指定jobid,后续指定同一个jobid,表示往同一个订单任务追加续期的成员。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/create_renew_order_job?provider_access_token=ACCESS_TOKEN

type RegisterCodeInfo

type RegisterCodeInfo struct {
	RegisterCode string `json:"register_code"`
	TemplateId   string `json:"template_id"`
	State        string `json:"state"`
}

type SessionInfo added in v1.8.5

type SessionInfo struct {
	AuthType int `json:"auth_type"`
}

type ShareActiveCode added in v1.0.23

type ShareActiveCode struct {
	FromCorpId string       `json:"from_corpid"`
	ToCorpId   string       `json:"to_corpid"`
	ShareList  []ActiveCode `json:"share_list"`
}

type ShareResult added in v1.0.23

type ShareResult struct {
	ActiveCode string `json:"active_code"`
	Errcode    int32  `json:"errcode"`
	Errmsg     string `json:"errmsg"`
}

func LICBatchShareActiveCode added in v1.0.23

func LICBatchShareActiveCode(api *token.Api, share *ShareActiveCode) ([]*ShareResult, error)

LICBatchShareActiveCode 分配激活码给下游企业 服务商可调用该接口将为上游企业购买的激活码分配给下游企业使用。

(1) 上游企业有共享该服务商的应用给下游企业,应用包括第三方应用和代开发应用 (2) 分配给下游企业的激活码,当前未激活,且属于上游企业的,且未分配给其他下游企业 (3) 分配的激活码帐号数的上限,不能超过下游企业在上下游通讯录中人数上限的两倍 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/batch_share_active_code?provider_access_token=ACCESS_TOKEN

type SharedFrom

type SharedFrom struct {
	CorpId    string `json:"corpid"`
	ShareType int    `json:"share_type"`
}

type SubOrder added in v1.0.23

type SubOrder struct {
	Jobid           string          `json:"jobid"`
	BuyerUserid     string          `json:"buyer_userid"`
	AccountDuration AccountDuration `json:"account_duration"`
}

type SuiteTicketNotify added in v1.0.37

type SuiteTicketNotify struct {
	SuiteId     string `json:"SuiteId" xml:"SuiteId"`
	AuthCorpId  string `json:"AuthCorpId" xml:"AuthCorpId"`
	SuiteTicket string `json:"SuiteTicketNotify" xml:"SuiteTicketNotify"`
}

SuiteTicketNotify 推送suite_ticket

type TrailInfo added in v1.0.23

type TrailInfo struct {
	StartTime int64 `json:"start_time"`
	EndTime   int64 `json:"end_time"`
}

type Transfer added in v1.0.23

type Transfer struct {
	HandoverUserid string `json:"handover_userid"`
	TakeoverUserid string `json:"takeover_userid"`
}

type TransferResult added in v1.0.23

type TransferResult struct {
	HandoverUserid string `json:"handover_userid"`
	TakeoverUserid string `json:"takeover_userid"`
	Errcode        int32  `json:"errcode"`
}

func LICBatchTransfer added in v1.0.23

func LICBatchTransfer(api *token.Api, corpId string, transfer []Transfer) ([]*TransferResult, error)

LICBatchTransfer 帐号继承 在企业员工离职或者工作范围的有变更时,允许将其许可帐号继承给其他员工。 调用限制:

转移成员和接收成员属于同一个企业 转移成员的帐号已激活,且在有效期 转移许可的成员为离职成员,或不在服务商应用的可见范围内时,不限制下次转移的时间间隔 转移许可的成员为在职成员且在服务商应用的可见范围内时,转移后30天后才可进行下次转移 接收成员许可不能与转移成员的许可重叠(同时拥有基础帐号或者互通帐号) 单次转移的帐号数限制在1000以内 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/batch_transfer_license?provider_access_token=ACCESS_TOKEN return []TransferResult

type UnionResult added in v1.8.4

type UnionResult struct {
	Order      OrderDetail `json:"order"`
	HasMore    int         `json:"has_more"`
	NextCursor string      `json:"next_cursor"`
	BuyList    []Buy       `json:"buy_list"`
}

func LIGetUnionOrder added in v1.8.4

func LIGetUnionOrder(api *token.Api, orderId string, cursor Cursor) (*UnionResult, error)

LIGetUnionOrder 获取多企业订单详情

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  int64  `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

Jump to

Keyboard shortcuts

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