lark

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApprovalStatusNotFound not defined by lark open api, it just means not found in local manager.
	ApprovalStatusNotFound = "NOTFOUND"

	ApprovalStatusPending  = "PENDING"
	ApprovalStatusApproved = "APPROVED"
	ApprovalStatusRejected = "REJECTED"
	ApprovalStatusCanceled = "CANCELED"
	ApprovalStatusDeleted  = "DELETED"
)
View Source
const (
	// ApproverSelectionMethodFree is the approver selection method in the definition of approval
	// Free means the approval sponsor can choose the approver freely
	ApproverSelectionMethodFree = "Free"
)

Variables

This section is empty.

Functions

func ApprovalNodeIDKey

func ApprovalNodeIDKey(id int) string

func Validate

func Validate(appID, secret string) error

Validate check whether the lark app id and secret are correct

Types

type ApprovalInstanceInfo

type ApprovalInstanceInfo struct {
	// key1 is node id, key2 is user open id
	ApproverInfoWithNode map[string]map[string]*UserApprovalComment
	ApproveOrReject      config.ApproveOrReject
}

type ApprovalNode

type ApprovalNode struct {
	ApproverIDList []string
	Type           ApproveType
}

type ApproveType

type ApproveType string
const (
	ApproveTypeAnd        ApproveType = "AND"
	ApproveTypeOr         ApproveType = "OR"
	ApproveTypeSequential ApproveType = "SEQUENTIAL"

	QueryTypeEmail  = "email"
	QueryTypeMobile = "mobile"
)

type CancelApprovalInstanceArgs

type CancelApprovalInstanceArgs struct {
	ApprovalID string
	InstanceID string
	UserID     string
}

type Client

type Client struct {
	*lark.Client
}

func NewClient

func NewClient(appID, secret string) *Client

func (*Client) CancelApprovalInstance

func (client *Client) CancelApprovalInstance(args *CancelApprovalInstanceArgs) error

func (*Client) CreateApprovalDefinition

func (client *Client) CreateApprovalDefinition(arg *CreateApprovalDefinitionArgs) (string, error)

func (*Client) CreateApprovalInstance

func (client *Client) CreateApprovalInstance(args *CreateApprovalInstanceArgs) (string, error)

func (*Client) GetApprovalDefinition

func (client *Client) GetApprovalDefinition(approvalCode string) (*larkapproval.GetApprovalRespData, error)

func (*Client) GetApprovalDefinitionNodeKeyMap

func (client *Client) GetApprovalDefinitionNodeKeyMap(approvalCode string) (map[string]string, error)

func (*Client) GetApprovalInstance

func (client *Client) GetApprovalInstance(args *GetApprovalInstanceArgs) (*ApprovalInstanceInfo, error)

func (*Client) GetDepartmentInfoByID

func (client *Client) GetDepartmentInfoByID(id string) (*DepartmentInfo, error)

func (*Client) GetUserInfoByID

func (client *Client) GetUserInfoByID(id string) (*UserInfo, error)

func (*Client) GetUserOpenIDByEmailOrMobile

func (client *Client) GetUserOpenIDByEmailOrMobile(_type, value string) (string, error)

func (*Client) ListAppContactRange

func (client *Client) ListAppContactRange() (*ContactRange, error)

ListAppContactRange get users, departments, groups open id authorized by the lark app

func (*Client) ListSubDepartmentsInfo

func (client *Client) ListSubDepartmentsInfo(departmentID string) ([]*DepartmentInfo, error)

func (*Client) ListUserFromDepartment

func (client *Client) ListUserFromDepartment(departmentID string) ([]*UserInfo, error)

func (*Client) SubscribeApprovalDefinition

func (client *Client) SubscribeApprovalDefinition(args *SubscribeApprovalDefinitionArgs) error

type ContactRange

type ContactRange struct {
	UserIDs       []string `json:"user_id_list"`
	DepartmentIDs []string `json:"department_id_list"`
	GroupIDs      []string `json:"group_id_list,omitempty"`
}

type CreateApprovalDefinitionArgs

type CreateApprovalDefinitionArgs struct {
	Name        string
	Description string
	Nodes       []*ApprovalNode
}

type CreateApprovalInstanceArgs

type CreateApprovalInstanceArgs struct {
	ApprovalCode string
	UserOpenID   string
	Nodes        []*ApprovalNode
	FormContent  string
}

type DepartmentInfo

type DepartmentInfo struct {
	ID   string `json:"id" yaml:"id" bson:"id"`
	Name string `json:"name" yaml:"name" bson:"name"`
}

type GetApprovalInstanceArgs

type GetApprovalInstanceArgs struct {
	InstanceID string
}

type SubscribeApprovalDefinitionArgs

type SubscribeApprovalDefinitionArgs struct {
	ApprovalID string
}

type UserApprovalComment

type UserApprovalComment struct {
	Comment string
}

type UserInfo

type UserInfo struct {
	ID     string `json:"id" yaml:"id" bson:"id"`
	Name   string `json:"name" yaml:"name" bson:"name"`
	Avatar string `json:"avatar" yaml:"avatar" bson:"avatar"`
}

Jump to

Keyboard shortcuts

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