favourites.go
author Mikael Berthe <mikael@lilotux.net>
Mon, 17 Apr 2017 10:28:10 +0200
changeset 130 c450bb73f59a
parent 120 579912e9d0ef
child 138 23d3a518d0ad
permissions -rw-r--r--
Update credits
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
130
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     1
/*
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     2
Copyright 2017 Mikael Berthe
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     3
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     4
Licensed under the MIT license.  Please see the LICENSE file is this directory.
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     5
*/
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     6
93
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
package gondole
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
import (
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
	"github.com/sendgrid/rest"
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
)
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
// GetFavourites returns the list of the user's favourites
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
func (g *Client) GetFavourites() ([]Status, error) {
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
	var faves []Status
120
579912e9d0ef Refactor API calls
Mikael Berthe <mikael@lilotux.net>
parents: 98
diff changeset
    16
	err := g.apiCall("favourites", rest.Get, nil, &faves)
93
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
	if err != nil {
120
579912e9d0ef Refactor API calls
Mikael Berthe <mikael@lilotux.net>
parents: 98
diff changeset
    18
		return nil, err
93
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
	}
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
	return faves, nil
d427d8aa75f9 Add GetFavourites()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
}