blockkit

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToTextObject

func ToTextObject(json *gjson.Result) (*TextObject, Skip, error)

Types

type Block

type Block interface {
	Parse(block *gjson.Result) (Skip, error)
	Render(out *gotify.MarkdownWriter) error
}

type ButtonElement

type ButtonElement struct {
	Text    *TextObject
	Url     string
	Confirm bool // TODO add a Emoji/Note?
}

func (*ButtonElement) Parse

func (be *ButtonElement) Parse(json *gjson.Result) (Skip, error)

func (*ButtonElement) Render

func (be *ButtonElement) Render(out *gotify.MarkdownWriter) error

type ContextBlock

type ContextBlock struct {
	// Can be ImageElement or TextObject
	Elements []Block
}

func (*ContextBlock) Parse

func (cb *ContextBlock) Parse(block *gjson.Result) (Skip, error)

func (*ContextBlock) Render

func (cb *ContextBlock) Render(out *gotify.MarkdownWriter) error

type DividerBlock

type DividerBlock struct{}

func (*DividerBlock) Parse

func (db *DividerBlock) Parse(_ *gjson.Result) (Skip, error)

func (*DividerBlock) Render

func (db *DividerBlock) Render(out *gotify.MarkdownWriter) error

type HeaderBlock

type HeaderBlock struct {
	// It's a TextObject but only `type=plain_text` is allowed.
	PlainText string
}

func (*HeaderBlock) Parse

func (hb *HeaderBlock) Parse(block *gjson.Result) (Skip, error)

func (*HeaderBlock) Render

func (hb *HeaderBlock) Render(out *gotify.MarkdownWriter) error

type ImageBlock

type ImageBlock struct {
	Image *ImageElement
	Title string
}

func (*ImageBlock) Parse

func (ib *ImageBlock) Parse(json *gjson.Result) (Skip, error)

func (*ImageBlock) Render

func (ib *ImageBlock) Render(out *gotify.MarkdownWriter) error

type ImageElement

type ImageElement struct {
	AltText string
	Url     string
}

func (*ImageElement) Parse

func (ie *ImageElement) Parse(json *gjson.Result) (Skip, error)

func (*ImageElement) Render

func (ie *ImageElement) Render(out *gotify.MarkdownWriter) error

type SectionBlock

type SectionBlock struct {
	Text      *TextObject
	Fields    []*TextObject
	Accessory Block
}

func (*SectionBlock) Parse

func (sb *SectionBlock) Parse(block *gjson.Result) (Skip, error)

func (*SectionBlock) Render

func (sb *SectionBlock) Render(out *gotify.MarkdownWriter) error

type Skip

type Skip bool

type TextObject

type TextObject struct {
	Text string
	Type string
}

func (*TextObject) Parse

func (to *TextObject) Parse(json *gjson.Result) (Skip, error)

func (*TextObject) Render

func (to *TextObject) Render(out *gotify.MarkdownWriter) error

type VideoBlock

type VideoBlock struct {
	Title    string
	VideoUrl string
	ThumbUrl string
	AltText  string
}

func (*VideoBlock) Parse

func (vb *VideoBlock) Parse(block *gjson.Result) (Skip, error)

func (*VideoBlock) Render

func (vb *VideoBlock) Render(out *gotify.MarkdownWriter) error

Jump to

Keyboard shortcuts

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