fbmbotapi

package module
v0.0.0-...-f61e04d Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: Apache-2.0 Imports: 12 Imported by: 6

README

bots-api-fbm

Go library for Facebook Messenger Bot API

Build Status Go Report Card GoDoc

Used by

This package is used in production by:

Frameworks that utilise this strongo/db package

Documentation

Index

Constants

View Source
const (
	// RequestNotificationTypeRegular is for regular notifications
	RequestNotificationTypeRegular = RequestNotificationType("REGULAR")

	// RequestNotificationTypeSilentPush is for silent notifications
	RequestNotificationTypeSilentPush = RequestNotificationType("SILENT_PUSH")

	// RequestNotificationTypeNoPush is for no push notifications
	RequestNotificationTypeNoPush = RequestNotificationType("NO_PUSH")
)
View Source
const (
	// RequestAttachmentTypeImage is for image attachment
	RequestAttachmentTypeImage = "image"

	// RequestAttachmentTypeTemplate is for template attachment
	RequestAttachmentTypeTemplate = "template"
)
View Source
const (
	// RequestAttachmentTemplateTypeGeneric is generic
	RequestAttachmentTemplateTypeGeneric = "generic"
	// RequestAttachmentTemplateTypeList is list
	RequestAttachmentTemplateTypeList = "list"
	// RequestAttachmentTemplateTypeButton is button
	RequestAttachmentTemplateTypeButton = "button"
	// RequestAttachmentTemplateTypeReceipt is receipt
	RequestAttachmentTemplateTypeReceipt = "receipt"
)
View Source
const (
	// RequestButtonTypePostback os postback
	RequestButtonTypePostback = "postback"

	// RequestButtonTypeWebURL is for web url
	RequestButtonTypeWebURL = "web_url"
)
View Source
const WebviewShareButtonHide = "hide"

WebviewShareButtonHide to hide button

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	ID string `json:"id"`
}

Actor represents actor

func (Actor) GetAvatar

func (Actor) GetAvatar() string

GetAvatar is not supported or not implemented yet

func (Actor) GetFirstName

func (a Actor) GetFirstName() string

GetFirstName returns first name

func (Actor) GetID

func (a Actor) GetID() interface{}

GetID returns ID of the actor

func (Actor) GetLanguage

func (Actor) GetLanguage() string

GetLanguage returns preferred language (not implemented yet)

func (Actor) GetLastName

func (a Actor) GetLastName() string

GetLastName returns last name

func (Actor) GetUserName

func (a Actor) GetUserName() string

GetUserName returns username

func (Actor) IsBotUser

func (Actor) IsBotUser() bool

IsBotUser returns false

func (*Actor) MarshalJSON

func (j *Actor) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Actor) MarshalJSONBuf

func (j *Actor) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (Actor) Platform

func (a Actor) Platform() string

Platform returns "fbm"

func (*Actor) UnmarshalJSON

func (j *Actor) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Actor) UnmarshalJSONFFLexer

func (j *Actor) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Attachment

type Attachment struct {
	Type    string  `json:"type"`
	Payload Payload `json:"paylaod"`
}

Attachment defines attachment

func (*Attachment) MarshalJSON

func (j *Attachment) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Attachment) MarshalJSONBuf

func (j *Attachment) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Attachment) UnmarshalJSON

func (j *Attachment) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Attachment) UnmarshalJSONFFLexer

func (j *Attachment) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Delivery

type Delivery struct {
	Watermark  int64      `json:"watermark"`
	MessageIDs MessageIDs `json:"mids"`
}

Delivery message

func (*Delivery) MarshalJSON

func (j *Delivery) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Delivery) MarshalJSONBuf

func (j *Delivery) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Delivery) UnmarshalJSON

func (j *Delivery) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Delivery) UnmarshalJSONFFLexer

func (j *Delivery) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Entry

type Entry struct {
	ID        string      `json:"id"`
	Time      int64       `json:"time"`
	Messaging []Messaging `json:"messaging"`
}

