Skip to content

Commit 316c55a

Browse files
committed
Updated return types
1 parent 93eb694 commit 316c55a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pkg/homeassistant/services.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ type reqCall struct {
4949
// API CALLS
5050

5151
// Domains returns all domains and their associated service objects
52-
func (c *Client) Domains() ([]Domain, error) {
53-
var response []Domain
52+
func (c *Client) Domains() ([]*Domain, error) {
53+
var response []*Domain
5454
if err := c.Do(nil, &response, client.OptPath("services")); err != nil {
5555
return nil, err
5656
}
@@ -86,14 +86,14 @@ func (c *Client) Services(domain string) ([]*Service, error) {
8686
// changed while the service was being executed.
8787
// TODO: This is a placeholder implementation, and requires fields to
8888
// be passed in the request
89-
func (c *Client) Call(service, entity string) ([]State, error) {
89+
func (c *Client) Call(service, entity string) ([]*State, error) {
9090
domain := domainForEntity(entity)
9191
if domain == "" {
9292
return nil, ErrBadParameter.Withf("Invalid entity: %q", entity)
9393
}
9494

9595
// Call the service
96-
var response []State
96+
var response []*State
9797
if payload, err := client.NewJSONRequest(reqCall{
9898
Entity: entity,
9999
}); err != nil {

pkg/homeassistant/states.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ type State struct {
3030
// API CALLS
3131

3232
// States returns all the entities and their state
33-
func (c *Client) States() ([]State, error) {
33+
func (c *Client) States() ([]*State, error) {
3434
// Return the response
35-
var response []State
35+
var response []*State
3636
if err := c.Do(nil, &response, client.OptPath("states")); err != nil {
3737
return nil, err
3838
}
@@ -42,9 +42,9 @@ func (c *Client) States() ([]State, error) {
4242
}
4343

4444
// State returns a state for a specific entity
45-
func (c *Client) State(EntityId string) (State, error) {
45+
func (c *Client) State(EntityId string) (*State, error) {
4646
// Return the response
47-
var response State
47+
var response *State
4848
if err := c.Do(nil, &response, client.OptPath("states", EntityId)); err != nil {
4949
return response, err
5050
}

0 commit comments

Comments
 (0)