Documentation
¶
Index ¶
- Constants
- func GetUnionIDByEmail(client client.Client, email string) (string, error)
- func GetUnionIDByMobile(client client.Client, mobile string) (string, error)
- type ListAllResponse
- type ListRequest
- type ListResponse
- type RetrieveRequest
- type RetrieveResponse
- type SearchRequest
- type SearchResponse
- type User
- type UserEntity
- type UserEntityAvatar
- type UserEntityCustomAttr
- type UserEntityOrder
- type UserEntityStatus
Constants ¶
View Source
const ListAPI = "/open-apis/contact/v3/users/find_by_department"
View Source
const RetrieveAPI = "/open-apis/contact/v3/users/:user_id"
View Source
const SearchAPI = "/open-apis/contact/v3/users/batch_get_id"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ListAllResponse ¶
type ListAllResponse struct { // 部门列表 Items []UserEntity `json:"items"` }
type ListRequest ¶
type ListRequest struct { // 部门 ID DepartmentID string `json:"department_id"` // 用户 ID 类型 // 示例值:"user_id" // 可选值:"open_id" "user_id" "union_id" UserIDType string `json:"user_id_type"` // 部门 ID 类型 // 示例值:"open_department_id" // 可选值:"open_department_id" "department_id" DepartmentIDType string `json:"department_id_type"` // 分页大小 PageSize int `json:"page_size"` // 分页标记 // 第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果 PageToken string `json:"page_token"` }
type ListResponse ¶
type ListResponse struct { // 是否有更多选项 HasMore bool `json:"has_more"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token PageToken string `json:"page_token"` // 部门列表 Items []UserEntity `json:"items"` }
func List ¶
func List(client client.Client, cfg *ListRequest) (resp *ListResponse, err error)
type RetrieveRequest ¶
type RetrieveRequest struct { // 用户ID,需要与查询参数中的user_id_type类型保持一致。 UserID string `json:"user_id"` // 用户 ID 类型 // 示例值:"user_id" // 可选值:"open_id" "user_id" "union_id" UserIDType string `json:"user_id_type"` // 部门 ID 类型 // 示例值:"open_department_id" // 可选值:"open_department_id" "department_id" DepartmentIDType string `json:"department_id_type"` }
type RetrieveResponse ¶
type RetrieveResponse struct { // 用户信息 User UserEntity `json:"user"` }
func Retrieve ¶
func Retrieve(client client.Client, cfg *RetrieveRequest) (resp *RetrieveResponse, err error)
type SearchRequest ¶
type SearchResponse ¶
type SearchResponse struct { // 手机号或者邮箱对应的用户id信息 UserList []struct { // 用户id,值为user_id_type所指定的类型。如果查询的手机号、邮箱不存在,或者无权限查看对应的用户,则此项为空 UserId string `json:"user_id"` // 手机号,通过手机号查询时返回 Mobile string `json:"mobile"` // 邮箱,通过邮箱查询时返回 Email string `json:"email"` } `json:"user_list"` }
func Search ¶
func Search(client client.Client, cfg *SearchRequest) (resp *SearchResponse, err error)
type User ¶
type User interface { List(cfg *ListRequest) (resp *ListResponse, err error) Retrieve(cfg *RetrieveRequest) (resp *RetrieveResponse, err error) // ListAll() (users []UserEntity, err error) Search(cfg *SearchRequest) (resp *SearchResponse, err error) GetUnionIDByEmail(email string) (string, error) GetUnionIDByMobile(mobile string) (string, error) }
type UserEntity ¶
type UserEntity struct { // 用户的union_id // 不同ID的说明参见 用户相关的 ID 概念: https://open.feishu.cn/document/home/user-identity-introduction/introduction UnionID string `json:"union_id"` // 租户内用户的唯一标识,用户的user_id // 不同ID的说明参见 用户相关的 ID 概念: https://open.feishu.cn/document/home/user-identity-introduction/introduction UserID string `json:"user_id"` // 用户的open_id // 不同ID的说明参见 用户相关的 ID 概念: https://open.feishu.cn/document/home/user-identity-introduction/introduction OpenID string `json:"open_id"` // 用户名 Name string `json:"name"` // 英文名 EnName string `json:"en_name"` // 昵称 Nickname string `json:"nickname"` // 邮箱 // 注意非 +86 手机号成员必须同时添加邮箱 Email string `json:"email"` // 手机号,在本企业内不可重复;未认证企业仅支持添加中国大陆手机号,通过飞书认证的企业允许添加海外手机号,注意国际电话区号前缀中必须包含加号 + Mobile string `json:"mobile"` // 手机号码可见性,true 为可见,false 为不可见,目前默认为 true。不可见时,组织员工将无法查看该员工的手机号码 MobileVisible bool `json:"mobile_visible"` // 性别 // 可选值:0 为保密,1 为男性,2 为女性 Gender int `json:"gender"` // 用户头像信息 Avatar UserEntityAvatar `json:"avatar"` // 部门状态 Status UserEntityStatus `json:"status"` // 用户所属部门的ID列表,一个用户可属于多个部门。 // ID值与查询参数中的department_id_type 对应 // 不同 ID 的说明参见:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/field-overview#23857fe0 DepartmentIDs []string `json:"department_ids"` // 用户的直接主管的用户ID,ID值与查询参数中的user_id_type 对应 // 不同 ID 的说明参见:https://open.feishu.cn/document/home/user-identity-introduction/introduction LeaderUserID string `json:"leader_user_id"` // 城市 City string `json:"city"` // 国家或地区Code缩写 // 具体写入格式请参考:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/country-code-description Country string `json:"country"` // 工位 WorkStation string `json:"work_station"` // 入职时间 JoinTime int `json:"join_time"` // 是否是租户超级管理员 IsTenantManager bool `json:"is_tenant_manager"` // 工号 EmployeeNo string `json:"employee_no"` // 员工类型 // 可选值 // 1: 正式员工 // 2: 实习生 // 3: 外包 // 4: 劳务 // 5: 顾问 EmployeeType int `json:"employee_type"` // 用户排序信息 Orders []UserEntityOrder `json:"orders"` // 自定义字段,请确保你的组织管理员已在管理后台/组织架构/成员字段管理/自定义字段管理/全局设置中开启了“允许开放平台 API 调用“,否则该字段不会生效/返回 CustomAttrs []UserEntityCustomAttr `json:"custom_attrs"` // 企业邮箱,请先确保已在管理后台启用飞书邮箱服务 EnterpriseEmail string `json:"enterprise_email"` // 职务 JobTitle string `json:"job_title"` // 是否暂停用户 IsFronzen bool `json:"is_fronzen"` }
type UserEntityAvatar ¶
type UserEntityCustomAttr ¶
type UserEntityCustomAttr struct { // 自定义字段类型 // 可选值: // TEXT:文本类型 // HREF:网页 // ENUMERATION:枚举 // PICTURE_ENUM:图片 // GENERIC_USER:用户 Type string `json:"type"` // 自定义字段 ID ID string `json:"id"` // 自定义字段取值 Value struct { // 字段类型为TEXT时该参数定义字段值,必填;字段类型为HREF时该参数定义网页标题,必填 Text string `json:"text"` // 字段类型为 HREF 时,该参数定义默认 URL URL string `json:"url"` // 字段类型为 HREF 时,该参数定义PC端 URL PCURL string `json:"pc_url"` // 字段类型为 ENUMERATION 或 PICTURE_ENUM 时,该参数定义选项值 OptionID string `json:"option_id"` // 选项值 OptionValue string `json:"option_value"` // 名称 Name string `json:"name"` // 图片链接 PictureURL string `json:"picture_url"` // 字段类型为 GENERIC_USER 时,该参数定义引用人员 GenericUser struct { // 引用人员 ID ID string `json:"id"` // 用户类型 1:用户 Type int `json:"type"` } `json:"generic_user"` } `json:"value"` }
type UserEntityOrder ¶
type UserEntityOrder struct { // 排序信息对应的部门ID, ID值与查询参数中的department_id_type 对应 // 不同 ID 的说明参见:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/field-overview DepartmentID string `json:"department_id"` // 用户在其直属部门内的排序,数值越大,排序越靠前 UserOrder int `json:"user_order"` // 用户所属的多个部门间的排序,数值越大,排序越靠前 DepartmentOrder int `json:"department_order"` }
type UserEntityStatus ¶
Click to show internal directories.
Click to hide internal directories.