service

package
v1.8.39 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Zlib Imports: 10 Imported by: 0

README

服务商

Documentation

Index

Constants

View Source
const (
	ItCreateAuth         = "create_auth"
	ItChangeAuth         = "change_auth"
	ItCancelAuth         = "cancel_auth"
	ItChangeContact      = "change_contact"
	ItShareAgentChange   = "share_agent_change"
	ItResetPermanentCode = "reset_permanent_code"
)

InfoType

View Source
const (
	CtCreateUser = "create_user"
	CtUpdateUser = "update_user"
	CtDeleteUser = "delete_user"
)
View Source
const (
	CtCreateParty = "create_party"
	CTUpdateParty = "update_party"
	CTDeleteParty = "delete_party"
)
View Source
const (
	EtLICUnlicensed = "unlicensed_notify" //接口许可失效通知
	EtLICPaySuccess = "license_pay_success"
	EtLICRefund     = "license_refund"
	EtLICAutoActive = "auto_activate"
)

MsgType= event, Event字段

View Source
const (
	ItChangeExternalContact = "change_external_contact"
	ItCustomerAcquisition   = "customer_acquisition"

	CtAddExternalContact     = "add_external_contact"      //添加企业客户事件
	CtEditExternalContact    = "edit_external_contact"     //编辑企业客户事件(授权企业中配置了客户联系功能的成员编辑外部联系人的备注信息(不包括备注手机号码)或企业标签时,企业微信服务器会向应用的“指令回调URL”推送该事件,但仅修改外部联系人备注手机号时不会触发回调。)
	CtAddHalfExternalContact = "add_half_external_contact" //外部联系人免验证添加成员事件(外部联系人添加了配置了客户联系功能且开启了免验证的成员时(此时成员尚未确认添加对方为好友),企业微信服务器会向应用的“指令回调URL”推送该事件)
	CtDeleteExternalContact  = "del_external_contact"      //删除企业客户事件(授权企业中配置了客户联系功能的成员删除外部联系人时,企业微信服务器会向应用的“指令回调URL”推送该事件)
	CtDeleteFollowUser       = "del_follow_user"           //删除跟进成员事件(授权企业中配置了客户联系功能的成员被外部联系人删除时,企业微信服务器会向应用的“指令回调URL”推送该事件)
	CtTransferFail           = "transfer_fail"             //客户接替失败事件(企业将客户分配给新的成员接替后,当客户添加失败时,企业微信服务器会向应用的“指令回调URL”推送该事件)
	CtBalanceLow             = "balance_low"               //获客额度即将耗尽事件
	CtBalanceExhausted       = "balance_exhausted"         //获客额度已经耗尽事件
	CtDeleteLink             = "delete_link"               //删除获客链接事件
	CtQuotaExpireSoon        = "quota_expire_soon"         //获客额度即将过期事件
	CtCustomerStartChat      = "customer_start_chat"       //微信客户发起会话事件
	CtLinkUnavailable        = "link_unavailable"          //获客链接失效事件
)

客户事件通知

View Source
const (
	ItChangeExternalChat = "change_external_chat"

	CtCreate  = "create"
	CtUpdate  = "update"
	CtDismiss = "dismiss"
	CtDelete  = "delete"
	CtShuffle = "shuffle" //重排 for tag
)
View Source
const (
	CtUpdateTag = "update_tag"
)
View Source
const (
	ItChangeExternalTag = "change_external_tag"
)

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 LICCancelOrder added in v1.8.12

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

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

func LICCreateOrder added in v1.8.12

func LICCreateOrder(api *token.Api, order *LicenseOrder) (string, error)

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

func LICSubmitOrderJob(api *token.Api, order *LicenseSubOrder) (string, error)

LICSubmitOrderJob 提交续期订单 创建续期任务之后,需要调用该接口,以提交订单任务。注意,提交之后,需要到服务商管理端发起支付,支付完成之后,订单才能生效。 请求方式: 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 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 ActivatedResult added in v1.8.12

type ActivatedResult struct {
	HasMore        int          `json:"has_more"`
	NextCursor     string       `json:"next_cursor"`
	ActiveInfoList []ActiveInfo `json:"account_list"`
}

func LICActivatedAccountList added in v1.8.12

func LICActivatedAccountList(api *token.Api, corpId string, cursor Cursor) (*ActivatedResult, error)

