feishu

package
v1.8.101 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Zlib Imports: 10 Imported by: 0

README

飞书开放平台

Documentation

Index

Constants

View Source
const ApiPrefixUrl = "https://open.feishu.cn/open-apis"

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(tk token.Token, d data.D) (access.Token, error)

func GetDepartmentUser

func GetDepartmentUser(api *token.Api)

GetDepartmentUser * * 获取部门成员

func GetDepartmentUserDetail

func GetDepartmentUserDetail(api *token.Api)

GetDepartmentUserDetail * * 获取部门成员详细信息

func GetRootGroups

func GetRootGroups(api *token.Api, page_size int) ([]Group, *Page, error)

GetRootGroups * 获取机器人所在的群列表

func GetService added in v1.0.28

func GetService() token.Service

func GetSubDepartmentList

func GetSubDepartmentList(api *token.Api)

GetSubDepartmentList * * 获取子部门列表

func GetUserGroups

func GetUserGroups(api *token.Api, page_size int) ([]Group, *Page, error)

GetUserGroups *获取用户所在的群列表

func GetUserWithEmailByBatch

func GetUserWithEmailByBatch(api *token.Api, emails ...string) (map[string]User, error)

func GetUserWithMobileByBatch

func GetUserWithMobileByBatch(api *token.Api, mobiles ...string) (map[string]User, error)

GetUserWithMobileByBatch *

  • 根据用户邮箱或手机号查询用户 open_id 和 user_id,支持批量查询。
  • 调用该接口需要申请 通过手机号或者邮箱获取用户ID 权限

func NewToken

func NewToken(app token.App) token.Token

func Notify added in v1.8.4

func Notify(option *config.Options, content interface{}, call FillContentCallback) error

func PutImage

func PutImage(api *token.Api, image Image) (string, error)

PutImage * 图片上传

func RobotToChat

func RobotToChat(api *token.Api, chatId string) error

RobotToChat * * 拉机器人进入群聊

func SendMessage

func SendMessage(api *token.Api, msg *MsgText) (string, error)

SendMessage *

  • 发送消息

Types

type AccessToken

type AccessToken struct {
	Data     string `json:"tenant_access_token"`
	ExpireIn int64  `json:"expire"`
}

func (AccessToken) GetAccessToken

func (a AccessToken) GetAccessToken() access.Value

func (AccessToken) GetRefAccessToken

func (a AccessToken) GetRefAccessToken() access.Value

type ContentImage

type ContentImage struct {
	ImageK string `json:"image_key"`
}

需要上传

type ContentRichText

type ContentRichText struct {
	Post PostRichText `json:"post"`
}

type ContentText

type ContentText struct {
	Text string `json:"text"`
}

type DepartmentInfo

type DepartmentInfo struct {
	Id                     string `json:"id"`
	OpenDepartmentId       string `json:"open_department_id"`
	LeaderEmployeeId       string `json:"leader_employee_id"`
	LeaderOpenId           string `json:"leader_open_id"`
	ChatId                 string `json:"chat_id"`
	MemberCount            int    `json:"member_count"`
	Name                   string `json:"name"`
	ParentId               string `json:"parent_id"`
	ParentOpenDepartmentId string `json:"parent_open_department_id"`
	Status                 int    `json:"status"`
}

func GetDepartmentInfo

func GetDepartmentInfo(api *token.Api, odId string) (*DepartmentInfo, error)

GetDepartmentInfo * * 获取部门信息 * @return

type DepartmentList

type DepartmentList struct {
	AuthedDepartments     []string `json:"authed_departments,omitempty"`
	AuthedOpenDepartments []string `json:"authed_open_departments,omitempty"`
	AuthedEmployeeIds     []string `json:"authed_employee_ids,omitempty"`
	AuthedOpenIds         []string `json:"authed_open_ids,omitempty"`
}

func GetDepartmentList

func GetDepartmentList(api *token.Api) (*DepartmentList, error)

