contact

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr struct {
	Type int    `json:"type"`
	Name string `json:"name"`
	Text *struct {
		Value string `json:"value"`
	} `json:"text,omitempty"`
	Web *struct {
		Url   string `json:"url"`
		Title string `json:"title"`
	} `json:"web,omitempty"`
}

Attr 扩展属性

type BatchCallback

type BatchCallback struct {
	Url            string `json:"url"`
	Token          string `json:"token"`
	EncodingAesKey string `json:"encodingaeskey"`
}

BatchCallback 异步任务回调信息

type BatchResult

type BatchResult struct {
	Status     int               `json:"status"`
	Type       string            `json:"type"`
	Total      int               `json:"total"`
	Percentage int               `json:"percentage"`
	Result     []BatchResultItem `json:"result"`
}

BatchResult 异步任务结果

type BatchResultItem

type BatchResultItem struct {
	Userid  string `json:"userid,omitempty"`
	Action  int    `json:"action"`
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
	PartyId int    `json:"partyid,omitempty"`
}

BatchResultItem 异步任务结果项

type Contact

type Contact struct {
	// contains filtered or unexported fields
}

Contact 通讯录管理

func New

func New(account contracts.AccountInterface, token, aesKey string) *Contact

func (*Contact) Department

func (b *Contact) Department() *Department

Department 通讯录管理-部门管理

func (*Contact) Export

func (b *Contact) Export() *Export

Export 通讯录管理-异步导出

func (*Contact) Import

func (b *Contact) Import() *Import

Import 通讯录管理-异步导入

func (*Contact) Tag

func (b *Contact) Tag() *Tag

Tag 通讯录管理-标签管理

func (*Contact) User

func (b *Contact) User() *User

User 通讯录管理-成员管理

type CreateDepartmentRequest

type CreateDepartmentRequest struct {
	Name     string `json:"name"`
	NameEn   string `json:"name_en,omitempty"`
	Parentid int    `json:"parentid"`
	Order    int    `json:"order,omitempty"`
	Id       int    `json:"id,omitempty"`
}

CreateDepartmentRequest 创建部门请求

type CreateUserRequest

type CreateUserRequest struct {
	Userid           string           `json:"userid"`
	Name             string           `json:"name"`
	Alias            string           `json:"alias,omitempty"`
	Mobile           string           `json:"mobile,omitempty"`
	Department       []int            `json:"department"`
	Order            []int            `json:"order,omitempty"`
	Position         string           `json:"position,omitempty"`
	Gender           string           `json:"gender,omitempty"`
	Email            string           `json:"email,omitempty"`
	BizMail          string           `json:"biz_mail,omitempty"`
	IsLeaderInDept   []int            `json:"is_leader_in_dept,omitempty"`
	DirectLeader     []string         `json:"direct_leader,omitempty"`
	Enable           int              `json:"enable,omitempty"`
	AvatarMediaid    string           `json:"avatar_mediaid,omitempty"`
	Telephone        string           `json:"telephone,omitempty"`
	Address          string           `json:"address,omitempty"`
	MainDepartment   int              `json:"main_department,omitempty"`
	Extattr          *ExtAttr         `json:"extattr,omitempty"`
	ToInvite         *bool            `json:"to_invite,omitempty"`
	ExternalPosition string           `json:"external_position,omitempty"`
	ExternalProfile  *ExternalProfile `json:"external_profile,omitempty"`
}

CreateUserRequest 创建成员请求

type Department

type Department struct {
	// contains filtered or unexported fields
}

Department 部门管理

func NewDepartment

func NewDepartment(account contracts.AccountInterface) *Department

func (*Department) Create

func (d *Department) Create(dept CreateDepartmentRequest) (int, error)

Create 创建部门

func (*Department) Delete

func (d *Department) Delete(id int) error

Delete 删除部门

func (*Department) Get

func (d *Department) Get(id int) (*DepartmentInfo, error)

Get 获取单个部门详情

func (*Department) List

func (d *Department) List(id int) ([]DepartmentInfo, error)

List 获取部门列表

func (*Department) SimpleList

func (d *Department) SimpleList(id int) ([]DepartmentIdInfo, error)

SimpleList 获取子部门ID列表

func (*Department) Update

func (d *Department) Update(dept UpdateDepartmentRequest) error

Update 更新部门

type DepartmentIdInfo

type DepartmentIdInfo struct {
	Id       int `json:"id"`
	Parentid int `json:"parentid"`
	Order    int `json:"order"`
}

DepartmentIdInfo 子部门ID信息

type DepartmentInfo

type DepartmentInfo struct {
	Id               int      `json:"id"`
	Name             string   `json:"name"`
	NameEn           string   `json:"name_en"`
	DepartmentLeader []string `json:"department_leader"`
	Parentid         int      `json:"parentid"`
	Order            int      `json:"order"`
}