Entry hold entry data

func (Entry) GetID

func (e Entry) GetID() interface{}

GetID returns ID

func (Entry) GetTime

func (e Entry) GetTime() time.Time

GetTime returns time of the message

func (*Entry) MarshalJSON

func (j *Entry) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Entry) MarshalJSONBuf

func (j *Entry) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Entry) UnmarshalJSON

func (j *Entry) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Entry) UnmarshalJSONFFLexer

func (j *Entry) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type GetStartedMessage

type GetStartedMessage struct {
	GetStarted struct {
		Payload string `json:"payload"`
	} `json:"get_started"`
}

GetStartedMessage is get started message

func (*GetStartedMessage) MarshalJSON

func (j *GetStartedMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*GetStartedMessage) MarshalJSONBuf

func (j *GetStartedMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*GetStartedMessage) UnmarshalJSON

func (j *GetStartedMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*GetStartedMessage) UnmarshalJSONFFLexer

func (j *GetStartedMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type GraphAPI

type GraphAPI struct {
	AccessToken string
	// contains filtered or unexported fields
}

GraphAPI is Facebook API client

func NewGraphAPI

func NewGraphAPI(httpClient *http.Client, accessToken string) GraphAPI

NewGraphAPI creates new API client

func (GraphAPI) SendMessage

func (graphAPI GraphAPI) SendMessage(c context.Context, request Request) error

SendMessage sends message

func (GraphAPI) SetGetStarted

func (graphAPI GraphAPI) SetGetStarted(c context.Context, message GetStartedMessage) error

SetGetStarted sets get started message

func (GraphAPI) SetPersistentMenu

func (graphAPI GraphAPI) SetPersistentMenu(c context.Context, message PersistentMenuMessage) error

SetPersistentMenu sets persistent menu

func (GraphAPI) SetWhitelistedDomains

func (graphAPI GraphAPI) SetWhitelistedDomains(c context.Context, message WhitelistedDomainsMessage) error

SetWhitelistedDomains sets whitelisted domains

type MenuItem interface {
	MenuItemType() MenuItemType
}

MenuItem is menu item

type MenuItemBase struct {
	Type  MenuItemType `json:"type"`
	Title string       `json:"title"`
}

MenuItemBase holds menu item base properties

func (j *MenuItemBase) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (j *MenuItemBase) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (mi MenuItemBase) MenuItemType() MenuItemType

MenuItemType returns type of menu item

func (j *MenuItemBase) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (j *MenuItemBase) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type MenuItemNested struct {
	MenuItemBase
	CallToActions []MenuItem `json:"call_to_actions"`
}

MenuItemPostback is nested menu item

func NewMenuItemNested

func NewMenuItemNested(title string, callToActions ...MenuItem) MenuItemNested

NewMenuItemNested creates nested menu item

func (j *MenuItemNested) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (j *MenuItemNested) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (j *MenuItemNested) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (j *MenuItemNested) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type MenuItemPostback struct {
	MenuItemBase
	Payload string `json:"payload"`
}

MenuItemPostback is postback menu item

func NewMenuItemPostback

func NewMenuItemPostback(title, payload string) MenuItemPostback

NewMenuItemPostback creates postback menu item

func (j *MenuItemPostback) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (j *MenuItemPostback) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (j *MenuItemPostback) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (j *MenuItemPostback) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type MenuItemType string

MenuItemType is type of persistent menu item

const (
	// MenuItemTypeWebURL is for URL menu items
	MenuItemTypeWebURL MenuItemType = "web_url"
	// MenuItemTypePostback is for postback menu items
	MenuItemTypePostback MenuItemType = "postback"
	// MenuItemTypeNested is for nested menu items
	MenuItemTypeNested MenuItemType = "nested"
)
type MenuItemWebURL struct {
	MenuItemBase
	URL                 string             `json:"url"`
	WebviewHeightRatio  WebviewHeightRatio `json:"webview_height_ratio"`
	WebviewShareButton  string             `json:"webview_share_button,omitempty"`
	MessengerExtensions bool               `json:"messenger_extensions,omitempty"`
}

MenuItemWebURL is URL menu item

func NewMenuItemWebUrl

func NewMenuItemWebUrl(title, url string, webviewHeightRatio WebviewHeightRatio, shareButton, messengerExtensions bool) MenuItemWebURL

NewMenuItemWebUrl creates new URL menu item

func (j *MenuItemWebURL) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (j *MenuItemWebURL) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (j *MenuItemWebURL) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (j *MenuItemWebURL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Message

type Message struct {
	MID         string       `json:"mid"`
	Seq         int          `json:"seq"`
	MText       string       `json:"text"`
	Attachments []Attachment `json:"attachments"`
}

Message defines message

func (Message) IntID

func (m Message) IntID() int64

IntID not supported

func (*Message) MarshalJSON

func (j *Message) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Message) MarshalJSONBuf

func (j *Message) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (Message) Sequence

func (m Message) Sequence() int

Sequence returns Seq of message

func (Message) StringID

func (m Message) StringID() string

StringID returns message ID as string

func (Message) Text

func (m Message) Text() string

Text returns text of the message

func (*Message) UnmarshalJSON

func (j *Message) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Message) UnmarshalJSONFFLexer