GetDepartmentList * * 获取授权的部门id列表 * @return array

type FillContentCallback added in v1.8.4

type FillContentCallback func(*config.Options, interface{}) string

type Group

type Group struct {
	Avatar      string `json:"avatar"`
	ChatId      string `json:"chat_id"`
	Desc        string `json:"description"`
	Name        string `json:"name"`
	OwnerOpenId string `json:"owner_open_id"`
	OwnerUserId string `json:"owner_user_id"`
}

群信息

func GetRootGroupWithName

func GetRootGroupWithName(api *token.Api, groupName string) (Group, error)

GetRootGroupWithName *

  • 根据群名,获取机器人所在的指定群

func GetUserGroupWithName

func GetUserGroupWithName(api *token.Api, groupName string) (Group, error)

GetUserGroupWithName *

  • 根据群名,获取用户所在的指定群

type Image added in v1.0.34

type Image struct {
	Type     string
	FileName string
}

func (*Image) CreateForm added in v1.0.34

func (img *Image) CreateForm(w *multipart.Writer, field string) error

type MsgHead

type MsgHead struct {
	OpenId  string `json:"open_id,omitempty"`
	RootId  string `json:"root_id,omitempty"`
	ChatId  string `json:"chat_id,omitempty"`
	UserId  string `json:"user_id,omitempty"`
	Email   string `json:"email,omitempty"`
	MsgType string `json:"msg_type"`
}

type MsgImage

type MsgImage struct {
	MsgHead
	Content ContentImage `json:"content"`
}

msg_type="image"

type MsgRichText

type MsgRichText struct {
	MsgHead
	Content ContentRichText `json:"content"`
}

msg_type="image"

type MsgText

type MsgText struct {
	MsgHead
	Content ContentText `json:"content"`
}

msg_type=text

type Page

type Page struct {
	HasMore   bool   `json:"has_more"`
	PageToken string `json:"page_token"`
}

页码信息

type PostRichText

type PostRichText struct {
	Zh PostText `json:"zh_cn"` //中文
	Jp PostText `json:"ja_jp"` //日
	En PostText `json:"en_us"` //英
}

type PostText

type PostText struct {
	Title   string        `json:"title"`
	Content []interface{} `json:"content"`
}

type Response

type Response struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg"`
}

func (Response) ErrorIf added in v1.2.8

func (r Response) ErrorIf() error

func (Response) ReturnIf

func (r Response) ReturnIf(api *token.Api) error

type User

type User struct {
	OpenId string `json:"open_id"`
	UserId string `json:"user_id"`
}

func GetUserWithEmail

func GetUserWithEmail(api *token.Api, email string) (User, error)

GetUserWithEmail

根据邮箱查单一用户

func GetUserWithMobile

func GetUserWithMobile(api *token.Api, mobile string) (User, error)

GetUserWithMobile

根据手机查单一用户

type UserDetail

type UserDetail struct {
	User
	Name             string   `json:"name"`
	NamePy           string   `json:"name_py"`
	NameEn           string   `json:"en_name"`
	EmployeeId       string   `json:"employee_id"`
	EmployeeNo       string   `json:"employee_no"`
	OpenId           string   `json:"open_id"`
	UnionId          string   `json:"union_id"`
	Status           int      `json:"status"`
	EmployeeType     int      `json:"employee_type"`
	Email            string   `json:"email"`
	Mobile           string   `json:"mobile"`
	LeaderEmployeeId string   `json:"leader_employee_id"`
	LeaderOpenId     string   `json:"leader_open_id"`
	LeaderUnionId    string   `json:"leader_union_id"`
	Departments      []string `json:"departments"`
	OpenDepartments  []string `json:"open_departments"`
}

func GetUserDetailByBatch

func GetUserDetailByBatch(api *token.Api, openIds ...string) ([]UserDetail, error)

GetUserDetailByBatch /*批量获取用户信息*/

Jump to

Keyboard shortcuts

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