api

package
Version: 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: 0 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const MAIN_INTENT = "assistant.intent.action.MAIN"

The assistant fires the main intent for the root level call (for example "Ok Google, Talk To <Action>").

View Source
const PERMISSION_INTENT = "assistant.intent.action.PERMISSION"

The assistant fires the permission intent when an action invokes askForPermission

View Source
const TEXT_INTENT = "assistant.intent.action.TEXT"

The assistant fires the text intent when you the action ask for a response.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionConfig

type ActionConfig struct {
	ErrorMessage                 string
	ConversationAPIVersionHeader string
	ConversationAPIVersion       string
	ResponseHeaders              map[string]string
}

func NewDefaultActionConfig

func NewDefaultActionConfig() ActionConfig

NewDefaultActionConfig generates an ActionConfig with the default values and returns it

type Argument

type Argument struct {
	Name             *string   `json:"name"`
	RawText          *string   `json:"raw_text"`
	IntValue         *string   `json:"int_value"`
	BoolValue        *string   `json:"bool_value"`
	TextValue        *string   `json:"text_value"`
	DateValue        *string   `json:"date_value"`
	TimeValue        *string   `json:"time_value"`
	LocationValue    *Location `json:"location_value"`
	FormattedAddress *string   `json:"formatted_address"`
}

type Conversation

type Conversation struct {
	ConversationID    *string `json:"conversation_id"`
	ConversationToken *string `json:"conversation_token"`
	Type              int     `json:"type"`
}

type Coordinates

type Coordinates struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type Device

type Device struct {
	Location_ *Location `json:"location"`
}

type ExpectedInput

type ExpectedInput struct {
	PossibleIntents []ExpectedIntent `json:"possible_intents"`
	InputPrompt_    InputPrompt      `json:"input_prompt"`
}

type ExpectedIntent

type ExpectedIntent struct {
	Intent          string          `json:"intent"`
	InputValueSpec_ *InputValueSpec `json:"input_value_spec,omitempty"`
}

type FinalResponse

type FinalResponse struct {
	SpeechResponse_ SpeechResponse `json:"speech_response"`
}

type Input

type Input struct {
	Intent    *string    `json:"intent"`
	RawInputs []RawInput `json:"raw_inputs"`
	Arguments []Argument `json:"arguments"`
}

type InputPrompt

type InputPrompt struct {
	InitialPrompts []SpeechResponse `json:"initial_prompts"`
	NoInputPrompts []SpeechResponse `json:"no_input_prompts,omitempty"`
}

type InputValueSpec

type InputValueSpec struct {
	PermissionValueSpec_ PermissionValueSpec `json:"permission_value_spec"`
}

type Location

type Location struct {
	City             *string      `json:"city"`
	ZipCode          *string      `json:"zip_code"`
	FormattedAddress *string      `json:"formatted_address"`
	Coordinates_     *Coordinates `json:"coordinates"`
}

type PermissionValueSpec

type PermissionValueSpec struct {
	OptContext  *string  `json:"opt_context"`
	Permissions []string `json:"permissions"`
}

type RawInput

type RawInput struct {
	CreateTime *Time   `json:"create_time"`
	Query      *string `json:"query"`
	InputType  int     `json:"input_type"`
}

type RootRequest

type RootRequest struct {
	User_         *User         `json:"user"`
	Device_       *Device       `json:"device"`
	Conversation_ *Conversation `json:"conversation"`
	Inputs        []Input       `json:"inputs"`
}

RootRequest object which should contain all the request data sent via google

type RootResponse

type RootResponse struct {
	ConversationToken  *string         `json:"conversation_token,omitempty"`
	ExpectUserResponse bool            `json:"expect_user_response"`
	ExpectedInputs     []ExpectedInput `json:"expected_inputs,omitempty"`
	FinalResponse_     *FinalResponse  `json:"final_response,omitempty"`
}

RootResponse object which will be formatted to json and sent back to google and onto the user.

type SpeechResponse

type SpeechResponse struct {
	TextToSpeech *string `json:"text_to_speech,omitempty"`
	SSML         *string `json:"ssml,omitempty"`
}

type Time

type Time struct {
	Seconds int `json:"seconds"`
	Nanos   int `json:"nanos"`
}

type User

type User struct {
	UserId      *string      `json:"user_id"`
	AccessToken *string      `json:"access_token"`
	Profile     *UserProfile `json:"profile"`
}

type UserProfile

type UserProfile struct {
	GivenName   *string `json:"given_name"`
	FamilyName  *string `json:"family_name"`
	DisplayName *string `json:"display_name"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL