slack

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessory

type Accessory struct {
	Type  string `json:"type"`
	Image string `json:"image_url"`
	Alt   string `json:"alt_text"`
}

func NewAccessory

func NewAccessory(image, alt string) *Accessory

type Actions

type Actions struct {
	Type     string    `json:"type"`
	BlockID  string    `json:"block_id,omitempty"`
	Elements []Element `json:"elements"`
}

func NewActions

func NewActions(blockID string, elements ...Element) Actions

type Block

type Block any

type ButtonElement

type ButtonElement struct {
	Type     string `json:"type"`
	Text     Text   `json:"text"`
	ActionID string `json:"action_id"`
	Value    string `json:"value,omitempty"`
	Style    string `json:"style,omitempty"`
}

type CommandHandler

type CommandHandler func(context.Context, SlashPayload) Response

type Config

type Config struct {
	ClientID      string
	ClientSecret  string
	SigningSecret string
}

func Flags

func Flags(fs *flag.FlagSet, prefix string, overrides ...flags.Override) *Config

type Context

type Context struct {
	Type     string    `json:"type"`
	Elements []Element `json:"elements"`
}

func NewContext

func NewContext() Context

func (Context) AddElement

func (c Context) AddElement(element Element) Context

type Element

type Element any

func NewButtonElement

func NewButtonElement(text, actionID, value, style string) Element

type Image

type Image struct {
	Type  string `json:"type"`
	Image string `json:"image_url"`
	Alt   string `json:"alt_text"`
	Title Text   `json:"title"`
}

func NewImage

func NewImage(image, alt, title string) Image

type InteractHandler

type InteractHandler func(context.Context, InteractivePayload) Response

type InteractiveAction

type InteractiveAction struct {
	Type     string `json:"type"`
	BlockID  string `json:"block_id,omitempty"`
	ActionID string `json:"action_id,omitempty"`
	Value    string `json:"value,omitempty"`
}

type InteractivePayload

type InteractivePayload struct {
	User struct {
		ID string `json:"id"`
	} `json:"user"`
	Container struct {
		ChannelID string `json:"channel_id"`
	} `json:"container"`
	Type        string              `json:"type"`
	ResponseURL string              `json:"response_url"`
	Actions     []InteractiveAction `json:"actions"`
}

type Response

type Response struct {
	ResponseType    string  `json:"response_type,omitempty"`
	Text            string  `json:"text,omitempty"`
	Blocks          []Block `json:"blocks,omitempty"`
	ReplaceOriginal bool    `json:"replace_original,omitempty"`
	DeleteOriginal  bool    `json:"delete_original,omitempty"`
}

func NewEphemeralMessage

func NewEphemeralMessage(message string) Response

func NewError

func NewError(err error) Response

func NewResponse

func NewResponse(message string) Response

func (Response) AddBlock

func (r Response) AddBlock(block Block) Response

func (Response) Ephemeral

func (r Response) Ephemeral() Response

func (Response) WithDeleteOriginal

func (r Response) WithDeleteOriginal() Response

func (Response) WithReplaceOriginal

func (r Response) WithReplaceOriginal() Response

type Section

type Section struct {
	Accessory *Accessory `json:"accessory,omitempty"`
	Text      Text       `json:"text"`
	Type      string     `json:"type"`
	Fields    []Text     `json:"fields,omitempty"`
}

func NewSection

func NewSection(text Text) Section

func (Section) AddField

func (s Section) AddField(field Text) Section

func (Section) IsZero

func (s Section) IsZero() bool

func (Section) WithAccessory

func (s Section) WithAccessory(accessory *Accessory) Section

type Service

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

func New

func New(config *Config, command CommandHandler, interact InteractHandler, tracerProvider trace.TracerProvider) Service

func (Service) NewServeMux

func (s Service) NewServeMux() *http.ServeMux

type SlashPayload

type SlashPayload struct {
	ChannelID   string `json:"channel_id"`
	Command     string `json:"command"`
	ResponseURL string `json:"response_url"`
	Text        string `json:"text"`
	Token       string `json:"token"`
	UserID      string `json:"user_id"`
}

type Text

type Text struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

func NewPlainText

func NewPlainText(text string) Text

func NewText

func NewText(text string) Text

Jump to

Keyboard shortcuts

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