meego

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PluginTokenHeader = "X-Plugin-Token"
	UserKeyHeader     = "X-USER-KEY"

	DefaultMeegoHost = "https://project.feishu.cn"
)

API Related consts

View Source
const (
	PluginTokenType        = 0
	VirtualPluginTokenType = 1

	WorkflowType   = 0
	StatusFlowType = 1
)

Variables

View Source
var TokenExpirationMap sync.Map

Since we only allow one meego integration at a time, we store the pluginToken in the memory

Functions

func GetPluginToken

func GetPluginToken(host, pluginID, pluginSecret string) (token string, expirationTime int64, err error)

Types

type Client

type Client struct {
	Host         string
	PluginID     string
	PluginSecret string
	PluginToken  string
	UserKey      string
}

func NewClient

func NewClient(host, pluginID, pluginSecret, userKey string) (*Client, error)

func (*Client) Comment

func (c *Client) Comment(projectKey, workItemTypeKey string, workItemID int64, comment string) (int64, error)

func (*Client) GetProjectList

func (c *Client) GetProjectList() ([]*NamespaceDetail, error)

func (*Client) GetWorkFlowInfo

func (c *Client) GetWorkFlowInfo(projectKey, workItemTypeKey string, workItemID int) ([]*Connection, []*StateFlowNode, error)

func (*Client) GetWorkItem

func (c *Client) GetWorkItem(projectKey, workItemTypeKey string, workItemID int) (*WorkItem, error)

func (*Client) GetWorkItemList

func (c *Client) GetWorkItemList(projectKey, workItemTypeKey, nameQuery string, pageNum, pageSize int) ([]*WorkItem, error)

func (*Client) GetWorkItemTypesList

func (c *Client) GetWorkItemTypesList(projectKey string) ([]*WorkItemType, error)

func (*Client) StatusTransition

func (c *Client) StatusTransition(projectKey, workItemTypeKey string, workItemID int, transitionID int64) error

type Connection

type Connection struct {
	SourceStateKey string `json:"source_state_key"`
	TargetStateKey string `json:"target_state_key"`
	TransitionID   int64  `json:"transition_id"`
}

type CreateCommentReq

type CreateCommentReq struct {
	Content string `json:"content"`
}

type CreateCommentResp

type CreateCommentResp struct {
	Data         int64       `json:"data"`
	ErrorMessage string      `json:"err_msg"`
	ErrorCode    int         `json:"err_code"`
	Error        interface{} `json:"error"`
}

type GeneralError

type GeneralError struct {
	Code    int    `json:"code"`
	Message string `json:"msg"`
}

type GeneralWebhookPayload

type GeneralWebhookPayload struct {
	ID                int64  `json:"id"`
	Name              string `json:"name"`
	ProjectKey        string `json:"project_key"`
	ProjectSimpleName string `json:"project_simple_name"`
	WorkItemTypeKey   string `json:"work_item_type_key"`
}

type GeneralWebhookRequest

type GeneralWebhookRequest struct {
	Header  *WebhookHeader         `json:"header"`
	Payload *GeneralWebhookPayload `json:"payload"`
}

type GetNamespaceDetailRequest

type GetNamespaceDetailRequest struct {
	ProjectKeys []string `json:"project_keys"`
	UserKey     string   `json:"user_key"`
}

type GetNamespaceDetailResult

type GetNamespaceDetailResult struct {
	Data         map[string]*NamespaceDetail `json:"data"`
	ErrorMessage string                      `json:"err_msg"`
	ErrorCode    int                         `json:"err_code"`
	Error        interface{}                 `json:"error"`
}

type GetNamespaceRequest

type GetNamespaceRequest struct {
	UserKey string `json:"user_key"`
}

type GetNamespaceResult

type GetNamespaceResult struct {
	Data         []string    `json:"data"`
	ErrorMessage string      `json:"err_msg"`
	ErrorCode    int         `json:"err_code"`
	Error        interface{} `json:"error"`
}