获取企业的帐号列表 最后更新:2023/04/27 查询指定企业下的平台能力服务帐号列表。 若为上下游场景,corpid指定的为上游企业,仅返回上游企业激活的账号;若corpid指定为下游企业,若激活码为上游企业分享过来的且已绑定,也会返回。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/list_actived_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"`
	ShareInfo ShareInfo `json:"share_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 ActiveDetailResult added in v1.8.20

type ActiveDetailResult 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) (*ActiveDetailResult, error)

LICBatchActiveCodeDetail 批量获取激活码详情 批量查询帐号激活码的状态以及激活绑定情况。 请求方式: POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/license/batch_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"` //激活码帐号类型:1:基础帐号,2:互通帐号
	Status     int    `json:"status"`
	Userid     string `json:"userid"` //企业的成员userid。返回加密的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 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"`               //第三方应用ID
	AuthCorpId     string `json:"AuthCorpId" xml:"AuthCorpId"`         //授权企业的CorpID
	UserID         string `json:"UserID" xml:"UserID"`                 //企业服务人员的UserID
	ExternalUserID string `json:"ExternalUserID" xml:"ExternalUserID"` //外部联系人的userid,注意不是企业成员的账号(第三方应用可以根据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 LicenseAccount added in v1.8.17

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

type LicenseAccountListResult added in v1.8.17

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

func LICOrderAccountList added in v1.8.12

func LICOrderAccountList(api *token.Api, orderId string, cursor Cursor) (*LicenseAccountListResult, error)

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

type LicenseBuy added in v1.8.17

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

type LicenseInvalidAccount added in v1.8.17

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

type LicenseOrder added in v1.8.17

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

type LicenseOrderAccountCount added in v1.8.17

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

type LicenseOrderAccountDuration added in v1.8.17

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

type LicenseOrderDetail added in v1.8.17

type LicenseOrderDetail 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    LicenseOrderAccountCount    `json:"account_count"`
	AccountDuration LicenseOrderAccountDuration `json:"account_duration"`
}

func LICGetOrderDetail added in v1.8.12

func LICGetOrderDetail(api *token.Api, orderId string) (*LicenseOrderDetail, error)

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

type LicenseOrderInfo added in v1.8.17

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

type LicenseOrderListResult added in v1.8.17

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

func LICGetOrderList added in v1.8.12

func LICGetOrderList(api *token.Api, cond *LicenseOrderListSearch) (*LicenseOrderListResult, error)

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

type LicenseOrderListSearch added in v1.8.17

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

type LicenseReOrder added in v1.8.17

type LicenseReOrder struct {
	CorpId      string           `json:"corpid"`
	JobId       string           `json:"jobid,omitempty"`
	AccountList []LicenseAccount `json:"account_list"`
}

type LicenseReOrderResult added in v1.8.17

type LicenseReOrderResult struct {
	//任务id,请求包中未指定jobid时,会生成一个新的jobid返回
	JobId string `json:"jobid"`
	//不合法的续期账号列表
	InvalidAccountList []LicenseInvalidAccount `json:"invalid_account_list"`
}

func LICCreateNewOrderJob added in v1.8.12

func LICCreateNewOrderJob(api *token.Api, buyList []LicenseBuy, JobId string) (*LicenseReOrderResult, error)

LICCreateNewOrderJob 创建多企业新购任务

func LICCreateRenewOrderJob added in v1.8.12

func LICCreateRenewOrderJob(api *token.Api, order *LicenseReOrder) (*LicenseReOrderResult, error)

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

type LicenseSubOrder added in v1.8.17

type LicenseSubOrder struct {
	JobId           string                      `json:"jobid"`
	BuyerUserid     string                      `json:"buyer_userid"`
	AccountDuration LicenseOrderAccountDuration `json:"account_duration"`
}

type LicenseUnionOrderResult added in v1.8.17

type LicenseUnionOrderResult struct {
	Order      LicenseOrderDetail `json:"order"`
	HasMore    int                `json:"has_more"`
	NextCursor string             `json:"next_cursor"`
	BuyList    []LicenseBuy       `json:"buy_list"`
}

func LICGetUnionOrder added in v1.8.12

func LICGetUnionOrder(api *token.Api, orderId string, cursor Cursor) (*LicenseUnionOrderResult, error)

LICGetUnionOrder 获取多企业订单详情

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 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 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 ShareInfo added in v1.8.12

type ShareInfo struct {
	ToCorpId   string `json:"to_corpid"`
	FromCorpId string `json:"from_corpid"`
}

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) 分配的激活码帐号数的上限,单次分享激活码不可超过1000个, 不能超过下游企业在上下游通讯录中人数上限的两倍 请求方式: 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 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 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 added in v1.8.16

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