department

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ListAPI = "/open-apis/contact/v3/departments/:department_id/children"
View Source
const RetrieveAPI = "/open-apis/contact/v3/departments/:department_id"

Variables

This section is empty.

Functions

This section is empty.

Types

type Department

type Department interface {
	List(cfg *ListRequest) (resp *ListResponse, err error)
	Retrieve(cfg *RetrieveRequest) (resp *RetrieveResponse, err error)

	//
	ListAll() (resp *ListAllResponse, err error)
}

func New

func New(c client.Client) Department

type DepartmentEntity

type DepartmentEntity struct {
	// 部门名称
	Name string `json:"name"`

	// 国际化的部门名称
	I18nName struct {
		ZhCN string `json:"zh_cn"`
		EnUS string `json:"en_us"`
		JaJP string `json:"ja_jp"`
	} `json:"i18n_name"`

	// 父部门的ID
	ParentDepartmentID string `json:"parent_department_id"`

	// 本部门的自定义部门ID
	DeparntmentID string `json:"department_id"`

	// 部门的open_id
	OpenDepartmentID string `json:"open_department_id"`

	// 部门主管用户ID
	LeaderUserID string `json:"leader_user_id"`

	// 部门群ID
	ChatID string `json:"chat_id"`

	// 部门的排序,即部门在其同级部门的展示顺序
	Order string `json:"order"`

	// 部门单位自定义ID列表,当前只支持一个
	UnitIDS []string `json:"unit_ids"`

	// 部门下用户的个数
	MemberCount int `json:"member_count"`

	// 部门状态
	Status DepartmentEntityStatus `json:"status"`

	// 是否创建部门群,默认不创建
	CreateGroupChat bool `json:"create_group_chat"`
}

type DepartmentEntityStatus

type DepartmentEntityStatus struct {
	// 是否被删除
	IsDeleted bool `json:"is_deleted"`
}

type ListAllResponse

type ListAllResponse struct {
	// 部门列表
	Items []DepartmentEntity `json:"items"`
}

func ListAll

func ListAll(client client.Client) (resp *ListAllResponse, err error)

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

	// 是否递归获取子部门
	// 示例值:false
	FetchChild bool `json:"fetch_child"`

	// 分页大小
	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 []DepartmentEntity `json:"items"`
}

func List

func List(client client.Client, cfg *ListRequest) (resp *ListResponse, err error)

type RetrieveRequest

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

type RetrieveResponse

type RetrieveResponse struct {
	// 部门信息
	Department DepartmentEntity `json:"department"`
}

func Retrieve

func Retrieve(client client.Client, cfg *RetrieveRequest) (resp *RetrieveResponse, err error)

Jump to

Keyboard shortcuts

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