Documentation
¶
Overview ¶
Package avs makes requests to Amazon's AVS API using HTTP/2 and also supports creating a downchannel which receives directives from AVS based on the user's speech and/or actions in the companion app.
To send a Recognize event to AVS, you can use the PostRecognize function:
audio, _ := os.Open("./request.wav") response, err := avs.PostRecognize(ACCESS_TOKEN, "abc123", "abc123dialog", audio)
For simple events you can use the PostEvent function:
event := NewVolumeChanged("abc123", 100, false) response, err := avs.PostEvent(ACCESS_TOKEN, event)
You can also make requests to AVS with the Client.Do method:
request := avs.NewRequest(ACCESS_TOKEN) request.Event = avs.NewRecognize("abc123", "abc123dialog") request.Audio, _ = os.Open("./request.wav") response, err := avs.DefaultClient.Do(request)
A Response will contain a list of directives from AVS. The list contains untyped Message instances which hold the raw response data and headers, but it can be typed by calling the Typed method of Message:
for _, directive := range response.Directives { switch d := directive.Typed().(type) { case *avs.Speak: cid := d.ContentId() ioutil.WriteFile("./speak.mp3", response.Content[cid], 0666) default: fmt.Println("No code to handle directive:", d) } }
To create a downchannel, a long-lived request for AVS to deliver directives, use the CreateDownchannel method of the Client type:
directives, _ := avs.CreateDownchannel(ACCESS_TOKEN) for directive := range directives { switch d := directive.Typed().(type) { case *avs.DeleteAlert: fmt.Println("Delete alert:", d.Payload.Token) case *avs.SetAlert: fmt.Println("Set an alert for:", d.Payload.ScheduledTime) default: fmt.Println("No code to handle directive:", d) } }
Index ¶
- Constants
- Variables
- func CreateDownchannel(accessToken string) (<-chan *Message, error)
- func RandomUUIDString() string
- type AdjustVolume
- type Alert
- type AlertEnteredBackground
- type AlertEnteredForeground
- type AlertStarted
- type AlertStopped
- type AlertType
- type AlertsState
- type AudioItem
- type ClearBehavior
- type ClearQueue
- type Client
- type DeleteAlert
- type DeleteAlertFailed
- type DeleteAlertSucceeded
- type ErrorType
- type Exception
- type ExceptionEncountered
- type ExpectSpeech
- type ExpectSpeechTimedOut
- type MediaErrorType
- type Message
- type MuteChanged
- type NextCommandIssued
- type PauseCommandIssued
- type Play
- type PlayBehavior
- type PlayCommandIssued
- type PlaybackFailed
- type PlaybackFinished
- type PlaybackNearlyFinished
- type PlaybackPaused
- type PlaybackQueueCleared
- type PlaybackResumed
- type PlaybackStarted
- type PlaybackState
- type PlaybackStopped
- type PlaybackStutterFinished
- type PlaybackStutterStarted
- type PlayerActivity
- type PreviousCommandIssued
- type ProgressReport
- type ProgressReportDelayElapsed
- type ProgressReportIntervalElapsed
- type Recognize
- type RecognizeProfile
- type Request
- type ResetUserInactivity
- type Response
- type SetAlert
- type SetAlertFailed
- type SetAlertSucceeded
- type SetEndpoint
- type SetMute
- type SetVolume
- type Setting
- type SettingLocale
- type SettingsUpdated
- type Speak
- type SpeechFinished
- type SpeechStarted
- type SpeechState
- type Stop
- type StopCapture
- type Stream
- type StreamMetadataExtracted
- type SynchronizeState
- type TypedMessage
- type UUID
- type UserInactivityReport
- type VolumeChanged
- type VolumeState
Constants ¶
const ( // You can find the latest versioning information on the AVS API overview page: // https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/content/avs-api-overview Version = "/v20160207" DirectivesPath = Version + "/directives" EventsPath = Version + "/events" PingPath = "/ping" )
The different endpoints that are supported by the AVS API.
const ( RecognizeProfileCloseTalk = RecognizeProfile("CLOSE_TALK") RecognizeProfileNearField = RecognizeProfile("NEAR_FIELD") RecognizeProfileFarField = RecognizeProfile("FAR_FIELD") )
Possible values for RecognizeProfile. Supports three distinct profiles optimized for speech at varying distances.
const ( SettingLocaleUS = SettingLocale("en-US") SettingLocaleGB = SettingLocale("en-GB") SettingLocaleDE = SettingLocale("de-DE") )
Possible values for SettingLocale.
const ( // AlertTypeAlarm specifies the type for an alarm. Alarms are scheduled for // specific times (e.g., to wake the user up). AlertTypeAlarm = AlertType("ALARM") // AlertTypeTimer specifies the type for a timer. Timers count down a certain // amount of time (e.g., "timer for 5 minutes"). AlertTypeTimer = AlertType("TIMER") )
Possible values for AlertType, used by the SetAlert directive.
const ( // ClearBehaviorClearAll clears all items in the queue, including the current // one. ClearBehaviorClearAll = ClearBehavior("CLEAR_ALL") // ClearBehaviorClearEnqueued clears all queued items in the queue (not // including the current one). ClearBehaviorClearEnqueued = ClearBehavior("CLEAR_ENQUEUED") )
Possible values for ClearBehavior.
const ( // ErrorTypeInternalError should be reported when none of the other error // types is applicable. ErrorTypeInternalError = ErrorType("INTERNAL_ERROR") // ErrorTypeUnexpectedInformation should be reported when the client is unable // to handle the received directive due to invalid format or data. ErrorTypeUnexpectedInformation = ErrorType("UNEXPECTED_INFORMATION_RECEIVED") // ErrorTypeUnsupportedOperation should be reported when the client is unable // to perform the operation specified by the directive. ErrorTypeUnsupportedOperation = ErrorType("UNSUPPORTED_OPERATION") )
Possible values for ErrorType.
const ( MediaErrorTypeInternalDeviceError = MediaErrorType("MEDIA_ERROR_INTERNAL_DEVICE_ERROR") MediaErrorTypeInternalServerError = MediaErrorType("MEDIA_ERROR_INTERNAL_SERVER_ERROR") MediaErrorTypeInvalidRequest = MediaErrorType("MEDIA_ERROR_INVALID_REQUEST") MediaErrorTypeUnknown = MediaErrorType("MEDIA_ERROR_UNKNOWN") )
const ( // PlayBehaviorEnqueue specifies that the audio should be played after current // queue of audio. PlayBehaviorEnqueue = PlayBehavior("ENQUEUE") // PlayBehaviorReplaceAll specifies that the audio should play immediately, // throwing away all queued audio. PlayBehaviorReplaceAll = PlayBehavior("REPLACE_ALL") // PlayBehaviorReplaceEnqueued specifies that the audio should play after the // currently playing audio, replacing all queued audio. PlayBehaviorReplaceEnqueued = PlayBehavior("REPLACE_ENQUEUED") )
Possible values for PlayBehavior.
const ( PlayerActivityBufferUnderrun = PlayerActivity("BUFFER_UNDERRUN") PlayerActivityIdle = PlayerActivity("IDLE") PlayerActivityPaused = PlayerActivity("PAUSED") PlayerActivityStopped = PlayerActivity("STOPPED") PlayerActivityPlaying = PlayerActivity("PLAYING") PlayerActivityFinished = PlayerActivity("FINISHED") )
Possible values for PlayerActivity.
Variables ¶
var DefaultClient = &Client{
EndpointURL: "https://avs-alexa-na.amazon.com",
}
DefaultClient is the default Client.
Functions ¶
func CreateDownchannel ¶
CreateDownchannel establishes a persistent connection with AVS and returns a read-only channel through which AVS will deliver directives.
CreateDownchannel is a wrapper around DefaultClient.CreateDownchannel.
func RandomUUIDString ¶
func RandomUUIDString() string
Types ¶
type AdjustVolume ¶
type AdjustVolume struct { *Message Payload struct { Volume int `json:"volume"` } `json:"payload"` }
The AdjustVolume directive.
type Alert ¶
type Alert struct { Token string `json:"token"` Type AlertType `json:"type"` ScheduledTime string `json:"scheduledTime"` }
Alert represents a single alarm or timer with a scheduled time.
type AlertEnteredBackground ¶
type AlertEnteredBackground struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The AlertEnteredBackground event.
func NewAlertEnteredBackground ¶
func NewAlertEnteredBackground(messageId, token string) *AlertEnteredBackground
type AlertEnteredForeground ¶
type AlertEnteredForeground struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The AlertEnteredForeground event.
func NewAlertEnteredForeground ¶
func NewAlertEnteredForeground(messageId, token string) *AlertEnteredForeground
type AlertStarted ¶
type AlertStarted struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The AlertStarted event.
func NewAlertStarted ¶
func NewAlertStarted(messageId, token string) *AlertStarted
type AlertStopped ¶
type AlertStopped struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The AlertStopped event.
func NewAlertStopped ¶
func NewAlertStopped(messageId, token string) *AlertStopped
type AlertsState ¶
type AlertsState struct { *Message Payload struct { AllAlerts []Alert `json:"allAlerts"` ActiveAlerts []Alert `json:"activeAlerts"` } `json:"payload"` }
The AlertsState context.
func NewAlertsState ¶
func NewAlertsState(allAlerts, activeAlerts []Alert) *AlertsState
type ClearBehavior ¶
type ClearBehavior string
ClearBehavior specifies how the play queue should be cleared.
type ClearQueue ¶
type ClearQueue struct { *Message Payload struct { ClearBehavior ClearBehavior `json:"clearBehavior"` } `json:"payload"` }
The ClearQueue directive.
type Client ¶
type Client struct {
EndpointURL string
}
Client enables making requests and creating downchannels to AVS.
func (*Client) CreateDownchannel ¶
CreateDownchannel establishes a persistent connection with AVS and returns a read-only channel through which AVS will deliver directives.
type DeleteAlert ¶
type DeleteAlert struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The DeleteAlert directive.
type DeleteAlertFailed ¶
type DeleteAlertFailed struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The DeleteAlertFailed event.
func NewDeleteAlertFailed ¶
func NewDeleteAlertFailed(messageId, token string) *DeleteAlertFailed
type DeleteAlertSucceeded ¶
type DeleteAlertSucceeded struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The DeleteAlertSucceeded event.
func NewDeleteAlertSucceeded ¶
func NewDeleteAlertSucceeded(messageId, token string) *DeleteAlertSucceeded
type ErrorType ¶
type ErrorType string
ErrorType specifies the types of errors that the client may report to AVS.
type Exception ¶
type Exception struct { *Message Payload struct { Code string `json:"code"` Description string `json:"description"` } `json:"payload"` }
The Exception message.
type ExceptionEncountered ¶
type ExceptionEncountered struct { *Message Payload struct { UnparsedDirective string `json:"unparsedDirective"` Error struct { Type ErrorType `json:"type"` Message string `json:"message"` } `json:"error"` } `json:"payload"` }
The ExceptionEncountered event.
func NewExceptionEncountered ¶
func NewExceptionEncountered(messageId, directive string, errorType ErrorType, errorMessage string) *ExceptionEncountered
type ExpectSpeech ¶
type ExpectSpeech struct { *Message Payload struct { TimeoutInMilliseconds int `json:"timeoutInMilliseconds"` } `json:"payload"` }
The ExpectSpeech directive.
func (*ExpectSpeech) Timeout ¶
func (m *ExpectSpeech) Timeout() time.Duration
type ExpectSpeechTimedOut ¶
type ExpectSpeechTimedOut struct { *Message Payload struct{} `json:"payload"` }
The ExpectSpeechTimedOut event.
func NewExpectSpeechTimedOut ¶
func NewExpectSpeechTimedOut(messageId string) *ExpectSpeechTimedOut
type MediaErrorType ¶
type MediaErrorType string
type Message ¶
type Message struct { Header map[string]string `json:"header"` Payload json.RawMessage `json:"payload,omitempty"` }
Message is a general structure for contexts, events and directives.
func (*Message) GetMessage ¶
GetMessage returns a pointer to the underlying Message object.
func (*Message) Typed ¶
func (m *Message) Typed() TypedMessage
Typed returns a more specific type for this message.
This only parses directives as they're the only type of message sent by AVS.
type MuteChanged ¶
type MuteChanged struct { *Message Payload struct { Volume int `json:"volume"` Muted bool `json:"muted"` } `json:"payload"` }
The MuteChanged event.
func NewMuteChanged ¶
func NewMuteChanged(messageId string, volume int, muted bool) *MuteChanged
type NextCommandIssued ¶
type NextCommandIssued struct { *Message Payload struct{} `json:"payload"` }
The NextCommandIssued event.
func NewNextCommandIssued ¶
func NewNextCommandIssued(messageId string) *NextCommandIssued
type PauseCommandIssued ¶
type PauseCommandIssued struct { *Message Payload struct{} `json:"payload"` }
The PauseCommandIssued event.
func NewPauseCommandIssued ¶
func NewPauseCommandIssued(messageId string) *PauseCommandIssued
type Play ¶
type Play struct { *Message Payload struct { AudioItem AudioItem `json:"audioItem"` PlayBehavior PlayBehavior `json:"playBehavior"` } `json:"payload"` }
The Play directive.
type PlayBehavior ¶
type PlayBehavior string
PlayBehavior specifies how an audio item should be inserted into the play queue.
type PlayCommandIssued ¶
type PlayCommandIssued struct { *Message Payload struct{} `json:"payload"` }
The PlayCommandIssued event.
func NewPlayCommandIssued ¶
func NewPlayCommandIssued(messageId string) *PlayCommandIssued
type PlaybackFailed ¶
type PlaybackFailed struct { *Message Payload struct { Token string `json:"token"` CurrentPlaybackState playbackState `json:"currentPlaybackState"` Error struct { Type MediaErrorType `json:"type"` Message string `json:"message"` } `json:"error"` } `json:"payload"` }
The PlaybackFailed event.
func NewPlaybackFailed ¶
func NewPlaybackFailed(messageId, token string, errorType MediaErrorType, errorMessage string) *PlaybackFailed
type PlaybackFinished ¶
type PlaybackFinished struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackFinished event.
func NewPlaybackFinished ¶
func NewPlaybackFinished(messageId, token string, offset time.Duration) *PlaybackFinished
type PlaybackNearlyFinished ¶
type PlaybackNearlyFinished struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackNearlyFinished event.
func NewPlaybackNearlyFinished ¶
func NewPlaybackNearlyFinished(messageId, token string, offset time.Duration) *PlaybackNearlyFinished
type PlaybackPaused ¶
type PlaybackPaused struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackPaused event.
func NewPlaybackPaused ¶
func NewPlaybackPaused(messageId, token string, offset time.Duration) *PlaybackPaused
type PlaybackQueueCleared ¶
type PlaybackQueueCleared struct { *Message Payload struct{} `json:"payload"` }
The PlaybackQueueCleared event.
func NewPlaybackQueueCleared ¶
func NewPlaybackQueueCleared(messageId string) *PlaybackQueueCleared
type PlaybackResumed ¶
type PlaybackResumed struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackResumed event.
func NewPlaybackResumed ¶
func NewPlaybackResumed(messageId, token string, offset time.Duration) *PlaybackResumed
type PlaybackStarted ¶
type PlaybackStarted struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackStarted event.
func NewPlaybackStarted ¶
func NewPlaybackStarted(messageId, token string, offset time.Duration) *PlaybackStarted
type PlaybackState ¶
type PlaybackState struct { *Message Payload playbackState `json:"payload"` }
The PlaybackState context.
func NewPlaybackState ¶
func NewPlaybackState(token string, offset time.Duration, activity PlayerActivity) *PlaybackState
type PlaybackStopped ¶
type PlaybackStopped struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackStopped event.
func NewPlaybackStopped ¶
func NewPlaybackStopped(messageId, token string, offset time.Duration) *PlaybackStopped
type PlaybackStutterFinished ¶
type PlaybackStutterFinished struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` StutterDurationInMilliseconds int `json:"stutterDurationInMilliseconds"` } `json:"payload"` }
The PlaybackStutterFinished event.
func NewPlaybackStutterFinished ¶
func NewPlaybackStutterFinished(messageId, token string, offset, stutterDuration time.Duration) *PlaybackStutterFinished
type PlaybackStutterStarted ¶
type PlaybackStutterStarted struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The PlaybackStutterStarted event.
func NewPlaybackStutterStarted ¶
func NewPlaybackStutterStarted(messageId, token string, offset time.Duration) *PlaybackStutterStarted
type PlayerActivity ¶
type PlayerActivity string
PlayerActivity specifies what state the audio player is in.
type PreviousCommandIssued ¶
type PreviousCommandIssued struct { *Message Payload struct{} `json:"payload"` }
The PreviousCommandIssued event.
func NewPreviousCommandIssued ¶
func NewPreviousCommandIssued(messageId string) *PreviousCommandIssued
type ProgressReport ¶
type ProgressReport struct { ProgressReportIntervalInMilliseconds float64 `json:"progressReportIntervalInMilliseconds"` ProgressReportDelayInMilliseconds float64 `json:"progressReportDelayInMilliseconds"` }
func (*ProgressReport) Delay ¶
func (p *ProgressReport) Delay() time.Duration
func (*ProgressReport) Interval ¶
func (p *ProgressReport) Interval() time.Duration
type ProgressReportDelayElapsed ¶
type ProgressReportDelayElapsed struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The ProgressReportDelayElapsed event.
func NewProgressReportDelayElapsed ¶
func NewProgressReportDelayElapsed(messageId, token string, offset time.Duration) *ProgressReportDelayElapsed
type ProgressReportIntervalElapsed ¶
type ProgressReportIntervalElapsed struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` } `json:"payload"` }
The ProgressReportIntervalElapsed event.
func NewProgressReportIntervalElapsed ¶
func NewProgressReportIntervalElapsed(messageId, token string, offset time.Duration) *ProgressReportIntervalElapsed
type Recognize ¶
type Recognize struct { *Message Payload struct { Profile RecognizeProfile `json:"profile"` Format string `json:"format"` } `json:"payload"` }
The Recognize event.
func NewRecognize ¶
func NewRecognizeWithProfile ¶
func NewRecognizeWithProfile(messageId, dialogRequestId string, profile RecognizeProfile) *Recognize
type RecognizeProfile ¶
type RecognizeProfile string
RecognizeProfile identifies the ASR profile associated with your product.
type Request ¶
type Request struct { // Access token for the user that this request should be made for. AccessToken string `json:"-"` Audio io.Reader `json:"-"` Context []TypedMessage `json:"context"` Event TypedMessage `json:"event"` }
A Request represents an event and optional context to send to AVS.
func NewRequest ¶
NewRequest returns a new Request given an access token.
The Request is suitable for use with Client.Do.
func (*Request) AddContext ¶
func (r *Request) AddContext(m TypedMessage)
AddContext adds a context Message to the Request.
type ResetUserInactivity ¶
type ResetUserInactivity struct { *Message Payload struct{} `json:"payload"` }
The ResetUserInactivity directive.
type Response ¶
type Response struct { // The Amazon request id (for debugging purposes). RequestId string // All the directives in the response. Directives []*Message // Attachments (usually audio). Key is the Content-ID header value. Content map[string][]byte }
Response represents a response from the AVS API.
func PostEvent ¶
func PostEvent(accessToken string, event TypedMessage) (*Response, error)
PostEvent will post an event to AVS.
PostEvent is a wrapper around DefaultClient.Do.
func PostRecognize ¶
func PostRecognize(accessToken, messageId, dialogRequestId string, audio io.Reader) (*Response, error)
PostRecognize will post a Recognize event to AVS.
PostRecognize is a wrapper around DefaultClient.Do.
func PostSynchronizeState ¶
func PostSynchronizeState(accessToken, messageId string, context []TypedMessage) (*Response, error)
PostSynchronizeState will post a SynchronizeState event with the provided context to AVS.
PostSynchronizeState is a wrapper around DefaultClient.Do.
type SetAlertFailed ¶
type SetAlertFailed struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The SetAlertFailed event.
func NewSetAlertFailed ¶
func NewSetAlertFailed(messageId, token string) *SetAlertFailed
type SetAlertSucceeded ¶
type SetAlertSucceeded struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The SetAlertSucceeded event.
func NewSetAlertSucceeded ¶
func NewSetAlertSucceeded(messageId, token string) *SetAlertSucceeded
type SetEndpoint ¶
type SetEndpoint struct { *Message Payload struct { Endpoint string `json:"endpoint"` } `json:"payload"` }
The SetEndpoint directive.
type SettingLocale ¶
type SettingLocale string
type SettingsUpdated ¶
type SettingsUpdated struct { *Message Payload struct { Settings []Setting `json:"settings"` } `json:"payload"` }
func NewLocaleSettingsUpdated ¶
func NewLocaleSettingsUpdated(messageId string, locale SettingLocale) *SettingsUpdated
type Speak ¶
type Speak struct { *Message Payload struct { Format string `json:"format"` URL string `json:"url"` Token string `json:"token"` } `json:"payload"` }
The Speak directive.
type SpeechFinished ¶
type SpeechFinished struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The SpeechFinished event.
func NewSpeechFinished ¶
func NewSpeechFinished(messageId, token string) *SpeechFinished
type SpeechStarted ¶
type SpeechStarted struct { *Message Payload struct { Token string `json:"token"` } `json:"payload"` }
The SpeechStarted event.
func NewSpeechStarted ¶
func NewSpeechStarted(messageId, token string) *SpeechStarted
type SpeechState ¶
type SpeechState struct { *Message Payload struct { Token string `json:"token"` OffsetInMilliseconds int `json:"offsetInMilliseconds"` PlayerActivity PlayerActivity `json:"playerActivity"` } `json:"payload"` }
The SpeechState context.
func NewSpeechState ¶
func NewSpeechState(token string, offset time.Duration, playerActivity PlayerActivity) *SpeechState
type StopCapture ¶
type StopCapture struct { *Message Payload struct{} `json:"payload"` }
The StopCapture directive.
type Stream ¶
type Stream struct { ExpiryTime string `json:"expiryTime"` OffsetInMilliseconds float64 `json:"offsetInMilliseconds"` ProgressReport ProgressReport `json:"progressReport"` Token string `json:"token"` ExpectedPreviousToken string `json:"expectedPreviousToken"` URL string `json:"url"` }
An audio stream which can either be attached with the response or a remote URL.
type StreamMetadataExtracted ¶
type StreamMetadataExtracted struct { *Message Payload struct { Token string `json:"token"` Metadata map[string]interface{} `json:"metadata"` } `json:"payload"` }
The StreamMetadataExtracted event.
func NewStreamMetadataExtracted ¶
func NewStreamMetadataExtracted(messageId, token string, metadata map[string]interface{}) *StreamMetadataExtracted
type SynchronizeState ¶
type SynchronizeState struct { *Message Payload struct{} `json:"payload"` }
The SynchronizeState event.
func NewSynchronizeState ¶
func NewSynchronizeState(messageId string) *SynchronizeState
type TypedMessage ¶
type TypedMessage interface { GetMessage() *Message Typed() TypedMessage }
TypedMessage is an interface that represents both raw Message objects and more specifically typed ones. Usually, values of this interface are used with a type switch:
switch d := typedMessage.(type) { case *Speak: fmt.Printf("We got a spoken response in format %s.\n", d.Payload.Format) }
type UserInactivityReport ¶
type UserInactivityReport struct { *Message Payload struct { InactiveTimeInSeconds int `json:"inactiveTimeInSeconds"` } `json:"payload"` }
The UserInactivityReport event.
func NewUserInactivityReport ¶
func NewUserInactivityReport(messageId string, inactiveTime time.Duration) *UserInactivityReport
type VolumeChanged ¶
type VolumeChanged struct { *Message Payload struct { Volume int `json:"volume"` Muted bool `json:"muted"` } `json:"payload"` }
The VolumeChanged event.
func NewVolumeChanged ¶
func NewVolumeChanged(messageId string, volume int, muted bool) *VolumeChanged
type VolumeState ¶
type VolumeState struct { *Message Payload struct { Volume int `json:"volume"` Muted bool `json:"muted"` } `json:"payload"` }
The VolumeState context.
func NewVolumeState ¶
func NewVolumeState(volume int, muted bool) *VolumeState