cards

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 2 Imported by: 3

README

GoDoc

go-adaptive-cards

Go package for creating adaptive cards in Go.

Purpose

Adaptive cards are JSON and can be very complex. Operating raw JSON is unconvinient, so this packages allows to build cards in Golang. Then they can be converted to JSON, filling in types and validating required fields. More on adaptive cards: https://adaptivecards.io/.

Usage

Import package:

import (
    cards "github.com/DanielTitkov/go-adaptive-cards"
)

And define your card:

c := cards.New([]cards.Node{
    &cards.Container{
        Items: []cards.Node{
            &cards.TextBlock{
                Text:     "foo",
                IsSubtle: cards.FalsePtr(),
            },
        },
    },
}, []cards.Node{}).
    WithSchema(cards.DefaultSchema).
    WithVersion(cards.Version12)

s, err := c.StringIndent("", "    ")

This will give you JSON that you can use with bot framework and so on:

{
    "type": "AdaptiveCard",
    "version": "1.2",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "body": [
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "foo",
                    "isSubtle": false
                }
            ]
        }
    ]
}

See more in examples directory and cards_test.go.

Limitations

  • As yet package does not validate string values except for types (e.g. "bolder" for text weight). Look for supported values in adaptive cards schema explorer.
  • Not all card attributes are supported by the constructor. By now you can define a card as struct in order to access all attributes.
  • Some fields can be both a JSON object or a string (e.g. Inlines of the RichTextBlock). This is not supported. Such field can only be provided as structs.

Documentation

Index

Constants

View Source
const (
	// DefaultSchema is card schema value by default
	DefaultSchema = "http://adaptivecards.io/schemas/adaptive-card.json"
	// Version1 is cards verstion 1.0
	Version1 = "1.0"
	// Version11 is cards verstion 1.1
	Version11 = "1.1"
	// Version12 is cards verstion 1.2
	Version12 = "1.2"
	// Version13 is cards verstion 1.3.
	// Warning maybe not supported by bot framework!
	Version13 = "1.3"

	// AdaptiveCardType is general card type
	AdaptiveCardType = "AdaptiveCard"
	// TextBlockType is type for text block
	TextBlockType = "TextBlock"
	// ImageType is type for Image
	ImageType = "Image"
	// MediaType is type for Media
	MediaType = "Media"
	// RichTextBlockType is type for RichTextBlock
	RichTextBlockType = "RichTextBlock"
	// TextRunType is type for TextRun
	TextRunType = "TextRun"
	// ActionSetType is type for ActionSet
	ActionSetType = "ActionSet"
	// ContainerType is type for container
	ContainerType = "Container"
	// ColumnSetType is type for ColumnSet
	ColumnSetType = "ColumnSet"
	// ColumnType is type for Column
	ColumnType = "Column"
	// FactSetType is type for FactSet
	FactSetType = "FactSet"
	// ImageSetType is type for ImageSet
	ImageSetType = "ImageSet"
	// ActionShowCardType is type for Action.ShowCard
	ActionShowCardType = "Action.ShowCard"
	// ActionSubmitType is type for Action.Submit
	ActionSubmitType = "Action.Submit"
	// ActionOpenURLType is type for Action.OpenUrl
	ActionOpenURLType = "Action.OpenUrl"
	// ActionToggleVisibilityType is type for Action.ToggleVisibility
	ActionToggleVisibilityType = "Action.ToggleVisibility"
	// InputTextType is type for Input.Text
	InputTextType = "Input.Text"
	// InputNumberType is type for Input.Number
	InputNumberType = "Input.Number"
	// InputTimeType is type for Imput.Time
	InputTimeType = "Input.Time"
	// InputDateType is type for Input.Date
	InputDateType = "Input.Date"
	// InputChoiceSetType is type for Input.ChoiceSet
	InputChoiceSetType = "Input.ChoiceSet"
	// InputToggleType is type for Input.Toggle
	InputToggleType = "Input.Toggle"
)

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns pointer to bool

func FalsePtr

func FalsePtr() *bool

FalsePtr returns pointer to false

func TruePtr

func TruePtr() *bool

TruePtr returns pointer to true

Types

type ActionInheritedFields