DepartmentInfo 部门信息

type Export

type Export struct {
	// contains filtered or unexported fields
}

Export 异步导出

func NewExport

func NewExport(account contracts.AccountInterface, token, aesKey string) *Export

func (*Export) Department

func (e *Export) Department(blockSize int) (string, error)

Department 导出部门

func (*Export) GetResult

func (e *Export) GetResult(jobId string) (*ExportResult, error)

GetResult 获取导出结果

func (*Export) SimpleUser

func (e *Export) SimpleUser(blockSize int) (string, error)

SimpleUser 导出成员

func (*Export) TagUser

func (e *Export) TagUser(blockSize int, tagId int) (string, error)

TagUser 导出标签成员

func (*Export) User

func (e *Export) User(blockSize int) (string, error)

User 导出成员详情

type ExportDataItem

type ExportDataItem struct {
	Url  string `json:"url"`
	Size int    `json:"size"`
	Md5  string `json:"md5"`
}

ExportDataItem 导出文件项

type ExportResult

type ExportResult struct {
	Status   int              `json:"status"`
	DataList []ExportDataItem `json:"data_list"`
}

ExportResult 导出结果

type ExtAttr

type ExtAttr struct {
	Attrs []Attr `json:"attrs"`
}

ExtAttr 扩展属性集合

type ExternalProfile

type ExternalProfile struct {
	ExternalCorpName string `json:"external_corp_name,omitempty"`
	WechatChannels   *struct {
		Nickname string `json:"nickname"`
	} `json:"wechat_channels,omitempty"`
	ExternalAttr []Attr `json:"external_attr,omitempty"`
}

ExternalProfile 对外职务信息

type Import

type Import struct {
	// contains filtered or unexported fields
}

Import 异步导入

func NewImport

func NewImport(account contracts.AccountInterface) *Import

func (*Import) GetResult

func (i *Import) GetResult(jobId string) (*BatchResult, error)

GetResult 获取异步任务结果

func (*Import) ReplaceParty

func (i *Import) ReplaceParty(mediaId string, callback *BatchCallback) (string, error)

ReplaceParty 全量覆盖部门

func (*Import) ReplaceUser

func (i *Import) ReplaceUser(mediaId string, toInvite bool, callback *BatchCallback) (string, error)

ReplaceUser 全量覆盖成员

func (*Import) SyncUser

func (i *Import) SyncUser(mediaId string, toInvite bool, callback *BatchCallback) (string, error)

SyncUser 增量更新成员

type InviteResult

type InviteResult struct {
	InvalidUser  []string `json:"invaliduser"`
	InvalidParty []int    `json:"invalidparty"`
	InvalidTag   []int    `json:"invalidtag"`
}

InviteResult 邀请成员结果

type SimpleUser

type SimpleUser struct {
	Userid     string `json:"userid"`
	Name       string `json:"name"`
	Department []int  `json:"department"`
	OpenUserid string `json:"open_userid"`
}

SimpleUser 部门成员简要信息

type Tag

type Tag struct {
	// contains filtered or unexported fields
}

Tag 标签管理

func NewTag

func NewTag(account contracts.AccountInterface) *Tag

func (*Tag) AddTagUsers

func (t *Tag) AddTagUsers(tagId int, userList []string, partyList []int) (*TagMemberResult, error)

AddTagUsers 增加标签成员

func (*Tag) Create

func (t *Tag) Create(tagName string, tagId int) (int, error)

Create 创建标签

func (*Tag) DelTagUsers

func (t *Tag) DelTagUsers(tagId int, userList []string, partyList []int) (*TagMemberResult, error)

DelTagUsers 删除标签成员

func (*Tag) Delete

func (t *Tag) Delete(tagId int) error

Delete 删除标签

func (*Tag) Get

func (t *Tag) Get(tagId int) (*TagDetail, error)

Get 获取标签成员

func (*Tag) List

func (t *Tag) List() ([]TagInfo, error)

List 获取标签列表

func (*Tag) Update

func (t *Tag) Update(tagId int, tagName string) error

Update 更新标签名字

type TagDetail

type TagDetail struct {
	TagName   string        `json:"tagname"`
	UserList  []TagUserInfo `json:"userlist"`
	PartyList []int         `json:"partylist"`
}

TagDetail 标签详情(含成员列表)

type TagInfo

type TagInfo struct {
	TagId   int    `json:"tagid"`
	TagName string `json:"tagname"`
}

TagInfo 标签信息

type TagMemberResult

type TagMemberResult struct {
	InvalidList  string `json:"invalidlist"`
	InvalidParty []int  `json:"invalidparty"`
}

TagMemberResult 标签成员操作结果

type TagUserInfo

type TagUserInfo struct {
	Userid string `json:"userid"`
	Name   string `json:"name"`
}