func (j *Message) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type MessageID

type MessageID string

MessageID defines message ID

type MessageIDs

type MessageIDs []MessageID

MessageIDs defiens message IDs

type Messaging

type Messaging struct {
	Sender    Sender    `json:"sender"`
	Recipient Recipient `json:"recipient"`
	Timestamp int64     `json:"timestamp"`
	Message   *Message  `json:"message"`
	Postback  *Postback `json:"postback"`
	Delivery  *Delivery `json:"delivery"`
}

Messaging ...

func (*Messaging) MarshalJSON

func (j *Messaging) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Messaging) MarshalJSONBuf

func (j *Messaging) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Messaging) UnmarshalJSON

func (j *Messaging) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Messaging) UnmarshalJSONFFLexer

func (j *Messaging) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Payload

type Payload struct {
	URL string `json:"url"`
}

Payload defines payload

func (*Payload) MarshalJSON

func (j *Payload) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Payload) MarshalJSONBuf

func (j *Payload) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Payload) UnmarshalJSON

func (j *Payload) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Payload) UnmarshalJSONFFLexer

func (j *Payload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type PersistentMenu

type PersistentMenu struct {
	Locale                string     `json:"locale"`
	ComposerInputDisabled bool       `json:"composer_input_disabled"`
	CallToActions         []MenuItem `json:"call_to_actions,omitempty"`
}

PersistentMenu is mersistent menu

func NewPersistentMenu

func NewPersistentMenu(locale string, composerInputDisabled bool, callToActions ...MenuItem) PersistentMenu

NewPersistentMenu creates new persistent menu

func (*PersistentMenu) MarshalJSON

func (j *PersistentMenu) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*PersistentMenu) MarshalJSONBuf

func (j *PersistentMenu) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*PersistentMenu) UnmarshalJSON

func (j *PersistentMenu) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*PersistentMenu) UnmarshalJSONFFLexer

func (j *PersistentMenu) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type PersistentMenuMessage

type PersistentMenuMessage struct {
	PersistentMenus []PersistentMenu `json:"persistent_menu"`
}

PersistentMenuMessage is persistent menus message

func (*PersistentMenuMessage) MarshalJSON

func (j *PersistentMenuMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*PersistentMenuMessage) MarshalJSONBuf

func (j *PersistentMenuMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*PersistentMenuMessage) UnmarshalJSON

func (j *PersistentMenuMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*PersistentMenuMessage) UnmarshalJSONFFLexer

func (j *PersistentMenuMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Postback

type Postback struct {
	Title   string `json:"title"`
	Payload string `json:"payload"`
}

Postback message

func (*Postback) MarshalJSON

func (j *Postback) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Postback) MarshalJSONBuf

