alexa

package
v0.0.0-...-7bbbcfe Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RgbToHex

func RgbToHex(r, g, b int) string

RgbToHex converts single rgb values to a hex string representation.

Types

type Application

type Application struct {
	ApplicationID string `json:"applicationId"`
}

Application object with the applications unique id.

type AudioItemMetadata

type AudioItemMetadata struct {
	Title           string              `json:"title,omitempty"`
	Subtitle        string              `json:"subtitle,omitempty"`
	Art             *DisplayImageObject `json:"art,omitempty"`
	BackgroundImage *DisplayImageObject `json:"backgroundImage,omitempty"`
}

AudioItemMetadata contains an object providing metadata about the audio to be displayed on the Echo Show and Echo Spot.

func (*AudioItemMetadata) SetArtImage

func (m *AudioItemMetadata) SetArtImage(contentDescription string) *DisplayImageObject

SetArtImage sets the art image description for the audio item metadata.

func (*AudioItemMetadata) SetBackgroundImage

func (m *AudioItemMetadata) SetBackgroundImage(contentDescription string) *DisplayImageObject

SetBackgroundImage sets the content description for the background image for the audio item metadata.

type AudioPlayer

type AudioPlayer struct {
	Token                string `json:"token,omitempty"`
	OffsetInMilliseconds int    `json:"offsetInMilliseconds,omitempty"`
	PlayerActivity       string `json:"playerActivity"`
}

AudioPlayer object providing the current state for the AudioPlayer interface.

type AudioPlayerClearQueueDirective

type AudioPlayerClearQueueDirective struct {
	Type          string `json:"type"`
	ClearBehavior string `json:"clearBehavior"`
}

AudioPlayerClearQueueDirective clears the audio playback queue. You can set this directive to clear the queue without stopping the currently playing stream, or clear the queue and stop any currently playing stream.

type AudioPlayerPlayDirective

type AudioPlayerPlayDirective struct {
	Type         string `json:"type"`
	PlayBehavior string `json:"playBehavior"`
	AudioItem    struct {
		Stream struct {
			URL                   string `json:"url"`
			Token                 string `json:"token"`
			ExpectedPreviousToken string `json:"expectedPreviousToken,omitempty"`
			OffsetInMilliseconds  int    `json:"offsetInMilliseconds"`
		} `json:"stream"`
		Metadata *AudioItemMetadata `json:"metadata,omitempty"`
	} `json:"audioItem"`
}

AudioPlayerPlayDirective sends Alexa a command to stream the audio file identified by the specified audioItem. Use the playBehavior parameter to determine whether the stream begins playing immediately, or is added to the queue. shouldEndSession should be set to false otherwise playback will pause immediately

func (*AudioPlayerPlayDirective) SetAudioItemMetadata

func (d *AudioPlayerPlayDirective) SetAudioItemMetadata(title, subtitle string) *AudioItemMetadata

SetAudioItemMetadata sets the metadata attributes for the audio item associated with the play directive.

func (*AudioPlayerPlayDirective) SetAudioItemStream

func (d *AudioPlayerPlayDirective) SetAudioItemStream(url, token, expectedPreviousToken string, offsetInMilliseconds int)

SetAudioItemStream sets the stream attributes for the audio item associated with the play directive.

type AudioPlayerPlaybackFailedRequest

