Documentation ¶
Index ¶
- func GetEndPointsURI(client *http.Client) (string, error)
- func GetToken(tokenFile string, config *oauth2.Config) (*oauth2.Token, error)
- func LoadToken(fname string) (*oauth2.Token, error)
- func NewOAuthConfig(client, secret string) *oauth2.Config
- func SaveToken(fname string, token *oauth2.Token) error
- type Attribute
- type Auth
- type Sensor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEndPointsURI ¶
GetEndPointsURI returns the smartthing endpoints URI. The endpoints URI is the base for all app requests.
func GetToken ¶
GetToken returns the token for the ClientID and Secret specified in config. The function attempts to load the token from tokenFile first, and failing that, starts a full token authentication cycle with SmartThings. If tokenFile is blank, the function uses a default name under the current user's home directory. The token is saved to local disk before being returned to the caller.
This function represents the most common (and possibly convenient) way to retrieve a token for a given ClientID and Secret.
func LoadToken ¶
LoadToken loads the token from a file on disk. If nil is used for filename a default filename user the user's directory is used.
func NewOAuthConfig ¶
NewOAuthConfig creates a new oauth2.config structure with the correct parameters to use smartthings.