func (j *Postback) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Postback) UnmarshalJSON

func (j *Postback) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Postback) UnmarshalJSONFFLexer

func (j *Postback) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type ReceivedMessage

type ReceivedMessage struct {
	Object  string  `json:"object"`
	Entries []Entry `json:"entry"`
}

ReceivedMessage ...

func (*ReceivedMessage) MarshalJSON

func (j *ReceivedMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*ReceivedMessage) MarshalJSONBuf

func (j *ReceivedMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*ReceivedMessage) UnmarshalJSON

func (j *ReceivedMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*ReceivedMessage) UnmarshalJSONFFLexer

func (j *ReceivedMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Recipient

type Recipient struct {
	Actor
}

Recipient represents recipient

func (*Recipient) MarshalJSON

func (j *Recipient) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Recipient) MarshalJSONBuf

func (j *Recipient) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Recipient) UnmarshalJSON

func (j *Recipient) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Recipient) UnmarshalJSONFFLexer

func (j *Recipient) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Request

type Request struct {
	Recipient        RequestRecipient        `json:"recipient"`
	Message          RequestMessage          `json:"message"`
	NotificationType RequestNotificationType `json:"notification_type,omitempty"` // Optional: Push notification type: REGULAR, SILENT_PUSH, NO_PUSH
}

Request is request

func (*Request) MarshalJSON

func (j *Request) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Request) MarshalJSONBuf

func (j *Request) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Request) UnmarshalJSON

func (j *Request) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Request) UnmarshalJSONFFLexer

func (j *Request) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachment

type RequestAttachment struct {
	Type    string                   `json:"type,omitempty"`
	Payload RequestAttachmentPayload `json:"payload,omitempty"`
}

RequestAttachment is request attachment

func (*RequestAttachment) MarshalJSON

func (j *RequestAttachment) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachment) MarshalJSONBuf

func (j *RequestAttachment) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachment) UnmarshalJSON

func (j *RequestAttachment) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachment) UnmarshalJSONFFLexer

func (j *RequestAttachment) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentButtonTemplate

type RequestAttachmentButtonTemplate struct {
	Text    string          `json:"text,omitempty"`
	Buttons []RequestButton `json:"buttons,omitempty"`
}

RequestAttachmentButtonTemplate defines attachment button template

func (*RequestAttachmentButtonTemplate) MarshalJSON

func (j *RequestAttachmentButtonTemplate) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentButtonTemplate) MarshalJSONBuf

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentButtonTemplate) UnmarshalJSON

func (j *RequestAttachmentButtonTemplate) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentButtonTemplate) UnmarshalJSONFFLexer

func (j *RequestAttachmentButtonTemplate) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentGenericTemplate

type RequestAttachmentGenericTemplate struct {
	Elements []RequestElement `json:"elements,omitempty"` // Data for each bubble in message
}

RequestAttachmentGenericTemplate is request attachment generic template

func (*RequestAttachmentGenericTemplate) MarshalJSON

func (j *RequestAttachmentGenericTemplate) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentGenericTemplate) MarshalJSONBuf

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentGenericTemplate) UnmarshalJSON

func (j *RequestAttachmentGenericTemplate) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentGenericTemplate) UnmarshalJSONFFLexer

func (j *RequestAttachmentGenericTemplate) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentImage

type RequestAttachmentImage struct {
	URL string `json:"url,omitempty"`
}

RequestAttachmentImage is request attachment image

func (*RequestAttachmentImage) MarshalJSON

func (j *RequestAttachmentImage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentImage) MarshalJSONBuf

func (j *RequestAttachmentImage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentImage) UnmarshalJSON

func (j *RequestAttachmentImage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentImage) UnmarshalJSONFFLexer

func (j *RequestAttachmentImage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentListTemplate

type RequestAttachmentListTemplate struct {
	RequestAttachmentGenericTemplate
	TopElementStyle string `json:"top_element_style,omitempty"`
}

RequestAttachmentListTemplate is request attachment list template

func (*RequestAttachmentListTemplate) MarshalJSON

func (j *RequestAttachmentListTemplate) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentListTemplate) MarshalJSONBuf

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentListTemplate) UnmarshalJSON

