Documentation
¶
Index ¶
- Variables
- type Alexa
- func (a *Alexa) Handler() http.Handler
- func (a *Alexa) OnAudioPlayer(h HandleFunc)
- func (a *Alexa) OnIntent(h HandleFunc)
- func (a *Alexa) OnLaunch(h HandleFunc)
- func (a *Alexa) OnSessionEnded(h HandleFunc)
- func (a *Alexa) OnSessionStarted(h HandleFunc)
- func (a *Alexa) Process(r *Request) (*Response, error)
- type Card
- type Directive
- type HandleFunc
- type Image
- type Intent
- type Options
- type OutputSpeech
- type Reprompt
- type Request
- func (r *Request) APIAccessToken() string
- func (r *Request) APIEndpoint() string
- func (r *Request) ApplicationID() string
- func (r *Request) DeviceID() string
- func (r *Request) IntentName() string
- func (r *Request) SessionID() string
- func (r *Request) Slot(name string) (*Slot, error)
- func (r *Request) UserID() string
- type Response
- func (r *Response) EndSession(end bool)
- func (r *Response) LinkAccountCard()
- func (r *Response) OutputSpeech(content string)
- func (r *Response) OutputSpeechSSML(content string)
- func (r *Response) RepromptSSML(content string)
- func (r *Response) RepromptSpeech(content string)
- func (r *Response) SimpleCard(title, content string)
- func (r *Response) StandardCard(title, content, smallImageURL, largeImageURL string)
- func (r *Response) String() (string, error)
- type ResponseObject
- type ResponseWriter
- type Slot
- type Stream
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyApplicationID = errors.New("Application ID should not be empty") ErrEmptyRequestApplicationID = errors.New("Request Application ID should not be empty") ErrNotSameApplicationID = errors.New("Application ID and Request Application ID is not the same") ErrInvalidTimestamp = errors.New("Invalid timestamp") ErrChainURL = errors.New("Unable to find certificate chain header") ErrBadChainURL = errors.New("Chain URL is not valid") ErrDownloadCert = errors.New("Certificate could not be downloaded") ErrReadCert = errors.New("Could not read certification content") ErrParsePem = errors.New("Failed to parse certificate PEM") ErrBadCertDate = errors.New("Certificate is not valid") )
var (
ErrNoSlotFound = errors.New("No slot found")
)
Functions ¶
This section is empty.
Types ¶
type Alexa ¶
type Alexa struct {
ApplicationID string
IgnoreTimestamp bool
IgnoreCertVerify bool
// contains filtered or unexported fields
}
Alexa represents the Alexa app.
func (*Alexa) OnAudioPlayer ¶
func (a *Alexa) OnAudioPlayer(h HandleFunc)
OnAudioPlayer sets the audio player handler.
func (*Alexa) OnSessionEnded ¶
func (a *Alexa) OnSessionEnded(h HandleFunc)
OnSessionEnded sets the session ended handler.
func (*Alexa) OnSessionStarted ¶
func (a *Alexa) OnSessionStarted(h HandleFunc)
OnSessionStarted sets the session started handler.
type Card ¶
type Card struct {
Type string `json:"type"`
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
Text string `json:"text,omitempty"`
Image *Image `json:"image,omitempty"`
}
Card represents the card object in the response to Alexa.
type Directive ¶
type Directive struct {
Type string `json:"type"`
PlayBehavior string `json:"playBehavior,omitempty"`
AudioItem *struct {
Stream *Stream `json:"stream,omitempty"`
} `json:"audioItem,omitempty"`
}
Directive represents the directive object in the response to Alexa.
type HandleFunc ¶
type HandleFunc func(ResponseWriter, *Request) error
HandleFunc represents the handler function.
type Image ¶
type Image struct {
SmallImageURL string `json:"smallImageUrl,omitempty"`
LargeImageURL string `json:"largeImageUrl,omitempty"`
}
Image represents the image object in the response to alexa.
type OutputSpeech ¶
type OutputSpeech struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
SSML string `json:"ssml,omitempty"`
}
OutputSpeech represents the output speech object in the response to Alexa.
type Reprompt ¶
type Reprompt struct {
OutputSpeech *OutputSpeech `json:"outputSpeech,omitempty"`
}
Reprompt represents the reprompt object in the response to Alexa.
type Request ¶
type Request struct {
Context struct {
AudioPlayer struct {
OffsetInMilliseconds int `json:"offsetInMilliseconds"`
PlayerActivity string `json:"playerActivity"`
Token string `json:"token"`
} `json:"AudioPlayer"`
System struct {
APIAccessToken string `json:"apiAccessToken"`
APIEndpoint string `json:"apiEndpoint"`
Application struct {
ApplicationID string `json:"applicationId"`
} `json:"application"`
Device struct {
DeviceID string `json:"deviceId"`
SupportedInterfaces struct {
AudioPlayer struct{} `json:"AudioPlayer"`
} `json:"supportedInterfaces"`
} `json:"device"`
User struct {
AccessToken string `json:"accessToken"`
Permissions struct {
ConsentToken string `json:"consentToken"`
} `json:"permissions"`
UserID string `json:"userId"`
} `json:"user"`
} `json:"System"`
} `json:"context"`
Session struct {
New bool `json:"new"`
SessionID string `json:"sessionId"`
Attributes struct {
} `json:"attributes"`
User struct {
AccessToken string `json:"accessToken"`
UserID string `json:"userId"`
} `json:"user"`
Application struct {
ApplicationID string `json:"applicationId"`
} `json:"application"`
} `json:"session"`
Request struct {
Locale string `json:"locale"`
Timestamp string `json:"timestamp"`
Type string `json:"type"`
RequestID string `json:"requestId"`
Intent *Intent `json:"intent"`
} `json:"request"`
Version string `json:"version"`
}
Request represents the payload object from Alexa.
func (*Request) APIAccessToken ¶
APIAccessToken returns the access token for Alexa API.
func (*Request) APIEndpoint ¶
APIEndpoint returns Alexa API endpoint.
func (*Request) ApplicationID ¶
ApplicationID returns the application id.
func (*Request) IntentName ¶
IntentName returns the intent name.
type Response ¶
type Response struct {
Response *ResponseObject `json:"response"`
SessionAttributes map[string]interface{} `json:"sessionAttributes,omitempty"`
Version string `json:"version"`
}
Response represents the top level response object to Alexa.
func (*Response) EndSession ¶
EndSession will set the should session end value.
func (*Response) LinkAccountCard ¶
func (r *Response) LinkAccountCard()
LinkAccountCard will set the response card as a link account card.
func (*Response) OutputSpeech ¶
OutputSpeech will set the output speech as plain text.
func (*Response) OutputSpeechSSML ¶
OutputSpeechSSML will set the output speech as SSML.
func (*Response) RepromptSSML ¶
RepromptSSML will set the reprompt output speech as SSML.
func (*Response) RepromptSpeech ¶
RepromptSpeech will set the reprompt output speech as plain text.
func (*Response) SimpleCard ¶
SimpleCard will set the response card as a simple card.
func (*Response) StandardCard ¶
StandardCard will set the response card as a standard card with images.
type ResponseObject ¶
type ResponseObject struct {
OutputSpeech *OutputSpeech `json:"outputSpeech,omitempty"`
Card *Card `json:"card,omitempty"`
Reprompt *Reprompt `json:"reprompt,omitempty"`
Directives *[]Directive `json:"directives,omitempty"`
ShouldSessionEnd bool `json:"shouldEndSession"`
}
ResponseObject represents the response object in the response to Alexa.
type ResponseWriter ¶
type ResponseWriter interface {
EndSession(bool)
LinkAccountCard()
OutputSpeech(string)
OutputSpeechSSML(string)
RepromptSpeech(string)
RepromptSSML(string)
SimpleCard(string, string)
StandardCard(string, string, string, string)
String() (string, error)
}
ResponseWriter represents the interface that handle a response to Alexa.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
lambda-apex
command
|
|
|
lambda-aws
command
|
|
|
lambda-eawsy
command
|
|
|
simple
command
|