type GetPluginData

type GetPluginData struct {
	Token      string `json:"token"`
	ExpireTime int64  `json:"expire_time"`
}

type GetPluginTokenRequest

type GetPluginTokenRequest struct {
	PluginID     string `json:"plugin_id"`
	PluginSecret string `json:"plugin_secret"`
	Type         int    `json:"type"`
}

type GetPluginTokenResult

type GetPluginTokenResult struct {
	Data  *GetPluginData `json:"data"`
	Error *GeneralError  `json:"error"`
}

type GetWorkItemListReq

type GetWorkItemListReq struct {
	WorkItemName     string   `json:"work_item_name,omitempty"`
	WorkItemTypeKeys []string `json:"work_item_type_keys"`
	WorkItemIDs      []int    `json:"work_item_ids,omitempty"`
	PageSize         int      `json:"page_size"`
	PageNum          int      `json:"page_num"`
}

type GetWorkItemListResp

type GetWorkItemListResp struct {
	Data         []*WorkItem `json:"data"`
	ErrorMessage string      `json:"err_msg"`
	ErrorCode    int         `json:"err_code"`
	Error        interface{} `json:"error"`
}

type GetWorkItemTypeResp

type GetWorkItemTypeResp struct {
	Data         []*WorkItemType `json:"data"`
	ErrorMessage string          `json:"err_msg"`
	ErrorCode    int             `json:"err_code"`
	Error        interface{}     `json:"error"`
}

type GetWorkflowReq

type GetWorkflowReq struct {
	FlowType int64    `json:"flow_type"`
	Fields   []string `json:"fields,omitempty"`
}

type GetWorkflowResp

type GetWorkflowResp struct {
	Data         *NodesConnections `json:"data"`
	ErrorMessage string            `json:"err_msg"`
	ErrorCode    int               `json:"err_code"`
	Error        interface{}       `json:"error"`
}

type NamespaceDetail

type NamespaceDetail struct {
	Admins     []string `json:"administrators"`
	Name       string   `json:"name"`
	ProjectKey string   `json:"project_key"`
	SimpleName string   `json:"simple_name"`
}

type NodesConnections

type NodesConnections struct {
	WorkflowNodes  []*WorkflowNode  `json:"workflow_nodes"`
	Connections    []*Connection    `json:"connections"`
	StateflowNodes []*StateFlowNode `json:"state_flow_nodes"`
}

type StateFlowNode

type StateFlowNode struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Status int    `json:"status"`
}

type StatusTransitionReq

type StatusTransitionReq struct {
	TransitionID int64 `json:"transition_id"`
}

type StatusTransitionResp

type StatusTransitionResp struct {
	ErrorMessage string      `json:"err_msg"`
	ErrorCode    int         `json:"err_code"`
	Error        interface{} `json:"error"`
}

type WebhookHeader

type WebhookHeader struct {
	Operator  string `json:"operator"`
	EventType string `json:"event_type"`
	Token     string `json:"token"`
	UUID      string `json:"uuid"`
}

type WorkItem

type WorkItem struct {
	ID             int               `json:"id"`
	Name           string            `json:"name"`
	SimpleName     string            `json:"simple_name"`
	TemplateType   string            `json:"template_type"`
	WorkItemStatus *WorkItemStatus   `json:"work_item_status"`
	WorkflowInfos  *NodesConnections `json:"workflow_infos"`
}

type WorkItemStatus

type WorkItemStatus struct {
	StateKey string `json:"state_key"`
}

type WorkItemType

type WorkItemType struct {
	TypeKey string `json:"type_key"`
	Name    string `json:"name"`
}

type WorkflowNode

type WorkflowNode struct {
	ID       string `json:"id"`
	StateKey string `json:"state_key"`
	Name     string `json:"name"`
}

Jump to

Keyboard shortcuts

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