Documentation ¶
Index ¶
- Constants
- type AddTagUserReq
- type AddTagUserResp
- type BatchDeleteUserReq
- type ContactManager
- func (manager *ContactManager) AddTagUser(req AddTagUserReq) (*AddTagUserResp, error)
- func (manager *ContactManager) BatchDeleteUser(req BatchDeleteUserReq) (*commons.CommonError, error)
- func (manager *ContactManager) CreateDepartment(department CreateDepartmentReq) (*CreateDepartmentResp, error)
- func (manager *ContactManager) CreateTag(req CreateTagReq) (*CreateTagResp, error)
- func (manager *ContactManager) CreateUser(user CreateUserReq) (*commons.CommonError, error)
- func (manager *ContactManager) DelTagUser(req DelTagUserReq) (*DelTagUserResp, error)
- func (manager *ContactManager) DeleteDepartment(departmentID int) (*commons.CommonError, error)
- func (manager *ContactManager) DeleteTag(tagid int) (*commons.CommonError, error)
- func (manager *ContactManager) DeleteUser(userID string) (*commons.CommonError, error)
- func (manager *ContactManager) GetActiveStat(date string) (*GetActiveStatResp, error)
- func (manager *ContactManager) GetDepartmentList(deparmentid int) (*GetDepartmentListResp, error)
- func (manager *ContactManager) GetDepartmentUser(departmentID string, fetchChild int) (*GetDepartmentUserResp, error)
- func (manager *ContactManager) GetDepartmentUserDetail(departmentID string, fetchChild int) (*GetDepartmentUserDetailResp, error)
- func (manager *ContactManager) GetJoinQrcode(sizeType int) (*GetJoinQrcodeResp, error)
- func (manager *ContactManager) GetTagList() (*GetTagListResp, error)
- func (manager *ContactManager) GetTagUser(tagid int) (*GetTagUserResp, error)
- func (manager *ContactManager) GetUser(userID string) (*GetUserResp, error)
- func (manager *ContactManager) InviteUser(req InviteUserReq) (*InviteUserResp, error)
- func (manager *ContactManager) UpdateDepartment(department UpdateDepartmentReq) (*commons.CommonError, error)
- func (manager *ContactManager) UpdateTag(req UpdateTagReq) (*commons.CommonError, error)
- func (manager *ContactManager) UpdateUser(user UpdateUserReq) (*commons.CommonError, error)
- type CreateDepartmentReq
- type CreateDepartmentResp
- type CreateTagReq
- type CreateTagResp
- type CreateUserReq
- type DelTagUserReq
- type DelTagUserResp
- type Department
- type DepartmentUser
- type GetActiveStatResp
- type GetDepartmentListResp
- type GetDepartmentUserDetailResp
- type GetDepartmentUserResp
- type GetJoinQrcodeResp
- type GetTagListResp
- type GetTagUserResp
- type GetUserResp
- type InviteUserReq
- type InviteUserResp
- type UpdateDepartmentReq
- type UpdateTagReq
- type UpdateUserReq
- type UserDetail
Constants ¶
const ( GetDepartmentListURL = "https://qyapi.weixin.qq.com/cgi-bin/department/list" CreateDepartmentURL = "https://qyapi.weixin.qq.com/cgi-bin/department/create" UpdateDepartmentURL = "https://qyapi.weixin.qq.com/cgi-bin/department/update" DeleteDepartmentURL = "https://qyapi.weixin.qq.com/cgi-bin/department/delete" )
const ( // 标签URL CreateTagURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/create" UpdateTagURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/update" DeleteTagURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/delete" GetTagUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/get" AddTagUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers" DelTagUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/deltagusers" GetTagListURL string = "https://qyapi.weixin.qq.com/cgi-bin/tag/list" )
const ( // 创建成员URL CreateUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/create" UpdateUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/update" DeleteUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/delete" GetUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/get" BatchDeleteUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/batchdelete" GetDepartmentUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist" GetDepartmentUserDetailURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/list" InviteUserURL string = "https://qyapi.weixin.qq.com/cgi-bin/batch/invite" GetJoinQrcodeURL string = "https://qyapi.weixin.qq.com/cgi-bin/corp/get_join_qrcode" GetActiveStatURL string = "https://qyapi.weixin.qq.com/cgi-bin/user/get_active_stat" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddTagUserReq ¶
type AddTagUserReq struct { TagID int `json:"tagid"` UserList []string `json:"userlist,omitempty"` PartyList []int `json:"partylist,omitempty"` }
AddTagUserReq 创建标签用户请求
type AddTagUserResp ¶
type AddTagUserResp struct { commons.CommonError InvalidList []string `json:"invalidlist,omitempty"` // 非法的成员帐号列表 InvaildParty []int `json:"invalidparty,omitempty"` // 非法的部门id列表 }
AddTagUserReq 创建标签用户响应
type BatchDeleteUserReq ¶
type BatchDeleteUserReq struct {
UserIDList []string `json:"useridlist"`
}
BatchDeleteUserReq 批量删除成员请求
type ContactManager ¶
type ContactManager struct {
// contains filtered or unexported fields
}
ContactManager 通讯录管理服务
func NewContactManager ¶
func NewContactManager(corpid string, agentid string, secret string, tokenStore *tokens.AccessTokenStore) *ContactManager
NewContactManager 返回一个manager的实例
func (*ContactManager) AddTagUser ¶
func (manager *ContactManager) AddTagUser(req AddTagUserReq) (*AddTagUserResp, error)
AddTagUser 增加标签成员 https://work.weixin.qq.com/api/doc/90000/90135/90214
func (*ContactManager) BatchDeleteUser ¶
func (manager *ContactManager) BatchDeleteUser(req BatchDeleteUserReq) (*commons.CommonError, error)
BatchDeleteUser 删除成员 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90199
func (*ContactManager) CreateDepartment ¶
func (manager *ContactManager) CreateDepartment(department CreateDepartmentReq) (*CreateDepartmentResp, error)
CreateDepartment 创建部门 参考https://open.work.weixin.qq.com/api/doc/90000/90135/90205
func (*ContactManager) CreateTag ¶
func (manager *ContactManager) CreateTag(req CreateTagReq) (*CreateTagResp, error)
CreateTag 创建标签 https://work.weixin.qq.com/api/doc/90000/90135/90210
func (*ContactManager) CreateUser ¶
func (manager *ContactManager) CreateUser(user CreateUserReq) (*commons.CommonError, error)
CreateUser 创建成员 参考https://open.work.weixin.qq.com/api/doc/90000/90135/90195
func (*ContactManager) DelTagUser ¶
func (manager *ContactManager) DelTagUser(req DelTagUserReq) (*DelTagUserResp, error)
DelTagUser 删除标签成员 https://work.weixin.qq.com/api/doc/90000/90135/90215
func (*ContactManager) DeleteDepartment ¶
func (manager *ContactManager) DeleteDepartment(departmentID int) (*commons.CommonError, error)
DeleteDepartment 删除部门,注意,(不能删除根部门,不能删除含有子部门、成员的部门) 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90207
func (*ContactManager) DeleteTag ¶
func (manager *ContactManager) DeleteTag(tagid int) (*commons.CommonError, error)
DeleteTag 删除标签 https://work.weixin.qq.com/api/doc/90000/90135/90212
func (*ContactManager) DeleteUser ¶
func (manager *ContactManager) DeleteUser(userID string) (*commons.CommonError, error)
DeleteUser 删除成员 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90198
func (*ContactManager) GetActiveStat ¶
func (manager *ContactManager) GetActiveStat(date string) (*GetActiveStatResp, error)
GetActiveStat 获取企业活跃成员数,date具体某天的活跃人数,最长支持获取30天前数据 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/92714
func (*ContactManager) GetDepartmentList ¶
func (manager *ContactManager) GetDepartmentList(deparmentid int) (*GetDepartmentListResp, error)
GetDepartmentList 获取部门列表 参考https://open.work.weixin.qq.com/api/doc/90000/90135/90208
func (*ContactManager) GetDepartmentUser ¶
func (manager *ContactManager) GetDepartmentUser(departmentID string, fetchChild int) (*GetDepartmentUserResp, error)
GetDepartmentUser 获取部门成员,department_id,获取的部门id,必填。fetch_child,是否递归获取子部门下面的成员:1-递归获取,0-只获取本部门 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90200
func (*ContactManager) GetDepartmentUserDetail ¶
func (manager *ContactManager) GetDepartmentUserDetail(departmentID string, fetchChild int) (*GetDepartmentUserDetailResp, error)
GetDepartmentUserDetail 获取部门成员详情,department_id,获取的部门id,必填。fetch_child,是否递归获取子部门下面的成员:1-递归获取,0-只获取本部门 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90200
func (*ContactManager) GetJoinQrcode ¶
func (manager *ContactManager) GetJoinQrcode(sizeType int) (*GetJoinQrcodeResp, error)
GetJoinQrcode 获取加入企业二维码, 二维码类型size_type,qrcode尺寸类型,1: 171 x 171; 2: 399 x 399; 3: 741 x 741; 4: 2052 x 2052 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/91714
func (*ContactManager) GetTagList ¶
func (manager *ContactManager) GetTagList() (*GetTagListResp, error)
GetTagList 获取标签列表 https://work.weixin.qq.com/api/doc/90000/90135/90216
func (*ContactManager) GetTagUser ¶
func (manager *ContactManager) GetTagUser(tagid int) (*GetTagUserResp, error)
GetTagUser 获取标签成员 https://work.weixin.qq.com/api/doc/90000/90135/90213
func (*ContactManager) GetUser ¶
func (manager *ContactManager) GetUser(userID string) (*GetUserResp, error)
GetUser 获取成员 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90196
func (*ContactManager) InviteUser ¶
func (manager *ContactManager) InviteUser(req InviteUserReq) (*InviteUserResp, error)
InviteUser 邀请成员 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90975
func (*ContactManager) UpdateDepartment ¶
func (manager *ContactManager) UpdateDepartment(department UpdateDepartmentReq) (*commons.CommonError, error)
UpdateDepartment 更新部门 参考https://open.work.weixin.qq.com/api/doc/90000/90135/90206
func (*ContactManager) UpdateTag ¶
func (manager *ContactManager) UpdateTag(req UpdateTagReq) (*commons.CommonError, error)
UpdateTag 更改标签名称 https://work.weixin.qq.com/api/doc/90000/90135/90211
func (*ContactManager) UpdateUser ¶
func (manager *ContactManager) UpdateUser(user UpdateUserReq) (*commons.CommonError, error)
UpdateUser 更新成员 参考https://open.work.weixin.qq.com/api/doc/90000/90135/90197
type CreateDepartmentReq ¶
type CreateDepartmentReq struct { ID int `json:"id,omitempty" ` Name string `json:"name"` NameEN string `json:"name_en,omitempty"` ParentID int `json:"parentid"` Order int `json:"order,omitempty"` }
CreateDepartmentReq 创建部门请求参数
type CreateDepartmentResp ¶
type CreateDepartmentResp struct { commons.CommonError ID int `json:"id"` // 返回部件创建的ID }
CreateDepartmentResp 创建部门响应
type CreateTagReq ¶
CreateTagReq 创建标签请求
type CreateTagResp ¶
type CreateTagResp struct { commons.CommonError TagID int `json:"tagid"` }
CreateTagResp 创建标签响应
type CreateUserReq ¶
type CreateUserReq struct { UserID string `json:"userid"` // 成员UserID Name string `json:"name"` // 成员名称 Alias string `json:"alias,omitempty"` // 成员别名 Mobile string `json:"mobile"` // 手机号码。企业内必须唯一,mobile/email二者不能同时为空 Department []int `json:"department"` // 成员所属部门id列表,不超过100个 Order []int `json:"order,omitempty"` // 部门内的排序值,默认为0,成员次序以创建时间从小到大排列。个数必须和参数department的个数一致,数值越大排序越前面。有效的值范围是[0, 2^32) Position string `json:"position,omitempty"` // 职务信息。长度为0~128个字符 Gender int `json:"gender,omitempty"` // 性别。1表示男性,2表示女性 Email string `json:"email"` // 邮箱。长度6~64个字节,且为有效的email格式。企业内必须唯一,mobile/email二者不能同时为空 Telephone string `json:"telephone,omitempty"` // 座机。32字节以内,由纯数字或’-‘号组成。 IsLeaderInDept []int `json:"is_leader_in_dept,omitempty"` // 个数必须和参数department的个数一致,表示在所在的部门内是否为上级。1表示为上级,0表示非上级。在审批等应用里可以用来标识上级审批人 AvatarMediaID string `json:"avatar_mediaid,omitempty"` // 成员头像的mediaid,通过素材管理接口上传图片获得的mediaid Enable int `json:"enable,omitempty"` // 启用/禁用成员。1表示启用成员,0表示禁用成员 ExternalPosition string `json:"external_position,omitempty"` // 对外职务,如果设置了该值,则以此作为对外展示的职务,否则以position来展示。长度12个汉字内 Address string `json:"address,omitempty"` // 地址。长度最大128个字符 MainDepartment int `json:"main_department,omitempty"` // 主部门 ToInvite bool `json:"to_invite,omitempty"` // 是否邀请该成员使用企业微信(将通过微信服务通知或短信或邮件下发邀请,每天自动下发一次,最多持续3个工作日),默认值为true。 }
CreateUserReq 创建成员请求,目前没有添加扩展属性
type DelTagUserReq ¶
type DelTagUserReq struct { TagID int `json:"tagid"` UserList []string `json:"userlist,omitempty"` PartyList []int `json:"partylist,omitempty"` }
DelTagUserReq 删除标签用户请求
type DelTagUserResp ¶
type DelTagUserResp struct { commons.CommonError InvalidList []string `json:"invalidlist,omitempty"` // 非法的成员帐号列表 InvaildParty []int `json:"invalidparty,omitempty"` // 非法的部门id列表 }
DelTagUserResp 删除标签用户响应
type Department ¶
type Department struct { ID int `json:"id" ` Name string `json:"name"` NameEN string `json:"name_en"` ParentID int `json:"parentid"` Order int `json:"order"` }
Department 部门结构
type DepartmentUser ¶
type DepartmentUser struct { UserID string `json:"userid"` Name string `json:"name"` Department []int `json:"department"` OpenUserID string `json:"open_userid"` }
DepartmentUser 部门成员细项
type GetActiveStatResp ¶
type GetActiveStatResp struct { commons.CommonError ActiveCount int `json:"active_cnt"` // 活跃成员数 }
GetActiveStatResp 获取企业活跃成员数响应
type GetDepartmentListResp ¶
type GetDepartmentListResp struct { commons.CommonError Departments []Department `json:"department"` }
GetDepartmentListResp 部门列表响应
type GetDepartmentUserDetailResp ¶
type GetDepartmentUserDetailResp struct { commons.CommonError UserList []UserDetail `json:"userlist"` }
GetDepartmentUserDetailResp 获取部门成员详情响应
type GetDepartmentUserResp ¶
type GetDepartmentUserResp struct { commons.CommonError UserList []DepartmentUser `json:"userlist"` }
GetDepartmentUserResp 获取部门成员响应
type GetJoinQrcodeResp ¶
type GetJoinQrcodeResp struct { commons.CommonError JoinQrcode string `json:"join_qrcode"` // 二维码链接,有效期7天 }
GetJoinQrcodeResp 获取加入企业二维码响应
type GetTagListResp ¶
type GetTagListResp struct { commons.CommonError TagList []struct { TagID int `jsong:"tagid"` TagName string `jsong:"tagname"` } `json:"taglist"` }
GetTagListResp 获取标签列表响应
type GetTagUserResp ¶
type GetTagUserResp struct { commons.CommonError TagName string `json:"tagname"` UserList []struct { UserID string `json:"userid"` Name string `json:"name"` } `json:"userlist"` PartyList []int `json:"partylist"` // 标签中包含的部门ID列表 }
GetTagUserResp 获取标签成员响应
type InviteUserReq ¶
type InviteUserReq struct { User []string `json:"user"` // 成员ID列表, 最多支持1000个。 Party []int `json:"party"` // 部门ID列表,最多支持100个。 Tag []int `json:"tag"` // 标签ID列表,最多支持100个。 }
InviteUserReq 邀请成员请求
type InviteUserResp ¶
type InviteUserResp struct { commons.CommonError InvaildUser []string `json:"invaliduser"` // 非法成员列表 InvaildParty []int `json:"invalidparty"` // 非法部门列表 InvaildTag []int `json:"invalidtag"` // 非法标签列表 }
InviteUserResp 邀请成员响应
type UpdateDepartmentReq ¶
type UpdateDepartmentReq struct { ID int `json:"id" ` Name string `json:"name,omitempty"` NameEN string `json:"name_en,omitempty"` ParentID int `json:"parentid,omitempty"` Order int `json:"order,omitempty"` }
UpdateDepartmentReq 更新部门请求参数
type UpdateTagReq ¶
UpdateTagReq 更改标签名称请求
type UpdateUserReq ¶
type UpdateUserReq struct { UserID string `json:"userid"` // 成员UserID Name string `json:"name,omitempty"` // 成员名称 Alias string `json:"alias,omitempty"` // 成员别名 Mobile string `json:"mobile,omitempty"` // 手机号码。企业内必须唯一,mobile/email二者不能同时为空 Department []int `json:"department,omitempty"` // 成员所属部门id列表,不超过100个 Order []int `json:"order,omitempty"` // 部门内的排序值,默认为0,成员次序以创建时间从小到大排列。个数必须和参数department的个数一致,数值越大排序越前面。有效的值范围是[0, 2^32) Position string `json:"position,omitempty"` // 职务信息。长度为0~128个字符 Gender int `json:"gender,omitempty"` // 性别。1表示男性,2表示女性 Email string `json:"email,omitempty"` // 邮箱。长度6~64个字节,且为有效的email格式。企业内必须唯一,mobile/email二者不能同时为空 Telephone string `json:"telephone,omitempty"` // 座机。32字节以内,由纯数字或’-‘号组成。 IsLeaderInDept []int `json:"is_leader_in_dept,omitempty"` // 个数必须和参数department的个数一致,表示在所在的部门内是否为上级。1表示为上级,0表示非上级。在审批等应用里可以用来标识上级审批人 AvatarMediaID string `json:"avatar_mediaid,omitempty"` // 成员头像的mediaid,通过素材管理接口上传图片获得的mediaid Enable int `json:"enable,omitempty"` // 启用/禁用成员。1表示启用成员,0表示禁用成员 ExternalPosition string `json:"external_position,omitempty"` // 对外职务,如果设置了该值,则以此作为对外展示的职务,否则以position来展示。长度12个汉字内 Address string `json:"address,omitempty"` // 地址。长度最大128个字符 MainDepartment int `json:"main_department,omitempty"` // 主部门 ToInvite bool `json:"to_invite,omitempty"` // 是否邀请该成员使用企业微信(将通过微信服务通知或短信或邮件下发邀请,每天自动下发一次,最多持续3个工作日),默认值为true。 }
UpdateUserReq 创建成员请求,目前没有添加扩展属性
type UserDetail ¶
type UserDetail struct { UserID string `json:"userid"` // 成员UserID Name string `json:"name,omitempty"` // 成员名称 Alias string `json:"alias,omitempty"` // 成员别名 Mobile string `json:"mobile,omitempty"` // 手机号码。企业内必须唯一,mobile/email二者不能同时为空 Department []int `json:"department,omitempty"` // 成员所属部门id列表,不超过100个 Order []int `json:"order,omitempty"` // 部门内的排序值,默认为0,成员次序以创建时间从小到大排列。个数必须和参数department的个数一致,数值越大排序越前面。有效的值范围是[0, 2^32) Position string `json:"position,omitempty"` // 职务信息。长度为0~128个字符 Gender string `json:"gender,omitempty"` // 性别。0表示未定义,1表示男性,2表示女性 Email string `json:"email,omitempty"` // 邮箱。长度6~64个字节,且为有效的email格式。企业内必须唯一,mobile/email二者不能同时为空 Telephone string `json:"telephone,omitempty"` // 座机。32字节以内,由纯数字或’-‘号组成。 IsLeaderInDept []int `json:"is_leader_in_dept,omitempty"` // 个数必须和参数department的个数一致,表示在所在的部门内是否为上级。1表示为上级,0表示非上级。在审批等应用里可以用来标识上级审批人 Avatar string `json:"avatar,omitempty"` // 头像url。 第三方仅通讯录应用可获取;对于非第三方创建的成员,第三方通讯录应用也不可获取 ThumbAvatar string `json:"thumb_avatar,omitempty"` // 头像缩略图url。第三方仅通讯录应用可获取;对于非第三方创建的成员,第三方通讯录应用也不可获取 Enable int `json:"enable,omitempty"` // 启用/禁用成员。1表示启用成员,0表示禁用成员 ExternalPosition string `json:"external_position,omitempty"` // 对外职务,如果设置了该值,则以此作为对外展示的职务,否则以position来展示。长度12个汉字内 Address string `json:"address,omitempty"` // 地址。长度最大128个字符 MainDepartment int `json:"main_department,omitempty"` // 主部门 Status int `json:"status"` // 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业。 QrCode string `json:"qr_code,omitempty"` // 员工个人二维码,扫描可添加为外部联系人 OpenUserID string `json:"open_userid,omitempty"` // 全局唯一。对于同一个服务商,不同应用获取到企业内同一个成员的open_userid是相同的,最多64个字节。仅第三方应用可获取 }
User 成员结构