lark_sdk

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 29 Imported by: 0

README

A lark-sdk

GORPOXY=https://gpproxy.cn

how to commit a issue if bug?

how to commit a pr?

api list

user

  • GetUserByUserId
  • GetEmpByUserId
  • ListUserByDeptId
  • AllEmp
  • AllUserId

dept

  • GetDeptById
  • ListChildDeptByDeptId
  • ListChildDeptIdByDeptId
  • AllDept

approval

  • SubscribeApproval

  • GetApprovalByCode

  • ListApprovalInstIdByCode

  • GetApprovalInstById

  • CreateApprovalInst

  • GetAttachment

Message

  • SendMessage
  • SendCard

TODO list

approval url

https://applink.feishu.cn/client/mini_program/open?appId=cli_9cb844403dbb9108&mode=appCenter&path=pc/pages/in-process/index?instanceId=xxx

Documentation

Index

Constants

View Source
const (
	User         = "user"
	UserId       = "user_id"
	DepartmentId = "department_id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FormWidget added in v0.1.5

type FormWidget struct {
	ID      string      `json:"id"`
	Name    string      `json:"name"`
	Type    string      `json:"type"`
	Value   interface{} `json:"value"`
	Ext     interface{} `json:"ext"`
	Option  interface{} `json:"option"`
	OpenIds []string    `json:"open_ids,omitempty"`
}

func ParseForm added in v0.1.6

func ParseForm(formStr string) ([]FormWidget, error)

type LarkClient

type LarkClient interface {
	Client() *lark.Client

	GetUserAccessToken(ctx context.Context, code string) (string, error)

	// 用户
	GetUserByUserId(ctx context.Context, userId string) (*larkcontact.User, error)
	GetEmpByUserId(ctx context.Context, userId string) (*larkehr.Employee, error)
	GetEmpNameMap(ctx context.Context, userIds []string) (map[string]string, error)
	ListEmp(ctx context.Context, userIds []string) ([]*larkehr.Employee, error)
	AllUser(ctx context.Context) ([]*larkcontact.User, error)
	AllEmp(ctx context.Context) ([]*larkehr.Employee, error)
	ListUserByDeptId(ctx context.Context, deptId string) ([]*larkcontact.User, error)
	AllUserId(ctx context.Context) ([]string, error)
	ListUserIdByDeptId(ctx context.Context, deptId string) ([]string, error)

	// 部门
	GetDeptById(ctx context.Context, deptIdType, deptId string) (*larkcontact.Department, error)
	ListChildDeptByDeptId(ctx context.Context, deptIdType string, deptId string) ([]*larkcontact.Department, error)
	ListChildDeptIdByDeptId(ctx context.Context, deptIdType string, deptId string) ([]string, error)
	ListParentDeptByDeptId(ctx context.Context, deptIdType string, deptId string) ([]*larkcontact.Department, error)

	// 消息
	SendMsg(ctx context.Context, receiveIdType, receivedId, msgType, content string) error
	SendCardMsg(ctx context.Context, receiveIdType, receivedId, cardId string, templateVar interface{}) error

	// 审批
	SubscribeApproval(ctx context.Context, code string) error
	GetApprovalDefineByCode(ctx context.Context, code string) (*larkapproval.GetApprovalRespData, error)
	ListApprovalInstIdByCode(ctx context.Context, code, startTime, endTime string) ([]string, error)
	GetApprovalInstById(ctx context.Context, instId string) (*larkapproval.GetInstanceRespData, error)
	SearchApprovalInst(ctx context.Context, userId, approvalCode, instCode, instStatus, timeFrom, timeTo string) ([]*larkapproval.InstanceSearchItem, error)
	CreateApprovalInst(ctx context.Context, approvalCode, userId string, form interface{}) error
	RollbackApprovalTask(ctx context.Context, currUserId, currTaskId, reason string, defKeys []string) error
	AddSign(ctx context.Context, operatorId, approvalCode, instCode, taskId, comment string, addSignUserIds []string, addSignType, approvalMethod int) error
	ApproveTask(ctx context.Context, approvalCode, instCode, userId, comment, taskId, form string) error
	CcApprovalInst(ctx context.Context, approvalCode, instCode, fromUserId, comment string, ccUserIds []string) error
	AddInstComment(ctx context.Context, instCode, userId, comment string) error
	SearchUserApprovalTask(ctx context.Context, userId, taskStatus string) ([]*larkapproval.TaskSearchItem, error)
	RejectTask(ctx context.Context, approvalCode, instCode, userId, comment, taskId string) error

	// 会议室
	ListRoom(ctx context.Context, roomLevelId string) ([]*larkvc.Room, error)
	CheckRoomFree(ctx context.Context, roomId, timeMin, timeMax string) (bool, error)
	SetCalendarRoom(ctx context.Context, calendarId, eventId, roomId string) error
	SetCalendarUsers(ctx context.Context, calendarId, eventId string, userIds []string) error
	ListCalendarEvent(ctx context.Context, calendarId string) ([]*larkcalendar.CalendarEvent, error)
	CreateCalendarEvent(ctx context.Context, calendarId, summary, startTs, endTs string) (*larkcalendar.CalendarEvent, error)

	// 云文档
	GetSpaceNode(ctx context.Context, objType, token string) (*larkwiki.Node, error)
	ListBitableRecord(ctx context.Context, appToken, tableId string, fieldNames []string, sort []*larkbitable.Sort, filter *larkbitable.FilterInfo) ([]*larkbitable.AppTableRecord, error)
	InsertBitableRecord(ctx context.Context, appToken, tableId string, records []*larkbitable.AppTableRecord) error
	InsertBitable1Record(ctx context.Context, appToken, tableId string, record *larkbitable.AppTableRecord) error
	UpdateBitableRecord(ctx context.Context, appToken, tableId string, records []*larkbitable.AppTableRecord) error

	// 其他
	GetAttachment(ctx context.Context, token string) error
	ListAttendanceRecord(ctx context.Context, userIds []string, dateFrom, dateTo int) ([]*larkattendance.UserTask, error)
	ListRoleMember(ctx context.Context, roleId string) ([]*larkcontact.FunctionalRoleMember, error)
	GetAppInfo(appId string) *larkapplication.Application
	AddAttendanceFlow(ctx context.Context, userId, locationName, checkTime string) error
	GetLog(ctx context.Context, appId, apiKey string) ([]*larksecurity_and_compliance.OpenapiLog, error)
	Alert(err error)
}

func NewClient

func NewClient(appId, appSecret string, debug ...string) LarkClient

type ProjectClient added in v0.3.5

type ProjectClient interface {
	Client() *projectsdk.Client

	ListProject(ctx context.Context, userKey string) ([]string, error)
	ListWorkItem(ctx context.Context, projectKey string) ([]*workitem.WorkItemInfo, error)
	ListTask(ctx context.Context) ([]*task.SubDetail, error)
}

func NewProjectClient added in v0.3.5

func NewProjectClient(appId, appSecret string, debug ...string) ProjectClient

Jump to

Keyboard shortcuts

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