func (j *RequestAttachmentListTemplate) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentListTemplate) UnmarshalJSONFFLexer

func (j *RequestAttachmentListTemplate) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentPayload

type RequestAttachmentPayload struct {
	RequestAttachmentImage
	RequestAttachmentTemplate
}

RequestAttachmentPayload defines attachment payload

func NewButtonTemplate

func NewButtonTemplate(text string, buttons ...RequestButton) RequestAttachmentPayload

NewButtonTemplate creates new button template

func NewGenericTemplate

func NewGenericTemplate(elements ...RequestElement) RequestAttachmentPayload

NewGenericTemplate creates new generic template

func NewListTemplate

func NewListTemplate(topElementStyle TopElementStyle, elements ...RequestElement) RequestAttachmentPayload

NewListTemplate creates new list template

func (*RequestAttachmentPayload) MarshalJSON

func (j *RequestAttachmentPayload) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentPayload) MarshalJSONBuf

func (j *RequestAttachmentPayload) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentPayload) UnmarshalJSON

func (j *RequestAttachmentPayload) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentPayload) UnmarshalJSONFFLexer

func (j *RequestAttachmentPayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentReceiptTemplate

type RequestAttachmentReceiptTemplate struct {
}

RequestAttachmentReceiptTemplate defines receipt template

func (*RequestAttachmentReceiptTemplate) MarshalJSON

func (j *RequestAttachmentReceiptTemplate) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentReceiptTemplate) MarshalJSONBuf

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentReceiptTemplate) UnmarshalJSON

func (j *RequestAttachmentReceiptTemplate) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentReceiptTemplate) UnmarshalJSONFFLexer

func (j *RequestAttachmentReceiptTemplate) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestAttachmentTemplate

type RequestAttachmentTemplate struct {
	TemplateType                  string `json:"template_type,omitempty"`
	RequestAttachmentListTemplate        // Used for both List & Generic templates
	// RequestAttachmentGenericTemplate - conflicts with RequestAttachmentListTemplate on json.Marshal - silently not marshalling Elements.
	RequestAttachmentButtonTemplate
	RequestAttachmentReceiptTemplate
}

RequestAttachmentTemplate defines attachment template

func (*RequestAttachmentTemplate) MarshalJSON

func (j *RequestAttachmentTemplate) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestAttachmentTemplate) MarshalJSONBuf

func (j *RequestAttachmentTemplate) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestAttachmentTemplate) UnmarshalJSON

func (j *RequestAttachmentTemplate) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestAttachmentTemplate) UnmarshalJSONFFLexer

func (j *RequestAttachmentTemplate) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestButton

type RequestButton struct {
	Type  string `json:"type"`  // Value is web_url or postback
	Title string `json:"title"` // Button title
	RequestWebURLAction
	RequestPostbackAction
}

RequestButton defines request button

func NewRequestPostbackButton

func NewRequestPostbackButton(title, payload string) RequestButton

NewRequestPostbackButton creates new postback button

func NewRequestWebExtentionURLButtonWithRatio

func NewRequestWebExtentionURLButtonWithRatio(title, url string, webviewHeightRatio WebviewHeightRatio) RequestButton

NewRequestWebExtentionURLButtonWithRatio creates new URL extention button

func NewRequestWebURLButton

func NewRequestWebURLButton(title, url string) RequestButton

NewRequestWebURLButton creates new URL button

func NewRequestWebURLButtonWithRatio

func NewRequestWebURLButtonWithRatio(title, url string, webviewHeightRatio WebviewHeightRatio) RequestButton

NewRequestWebURLButtonWithRatio create new web url button with ratio

func (*RequestButton) MarshalJSON

func (j *RequestButton) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestButton) MarshalJSONBuf

func (j *RequestButton) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestButton) UnmarshalJSON

