Skip to content

Latest commit

 

History

History
468 lines (271 loc) · 11.4 KB

template.md

File metadata and controls

468 lines (271 loc) · 11.4 KB

template

import "github.com/dueros/bot-sdk-go/bot/directive/display/template"

base.go body_template1.go body_template2_3_4.go body_template5.go list.go list_template1_2.go text_image.go

const (
    PLAIN_TEXT = "PlainText"
    RICH_TEXT  = "RichText"
)
const (
    BOTTOM_LEFT_POSITION = "BOTTOM-LEFT"
    CENTER               = "CENTER"
    TOP_LEFT             = "TOP-LEFT"
)
type BaseTemplate struct {
    directive.BaseDirective
    Token           string `json:"token"`
    BackgroundImage *Image `json:"backgroundImage,omitempty"`
    Title           string `json:"title"`
}

func (*BaseTemplate) SetBackgroundImage

func (this *BaseTemplate) SetBackgroundImage(background *Image)

func (*BaseTemplate) SetBackgroundImageUrl

func (this *BaseTemplate) SetBackgroundImageUrl(url string)

func (*BaseTemplate) SetTitle

func (this *BaseTemplate) SetTitle(title string)
type BodyTemplate1 struct {
    BaseTemplate
    TextContent struct {
        Position string `json:"position"`
        Text     *Text  `json:"text"`
    } `json:"content"`
}
func NewBodyTemplate1() *BodyTemplate1

func (*BodyTemplate1) SetContentPosition

func (this *BodyTemplate1) SetContentPosition(position string) *BodyTemplate1

func (*BodyTemplate1) SetPlainContent

func (this *BodyTemplate1) SetPlainContent(content string) *BodyTemplate1
type BodyTemplate2 struct {
    TextImageTemplate
}
func NewBodyTemplate2() *BodyTemplate2
type BodyTemplate3 struct {
    TextImageTemplate
}
func NewBodyTemplate3() *BodyTemplate3
type BodyTemplate4 struct {
    TextImageTemplate
}
func NewBodyTemplate4() *BodyTemplate4
type BodyTemplate5 struct {
    BaseTemplate
    Images []*Image `json:"images"`
}
func NewBodyTemplate5() *BodyTemplate5

func (*BodyTemplate5) AddImage

func (this *BodyTemplate5) AddImage(image *Image) *BodyTemplate5
type Image struct {
    Url          string `json:"url"`
    WidthPixels  int    `json:"widthPixels,omitempty"`
    HeightPixels int    `json:"heightPixels,omitempty"`
}
func NewImage(url string) *Image

func (*Image) SetHeight

func (this *Image) SetHeight(height int) *Image

func (*Image) SetWidth

func (this *Image) SetWidth(width int) *Image
type ListItem struct {
    Token       string `json:"token"`
    Image       *Image `json:"image,omitempty"`
    TextContent struct {
        PrimaryText   *Text `json:"primaryText"`
        SecondaryText *Text `json:"secondaryText"`
        TertiaryText  *Text `json:"tertiaryText,omitempty"`
    } `json:"textContent"`
}
func NewListItem() *ListItem

func (*ListItem) SetImage

func (this *ListItem) SetImage(image *Image) *ListItem

func (*ListItem) SetImageUrl

func (this *ListItem) SetImageUrl(url string) *ListItem
func (this *ListItem) SetPlainPrimaryText(text string) *ListItem
func (this *ListItem) SetPlainSecondaryText(text string) *ListItem
func (this *ListItem) SetPlainTertiary(text string) *ListItem
type ListTemplate struct {
    BaseTemplate
    ListItems []*ListItem `json:"listItems"`
}

func (*ListTemplate) AddItem

func (this *ListTemplate) AddItem(listItem *ListItem)
type ListTemplate1 struct {
    ListTemplate
}
func NewListTemplate1() *ListTemplate1
type ListTemplate2 struct {
    ListTemplate
}
func NewListTemplate2() *ListTemplate2
type Text struct {
    Type string `json:"type"`
    Text string `json:"text"`
}
func NewText(textType, text string) *Text
type TextImageTemplate struct {
    BaseTemplate
    Content *Text  `json:"content"`
    Image   *Image `json:"image"`
}

func (*TextImageTemplate) SetImage

func (this *TextImageTemplate) SetImage(image *Image)

func (*TextImageTemplate) SetImageUrl

func (this *TextImageTemplate) SetImageUrl(url string)

func (*TextImageTemplate) SetPlainContent

func (this *TextImageTemplate) SetPlainContent(content string)

Generated by godoc2md