TagUserInfo 标签成员信息

type UpdateDepartmentRequest

type UpdateDepartmentRequest 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"`
}

UpdateDepartmentRequest 更新部门请求

type UpdateUserRequest

type UpdateUserRequest struct {
	Userid           string           `json:"userid"`
	Name             string           `json:"name,omitempty"`
	Alias            string           `json:"alias,omitempty"`
	Mobile           string           `json:"mobile,omitempty"`
	Department       []int            `json:"department,omitempty"`
	Order            []int            `json:"order,omitempty"`
	Position         string           `json:"position,omitempty"`
	Gender           string           `json:"gender,omitempty"`
	Email            string           `json:"email,omitempty"`
	BizMail          string           `json:"biz_mail,omitempty"`
	IsLeaderInDept   []int            `json:"is_leader_in_dept,omitempty"`
	DirectLeader     []string         `json:"direct_leader,omitempty"`
	Enable           int              `json:"enable,omitempty"`
	AvatarMediaid    string           `json:"avatar_mediaid,omitempty"`
	Telephone        string           `json:"telephone,omitempty"`
	Address          string           `json:"address,omitempty"`
	MainDepartment   int              `json:"main_department,omitempty"`
	Extattr          *ExtAttr         `json:"extattr,omitempty"`
	ExternalPosition string           `json:"external_position,omitempty"`
	ExternalProfile  *ExternalProfile `json:"external_profile,omitempty"`
}

UpdateUserRequest 更新成员请求

type User

type User struct {
	// contains filtered or unexported fields
}

User 通讯录成员管理

func NewUser

func NewUser(account contracts.AccountInterface) *User

func (*User) BatchDelete

func (u *User) BatchDelete(useridList []string) error

BatchDelete 批量删除成员

func (*User) ConvertToOpenid

func (u *User) ConvertToOpenid(userid string) (string, error)

ConvertToOpenid userid转openid

func (*User) ConvertToUserid

func (u *User) ConvertToUserid(openid string) (string, error)

ConvertToUserid openid转userid

func (*User) Create

func (u *User) Create(user CreateUserRequest) error

Create 创建成员

func (*User) Delete

func (u *User) Delete(userid string) error

Delete 删除成员

func (*User) DetailList

func (u *User) DetailList(departmentId int) ([]UserInfo, error)

DetailList 获取部门成员详情

func (*User) Get

func (u *User) Get(userid string) (*UserInfo, error)

Get 读取成员

func (*User) GetUseridByEmail

func (u *User) GetUseridByEmail(email string, emailType int) (string, error)

GetUseridByEmail 邮箱获取userid

func (*User) GetUseridByMobile

func (u *User) GetUseridByMobile(mobile string) (string, error)

GetUseridByMobile 手机号获取userid

func (*User) Invite

func (u *User) Invite(userIds []string, partyIds []int, tagIds []int) (*InviteResult, error)

Invite 邀请成员

func (*User) ListId

func (u *User) ListId(cursor string, limit int) (*UserIdList, error)

ListId 获取成员ID列表

func (*User) SimpleList

func (u *User) SimpleList(departmentId int) ([]SimpleUser, error)

SimpleList 获取部门成员

func (*User) Update

func (u *User) Update(user UpdateUserRequest) error

Update 更新成员

type UserIdItem

type UserIdItem struct {
	Userid     string `json:"userid"`
	Department int    `json:"department"`
}

UserIdItem 成员ID项

type UserIdList

type UserIdList struct {
	NextCursor string       `json:"next_cursor"`
	DeptUser   []UserIdItem `json:"dept_user"`
}

UserIdList 成员ID列表

type UserInfo

type UserInfo struct {
	Userid           string           `json:"userid"`
	Name             string           `json:"name"`
	Alias            string           `json:"alias"`
	Mobile           string           `json:"mobile"`
	Department       []int            `json:"department"`
	Order            []int            `json:"order"`
	Position         string           `json:"position"`
	Gender           string           `json:"gender"`
	Email            string           `json:"email"`
	BizMail          string           `json:"biz_mail"`
	IsLeaderInDept   []int            `json:"is_leader_in_dept"`
	DirectLeader     []string         `json:"direct_leader"`
	Avatar           string           `json:"avatar"`
	ThumbAvatar      string           `json:"thumb_avatar"`
	Telephone        string           `json:"telephone"`
	Address          string           `json:"address"`
	OpenUserid       string           `json:"open_userid"`
	MainDepartment   int              `json:"main_department"`
	Extattr          ExtAttr          `json:"extattr"`
	Status           int              `json:"status"`
	QrCode           string           `json:"qr_code"`
	ExternalPosition string           `json:"external_position"`
	ExternalProfile  *ExternalProfile `json:"external_profile"`
}

UserInfo 成员详细信息

Jump to

Keyboard shortcuts

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