Documentation ¶
Overview ¶
This package works with Google Assistant Actions SDK and provides bindings to support json encoding and decoding for some data types. Enough functionality to get a webhook and fulfillment working with TakeoutFMFM is supported.
https://developers.google.com/assistant/conversational/overview https://developers.google.com/assistant/conversational/prompts
Index ¶
- Constants
- type Card
- type Content
- type Context
- type Device
- type Handler
- type Home
- type Image
- type Intent
- type Media
- type MediaContext
- type MediaImage
- type MediaObject
- type Param
- type Params
- type Prompt
- type Scene
- type Session
- type SimpleResponse
- type Suggestion
- type TimeZone
- type User
- type WebhookRequest
- func (r WebhookRequest) AnyParam() string
- func (r WebhookRequest) ArtistParam() string
- func (r WebhookRequest) IntentName() string
- func (r WebhookRequest) LatestParam() string
- func (r WebhookRequest) PopularParam() string
- func (r WebhookRequest) RadioParam() string
- func (r WebhookRequest) ReleaseParam() string
- func (r *WebhookRequest) SessionParam(name string) string
- func (r WebhookRequest) SongParam() string
- func (r WebhookRequest) SupportsMedia() bool
- func (r WebhookRequest) SupportsRichResponse() bool
- func (r *WebhookRequest) UserParam(name string) string
- func (r WebhookRequest) Verified() bool
- func (r WebhookRequest) VerifiedStatus() string
- type WebhookResponse
- func (r *WebhookResponse) AddMedia(name, desc, url, image string)
- func (r *WebhookResponse) AddSession(id string)
- func (r *WebhookResponse) AddSessionParam(name, value string)
- func (r *WebhookResponse) AddSimple(speech, text string)
- func (r *WebhookResponse) AddSuggestions(suggestions ...string)
- func (r *WebhookResponse) AddUserParam(name, value string)
- func (h *WebhookResponse) Send(w http.ResponseWriter)
- func (r *WebhookResponse) SessionParam(name string) string
- func (r *WebhookResponse) UserParam(name string) string
Constants ¶
View Source
const ( GoogleAssistantSignature = "google-assistant-signature" MediaTypeAudio = "AUDIO" MediaControlPaused = "PAUSED" MediaControlStopped = "STOPPED" CapabilitySpeech = "SPEECH" CapabilityRichResponse = "RICH_RESPONSE" CapabilityLongFormAudio = "LONG_FORM_AUDIO" CapabilityInteractiveCanvas = "INTERACTIVE_CANVAS" CapabilityWebLink = "WEB_LINK" CapabilityHomeStorage = "HOME_STORAGE" VerificationStatusGuest = "GUEST" VerificationStatusVerified = "VERIFIED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Media *MediaContext `json:"media"`
}
type Media ¶
type Media struct { MediaObjects []*MediaObject `json:"mediaObjects,omitempty"` MediaType string `json:"mediaType,omitempty"` OptionalMediaControls []string `json:"optionalMediaControls,omitempty"` RepeatMode string `json:"repeatMode,omitempty"` }
type MediaContext ¶
type MediaImage ¶
type MediaObject ¶
type MediaObject struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` Image *MediaImage `json:"image"` }
type Params ¶
type Params struct { Artist *Param `json:"artist"` Song *Param `json:"song"` Release *Param `json:"release"` Radio *Param `json:"radio"` Popular *Param `json:"popular"` Latest *Param `json:"latest"` Any *Param `json:"any"` }
These params are Takeout specific. Included here to make overall json handing easier.
type Prompt ¶
type Prompt struct { Override bool `json:"override"` Content *Content `json:"content"` FirstSimple *SimpleResponse `json:"firstSimple"` LastSimple *SimpleResponse `json:"lastSimple"` Suggestions []*Suggestion `json:"suggestions,omitempty"` }
type SimpleResponse ¶
type Suggestion ¶
type Suggestion struct {
Title string `json:"title,omitempty"`
}
type WebhookRequest ¶
type WebhookRequest struct { Handler *Handler `json:"handler"` Intent *Intent `json:"intent"` Scene *Scene `json:"scene"` Session *Session `json:"session"` User *User `json:"user"` Home *Home `json:"home"` Device *Device `json:"device"` Context *Context `json:"Context"` }
func NewWebhookRequest ¶
func NewWebhookRequest(r *http.Request) *WebhookRequest
func (WebhookRequest) AnyParam ¶
func (r WebhookRequest) AnyParam() string
func (WebhookRequest) ArtistParam ¶
func (r WebhookRequest) ArtistParam() string
func (WebhookRequest) IntentName ¶
func (r WebhookRequest) IntentName() string
func (WebhookRequest) LatestParam ¶
func (r WebhookRequest) LatestParam() string
func (WebhookRequest) PopularParam ¶
func (r WebhookRequest) PopularParam() string
func (WebhookRequest) RadioParam ¶
func (r WebhookRequest) RadioParam() string
func (WebhookRequest) ReleaseParam ¶
func (r WebhookRequest) ReleaseParam() string
func (*WebhookRequest) SessionParam ¶
func (r *WebhookRequest) SessionParam(name string) string
func (WebhookRequest) SongParam ¶
func (r WebhookRequest) SongParam() string
func (WebhookRequest) SupportsMedia ¶
func (r WebhookRequest) SupportsMedia() bool
func (WebhookRequest) SupportsRichResponse ¶
func (r WebhookRequest) SupportsRichResponse() bool
func (*WebhookRequest) UserParam ¶
func (r *WebhookRequest) UserParam(name string) string
func (WebhookRequest) Verified ¶
func (r WebhookRequest) Verified() bool
func (WebhookRequest) VerifiedStatus ¶
func (r WebhookRequest) VerifiedStatus() string
type WebhookResponse ¶
type WebhookResponse struct { Session *Session `json:"session"` User *User `json:"user"` Home *Home `json:"home"` Prompt *Prompt `json:"prompt"` }
func NewWebhookResponse ¶
func NewWebhookResponse(r *WebhookRequest) *WebhookResponse
func (*WebhookResponse) AddMedia ¶
func (r *WebhookResponse) AddMedia(name, desc, url, image string)
func (*WebhookResponse) AddSession ¶
func (r *WebhookResponse) AddSession(id string)
func (*WebhookResponse) AddSessionParam ¶
func (r *WebhookResponse) AddSessionParam(name, value string)
func (*WebhookResponse) AddSimple ¶
func (r *WebhookResponse) AddSimple(speech, text string)
func (*WebhookResponse) AddSuggestions ¶
func (r *WebhookResponse) AddSuggestions(suggestions ...string)
func (*WebhookResponse) AddUserParam ¶
func (r *WebhookResponse) AddUserParam(name, value string)
func (*WebhookResponse) Send ¶
func (h *WebhookResponse) Send(w http.ResponseWriter)
func (*WebhookResponse) SessionParam ¶
func (r *WebhookResponse) SessionParam(name string) string
func (*WebhookResponse) UserParam ¶
func (r *WebhookResponse) UserParam(name string) string
Click to show internal directories.
Click to hide internal directories.