go_action_sdk

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

README

Go Action SDK (port of the google action java sdk)

Build Status Coverage Status

Warning

This is currently an extremely alpha SDK, maybe even pre-alpha, it is not ready for prime time and comes with no guarantees that it will actually work for you, or that the interfaces won't change (in fact at this moment there are changes planned). It has worked for my limited test cases, if you do use it and run into issues feel free to open an issue however it's possible I will not maintain this in the long term depending on life and other factors.

About

This is a port of a port. Put simply my javascript experience and knowledge is minimal at best, however frogermcs ported the action sdk google released from javascript to java. I know java and since I wanted to work in go to make containerization easier and smaller I have ported his work to Go which is my goto language currently.

This is currently under active development and is not ready. I will merge it into the master branch when it is ready to be used/tested/broken. That being said I do not guarantee any functionality or that it will be kept up to date if google changes their API.

TODO:

  • Add various other handlers to abstract interacting with the API based on documentation here.
  • Add examples/sample code of how to use it.
  • More to come

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageMode

type MessageMode uint8
const (
	TEXT_MODE MessageMode = iota
	SSML_MODE
)

Useful for response builders to distinguish between response modes and generate a response in a generic way

type ResponseBuilder

type ResponseBuilder interface {
	// Generates a new response object which ends the discussion, not asking the user for any sort of prompt.
	TellResponse(message string, conversationToken *string) (api.RootResponse, error)
	// Generates a new response object which ends the discussion using SSML in the final response, not asking the user for any sort of prompt.
	TellResponseSSML(message string, conversationToken *string) (api.RootResponse, error)
	// Generates a response object which asks the user to respond.  You can also provide a list of strings that
	// can be said to not provide a response.  A conversation token is key in making sure you do not lose the context of
	// the conversation, make sure this is either the same one that is sent from the user or if this is a new request a
	// unique one as any response that comes back will contain it and can be used for correlation.
	AskResponse(message string, conversationToken *string, noInputPrompt []string) (api.RootResponse, error)
	// Generates a response object which asks the user to respond using SSML.  You can also provide a list of strings that
	// can be said to not provide a response.  A conversation token is key in making sure you do not lose the context of
	// the conversation, make sure this is either the same one that is sent from the user or if this is a new request a
	// unique one as any response that comes back will contain it and can be used for correlation.
	AskResponseSSML(message string, conversationToken *string, noInputPrompt []string) (api.RootResponse, error)
}

func NewResponseBuilder

func NewResponseBuilder() ResponseBuilder

Create a response builder object used to respond to the request

Directories

Path Synopsis
The basic API for interacting with a google home/google assistant with structures to convert the request/response to and from json
The basic API for interacting with a google home/google assistant with structures to convert the request/response to and from json

Jump to

Keyboard shortcuts

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