Documentation ¶
Index ¶
- Constants
- 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
- type AudioPlayerClearQueueBehavior
- type AudioPlayerPlayBehavior
- type CanFulfillIntentAnswer
- type CanFulfillIntentPayload
- type CanFulfillIntentSlot
- type Directive
- 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) GetSlotValue(slotName string) (string, error)
- func (this *EchoRequest) GetUserID() string
- func (this *EchoRequest) VerifyAppID(myAppID string) bool
- func (this *EchoRequest) VerifyTimestamp() bool
- type EchoRespBody
- type EchoRespImage
- type EchoRespPayload
- type EchoResponse
- func (this *EchoResponse) AudioPlayerClearQueue(clearBehavior AudioPlayerClearQueueBehavior) *EchoResponse
- func (this *EchoResponse) AudioPlayerPlay(behavior AudioPlayerPlayBehavior, streamUrl, token string, prevToken *string, ...) *EchoResponse
- func (this *EchoResponse) AudioPlayerStop() *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)
- func (this *EchoResponse) VideoAppLaunch(streamUrl, title, subtitle string) *EchoResponse
- type EchoSession
- type EchoSlot
- type EchoSlotAuthority
- type EchoSlotAuthorityValue
- type EchoSlotAuthorityValueCollection
- type EchoSlotResolutions
- 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 ¶
View Source
const ( CanFulfillIntentAnswerYes CanFulfillIntentAnswer = "YES" CanFulfillIntentAnswerNo = "NO" CanFulfillIntentAnswerMaybe = "MAYBE" )
Variables ¶
View Source
var Applications = map[string]interface{}{}
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
Types ¶
type AudioPlayerClearQueueBehavior ¶
type AudioPlayerClearQueueBehavior string
const ( ClearEnqueued AudioPlayerClearQueueBehavior = "CLEAR_ENQUEUED" ClearAll AudioPlayerClearQueueBehavior = "CLEAR_ALL" )
type AudioPlayerPlayBehavior ¶
type AudioPlayerPlayBehavior string
const ( ReplaceAll AudioPlayerPlayBehavior = "REPLACE_ALL" Enqueue AudioPlayerPlayBehavior = "ENQUEUE" ReplaceEnqueued AudioPlayerPlayBehavior = "REPLACE_ENQUEUED" )
type CanFulfillIntentAnswer ¶
type CanFulfillIntentAnswer string
type CanFulfillIntentPayload ¶
type CanFulfillIntentPayload struct { CanFulfill CanFulfillIntentAnswer `json:"canFulfill"` Slots map[string]CanFulfillIntentSlot `json:"slots,omitempty"` }
type CanFulfillIntentSlot ¶
type CanFulfillIntentSlot struct { CanUnderstand CanFulfillIntentAnswer `json:"canUnderstand"` CanFulfill CanFulfillIntentAnswer `json:"canFulfill"` }
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 EchoContext struct { System struct { ApiEndpoint string `json:"apiEndpoint,omitempty"` ApiAccessToken string `json:"apiAccessToken,omitempty"` Device struct { DeviceId string `json:"deviceId,omitempty"` } `json:"device,omitempty"` Application struct { ApplicationID string `json:"applicationId,omitempty"` } `json:"application,omitempty"` User struct { AccessToken string `json:"accessToken,omitempty"` UserId string `json:"userId,omitempty"` Permissions struct { ConsentToken string `json:"consentToken,omitempty"` } `json:"permissions,omitempty"` } `json:"user,omitempty"` } `json:"System,omitempty"` }
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) VerifyAppID ¶
func (this *EchoRequest) VerifyAppID(myAppID string) bool
func (*EchoRequest) VerifyTimestamp ¶
func (this *EchoRequest) VerifyTimestamp() bool
Request Functions
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,omitempty"` // Same Directives []Directive `json:"directives,omitempty"` CanFulfillIntent *CanFulfillIntentPayload `json:"canFulfillIntent,omitempty"` }
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) AudioPlayerClearQueue ¶
func (this *EchoResponse) AudioPlayerClearQueue(clearBehavior AudioPlayerClearQueueBehavior) *EchoResponse
func (*EchoResponse) AudioPlayerPlay ¶
func (this *EchoResponse) AudioPlayerPlay( behavior AudioPlayerPlayBehavior, streamUrl, token string, prevToken *string, offsetMs int, ) *EchoResponse
func (*EchoResponse) AudioPlayerStop ¶
func (this *EchoResponse) AudioPlayerStop() *EchoResponse
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)
func (*EchoResponse) VideoAppLaunch ¶
func (this *EchoResponse) VideoAppLaunch( streamUrl, title, subtitle string, ) *EchoResponse
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 *EchoSlotResolutions `json:"resolutions,omitempty"` }
type EchoSlotAuthority ¶
type EchoSlotAuthority struct { Authority string `json:"authority"` Values []EchoSlotAuthorityValueCollection `json:"values,omitempty"` }
type EchoSlotAuthorityValue ¶
type EchoSlotAuthorityValueCollection ¶
type EchoSlotAuthorityValueCollection struct {
Value *EchoSlotAuthorityValue `json:"value,omitempty"`
}
type EchoSlotResolutions ¶
type EchoSlotResolutions struct {
ResolutionsPerAuthority []EchoSlotAuthority `json:"resolutionsPerAuthority,omitempty"`
}
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.