dynamic_block

package module
v0.0.0-...-524240a Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ActionAddTag          string = "add_tag"
	ActionRemoveTag       string = "remove_tag"
	ActionSetFieldValue   string = "set_field_value"
	ActionUnsetFieldValue string = "unset_field_value"
)
View Source
const (
	ButtonTypeCall                 string = "call"
	ButtonTypeUrl                  string = "url"
	ButtonTypeFlow                 string = "flow"
	ButtonTypeNode                 string = "node"
	ButtonTypeBuy                  string = "buy"
	ButtonTypeDynamicBlockCallback string = "dynamic_block_callback"
)
View Source
const (
	WebViewSizeFull    string = "full"
	WebViewSizeMedium  string = "medium"
	WebViewSizeCompact string = "compact"
)
View Source
const (
	ImageAspectRatioHorizontal string = "horizontal"
	ImageAspectRationSquare    string = "square"
)
View Source
const (
	MessageTypeText  string = "text"
	MessageTypeImage string = "image"
	MessageTypeVideo string = "video"
	MessageTypeAudio string = "audio"
	MessageTypeFile  string = "file"
	MessageTypeCards string = "cards"
)
View Source
const (
	QuickReplyTypeNode                 string = "node"
	QuickReplyTypeFlow                 string = "flow"
	QuickReplyTypeDynamicBlockCallback string = "dynamic_block_callback"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Action    string      `json:"action"`
	TagName   string      `json:"tag_name,omitempty"`
	FieldName string      `json:"field_name,omitempty"`
	Value     interface{} `json:"value,omitempty"`
}

type ActionBuilder

type ActionBuilder struct{}

func (*ActionBuilder) BuildAddTagAction

func (builder *ActionBuilder) BuildAddTagAction(tagName string) *Action

func (*ActionBuilder) BuildRemoveTagAction

func (builder *ActionBuilder) BuildRemoveTagAction(tagName string) *Action

func (*ActionBuilder) BuildSetFieldValueAction

func (builder *ActionBuilder) BuildSetFieldValueAction(fieldName string, value interface{}) *Action

func (*ActionBuilder) BuildUnsetFieldValueAction

func (builder *ActionBuilder) BuildUnsetFieldValueAction(fieldName string) *Action

type Button

type Button struct {
	Type          string      `json:"type"`
	Caption       string      `json:"caption"`
	Phone         string      `json:"phone,omitempty"`
	Url           string      `json:"url,omitempty"`
	Method        string      `json:"method,omitempty"`
	WebViewSize   string      `json:"web_view_size,omitempty"`
	Target        string      `json:"target,omitempty"`
	Customer      Customer    `json:"customer,omitempty"`
	Product       Product     `json:"product,omitempty"`
	SuccessTarget string      `json:"success_target,omitempty"`
	Headers       interface{} `json:"headers,omitempty"`
	Payload       interface{} `json:"payload,omitempty"`
}

type ButtonsBuilder

type ButtonsBuilder struct{}

func (*ButtonsBuilder) BuildBuyButton

func (builder *ButtonsBuilder) BuildBuyButton(caption string, customer Customer, product Product, successTarget string) *Button

func (*ButtonsBuilder) BuildCallButton

func (builder *ButtonsBuilder) BuildCallButton(caption string, phone string) *Button

func (*ButtonsBuilder) BuildCallbackButton

func (builder *ButtonsBuilder) BuildCallbackButton(caption string, url string, method string, headers interface{}, payload interface{}) *Button

func (*ButtonsBuilder) BuildFlowButton

func (builder *ButtonsBuilder) BuildFlowButton(caption string, target string) *Button

func (*ButtonsBuilder) BuildNodeButton

func (builder *ButtonsBuilder) BuildNodeButton(caption string, target string) *Button

func (*ButtonsBuilder) BuildUrlButton

func (builder *ButtonsBuilder) BuildUrlButton(caption string, url string, webViewSize string) *Button

type Customer

type Customer struct {
	ShippingAddress bool `json:"shipping_address"`
	ContactName     bool `json:"contact_name"`
	ContactPhone    bool `json:"contact_phone"`
	ContactEmail    bool `json:"contact_email"`
}

type DynamicBlock

type DynamicBlock struct {
	Version string `json:"version"`
	Content struct {
		Messages     []*Message    `json:"messages"`
		Actions      []*Action     `json:"actions,omitempty"`
		QuickReplies []*QuickReply `json:"quick_replies,omitempty"`
	} `json:"content"`
}

func (*DynamicBlock) AddAction

func (dynamicBlock *DynamicBlock) AddAction(action *Action)

func (*DynamicBlock) AddActions

func (dynamicBlock *DynamicBlock) AddActions(actions []*Action)

func (*DynamicBlock) AddMessage

func (dynamicBlock *DynamicBlock) AddMessage(message *Message)

func (*DynamicBlock) AddMessages

func (dynamicBlock *DynamicBlock) AddMessages(messages []*Message)

