dfcx

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Parameters   map[string]string `json:"parameters,omitempty"`
	Name         string            `json:"name"`
	LanguageCode string            `json:"languageCode"`
}

type FormInfo

type FormInfo struct {
	ParameterInfo []ParameterInfo `json:"parameterInfo,omitempty"`
}

FormInfo has been added 2022-03-15

type FulfillmentInfo

type FulfillmentInfo struct {
	Tag string `json:"tag,omitempty"`
}

type FulfillmentResponse

type FulfillmentResponse struct {
	// https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1#ResponseMessage
	Messages      []Message `json:"messages,omitempty"`
	MergeBehavior int
}

func (*FulfillmentResponse) AddMessage

func (fr *FulfillmentResponse) AddMessage(m Message)

type Icon

type Icon struct {
	Color string `json:"color,omitempty"`
	Type  string `json:"type"`
}

type IntentInfo

type IntentInfo struct {
	LastMatchedIntent string  `json:"lastMatchedIntent,omitempty"`
	DisplayName       string  `json:"displayName,omitempty"`
	Confidence        float64 `json:"confidence,omitempty"`
}

type Message

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

type Messages

type Messages struct {
	Text         Text   `json:"text,omitempty"`
	ResponseType string `json:"responseType,omitempty"`
	Source       string `json:"source,omitempty"`
}

type OutputAudioText

type OutputAudioText struct {
	AllowPlaybackInterruption bool   `json:"allowPlaybackInterruption,omitempty"`
	Source                    Source `json:"source,omitempty"`
}

type OutputAudioTextMessage

type OutputAudioTextMessage struct {
	OutputAudioText OutputAudioText `json:"outputAudioText,omitempty"`
}

type PageInfo

type PageInfo struct {
	CurrentPage string   `json:"currentPage,omitempty"`
	DisplayName string   `json:"displayName,omitempty"`
	FormInfo    FormInfo `json:"formInfo,omitempty"`
}

type ParameterInfo

type ParameterInfo struct {
	DisplayName   string      `json:"displayName,omitempty"`
	Required      bool        `json:"required,omitempty"`
	State         string      `json:"state,omitempty"`
	Value         interface{} `json:"value,omitempty"`
	JustCollected bool        `json:"justCollected,omitempty"`
}

type PayloadMessage

type PayloadMessage struct {
	Payload map[string]interface{} `json:"payload,omitempty"`
}

Rethink - may not work.

type RichContent

type RichContent struct {
	Type  string `json:"type"`
	Title string `json:"title"`
	Text  string `json:"text"`
	Event *Event `json:"event,omitempty"`
	Icon  *Icon  `json:"icon,omitempty"`
	Link  string `json:"link,omitempty"`
}

type RichContents

type RichContents struct {
	RichContent [][]*RichContent `json:"richContent"`
}

func (*RichContents) AddContents

func (cs *RichContents) AddContents(c *RichContent)

type RichContentsMessage

type RichContentsMessage struct {
	Payload *RichContents `json:"payload"`
}

func NewRichContentsMessage

func NewRichContentsMessage(c *RichContent) *RichContentsMessage

type SessionInfo

type SessionInfo struct {
	Session    string                 `json:"session,omitempty"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

func (*SessionInfo) ExtractSession

func (si *SessionInfo) ExtractSession() (string, error)

type Source

type Source struct {
	Text string `json:"text,omitempty"`
	SSML string `json:"ssml,omitempty"`
}

type Text

type Text struct {
	Text                      []string `json:"text,omitempty"`
	RedactedText              []string `json:"redactedText,omitempty"`
	AllowPlaybackInterruption bool     `json:"allowPlaybackInterruption,omitempty"`
}

type TextMessage

type TextMessage struct {
	Text Text `json:"text,omitempty"`
}

Response Messages

type WebhookRequest

type WebhookRequest struct {
	DetectIntentResponseID string                 `json:"detectIntentResponseId,omitempty"`
	IntentInfo             IntentInfo             `json:"intentInfo,omitempty"`
	PageInfo               PageInfo               `json:"pageInfo,omitempty"`
	SessionInfo            SessionInfo            `json:"sessionInfo,omitempty"`
	FulfillmentInfo        FulfillmentInfo        `json:"fulfillmentInfo,omitempty"`
	Messages               []Messages             `json:"messages,omitempty"`
	Payload                map[string]interface{} `json:"payload,omitempty"`
	Text                   string                 `json:"text,omitempty"`
	LanguageCode           string                 `json:"languageCode,omitempty"`
}

Structs are fun ()

func FromReader

func FromReader(r io.Reader) (*WebhookRequest, error)

func FromRequest

func FromRequest(r *http.Request) (*WebhookRequest, error)

func (*WebhookRequest) FromReader

func (wr *WebhookRequest) FromReader(r io.Reader) error

func (*WebhookRequest) FromRequest

func (wr *WebhookRequest) FromRequest(r *http.Request) error

type WebhookRequests

type WebhookRequests []*WebhookRequest

Added to make testing easier.

func (*WebhookRequests) UnmarshalJSONReader

func (wrs *WebhookRequests) UnmarshalJSONReader(r io.Reader) error

func (*WebhookRequests) UnmarshalJSONToReaders

func (wrs *WebhookRequests) UnmarshalJSONToReaders(r io.Reader) ([]io.Reader, error)

Returns Readers to supply as Request Bodies for testing purposes.

type WebhookResponse

type WebhookResponse struct {
	FulfillmentResponse *FulfillmentResponse `json:"fulfillmentResponse,omitempty"`
	PageInfo            *PageInfo            `json:"pageInfo,omitempty"`
	SessionInfo         *SessionInfo         `json:"sessionInfo,omitempty"`
	Payload             map[string]string    `json:"payload,omitempty"`
}

func NewTextResponse

func NewTextResponse(msgs ...string) *WebhookResponse

Helpers

func (*WebhookResponse) AddMessage

func (r *WebhookResponse) AddMessage(m Message) *WebhookResponse

func (*WebhookResponse) Respond

func (r *WebhookResponse) Respond(w http.ResponseWriter) error

func (*WebhookResponse) SSMLResponse

func (wr *WebhookResponse) SSMLResponse(w http.ResponseWriter, msg string)

func (*WebhookResponse) TextResponse

func (wr *WebhookResponse) TextResponse(w http.ResponseWriter, msgs ...string)

Jump to

Keyboard shortcuts

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