feishuApi

package
v1.17.45 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Department

type Department struct {
	Name     string `json:"name"`
	I18NName struct {
		ZhCn string `json:"zh_cn"`
		JaJp string `json:"ja_jp"`
		EnUs string `json:"en_us"`
	} `json:"i18n_name"`
	ParentDepartmentId string   `json:"parent_department_id"`
	DepartmentId       string   `json:"department_id"`
	OpenDepartmentId   string   `json:"open_department_id"`
	LeaderUserId       string   `json:"leader_user_id"`
	ChatId             string   `json:"chat_id"`
	Order              string   `json:"order"`
	UnitIds            []string `json:"unit_ids"`
	MemberCount        int      `json:"member_count"`
	Status             struct {
		IsDeleted bool `json:"is_deleted"`
	} `json:"status"`
	CreateGroupChat bool `json:"create_group_chat"`
	Leaders         []struct {
		LeaderType int    `json:"leaderType"`
		LeaderID   string `json:"leaderID"`
	} `json:"leaders"`
	DepartmentHrbps []string `json:"department_hrbps"`
}

type Event

type Event struct {
	Schema string          `json:"schema"`
	Header EventHeader     `json:"header"`
	Event  json.RawMessage `json:"event"`

	Type      string `json:"type"`
	Token     string `json:"token"`
	Challenge string `json:"challenge"`
}

type EventHeader

type EventHeader struct {
	EventID    string `json:"event_id"`
	Token      string `json:"token"`
	CreateTime string `json:"create_time"`
	EventType  string `json:"event_type"`
	TenantKey  string `json:"tenant_key"`
	AppID      string `json:"app_id"`
}

type Fs

type Fs struct {
	Http *tool.Http
	// contains filtered or unexported fields
}

Fs 飞书缩写

func New

func New(ClientID, Secret string, client *http.Client) *Fs

func (Fs) GetTenantAccessToken

func (f Fs) GetTenantAccessToken() (*TenantAccessTokenResp, error)

func (Fs) GetUser

func (f Fs) GetUser(code string) (*FsUser, error)

func (Fs) LoadDepartmentList

func (f Fs) LoadDepartmentList() (*ListDepartmentResp, error)

func (Fs) LoadUserList

func (f Fs) LoadUserList() (map[string][]User, error)

LoadUserList 键名为部门 OpenID,只能挨个部门获取用户列表

func (f Fs) LoginLink(selfDomain, state string) string

type FsUser

type FsUser struct {
	AccessToken      string `json:"access_token"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int64  `json:"expires_in"`
	Name             string `json:"name"`
	AvatarUrl        string `json:"avatar_url"`
	AvatarThumb      string `json:"avatar_thumb"`
	AvatarMiddle     string `json:"avatar_middle"`
	AvatarBig        string `json:"avatar_big"`
	OpenId           string `json:"open_id"`
	UnionId          string `json:"union_id"`
	Email            string `json:"email"`
	EnterpriseEmail  string `json:"enterprise_email"`
	UserId           string `json:"user_id"`
	Mobile           string `json:"mobile"`
	TenantKey        string `json:"tenant_key"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	Sid              string `json:"sid"`
	// contains filtered or unexported fields
}

func (FsUser) Info

func (u FsUser) Info() (*UserInfoResp, error)

type ListDepartmentResp

type ListDepartmentResp struct {
	HasMore   bool         `json:"has_more"`
	PageToken string       `json:"page_token"`
	Items     []Department `json:"items"`
}

type ListUserResp

type ListUserResp struct {
	HasMore   bool   `json:"has_more"`
	PageToken string `json:"page_token"`
	Items     []User `json:"items"`
}

type Resp

type Resp struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type TenantAccessTokenResp

type TenantAccessTokenResp struct {
	Code              int    `json:"code"`
	Msg               string `json:"msg"`
	TenantAccessToken string `json:"tenant_access_token"`
	Expire            int64  `json:"expire"`
}

type TenantToken

type TenantToken struct {
	sync.Mutex
	Token    string
	ExpireAt int64
	// contains filtered or unexported fields
}

func NewTenant

func NewTenant(fs *Fs) *TenantToken

func (*TenantToken) Load

func (t *TenantToken) Load() (string, error)

type User

type User struct {
	UserId string `json:"user_id"`
	Avatar struct {
		Avatar240    string `json:"avatar_240"`
		Avatar640    string `json:"avatar_640"`
		Avatar72     string `json:"avatar_72"`
		AvatarOrigin string `json:"avatar_origin"`
	} `json:"avatar"`
	City        string `json:"city"`
	Country     string `json:"country"`
	CustomAttrs []struct {
		Type  string `json:"type"`
		Id    string `json:"id"`
		Value struct {
			Text        string `json:"text"`
			Url         string `json:"url"`
			PcUrl       string `json:"pc_url"`
			OptionValue string `json:"option_value"`
			Name        string `json:"name"`
			PictureUrl  string `json:"picture_url"`
			GenericUser struct {
				Id   string `json:"id"`
				Type int    `json:"type"`
			} `json:"generic_user"`
		} `json:"value"`
	} `json:"custom_attrs"`
	DepartmentIds   []string `json:"department_ids"`
	Description     string   `json:"description"`
	EmployeeNo      string   `json:"employee_no"`
	EmployeeType    int      `json:"employee_type"`
	EnName          string   `json:"en_name"`
	EnterpriseEmail string   `json:"enterprise_email"`
	Gender          int      `json:"gender"`
	IsTenantManager bool     `json:"is_tenant_manager"`
	JobTitle        string   `json:"job_title"`
	JoinTime        int      `json:"join_time"`
	Email           string   `json:"email"`
	Mobile          string   `json:"mobile"`
	MobileVisible   bool     `json:"mobile_visible"`
	Name            string   `json:"name"`
	OpenId          string   `json:"open_id"`
	Orders          []struct {
		DepartmentId    string `json:"department_id"`
		DepartmentOrder int    `json:"department_order"`
		UserOrder       int    `json:"user_order"`
	} `json:"orders"`
	Status struct {
		IsActivated bool `json:"is_activated"`
		IsExited    bool `json:"is_exited"`
		IsFrozen    bool `json:"is_frozen"`
		IsResigned  bool `json:"is_resigned"`
		IsUnjoin    bool `json:"is_unjoin"`
	} `json:"status"`
	UnionId     string `json:"union_id"`
	WorkStation string `json:"work_station"`
}

type UserDeletedEvent

type UserDeletedEvent struct {
	Object    User `json:"object"`
	OldObject struct {
		DepartmentIds []string `json:"department_ids"`
		OpenId        string   `json:"open_id"`
	} `json:"old_object"`
}

type UserInfoResp

type UserInfoResp struct {
	User User `json:"user"`
}

type UserUpdatedEvent

type UserUpdatedEvent struct {
	Object User `json:"object"`
	// 只有变更字段有值
	OldObject User `json:"old_object"`
}

Jump to

Keyboard shortcuts

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