func (*DynamicBlock) AddQuickReplies

func (dynamicBlock *DynamicBlock) AddQuickReplies(quickReplies []*QuickReply)

func (*DynamicBlock) AddQuickReply

func (dynamicBlock *DynamicBlock) AddQuickReply(quickReply *QuickReply)

type DynamicBlockBuilder

type DynamicBlockBuilder struct {
	Messages        *MessageBuilder
	Buttons         *ButtonsBuilder
	Actions         *ActionBuilder
	QuickReply      *QuickReplyBuilder
	Gallery         *GalleryBuilder
	ExternalMessage *ExternalMessageBuilder
}

func NewDynamicBlockBuilder

func NewDynamicBlockBuilder() *DynamicBlockBuilder

func (*DynamicBlockBuilder) BuildDynamicBlock

func (builder *DynamicBlockBuilder) BuildDynamicBlock() *DynamicBlock

type ExternalMessage

type ExternalMessage struct {
	Url     string      `json:"url"`
	Method  string      `json:"method"`
	Headers interface{} `json:"headers,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
	Timeout int64       `json:"timeout,omitempty"`
}

type ExternalMessageBuilder

type ExternalMessageBuilder struct{}

func (*ExternalMessageBuilder) BuildExternalMessage

func (builder *ExternalMessageBuilder) BuildExternalMessage(url string, method string, headers interface{}, payload interface{}, timeout int64) *ExternalMessage
type Gallery struct {
	Elements []*GalleryCard `json:"elements"`
	// contains filtered or unexported fields
}

func (*Gallery) AddGalleryCard

func (gallery *Gallery) AddGalleryCard(title string, subtitle string, imageUrl string, actionUrl string, buttons []Button)

func (*Gallery) GetImageAspectRation

func (gallery *Gallery) GetImageAspectRation() string

func (*Gallery) SetImageAspectRation

func (gallery *Gallery) SetImageAspectRation(imageAspectRatio string)

type GalleryBuilder

type GalleryBuilder struct{}

func (*GalleryBuilder) NewGallery

func (builder *GalleryBuilder) NewGallery() *Gallery

type GalleryCard

type GalleryCard struct {
	Title     string   `json:"title"`
	SubTitle  string   `json:"subtitle"`
	ImageUrl  string   `json:"image_url"`
	ActionUrl string   `json:"action_url,omitempty"`
	Buttons   []Button `json:"buttons,omitempty"`
}

type Message

type Message struct {
	Type             string         `json:"type"`
	Text             string         `json:"text,omitempty"`
	Url              string         `json:"url,omitempty"`
	Buttons          []*Button      `json:"buttons,omitempty"`
	Elements         []*GalleryCard `json:"elements,omitempty"`
	ImageAspectRatio string         `json:"image_aspect_ratio"`
}

func (*Message) AddButton

func (message *Message) AddButton(button *Button)

func (*Message) AddButtons

func (message *Message) AddButtons(buttons []*Button)

type MessageBuilder

type MessageBuilder struct{}

func (*MessageBuilder) BuildAudioMessage

func (builder *MessageBuilder) BuildAudioMessage(url string) *Message

func (*MessageBuilder) BuildFileMessage

func (builder *MessageBuilder) BuildFileMessage(url string) *Message

func (*MessageBuilder) BuildGalleryMessage

func (builder *MessageBuilder) BuildGalleryMessage(gallery *Gallery) *Message

func (*MessageBuilder) BuildImageMessage

func (builder *MessageBuilder) BuildImageMessage(url string) *Message

func (*MessageBuilder) BuildTextMessage

func (builder *MessageBuilder) BuildTextMessage(text string) *Message

func (*MessageBuilder) BuildVideoMessage

func (builder *MessageBuilder) BuildVideoMessage(url string) *Message

type Product

type Product struct {
	Label string `json:"label"`
	Cost  int64  `json:"cost"`
}

type QuickReply

type QuickReply struct {
	Type    string      `json:"type"`
	Caption string      `json:"caption"`
	Target  string      `json:"target,omitempty"`
	Url     string      `json:"url,omitempty"`
	Method  string      `json:"method,omitempty"`
	Headers interface{} `json:"headers,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
}

type QuickReplyBuilder

type QuickReplyBuilder struct{}

func (*QuickReplyBuilder) BuildDynamicBlockCallbackQuickReply

func (builder *QuickReplyBuilder) BuildDynamicBlockCallbackQuickReply(caption string, url string, method string, headers interface{}, payload interface{}) *QuickReply

func (*QuickReplyBuilder) BuildFlowQuickReply

func (builder *QuickReplyBuilder) BuildFlowQuickReply(caption string, target string) *QuickReply

func (*QuickReplyBuilder) BuildNodeQuickReply

func (builder *QuickReplyBuilder) BuildNodeQuickReply(caption string, target string) *QuickReply

Jump to

Keyboard shortcuts

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