github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-google-assistant/googleassistant/response.go (about)

     1  package googleassistant
     2  
     3  type DeviceName struct {
     4  	DefaultNames []string `json:"defaultNames,omitempty"`
     5  	Name         string   `json:"name,omitempty"`
     6  	Nicknames    []string `json:"nicknames,omitempty"`
     7  }
     8  
     9  type DeviceAttributes struct {
    10  	ColorModel      string `json:"colorModel,omitempty"`
    11  	TemperatureMinK int    `json:"temperatureMinK,omitempty"`
    12  	TemperatureMaxK int    `json:"temperatureMaxK,omitempty"`
    13  }
    14  
    15  type Device struct {
    16  	ID              string     `json:"id"`
    17  	Type            string     `json:"type"`
    18  	Traits          []string   `json:"traits"`
    19  	Name            DeviceName `json:"name"`
    20  	WillReportState bool       `json:"willReportState"`
    21  	//DeviceInfo      struct {
    22  	//Manufacturer string `json:"manufacturer"`
    23  	//Model        string `json:"model"`
    24  	//HwVersion    string `json:"hwVersion"`
    25  	//SwVersion    string `json:"swVersion"`
    26  	//} `json:"deviceInfo"`
    27  	//CustomData struct {
    28  	//FooValue int    `json:"fooValue"`
    29  	//BarValue bool   `json:"barValue"`
    30  	//BazValue string `json:"bazValue"`
    31  	//} `json:"customData"`
    32  	Attributes DeviceAttributes `json:"attributes,omitempty"`
    33  }
    34  
    35  type ResponseStates struct {
    36  	On         bool `json:"on,omitempty"`
    37  	Brightness int  `json:"brightness,omitempty"`
    38  	Online     bool `json:"online,omitempty"`
    39  }
    40  
    41  func NewResponseCommand() ResponseCommand {
    42  	return ResponseCommand{
    43  		States: ResponseStates{},
    44  		Status: "SUCCESS",
    45  	}
    46  }
    47  
    48  type ResponseCommand struct {
    49  	IDs       []string       `json:"ids"`
    50  	Status    string         `json:"status"`
    51  	States    ResponseStates `json:"states"`
    52  	ErrorCode string         `json:"errorCode,omitempty"`
    53  }
    54  
    55  type Response struct {
    56  	RequestID string `json:"requestId"`
    57  	Payload   struct {
    58  		AgentUserID string            `json:"agentUserId,omitempty"`
    59  		Devices     []Device          `json:"devices,omitempty"`
    60  		Commands    []ResponseCommand `json:"commands,omitempty"`
    61  	} `json:"payload"`
    62  }