model

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControl

type AccessControl struct {
	TeamID      []string `yaml:"team_id"`
	TeamName    []string `yaml:"team_name"`
	ChannelID   []string `yaml:"channel_id"`
	ChannelName []string `yaml:"channel_name"`
	UserID      []string `yaml:"user_id"`
	UserName    []string `yaml:"user_name"`
}

func (*AccessControl) IsEmpty

func (a *AccessControl) IsEmpty() bool

return true if all rules are empty

type Color

type Color struct {
	Color  string `yaml:"color"`
	Status string `yaml:"status"`
}

type Command

type Command struct {
	Command        string
	Name           string
	Description    string
	Usage          string
	Plugin         string
	CommandHandler func(ctx context.Context, mmCommand *MMSlashCommand, args map[string]string) (*CommandResponse, error)
	DialogHandler  func(ctx context.Context, submission *DialogSubmission, args map[string]string) (*CommandResponse, error)
}

type CommandResponse

type CommandResponse struct {
	Type    CommandResponseType
	Dialog  Dialog
	Message Message
}

type CommandResponseType

type CommandResponseType string
const (
	CommandResponseTypeEphemeral CommandResponseType = "ephemeral"
	CommandResponseTypeInChannel CommandResponseType = "in_channel"
	CommandResponseTypeDialog    CommandResponseType = "dialog"
)

type Dialog

type Dialog struct {
	Title       string          `yaml:"title"`
	URL         string          `yaml:"url"`
	CallbackURL string          `yaml:"callbackUrl"`
	MMHookURL   string          `yaml:"hook"`
	Text        string          `yaml:"introduction_text"`
	Elements    []DialogElement `yaml:"elements"`
}

type DialogElement

type DialogElement struct {
	DisplayName string          `yaml:"display_name"`
	Name        string          `yaml:"name"`
	Type        string          `yaml:"type"`
	SubType     string          `yaml:"subtype"`
	Default     string          `yaml:"default"`
	Placeholder string          `yaml:"placeholder"`
	HelpText    string          `yaml:"help_text"`
	Optional    bool            `yaml:"optional"`
	MinLength   int             `yaml:"min_length"`
	MaxLength   int             `yaml:"max_length"`
	Options     []*DialogOption `yaml:"options"`
}

type DialogOption

type DialogOption struct {
	Text  string `yaml:"text"`
	Value string `yaml:"value"`
}

type DialogSubmission

type DialogSubmission struct {
	Type       string `json:"type"`
	CallbackID string `json:"callback_id"`
	State      string `json:"state"`
	UserID     string `json:"user_id"`
	ChannelID  string `json:"channel_id"`
	TeamID     string `json:"team_id"`
	//nolint:misspell // cancelled is misspelled but it is sent from mattermost-server.
	Canceled   bool              `json:"cancelled"`
	Submission map[string]string `json:"submission"`
}

func ParseDialogSubmission

func ParseDialogSubmission(r *http.Request) (*DialogSubmission, error)

type MMSlashCommand

type MMSlashCommand struct {
	ChannelID   string `schema:"channel_id"`
	ChannelName string `schema:"channel_name"`
	Command     string `schema:"command"`
	TeamName    string `schema:"team_domain"`
	TeamID      string `schema:"team_id"`
	Text        string `schema:"text"`
	Token       string `schema:"token"`
	UserID      string `schema:"user_id"`
	Username    string `schema:"user_name"`
	ResponseURL string `schema:"response_url"`
	TriggerID   string `schema:"trigger_id"`
}

func ParseMattermostSlashCommand

func ParseMattermostSlashCommand(r *http.Request) (*MMSlashCommand, error)

type Message

type Message struct {
	Title        string
	Color        string
	ResponseType string
	Body         string
}

Jump to

Keyboard shortcuts

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