Documentation ¶
Index ¶
- Variables
- func HTTPError(w http.ResponseWriter, logMsg string, err string, errCode int)
- func Init(apps map[string]interface{}, router *mux.Router)
- func IsValidAlexaRequest(w http.ResponseWriter, r *http.Request) bool
- func Run(apps map[string]interface{}, port string)
- func RunSSL(apps map[string]interface{}, port, cert, key string) error
- func SetEchoPrefix(prefix string)
- func SetRootPrefix(prefix string)
- type EchoApplication
- type EchoContext
- type EchoIntent
- type EchoReprompt
- type EchoReqBody
- type EchoRequest
- func (this *EchoRequest) AllSlots() map[string]EchoSlot
- func (this *EchoRequest) GetIntentName() string
- func (this *EchoRequest) GetRequestType() string
- func (this *EchoRequest) GetSessionID() string
- func (this *EchoRequest) GetSlot(slotName string) (EchoSlot, error)
- func (this *EchoRequest) GetSlotValue(slotName string) (string, error)
- func (this *EchoRequest) GetUserID() string
- func (this *EchoRequest) Locale() string
- func (this *EchoRequest) VerifyAppID(myAppID string) bool
- func (this *EchoRequest) VerifyTimestamp() bool
- type EchoResolution
- type EchoResolutionPerAuthority
- type EchoRespBody
- type EchoRespImage
- type EchoRespPayload
- type EchoResponse
- func (this *EchoResponse) Card(title string, content string) *EchoResponse
- func (this *EchoResponse) EndSession(flag bool) *EchoResponse
- func (this *EchoResponse) LinkAccountCard() *EchoResponse
- func (this *EchoResponse) OutputSpeech(text string) *EchoResponse
- func (this *EchoResponse) OutputSpeechSSML(text string) *EchoResponse
- func (this *EchoResponse) Reprompt(text string) *EchoResponse
- func (this *EchoResponse) RepromptSSML(text string) *EchoResponse
- func (this *EchoResponse) SimpleCard(title string, content string) *EchoResponse
- func (this *EchoResponse) StandardCard(title string, content string, smallImg string, largeImg string) *EchoResponse
- func (this *EchoResponse) String() ([]byte, error)
- type EchoSession
- type EchoSlot
- type SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendAmazonEffect(text, name string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendAudio(src string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendBreak(strength, time string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendEmphasis(text, level string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendParagraph(text string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendPlainSpeech(text string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendProsody(text, rate, pitch, volume string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendSentence(text string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) AppendSubstitution(text, alias string) *SSMLTextBuilder
- func (builder *SSMLTextBuilder) Build() string
- type StdApplication
Constants ¶
This section is empty.
Variables ¶
View Source
var Applications = map[string]interface{}{}
View Source
var EchoPrefix = "/echo/"
View Source
var RootPrefix = "/"
Functions ¶
func IsValidAlexaRequest ¶
func IsValidAlexaRequest(w http.ResponseWriter, r *http.Request) bool
IsValidAlexaRequest handles all the necessary steps to validate that an incoming http.Request has actually come from the Alexa service. If an error occurs during the validation process, an http.Error will be written to the provided http.ResponseWriter. The required steps for request validation can be found on this page: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service#hosting-a-custom-skill-as-a-web-service
func SetEchoPrefix ¶
func SetEchoPrefix(prefix string)
func SetRootPrefix ¶
func SetRootPrefix(prefix string)
Types ¶
type EchoApplication ¶
type EchoApplication struct { AppID string Handler func(http.ResponseWriter, *http.Request) OnLaunch func(*EchoRequest, *EchoResponse) OnIntent func(*EchoRequest, *EchoResponse) OnSessionEnded func(*EchoRequest, *EchoResponse) OnAudioPlayerState func(*EchoRequest, *EchoResponse) }
type EchoContext ¶
type EchoIntent ¶
type EchoReprompt ¶
type EchoReprompt struct {
OutputSpeech EchoRespPayload `json:"outputSpeech,omitempty"`
}
type EchoReqBody ¶
type EchoRequest ¶
type EchoRequest struct { Version string `json:"version"` Session EchoSession `json:"session"` Request EchoReqBody `json:"request"` Context EchoContext `json:"context"` }
func GetEchoRequest ¶
func GetEchoRequest(r *http.Request) *EchoRequest
func (*EchoRequest) AllSlots ¶
func (this *EchoRequest) AllSlots() map[string]EchoSlot
func (*EchoRequest) GetIntentName ¶
func (this *EchoRequest) GetIntentName() string
func (*EchoRequest) GetRequestType ¶
func (this *EchoRequest) GetRequestType() string
func (*EchoRequest) GetSessionID ¶
func (this *EchoRequest) GetSessionID() string
func (*EchoRequest) GetSlotValue ¶
func (this *EchoRequest) GetSlotValue(slotName string) (string, error)
func (*EchoRequest) GetUserID ¶
func (this *EchoRequest) GetUserID() string
func (*EchoRequest) Locale ¶
func (this *EchoRequest) Locale() string
Locale returns the locale specified in the request.
func (*EchoRequest) VerifyAppID ¶
func (this *EchoRequest) VerifyAppID(myAppID string) bool
func (*EchoRequest) VerifyTimestamp ¶
func (this *EchoRequest) VerifyTimestamp() bool
Request Functions
type EchoResolution ¶
type EchoResolution struct {
ResolutionsPerAuthority []EchoResolutionPerAuthority `json:"resolutionsPerAuthority"`
}
type EchoRespBody ¶
type EchoRespBody struct { OutputSpeech *EchoRespPayload `json:"outputSpeech,omitempty"` Card *EchoRespPayload `json:"card,omitempty"` Reprompt *EchoReprompt `json:"reprompt,omitempty"` // Pointer so it's dropped if empty in JSON response. ShouldEndSession bool `json:"shouldEndSession"` }
type EchoRespImage ¶
type EchoRespPayload ¶
type EchoResponse ¶
type EchoResponse struct { Version string `json:"version"` SessionAttributes map[string]interface{} `json:"sessionAttributes,omitempty"` Response EchoRespBody `json:"response"` }
func (*EchoResponse) Card ¶
func (this *EchoResponse) Card(title string, content string) *EchoResponse
func (*EchoResponse) EndSession ¶
func (this *EchoResponse) EndSession(flag bool) *EchoResponse
func (*EchoResponse) LinkAccountCard ¶
func (this *EchoResponse) LinkAccountCard() *EchoResponse
func (*EchoResponse) OutputSpeech ¶
func (this *EchoResponse) OutputSpeech(text string) *EchoResponse
func (*EchoResponse) OutputSpeechSSML ¶
func (this *EchoResponse) OutputSpeechSSML(text string) *EchoResponse
func (*EchoResponse) Reprompt ¶
func (this *EchoResponse) Reprompt(text string) *EchoResponse
func (*EchoResponse) RepromptSSML ¶
func (this *EchoResponse) RepromptSSML(text string) *EchoResponse
func (*EchoResponse) SimpleCard ¶
func (this *EchoResponse) SimpleCard(title string, content string) *EchoResponse
func (*EchoResponse) StandardCard ¶
func (this *EchoResponse) StandardCard(title string, content string, smallImg string, largeImg string) *EchoResponse
func (*EchoResponse) String ¶
func (this *EchoResponse) String() ([]byte, error)
type EchoSession ¶
type EchoSession struct { New bool `json:"new"` SessionID string `json:"sessionId"` Application struct { ApplicationID string `json:"applicationId"` } `json:"application"` Attributes map[string]interface{} `json:"attributes"` User struct { UserID string `json:"userId"` AccessToken string `json:"accessToken,omitempty"` } `json:"user"` }
type EchoSlot ¶
type EchoSlot struct { Name string `json:"name"` Value string `json:"value"` Resolutions EchoResolution `json:"resolutions"` }
type SSMLTextBuilder ¶
type SSMLTextBuilder struct {
// contains filtered or unexported fields
}
func NewSSMLTextBuilder ¶
func NewSSMLTextBuilder() *SSMLTextBuilder
func (*SSMLTextBuilder) AppendAmazonEffect ¶
func (builder *SSMLTextBuilder) AppendAmazonEffect(text, name string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendAudio ¶
func (builder *SSMLTextBuilder) AppendAudio(src string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendBreak ¶
func (builder *SSMLTextBuilder) AppendBreak(strength, time string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendEmphasis ¶
func (builder *SSMLTextBuilder) AppendEmphasis(text, level string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendParagraph ¶
func (builder *SSMLTextBuilder) AppendParagraph(text string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendPlainSpeech ¶
func (builder *SSMLTextBuilder) AppendPlainSpeech(text string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendProsody ¶
func (builder *SSMLTextBuilder) AppendProsody(text, rate, pitch, volume string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendSentence ¶
func (builder *SSMLTextBuilder) AppendSentence(text string) *SSMLTextBuilder
func (*SSMLTextBuilder) AppendSubstitution ¶
func (builder *SSMLTextBuilder) AppendSubstitution(text, alias string) *SSMLTextBuilder
func (*SSMLTextBuilder) Build ¶
func (builder *SSMLTextBuilder) Build() string
type StdApplication ¶
type StdApplication struct { Methods string Handler func(http.ResponseWriter, *http.Request) }
Click to show internal directories.
Click to hide internal directories.