func (j *RequestButton) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestButton) UnmarshalJSONFFLexer

func (j *RequestButton) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestDefaultAction

type RequestDefaultAction struct {
	Type string `json:"type"` // Value is web_url or postback
	RequestWebURLAction
	RequestPostbackAction
}

RequestDefaultAction defines default action

func NewDefaultActionWithWebURL

func NewDefaultActionWithWebURL(action RequestWebURLAction) RequestDefaultAction

NewDefaultActionWithWebURL creates new default action

func (*RequestDefaultAction) MarshalJSON

func (j *RequestDefaultAction) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestDefaultAction) MarshalJSONBuf

func (j *RequestDefaultAction) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestDefaultAction) UnmarshalJSON

func (j *RequestDefaultAction) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestDefaultAction) UnmarshalJSONFFLexer

func (j *RequestDefaultAction) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestElement

type RequestElement struct {
	Title         string                `json:"title"`               // Required: Bubble title
	Subtitle      string                `json:"subtitle,omitempty"`  // Optional: Bubble subtitle
	ImageURL      string                `json:"image_url,omitempty"` // Optional: Bubble image
	ItemURL       string                `json:"item_url,omitempty"`  // Optional: URL that is opened when bubble is tapped
	DefaultAction *RequestDefaultAction `json:"default_action,omitempty"`
	Buttons       []RequestButton       `json:"buttons,omitempty"` // Optional: Set of buttons that appear as call-to-actions
}

RequestElement defines request element

func NewRequestElement

func NewRequestElement(title, subtitle string, buttons ...RequestButton) RequestElement

NewRequestElement creates new request element

func NewRequestElementWithDefaultAction

func NewRequestElementWithDefaultAction(title, subtitle string, defaultAction RequestDefaultAction, buttons ...RequestButton) RequestElement

NewRequestElementWithDefaultAction creates new request element with default action

func (*RequestElement) MarshalJSON

func (j *RequestElement) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestElement) MarshalJSONBuf

func (j *RequestElement) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestElement) UnmarshalJSON

func (j *RequestElement) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestElement) UnmarshalJSONFFLexer

func (j *RequestElement) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestMessage

type RequestMessage struct {
	Text       string             `json:"text,omitempty"`       // Message text, must be UTF-8, 320 character limit
	Attachment *RequestAttachment `json:"attachment,omitempty"` // Attachment data
}

RequestMessage is request message

func (*RequestMessage) MarshalJSON

func (j *RequestMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestMessage) MarshalJSONBuf

func (j *RequestMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestMessage) UnmarshalJSON

func (j *RequestMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestMessage) UnmarshalJSONFFLexer

func (j *RequestMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestNotificationType

type RequestNotificationType string

RequestNotificationType defines request notification type

type RequestPostbackAction

type RequestPostbackAction struct {
	Payload string `json:"payload,omitempty"` // For postback buttons, this data will be sent back to you via webhook
}

RequestPostbackAction defines postback action

func (*RequestPostbackAction) MarshalJSON

func (j *RequestPostbackAction) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestPostbackAction) MarshalJSONBuf

func (j *RequestPostbackAction) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestPostbackAction) UnmarshalJSON

func (j *RequestPostbackAction) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestPostbackAction) UnmarshalJSONFFLexer

func (j *RequestPostbackAction) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestRecipient

type RequestRecipient struct {
	ID          string `json:"id,omitempty"`           // Alex: changed from int64 on 21st November
	PhoneNumber string `json:"phone_number,omitempty"` // Phone number of the recipient with the format +1(212)555-2368
}

RequestRecipient describes recipient

func (*RequestRecipient) MarshalJSON

func (j *RequestRecipient) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestRecipient) MarshalJSONBuf

func (j *RequestRecipient) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestRecipient) UnmarshalJSON

func (j *RequestRecipient) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestRecipient) UnmarshalJSONFFLexer

func (j *RequestRecipient) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestWebURLAction

