block

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	// Prep this block for Marshaling.
	Build() gojay.MarshalerJSONObject
	// Removes all the element and release the associated elements into their own pool for reuse.
	Release()
}

type Blocks

type Blocks []Block

func (Blocks) IsNil

func (b Blocks) IsNil() bool

func (Blocks) MarshalJSONArray

func (b Blocks) MarshalJSONArray(enc *gojay.Encoder)

type Composition

type Composition interface {
	BuildComposition() gojay.MarshalerJSONObject
	// Removes all the element and release the associated elements into their own pool for reuse.
	Release()
}

type ContextBlock

type ContextBlock struct {
	Elements Elements
	BlockID  string
}

func NewContextBlock

func NewContextBlock(elements ...Element) *ContextBlock

func (ContextBlock) Build

func (ContextBlock) IsNil

func (b ContextBlock) IsNil() bool

func (ContextBlock) MarshalJSONObject

func (b ContextBlock) MarshalJSONObject(enc *gojay.Encoder)

func (*ContextBlock) Release

func (c *ContextBlock) Release()

type DividerBlock

type DividerBlock struct {
	BlockID string
}

func NewDividerBlock

func NewDividerBlock() *DividerBlock

func (DividerBlock) Build

func (DividerBlock) IsNil

func (b DividerBlock) IsNil() bool

func (DividerBlock) MarshalJSONObject

func (b DividerBlock) MarshalJSONObject(enc *gojay.Encoder)

func (*DividerBlock) Release

func (c *DividerBlock) Release()

Removes all the element and release the associated elements into their own pool for reuse.

type Element

type Element interface {
	BuildElement() gojay.MarshalerJSONObject
	// Removes all the element and release the associated elements into their own pool for reuse.
	Release()
}

type Elements

type Elements []Element

func (Elements) IsNil

func (e Elements) IsNil() bool

func (Elements) MarshalJSONArray

func (e Elements) MarshalJSONArray(enc *gojay.Encoder)

type FileBlock

type FileBlock struct {
	ExternalID string
	BlockID    string
}

func NewFileBlock

func NewFileBlock(externalID string) *FileBlock

func (FileBlock) Build

func (FileBlock) IsNil

func (b FileBlock) IsNil() bool

func (FileBlock) MarshalJSONObject

func (b FileBlock) MarshalJSONObject(enc *gojay.Encoder)

func (*FileBlock) Release

func (b *FileBlock) Release()

Removes all the element and release the associated elements into their own pool for reuse.

type HeaderBlock

type HeaderBlock struct {
	Text    *TextComposition
	BlockID string
}

func NewHeaderBlock

func NewHeaderBlock(text string) *HeaderBlock

Creates New HeaderBlock. Text with length higher than 150 will be truncated to that length.

func (HeaderBlock) Build

Prep this block for Marshaling.

func (HeaderBlock) IsNil

func (b HeaderBlock) IsNil() bool

func (HeaderBlock) MarshalJSONObject

func (b HeaderBlock) MarshalJSONObject(enc *gojay.Encoder)

func (*HeaderBlock) Release

func (b *HeaderBlock) Release()

Removes all the element and release the associated elements into their own pool for reuse.

type SectionBlock

type SectionBlock struct {
	Text      *TextComposition
	Fields    []*TextComposition
	BlockID   string
	Accessory Element
}

func NewSectionBlockFields

func NewSectionBlockFields(t TextType, texts ...string) *SectionBlock

func NewSectionBlockText

func NewSectionBlockText(t TextType, text string) *SectionBlock

func (SectionBlock) Build

Prep this block for Marshaling.

func (SectionBlock) IsNil

func (s SectionBlock) IsNil() bool

func (SectionBlock) MarshalJSONObject

func (s SectionBlock) MarshalJSONObject(enc *gojay.Encoder)

func (*SectionBlock) Release

func (s *SectionBlock) Release()

Removes all the element and release the associated elements into their own pool for reuse.

type TextComposition

type TextComposition struct {
	Type     TextType
	Text     string
	Emoji    bool
	Verbatim bool
}

See https://api.slack.com/reference/block-kit/composition-objects#text for details.

func NewTextComposition

func NewTextComposition(t TextType, text string) *TextComposition

func (TextComposition) BuildComposition

func (t TextComposition) BuildComposition() gojay.MarshalerJSONObject

func (TextComposition) IsNil

func (t TextComposition) IsNil() bool

func (TextComposition) MarshalJSONObject

func (t TextComposition) MarshalJSONObject(enc *gojay.Encoder)

func (*TextComposition) Release

func (t *TextComposition) Release()

Removes all the element and release the associated elements into their own pool for reuse.

type TextType

type TextType string
const (
	TextMrkdwn TextType = "mrkdwn"
	TextPlain  TextType = "plain_text"
)

Jump to

Keyboard shortcuts

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