type ActionInheritedFields struct {
	Title    string            `json:"title,omitempty"`
	IconURL  string            `json:"iconUrl,omitempty"`
	Style    string            `json:"style,omitempty"`
	Fallback []Node            `json:"fallback,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

ActionInheritedFields holds common inherited fields for actions. Not really used for the brewety of API.

type ActionOpenURL

type ActionOpenURL struct {
	Type string `json:"type"` // required
	URL  string `json:"url"`  // required
	// inherited
	Title    string            `json:"title,omitempty"`
	IconURL  string            `json:"iconUrl,omitempty"`
	Style    string            `json:"style,omitempty"`
	Fallback []Node            `json:"fallback,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

ActionOpenURL when invoked, show the given url either by launching it in an external web browser or showing within an embedded web browser.

type ActionSet added in v0.2.2

type ActionSet struct {
	Type    string `json:"type"` // required
	Actions []Node `json:"actions,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

ActionSet displays a set of actions.

type ActionShowCard

type ActionShowCard struct {
	Type string     `json:"type"` // required
	Card NestedCard `json:"card,omitempty"`
	// inherited
	Title    string            `json:"title,omitempty"`
	IconURL  string            `json:"iconUrl,omitempty"`
	Style    string            `json:"style,omitempty"`
	Fallback []Node            `json:"fallback,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

ActionShowCard defines an AdaptiveCard which is shown to the user when the button or link is clicked.

type ActionSubmit

type ActionSubmit struct {
	Type             string                 `json:"type"` // required
	Data             map[string]interface{} `json:"data,omitempty"`
	AssociatedInputs string                 `json:"associatedInputs,omitempty"`
	// inherited
	Title    string            `json:"title,omitempty"`
	IconURL  string            `json:"iconUrl,omitempty"`
	Style    string            `json:"style,omitempty"`
	Fallback []Node            `json:"fallback,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

ActionSubmit gathers input fields, merges with optional data field, and sends an event to the client. It is up to the client to determine how this data is processed. See https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/input-validation for more details.

type ActionToggleVisibility

type ActionToggleVisibility struct {
	Type           string          `json:"type"` // required
	TargetElements []TargetElement `json:"targetElements,omitempty"`
	// inherited
	Title    string            `json:"title,omitempty"`
	IconURL  string            `json:"iconUrl,omitempty"`
	Style    string            `json:"style,omitempty"`
	Fallback []Node            `json:"fallback,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

ActionToggleVisibility toggles the visibility of associated card elements.

type BackgroundImage

type BackgroundImage struct {
	URL                 string `json:"url"` // required
	FillMode            string `json:"fillMode,omitempty"`
	HorizontalAlignment string `json:"horizontalAlignment,omitempty"`
	VerticalAlignment   string `json:"verticalAlignment,omitempty"`
}

BackgroundImage specifies a background image. Acceptable formats are PNG, JPEG, and GIF.

type Card

type Card struct {
	Type                     string           `json:"type"`    // required
	Version                  string           `json:"version"` // required
	Schema                   string           `json:"$schema,omitempty"`
	Body                     []Node           `json:"body,omitempty"`
	Actions                  []Node           `json:"actions,omitempty"`
	SelectAction             Node             `json:"selectAction,omitempty"`
	FallbackText             string           `json:"fallbackText,omitempty"`
	BackgroundImage          *BackgroundImage `json:"backgroundImage,omitempty"`
	MinHeight                string           `json:"minHeight,omitempty"`
	Speak                    string           `json:"speak,omitempty"`
	Lang                     string           `json:"lang,omitempty"`
	VerticalContentAlignment string           `json:"verticalContentAlignment,omitempty"`
}

Card is basic adaptive cards type.

func New

func New(body []Node, actions []Node) *Card

New returns a card with provided body and default schema

func (*Card) Bytes

func (c *Card) Bytes() ([]byte, error)

Bytes returns adaptive card JSON as bytes

func (*Card) BytesIndent

func (c *Card) BytesIndent(prefix string, indent string) ([]byte, error)

BytesIndent returns adaptive card JSON as bytes with indentation

func (*Card) Prepare

func (c *Card) Prepare() error

Prepare validates card (required fields etc) and sets relevant types

func (*Card) String

func (c *Card) String() (string, error)

String returns adaptive card JSON as string

func (*Card) StringIndent

func (c *Card) StringIndent(prefix string, indent string) (string, error)

StringIndent returns adaptive card JSON as string with indentation

func (*Card) WithBackgroundImage

func (c *Card) WithBackgroundImage(i BackgroundImage) *Card

WithBackgroundImage allows to set card image

func (*Card) WithMinHeight

func (c *Card) WithMinHeight(h string) *Card

WithMinHeight allows to set card min height

func (*Card) WithSchema

func (c *Card) WithSchema(s string) *Card

WithSchema allows to set card schema

func (*Card) WithVersion

func (c *Card) WithVersion(v string) *Card

WithVersion allows to set card version

type Column

type Column struct {
	Type                     string           `json:"type"` // required - it is not stated in a.c. docs but actually has to be "Column"
	Items                    []Node           `json:"items,omitempty"`
	BackgroundImage          *BackgroundImage `json:"backgroundImage,omitempty"`
	Bleed                    *bool            `json:"bleed,omitempty"`
	Fallback                 Node             `json:"fallback,omitempty"`
	MinHeight                string           `json:"minHeight,omitempty"`
	Separator                *bool            `json:"separator,omitempty"`
	Spacing                  string           `json:"spacing,omitempty"`
	SelectAction             Node             `json:"selectAction,omitempty"`
	Style                    string           `json:"style,omitempty"`
	VerticalContentAlignment string           `json:"verticalContentAlignment,omitempty"`
	Width                    string           `json:"width,omitempty"`
	// inherited
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

Column defines a container that is part of a ColumnSet.

type ColumnSet

type ColumnSet struct {
	Type                string    `json:"type"` // required
	Columns             []*Column `json:"columns,omitempty"`
	SelectAction        Node      `json:"selectAction,omitempty"`
	Style               string    `json:"style,omitempty"`
	Bleed               *bool     `json:"bleed,omitempty"`
	MinHeight           string    `json:"minHeight,omitempty"`
	HorizontalAlignment string    `json:"horizontalAlignment,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

ColumnSet divides a region into Columns, allowing elements to sit side-by-side.

type Container

type Container struct {
	Type            string           `json:"type"`  // required
	Items           []Node           `json:"items"` // required
	SelectAction    Node             `json:"selectAction,omitempty"`
	Style           string           `json:"style,omitempty"`
	Bleed           *bool            `json:"bleed,omitempty"`
	BackgroundImage *BackgroundImage `json:"backgroundImage,omitempty"`
	MinHeight       string           `json:"minHeight,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

Container groups items together.

type Fact

type Fact struct {
	Title string `json:"title"` // required
	Value string `json:"value"` // required
}

Fact describes a Fact in a FactSet as a key/value pair.

type FactSet

type FactSet struct {
	Type  string  `json:"type"`  // required - must be "FactSet"
	Facts []*Fact `json:"facts"` // required
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

FactSet element displays a series of facts (i.e. name/value pairs) in a tabular form.

type Image

type Image struct {
	Type                string `json:"type"` // required, must be "Image"
	URL                 string `json:"url"`  // required
	AltText             string `json:"altText,omitempty"`
	BackgroundColor     string `json:"backgroundColor,omitempty"`
	Height              string `json:"height,omitempty"` // default "auto"
	HorizontalAlignment string `json:"horizontalAlignment,omitempty"`
	SelectAction        Node   `json:"selectAction,omitempty"`
	Size                string `json:"size,omitempty"`
	Style               string `json:"style,omitempty"` // "default" or "person"
	Width               string `json:"width,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

Image is Image element.

type ImageSet

type ImageSet struct {
	Type      string   `json:"type"`   // required
	Images    []*Image `json:"images"` // required
	ImageSize string   `json:"imageSize,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

ImageSet displays a collection of Images similar to a gallery. Acceptable formats are PNG, JPEG, and GIF.

type InputChoice

type InputChoice struct {
	Title string `json:"title"` // required
	Value string `json:"value"` // required
}

InputChoice describes a choice for use in a ChoiceSet. Warning: do not use comma is the value.

type InputChoiceSet

type InputChoiceSet struct {
	Type          string         `json:"type"`    // required
	Choices       []*InputChoice `json:"choices"` // required
	ID            string         `json:"id"`      // required
	IsMultiSelect *bool          `json:"isMultiSelect,omitempty"`
	Style         string         `json:"style,omitempty"`
	Placeholder   string         `json:"placeholder,omitempty"`
	Value         string         `json:"value,omitempty"`
	Wrap          *bool          `json:"wrap,omitempty"`
	// inherited
	ErrorMessage string            `json:"errorMessage,omitempty"`
	IsRequired   *bool             `json:"isRequired,omitempty"`
	Label        string            `json:"label,omitempty"`
	Fallback     []Node            `json:"fallback,omitempty"`
	Height       string            `json:"height,omitempty"`
	Separator    *bool             `json:"separator,omitempty"`
	Spacing      string            `json:"spacing,omitempty"`
	IsVisible    *bool             `json:"isVisible,omitempty"`
	Requires     map[string]string `json:"requires,omitempty"`
}

InputChoiceSet allows a user to input a Choice.

type InputDate

type InputDate struct {
	Type        string `json:"type"` // required
	ID          string `json:"id"`   // required
	Max         string `json:"max,omitempty"`
	Min         string `json:"min,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
	Value       string `json:"value,omitempty"`
	// inherited
	ErrorMessage string            `json:"errorMessage,omitempty"`
	IsRequired   *bool             `json:"isRequired,omitempty"`
	Label        string            `json:"label,omitempty"`
	Fallback     []Node            `json:"fallback,omitempty"`
	Height       string            `json:"height,omitempty"`
	Separator    *bool             `json:"separator,omitempty"`
	Spacing      string            `json:"spacing,omitempty"`
	IsVisible    *bool             `json:"isVisible,omitempty"`
	Requires     map[string]string `json:"requires,omitempty"`
}

InputDate lets a user choose a date.

type InputNumber

type InputNumber struct {
	Type        string  `json:"type"` // required
	ID          string  `json:"id"`   // required
	Max         float64 `json:"max,omitempty"`
	Min         float64 `json:"min,omitempty"`
	Placeholder string  `json:"placeholder,omitempty"`
	Value       float64 `json:"value,omitempty"`
	// inherited
	ErrorMessage string            `json:"errorMessage,omitempty"`
	IsRequired   *bool             `json:"isRequired,omitempty"`
	Label        string            `json:"label,omitempty"`
	Fallback     []Node            `json:"fallback,omitempty"`
	Height       string            `json:"height,omitempty"`
	Separator    *bool             `json:"separator,omitempty"`
	Spacing      string            `json:"spacing,omitempty"`
	IsVisible    *bool             `json:"isVisible,omitempty"`
	Requires     map[string]string `json:"requires,omitempty"`
}

InputNumber allows a user to enter a number.

type InputText

type InputText struct {
	Type         string `json:"type"` // required
	ID           string `json:"id"`   // required
	IsMultiline  *bool  `json:"isMultiline,omitempty"`
	MaxLength    int64  `json:"maxLength,omitempty"`
	Placeholder  string `json:"placeholder,omitempty"`
	Regex        string `json:"regex,omitempty"`
	Style        string `json:"style,omitempty"`
	InlineAction Node   `json:"inlineAction,omitempty"` // FIXME
	Value        string `json:"value,omitempty"`
	// inherited
	ErrorMessage string            `json:"errorMessage,omitempty"`
	IsRequired   *bool             `json:"isRequired,omitempty"`
	Label        string            `json:"label,omitempty"`
	Height       string            `json:"height,omitempty"`
	Separator    *bool             `json:"separator,omitempty"`
	Spacing      string            `json:"spacing,omitempty"`
	IsVisible    *bool             `json:"isVisible,omitempty"`
	Requires     map[string]string `json:"requires,omitempty"`
}

InputText is Input.Text type

type InputTime

type InputTime struct {
	Type        string `json:"type"` // required
	ID          string `json:"id"`   // required
	Max         string `json:"max,omitempty"`
	Min         string `json:"min,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
	Value       string `json:"value,omitempty"`
	// inherited
	ErrorMessage string            `json:"errorMessage,omitempty"`
	IsRequired   *bool             `json:"isRequired,omitempty"`
	Label        string            `json:"label,omitempty"`
	Fallback     []Node            `json:"fallback,omitempty"`
	Height       string            `json:"height,omitempty"`
	Separator    *bool             `json:"separator,omitempty"`
	Spacing      string            `json:"spacing,omitempty"`
	IsVisible    *bool             `json:"isVisible,omitempty"`
	Requires     map[string]string `json:"requires,omitempty"`
}

InputTime lets a user select a time.

type InputToggle

type InputToggle struct {
	Type     string `json:"type"`  // required
	Title    string `json:"title"` // required
	ID       string `json:"id"`    // required
	Value    string `json:"value,omitempty"`
	ValueOff string `json:"valueOff,omitempty"`
	ValueOn  string `json:"valueOn,omitempty"`
	Wrap     *bool  `json:"wrap,omitempty"`
	// inherited
	ErrorMessage string            `json:"errorMessage,omitempty"`
	IsRequired   *bool             `json:"isRequired,omitempty"`
	Label        string            `json:"label,omitempty"`
	Fallback     []Node            `json:"fallback,omitempty"`
	Height       string            `json:"height,omitempty"`
	Separator    *bool             `json:"separator,omitempty"`
	Spacing      string            `json:"spacing,omitempty"`
	IsVisible    *bool             `json:"isVisible,omitempty"`
	Requires     map[string]string `json:"requires,omitempty"`
}

InputToggle lets a user choose between two options.

type Media

type Media struct {
	Type    string         `json:"type"`    // required, must be Media
	Sources []*MediaSource `json:"sources"` // required
	Poster  string         `json:"poster,omitempty"`
	AltText string         `json:"altText,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

Media displays a media player for audio or video content.

type MediaSource

type MediaSource struct {
	MimeType string `json:"mimeType"` // required
	URL      string `json:"url"`      // required
}

MediaSource defines a source for a Media element.

type NestedCard

type NestedCard struct {
	Type                     string           `json:"type"` // required
	Version                  string           `json:"version,omitempty"`
	Schema                   string           `json:"$schema,omitempty"`
	Body                     []Node           `json:"body,omitempty"`
	Actions                  []Node           `json:"actions,omitempty"`
	SelectAction             Node             `json:"selectAction,omitempty"`
	FallbackText             string           `json:"fallbackText,omitempty"`
	BackgroundImage          *BackgroundImage `json:"backgroundImage,omitempty"`
	MinHeight                string           `json:"minHeight,omitempty"`
	Speak                    string           `json:"speak,omitempty"`
	Lang                     string           `json:"lang,omitempty"`
	VerticalContentAlignment string           `json:"verticalContentAlignment,omitempty"`
}

NestedCard is similar to adaptive card but doesn't require version and schema

type Node

type Node interface {
	// contains filtered or unexported methods
}

Node is card element

type RichTextBlock

type RichTextBlock struct {
	Type                string     `json:"type"`    // required, must be RichTextBlock
	Inlines             []*TextRun `json:"inlines"` // required
	HorizontalAlignment string     `json:"horizontalAlignment,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

RichTextBlock defines an array of inlines, allowing for inline text formatting.

type TargetElement

type TargetElement struct {
	ElementID string `json:"elementId"` // required
	IsVisible *bool  `json:"isVisible,omitempty"`
}

TargetElement represents an entry for Action.ToggleVisibility's targetElements property

type TextBlock

type TextBlock struct {
	Type                string `json:"type"` // required
	Text                string `json:"text"` // required
	Color               string `json:"color,omitempty"`
	FontType            string `json:"fontType,omitempty"` // FIXME this is a special type in a.c.
	HorizontalAlignment string `json:"horizontalAlignment,omitempty"`
	IsSubtle            *bool  `json:"isSubtle,omitempty"`
	MaxLines            int64  `json:"maxLines,omitempty"`
	Size                string `json:"size,omitempty"`
	Weight              string `json:"weight,omitempty"`
	Wrap                *bool  `json:"wrap,omitempty"`
	// inherited
	Fallback  []Node            `json:"fallback,omitempty"`
	Height    string            `json:"height,omitempty"`
	Separator *bool             `json:"separator,omitempty"`
	Spacing   string            `json:"spacing,omitempty"`
	ID        string            `json:"id,omitempty"`
	IsVisible *bool             `json:"isVisible,omitempty"`
	Requires  map[string]string `json:"requires,omitempty"`
}

TextBlock is textblock element

type TextRun

type TextRun struct {
	Type          string `json:"type"` // required
	Text          string `json:"text"` // required
	Color         string `json:"color,omitempty"`
	FontType      string `json:"fontType,omitempty"` // FIXME this is a special type in a.c.
	Highlight     *bool  `json:"highlight,omitempty"`
	IsSubtle      *bool  `json:"isSubtle,omitempty"`
	Italic        *bool  `json:"italic,omitempty"`
	SelectAction  Node   `json:"selectAction,omitempty"`
	Size          string `json:"size,omitempty"`
	Strikethrough *bool  `json:"strikethrough,omitempty"`
	Underline     *bool  `json:"underline,omitempty"`
	Weight        string `json:"weight,omitempty"`
}

TextRun defines a single run of formatted text.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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