type RequestWebURLAction struct {
	URL                 string             `json:"url,omitempty"` // For web_url buttons, this URL is opened in a mobile browser when the button is tapped
	FallbackURL         string             `json:"fallback_url,omitempty"`
	WebviewHeightRatio  WebviewHeightRatio `json:"webview_height_ratio,omitempty"`
	MessengerExtensions bool               `json:"messenger_extensions,omitempty"`
}

RequestWebURLAction defines web URL action

func (*RequestWebURLAction) MarshalJSON

func (j *RequestWebURLAction) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestWebURLAction) MarshalJSONBuf

func (j *RequestWebURLAction) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestWebURLAction) UnmarshalJSON

func (j *RequestWebURLAction) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestWebURLAction) UnmarshalJSONFFLexer

func (j *RequestWebURLAction) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type RequestWhitelistDomain

type RequestWhitelistDomain struct {
	SettingType        string   `json:"setting_type"` // Must be domain_whitelisting.
	DomainActionType   string   `json:"domain_action_type"`
	WhitelistedDomains []string `json:"whitelisted_domains"`
}

RequestWhitelistDomain see https://developers.facebook.com/docs/messenger-platform/thread-settings/domain-whitelisting

func NewRequestWhitelistDomain

func NewRequestWhitelistDomain(domainActionType string, domains ...string) RequestWhitelistDomain

NewRequestWhitelistDomain creates new request for whitelisted domains

func (*RequestWhitelistDomain) MarshalJSON

func (j *RequestWhitelistDomain) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*RequestWhitelistDomain) MarshalJSONBuf

func (j *RequestWhitelistDomain) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*RequestWhitelistDomain) UnmarshalJSON

func (j *RequestWhitelistDomain) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*RequestWhitelistDomain) UnmarshalJSONFFLexer

func (j *RequestWhitelistDomain) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type SendMessage

type SendMessage struct {
	Recipient Recipient `json:"recipient"`
	Message   struct {
		Text string `json:"text"`
	} `json:"message"`
}

SendMessage ...

func (*SendMessage) MarshalJSON

func (j *SendMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*SendMessage) MarshalJSONBuf

func (j *SendMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*SendMessage) UnmarshalJSON

func (j *SendMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*SendMessage) UnmarshalJSONFFLexer

func (j *SendMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Sender

type Sender struct {
	Actor
}

Sender represents sender

func (*Sender) MarshalJSON

func (j *Sender) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Sender) MarshalJSONBuf

func (j *Sender) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Sender) UnmarshalJSON

func (j *Sender) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Sender) UnmarshalJSONFFLexer

func (j *Sender) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type TopElementStyle

type TopElementStyle string

TopElementStyle defines top element style

const (
	// TopElementStyleCompact for compact top element
	TopElementStyleCompact TopElementStyle = "compact"

	// TopElementStyleLarge for large top element
	TopElementStyleLarge TopElementStyle = "large"
)

type WebviewHeightRatio

type WebviewHeightRatio string

WebviewHeightRatio defines height ratio

const (
	// WebviewHeightRatioCompact is compact height ratio
	WebviewHeightRatioCompact WebviewHeightRatio = "compact"
	// WebviewHeightRatioTall is tall height ratio
	WebviewHeightRatioTall WebviewHeightRatio = "tall"
	// WebviewHeightRatioFull is full height ratio
	WebviewHeightRatioFull WebviewHeightRatio = "full"
)

type WhitelistedDomainsMessage

type WhitelistedDomainsMessage struct {
	WhitelistedDomains []string `json:"whitelisted_domains"`
}

func (*WhitelistedDomainsMessage) MarshalJSON

func (j *WhitelistedDomainsMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*WhitelistedDomainsMessage) MarshalJSONBuf

func (j *WhitelistedDomainsMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*WhitelistedDomainsMessage) UnmarshalJSON

func (j *WhitelistedDomainsMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*WhitelistedDomainsMessage) UnmarshalJSONFFLexer

func (j *WhitelistedDomainsMessage) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

Jump to

Keyboard shortcuts

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