command

package
v0.1.47 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "slack_command"
	CommandPort   = "command"
	ErrorPort     = "error"
	RequestPort   = "request"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Context any `json:"context,omitempty" title:"Context"`

	// Original request context
	ResponseURL string `json:"responseUrl" title:"Response URL" description:"URL to send delayed responses"`
	TriggerID   string `json:"triggerId" title:"Trigger ID" description:"ID for opening modals"`

	// Command details
	Command string   `json:"command" title:"Command" description:"The slash command used (e.g., /deploy)"`
	Text    string   `json:"text" title:"Text" description:"Text after the command"`
	Args    []string `json:"args" title:"Args" description:"Text split into arguments"`

	// User info
	UserID   string `json:"userId" title:"User ID" description:"Slack user ID"`
	UserName string `json:"userName" title:"User Name" description:"Slack username"`

	// Channel info
	ChannelID   string `json:"channelId" title:"Channel ID" description:"Channel where command was invoked"`
	ChannelName string `json:"channelName" title:"Channel Name" description:"Channel name"`

	// Team info
	TeamID     string `json:"teamId" title:"Team ID" description:"Slack workspace ID"`
	TeamDomain string `json:"teamDomain" title:"Team Domain" description:"Slack workspace domain"`

	// For routing
	Action    string   `json:"action" title:"Action" description:"First argument (e.g., 'status' from '/k8s status app')"`
	Target    string   `json:"target" title:"Target" description:"Second argument (e.g., 'app' from '/k8s status app')"`
	ExtraArgs []string `json:"extraArgs" title:"Extra Args" description:"Remaining arguments after action and target"`
}

Command is the parsed slash command

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component implements the Slack command receiver

func (*Component) GetInfo

func (c *Component) GetInfo() module.ComponentInfo

func (*Component) Handle

func (c *Component) Handle(ctx context.Context, handler module.Handler, port string, msg any) any

func (*Component) Instance

func (c *Component) Instance() module.Component

func (*Component) Ports

func (c *Component) Ports() []module.Port

type Error

type Error struct {
	Context any     `json:"context,omitempty" title:"Context"`
	Error   string  `json:"error" title:"Error"`
	Request Request `json:"request" title:"Request"`
}

Error output

type Header struct {
	Key   string `json:"key" required:"true" title:"Key"`
	Value string `json:"value" required:"true" title:"Value"`
}

Header matches HTTP Server's header format

type Request

type Request struct {
	Context any `json:"context,omitempty" configurable:"true" title:"Context" description:"Arbitrary context to pass through to output"`

	// Credentials - from edge config (e.g., inject component)
	SigningSecret string `` /* 127-byte string literal not displayed */
	SkipVerify    bool   `json:"skipVerify,omitempty" configurable:"true" title:"Skip Verify" description:"Skip signature verification (for testing)"`

	// HTTP request data - matches HTTP Server Request format
	RequestURI string   `json:"requestURI,omitempty" title:"Request URI"`
	Method     string   `json:"method,omitempty" title:"Method"`
	Headers    []Header `json:"headers,omitempty" title:"Headers" description:"HTTP headers from the request"`
	Body       string   `json:"body" required:"true" title:"Body" description:"Raw request body"`
}

Request is compatible with HTTP Server's Request output

type Settings

type Settings struct {
	EnableErrorPort bool `json:"enableErrorPort" title:"Enable Error Port" description:"Output errors to error port instead of failing"`
}

Settings configures the component - only port flags

Jump to

Keyboard shortcuts

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