slack

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 22 Imported by: 5

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 added in v0.0.10

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

func NewContext added in v0.0.10

func NewContext() Context

func (Context) AddElement added in v0.0.10

func (c Context) AddElement(element Element) Context

type Element

type Element any

func NewButtonElement

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

type Image added in v0.0.15

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

func NewImage added in v0.0.15

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 added in v0.0.5

func NewResponse(message string) Response

func (Response) AddBlock added in v0.0.6

func (r Response) AddBlock(block Block) Response

func (Response) Ephemeral added in v0.0.6

func (r Response) Ephemeral() Response

func (Response) WithDeleteOriginal added in v0.0.6

func (r Response) WithDeleteOriginal() Response

func (Response) WithReplaceOriginal added in v0.0.6

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 added in v0.0.5

func (s Section) AddField(field Text) Section

func (Section) IsZero added in v0.0.5

func (s Section) IsZero() bool

func (Section) WithAccessory added in v0.0.5

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

type Service added in v0.3.2

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 added in v0.4.7

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