type AudioPlayerPlaybackFailedRequest struct {
	AudioPlayerRequest
	Error struct {
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"error"`
	CurrentPlaybackState struct {
		Token                string `json:"token"`
		OffsetInMilliseconds int    `json:"offsetInMilliseconds"`
		PlayerActivity       string `json:"playerActivity"`
	} `json:"currentPlaybackState"`
}

AudioPlayerPlaybackFailedRequest is sent when Alexa encounters an error when attempting to play a stream.

type AudioPlayerRequest

type AudioPlayerRequest struct {
	CommonRequest
	Token                string `json:"token"`
	OffsetInMilliseconds int    `json:"offsetInMilliseconds"`
}

AudioPlayerRequest represents an incoming request from the Audioplayer Interface. It does not have a session context. Response to such a request must be a AudioPlayerDirective or empty

type AudioPlayerStopDirective

type AudioPlayerStopDirective struct {
	Type string `json:"type"`
}

AudioPlayerStopDirective stopts the current audio playback

type Card

type Card struct {
	// A string describing the type of card to render. Values: 'Simple', 'Standard', 'LinkAccount'
	Type string `json:"type,omitempty"`
	// A string containing the title of the card. (not applicable for cards of type LinkAccount).
	Title string `json:"title,omitempty"`
	// A string containing the contents of a Simple card (not applicable for cards of type Standard or LinkAccount).
	Content string `json:"content,omitempty"`
	// A string containing the contents of a Simple card (not applicable for cards of type Standard or LinkAccount).
	Text string `json:"text,omitempty"`
	// An image object that specifies the URLs for the image to display on a Standard card. Only applicable for Standard cards.
	Image struct {
		SmallImageURL string `json:"smallImageUrl,omitempty"`
		LargeImageURL string `json:"largeImageUrl,omitempty"`
	} `json:"image,omitempty"`
	// A list of scope strings that maps to Alexa permissions.
	// Include only those Alexa permissions that are both needed by your skill and that are declared in your skill metadata on the Amazon Developer Portal.
	Permissions []string `json:"permissions"`
}

Card containing a card to render to the Amazon Alexa App

type CommonRequest

type CommonRequest struct {
	Type      string `json:"type"`
	RequestID string `json:"requestId"`
	Timestamp string `json:"timestamp"`
	Locale    string `json:"locale"`
	// Set manually from request envelope
	Session *Session
	Context *Context
}

CommonRequest contains the attributes all alexa requests have in common.

type Context

type Context struct {
	System      System      `json:"System"`
	AudioPlayer AudioPlayer `json:"audioPlayer"`
}

Context object provides your skill with information about the current state of the Alexa service and device at the time the request is sent to your service.

type Device

type Device struct {
	DeviceID            string                 `json:"deviceId"`
	SupportedInterfaces map[string]interface{} `json:"supportedInterfaces"`
}

Device object providing information about the device used to send the request.

type DeviceAddress

type DeviceAddress struct {
	DeviceShortAddress
	StateOrRegion    string `json:"stateOrRegion"`
	City             string `json:"city"`
	AddressLine1     string `json:"addressLine1"`
	AddressLine2     string `json:"addressLine2"`
	AddressLine3     string `json:"addressLine3"`
	DistrictOrCounty string `json:"districtOrCounty"`
}

DeviceAddress contains all the customers address informations.

type DeviceAddressService

type DeviceAddressService interface {
	// GetCountyAndPostelCode gets the country and postal code associated with a device specified by deviceId in the syste struct.
	GetCountryAndPostalCode(system *System) (*DeviceShortAddress, error)
	// GetFullAddress gets the full address associated with the device specified by deviceId in the system struct.
	GetFullAddress(system *System) (*DeviceAddress, error)
	//IsNotAuthorizedError return true if it is a not authorized error
	IsNotAuthorizedError(err error) bool
}

DeviceAddressService provides methods to read customer adress information data.

func GetDeviceAddressService

func GetDeviceAddressService() DeviceAddressService

GetDeviceAddressService provides an instance of the device address service to query a customers address information.

type DeviceShortAddress

type DeviceShortAddress struct {
	CountryCode string `json:"countryCode"`
	PostalCode  string `json:"postalCode"`
}

DeviceShortAddress contains the customers country and postal code.

type DialogConfirmIntentDirective

type DialogConfirmIntentDirective struct {
	// contains filtered or unexported fields
}

DialogConfirmIntentDirective sends Alexa a command to confirm the all the information the user has provided for the intent before the skill takes action. Provide a prompt to ask the user for confirmation in an OutputSpeech object in the response. Be sure to repeat back all the values the user needs to confirm in the prompt.

type DialogConfirmSlotDirective

type DialogConfirmSlotDirective struct {
	SlotToConfirm string `json:"slotToConfirm"`
	// contains filtered or unexported fields
}

DialogConfirmSlotDirective sends Alexa a command to confirm the value of a specific slot before continuing with the dialog. Specify the name of the slot to confirm in the slotToConfirm property. Provide a prompt to ask the user for confirmation in an OutputSpeech object in the response. Be sure repeat back the value to confirm in the prompt.

type DialogDelegateDirective

type DialogDelegateDirective struct {
	// contains filtered or unexported fields
}

DialogDelegateDirective sends Alexa a command to handle the next turn in the dialog with the user. You can use this directive if the skill has a dialog model and the current status of the dialog (dialogState) is either STARTED or IN_PROGRESS. You cannot return this directive if the dialogState is COMPLETED.

type DialogElicitDirective

type DialogElicitDirective struct {
	SlotToElicit string `json:"slotToElicit"`
	// contains filtered or unexported fields
}

DialogElicitDirective sends Alexa a command to ask the user for the value of a specific slot. Specify the name of the slot to elicit in the slotToElicit property. Provide a prompt to ask the user for the slot value in an OutputSpeech object in the response.

type DisplayImageObject

type DisplayImageObject struct {
	ContentDescription string                `json:"contentDescription"`
	Sources            []*DisplayImageSource `json:"sources"`
}

DisplayImageObject references and describes the image. Multiple sources for the image can be provided.

func (*DisplayImageObject) AddImageSource

func (i *DisplayImageObject) AddImageSource(size, url string, heightPixels, widthPixels int) *DisplayImageSource

AddImageSource adds source information for a image with the given size.

type DisplayImageSource

type DisplayImageSource struct {
	URL          string `json:"url"`
	Size         string `json:"size,omitempty"`
	WidthPixels  int    `json:"widthPixels,omitempty"`
	HeightPixels int    `json:"heightPixels,omitempty"`
}

DisplayImageSource describes the source url and size for a image.

type DisplayRenderTemplateDirective

type DisplayRenderTemplateDirective struct {
	Type string `json:"type,omitempty"`
	// Template is the body template to render
	Template DisplayTemplate `json:"template"`
}

DisplayRenderTemplateDirective directive to render display text, images or items on an device with screen.

type DisplayTemplate

type DisplayTemplate struct {
	Type  string `json:"type"`
	Token string `json:"token"`
	// BackButton state (e.g. 'VISIBLE' or 'HIDDEN')
	BackButton      string             `json:"backButton,omitempty"`
	BackgroundImage DisplayImageObject `json:"backgroundImage,omitempty"`
	Title           string             `json:"title,omitempty"`
	TextContent     struct {
		PrimaryText   DisplayTextContent `json:"primaryText,omitempty"`
		SecondaryText DisplayTextContent `json:"secondaryText,omitempty"`
		TertiaryText  DisplayTextContent `json:"tertiaryText,omitempty"`
	} `json:"textContent,omitempty"`
	// ListItems contains the text and images of the list items.
	ListItems []struct{} `json:"listItems,omitempty"`
}

DisplayTemplate displays text and images. Types may either be BodyTemplate* or ListTemplate*. For a body template these images cannot be made selectable. List template displays a scrollable list of items, each with associated text and optional images. These images can be made selectable, as described in this reference.

type DisplayTextContent

type DisplayTextContent struct {
	//Type must be PlainText or RichtText
	Type string `json:"type"`
	Text string `json:"text"`
}

DisplayTextContent contains text and a text type for displaying text with the Display interface.

type GadgetAnimation

type GadgetAnimation struct {
	Repeat       int                   `json:"repeat"`
	TargetLights []string              `json:"targetLights"`
	Sequence     []GadgetAnimationStep `json:"sequence"`
}

GadgetAnimation contains a sequence of instructions to be performed in a specific order, along with the number of times to play the overall animation.

type GadgetAnimationStep

type GadgetAnimationStep struct {
	DurationMs int    `json:"durationMs"`
	Color      string `json:"color"`
	Blend      bool   `json:"blend"`
}

GadgetAnimationStep a step to render in a animation.

type GadgetControllerSetLightDirective

type GadgetControllerSetLightDirective struct {
	Type          string           `json:"type,omitempty"`
	Version       int              `json:"version"`
	TargetGadgets []string         `json:"targetGadgets,omitempty"`
	Parameters    GadgetParameters `json:"parameters"`
}

GadgetControllerSetLightDirective sends a command to animate the LEDs of connected Echo Buttons. The following example shows the general form of the directive.

type GadgetParameters

type GadgetParameters struct {
	TriggerEvent       GadgetTriggerEventType `json:"triggerEvent"`
	TriggerEventTimeMs int                    `json:"triggerEventTimeMs"`
	Animations         []GadgetAnimation      `json:"animations"`
}

GadgetParameters contains instructions on how to animate the buttons.

type GadgetTriggerEventType

type GadgetTriggerEventType string

GadgetTriggerEventType describes the action that triggers the animation.

type GameEngineDeviationRecognizer

type GameEngineDeviationRecognizer struct {
	// Must be deviation
	Type       string `json:"type"`
	Recognizer string `json:"recognizer"`
}

GameEngineDeviationRecognizer returns true when another specified recognizer reports that the player has deviated from its expected pattern.

type GameEngineInputEvent

type GameEngineInputEvent struct {
	Name        string `json:"name"`
	InputEvents []struct {
		GadgetID  string `json:"gadgetId"`
		Timestamp string `json:"timestamp"`
		Action    string `json:"action"`
		Color     string `json:"color"`
		Feature   string `json:"feature"`
	} `json:"inputEvents"`
}

GameEngineInputEvent contains list of events sent from the Input Handler. Each event that you specify will be sent only once to your skill as it becomes true. Note that in any InputHandlerEvent request one or more events may have become true at the same time.

type GameEngineInputHandlerEventRequest

type GameEngineInputHandlerEventRequest struct {
	CommonRequest
	// From GamEngine.InputHandlerEvent
	OriginatingRequestID string                 `json:"originatingRequestId"`
	Events               []GameEngineInputEvent `json:"events"`
}

GameEngineInputHandlerEventRequest is send by GameEngine to notify your skill about Echo Button events

type GameEnginePattern

type GameEnginePattern struct {
	GadgetIds []string `json:"gadgetIds,omitempty"`
	Colors    []string `json:"colors,omitempty"`
	Action    string   `json:"action,omitempty"`
}

GameEnginePattern is an object that provides all of the events that need to occur, in a specific order, for this recognizer to be true

type GameEnginePatternRecognizer

type GameEnginePatternRecognizer struct {
	// Must be match
	Type      string              `json:"type"`
	Anchor    string              `json:"anchor,omitempty"`
	Fuzzy     bool                `json:"fuzzy"`
	GadgetIds []string            `json:"gadgetIds,omitempty"`
	Actions   []interface{}       `json:"actions,omitempty"`
	Pattern   []GameEnginePattern `json:"pattern"`
}

GameEnginePatternRecognizer is true when all of the specified events have occurred in the specified order.

func (*GameEnginePatternRecognizer) AddPattern

func (gep *GameEnginePatternRecognizer) AddPattern(gadgetIds, colors []string, action string)

AddPattern adds a pattern object. All patterns must occur in order for the recognizer to be true

type GameEngineProgressRecognizer

type GameEngineProgressRecognizer struct {
	// Must be progress
	Type       string `json:"type"`
	Recognizer string `json:"recognizer"`
	Completion int    `json:"completion"`
}

GameEngineProgressRecognizer consults another recognizer for the degree of completion, and is true if that degree is above the specified threshold. The completion parameter is specified as a decimal percentage.

type GameEngineRegistrationEvent

type GameEngineRegistrationEvent struct {
	Meets []string `json:"meets"`
	Fails []string `json:"fails,omitempty"`
	// Possible values: history, matches
	Reports                 string `json:"reports,omitempty"`
	ShouldEndInputHandler   bool   `json:"shouldEndInputHandler"`
	MaximumInvocations      int    `json:"maximumInvocations,omitempty"`
	TriggerTimeMilliseconds int    `json:"triggerTimeMilliseconds,omitempty"`
}

GameEngineRegistrationEvent object is where you define the conditions that must be met for your skill to be notified of Echo Button input. You must define at least one event.

type GameEngineStartInputDirective

type GameEngineStartInputDirective struct {
	Type                 string                                  `json:"type,omitempty"`
	Timeout              int                                     `json:"timeout"`
	MaximumHistoryLength int                                     `json:"maximumHistoryLength,omitempty"`
	Proxies              []interface{}                           `json:"proxies,omitempty"`
	Recognizers          map[string]interface{}                  `json:"recognizers"`
	Events               map[string]*GameEngineRegistrationEvent `json:"events"`
}

GameEngineStartInputDirective directive to start the game engine.

func (*GameEngineStartInputDirective) AddDeviationRecognizer

func (sid *GameEngineStartInputDirective) AddDeviationRecognizer(name string, recognizerName string) *GameEngineDeviationRecognizer

AddDeviationRecognizer adds a recognizer with the given name and returns the reference.

func (*GameEngineStartInputDirective) AddEvent

func (sid *GameEngineStartInputDirective) AddEvent(name string, shouldEndInputHandler bool, meetsRecognizers []string) *GameEngineRegistrationEvent

AddEvent adds a GameEngine Event registration to the directive.

func (*GameEngineStartInputDirective) AddPatternRecognizer

func (sid *GameEngineStartInputDirective) AddPatternRecognizer(name string) *GameEnginePatternRecognizer

AddPatternRecognizer adds a recognizer with the given name and returns the reference. The recognizer is true when all of the specified events have occurred in the specified order.

func (*GameEngineStartInputDirective) AddProgressRecognizer

func (sid *GameEngineStartInputDirective) AddProgressRecognizer(name, recognizerName string, completion int) *GameEngineProgressRecognizer

AddProgressRecognizer adds a recognizer with the given name and returns the reference. The recognizer is true when all of the specified events have occurred in the specified order.

type GameEngineStopInputHandlerDirective

type GameEngineStopInputHandlerDirective struct {
	Type                 string `json:"type,omitempty"`
	OriginatingRequestID string `json:"originatingRequestId"`
}

GameEngineStopInputHandlerDirective stops Echo Button events from being sent to your skill.

type Intent

type Intent struct {
	Name               string                `json:"name,omitempty"`
	Slots              map[string]IntentSlot `json:"slots,omitempty"`
	ConfirmationStatus string                `json:"confirmationStatus,omitempty"`
}

Intent provided in Intent requests

type IntentRequest

type IntentRequest struct {
	CommonRequest
	Intent      Intent `json:"intent,omitempty"`
	DialogState string `json:"dialogState,omitempty"`
}

IntentRequest is send if a intent is invoked.

type IntentSlot

type IntentSlot struct {
	Name               string      `json:"name"`
	Value              string      `json:"value"`
	ConfirmationStatus string      `json:"confirmationStatus,omitempty"`
	Resolutions        interface{} `json:"resolutions"`
}

IntentSlot is provided in Intents

type LambdaHandler

type LambdaHandler func(ctx context.Context, event interface{}) (interface{}, error)

LambdaHandler interface which a lambda handler must fulfil.

type LaunchRequest

type LaunchRequest struct {
	CommonRequest
}

LaunchRequest send by Alexa if a skill is started.

type OutputSpeech

type OutputSpeech struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
	Ssml string `json:"ssml,omitempty"`
}

OutputSpeech containing the speech to render to the user.

type Reprompt

type Reprompt struct {
	OutputSpeech *OutputSpeech `json:"outputSpeech"`
}

Reprompt containing the outputSpeech to use if a re-prompt is necessary.

type RequestEnvelope

type RequestEnvelope struct {
	Version string  `json:"version"`
	Session Session `json:"session"`
	// one of the request structs
	Request interface{} `json:"request"`
	Context Context     `json:"context"`
}

RequestEnvelope is the deserialized http post request sent by alexa.

type Response

type Response struct {
	OutputSpeech *OutputSpeech `json:"outputSpeech,omitempty"`
	Card         *Card         `json:"card,omitempty"`
	Reprompt     *Reprompt     `json:"reprompt,omitempty"`
	// Use a pointer to be able to specify true,false and do not set it
	ShouldEndSession *bool         `json:"shouldEndSession,omitempty"`
	Directives       []interface{} `json:"directives,omitempty"`
}

Response payload for alexa requests

func (*Response) AddAudioPlayerClearQueueDirective

func (r *Response) AddAudioPlayerClearQueueDirective(clearBehavior string) *AudioPlayerClearQueueDirective

AddAudioPlayerClearQueueDirective creates a new clear queue directive for AudioPlayer interface.

func (*Response) AddAudioPlayerPlayDirective

func (r *Response) AddAudioPlayerPlayDirective(playBehavior string) *AudioPlayerPlayDirective

AddAudioPlayerPlayDirective creates a new play directive for AudioPlayer interfaces.

func (*Response) AddAudioPlayerStopDirective

func (r *Response) AddAudioPlayerStopDirective() *AudioPlayerStopDirective

AddAudioPlayerStopDirective creates a new stop directive for AudioPlayer interface.

func (*Response) AddDialogConfirmIntentDirective

func (r *Response) AddDialogConfirmIntentDirective() *DialogConfirmIntentDirective

AddDialogConfirmIntentDirective creates a new directive to render a body or list template for the Alexa Display Interface.

func (*Response) AddDialogConfirmSlotDirective

func (r *Response) AddDialogConfirmSlotDirective(slotToConfirm string) *DialogConfirmSlotDirective

AddDialogConfirmSlotDirective creates a new directive to render a body or list template for the Alexa Display Interface.

func (*Response) AddDialogDelegateDirective

func (r *Response) AddDialogDelegateDirective() *DialogDelegateDirective

AddDialogDelegateDirective creates a new directive to render a body or list template for the Alexa Display Interface.

func (*Response) AddDialogElicitSlotDirective

func (r *Response) AddDialogElicitSlotDirective(slotToElicit string) *DialogElicitDirective

AddDialogElicitSlotDirective creates a new directive to render a body or list template for the Alexa Display Interface.

func (*Response) AddDirective

func (response *Response) AddDirective(directive interface{})

AddDirective adds a directive to the slice of existing directives for a response.

func (*Response) AddDisplayRenderTemplateDirective

func (r *Response) AddDisplayRenderTemplateDirective(templateType string) *DisplayRenderTemplateDirective

AddDisplayRenderTemplateDirective creates a new directive to render a body or list template for the Alexa Display Interface.

func (*Response) AddGadgetControllerSetLightDirective

func (r *Response) AddGadgetControllerSetLightDirective(targetGadgets []string, triggerEvent GadgetTriggerEventType, triggerEventTimeMs int, animations []GadgetAnimation) *GadgetControllerSetLightDirective

AddGadgetControllerSetLightDirective creates a new directive to stop listening for input events and adds it to the response.

func (*Response) AddGameEngineStartInputDirective

func (r *Response) AddGameEngineStartInputDirective(timeout int) *GameEngineStartInputDirective

AddGameEngineStartInputDirective creates a new directive with StartInputerHandler Type and adds it to the response.

func (*Response) AddGameEngineStopInputHandlerDirective

func (r *Response) AddGameEngineStopInputHandlerDirective(originatingRequestID string) *GameEngineStopInputHandlerDirective

AddGameEngineStopInputHandlerDirective creates a new directive to stop listening for input events and adds it to the response.

func (*Response) SetAskForPermissionsConsentCard

func (response *Response) SetAskForPermissionsConsentCard(title, content string, permissions []string) *Response

SetAskForPermissionsConsentCard creates a card to ask for permissions to read user or list data. Any present card is overwritten. Permission examples are 'read::alexa:device:all:address' or 'read::alexa:device:all:address:country_and_postal_code'

func (*Response) SetOutputSpeech

func (response *Response) SetOutputSpeech(text string) *Response

SetOutputSpeech creates a SSML output speech object for the response. Any present output speech is overwritten.

func (*Response) SetReprompt

func (response *Response) SetReprompt(text string) *Response

SetReprompt creates a PlainText reprompt output speech object for the response. Any present reprompt is overwritten.

func (*Response) SetSimpleCard

func (response *Response) SetSimpleCard(title string, content string) *Response

SetSimpleCard creates a simple card for the response. Any present card is overwritten.

type ResponseEnvelope

type ResponseEnvelope struct {
	Version           string                 `json:"version"`
	SessionAttributes map[string]interface{} `json:"sessionAttributes,omitempty"`
	Response          *Response              `json:"response,omitempty"`
}

ResponseEnvelope is the envelope for the object returned for a alexa POST request.

type Session

type Session struct {
	New         bool                   `json:"new"`
	SessionID   string                 `json:"sessionId"`
	Attributes  map[string]interface{} `json:"attributes"`
	Application Application            `json:"application"`
	User        User                   `json:"user"`
}

Session object contained in standard request types like LaunchRequest, IntentRequest, SessionEndedRequest and GameEngine interface.

type SessionEndedRequest

type SessionEndedRequest struct {
	CommonRequest
	Reason string `json:"reason,omitempty"`
	Error  struct {
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"error,omitempty"`
}

SessionEndedRequest if a skill is stopped or cancelled.

type Skill

type Skill struct {
	ApplicationID string
	// SkipValidation skips any request validation (TEST ONLY!)
	SkipValidation bool
	// Verbose enables request and response logging
	Verbose                  bool
	OnLaunch                 func(*LaunchRequest, *ResponseEnvelope)
	OnIntent                 func(*IntentRequest, *ResponseEnvelope)
	OnSessionEnded           func(*SessionEndedRequest, *ResponseEnvelope)
	OnAudioPlayerState       func(*AudioPlayerRequest, *ResponseEnvelope)
	OnAudioPlayerFailedState func(*AudioPlayerPlaybackFailedRequest, *ResponseEnvelope)
	OnSystemException        func(*SystemExceptionEncounteredRequest, *ResponseEnvelope)
	OnGameEngineEvent        func(*GameEngineInputHandlerEventRequest, *ResponseEnvelope)
}

Skill configures the different Handlers for skill execution.

func (*Skill) GetHTTPSkillHandler

func (skill *Skill) GetHTTPSkillHandler() http.Handler

GetHTTPSkillHandler provides a http.Handler to have the freedom to use any http framework.

func (*Skill) GetLambdaSkillHandler

func (skill *Skill) GetLambdaSkillHandler() LambdaHandler

GetLambdaSkillHandler provides a handler which can be used in a lambda function.

type System

type System struct {
	APIAccessToken string      `json:"apiAccessToken"`
	APIEndpoint    string      `json:"apiEndpoint"`
	Application    Application `json:"application"`
	Device         Device      `json:"device"`
	User           User        `json:"user"`
}

System object that provides information about the current state of the Alexa service and the device interacting with your skill.

type SystemExceptionEncounteredRequest

type SystemExceptionEncounteredRequest struct {
	CommonRequest
	Error struct {
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"error"`
	Cause struct {
		RequestID string `json:"requestId"`
	} `json:"cause"`
}

SystemExceptionEncounteredRequest is send ff a GameEngine directive that you send fails, then your skill will be invoked with a standard System.ExceptionEncountered request. Any directives included in the response are ignored.

type User

type User struct {
	UserID      string `json:"userId"`
	AccessToken string `json:"accessToken,omitempty"`
}

User contains the userId and access token if existent.

Jump to

Keyboard shortcuts

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