### Install gotado with go get Source: https://github.com/gonzolino/gotado/blob/main/README.md Install the gotado library using the go get command. This is the initial step before importing it into your Go packages. ```sh go get github.com/gonzolino/gotado ``` -------------------------------- ### Get User Information Source: https://github.com/gonzolino/gotado/blob/main/README.md Retrieve the current user's information using the Me() method on the gotado client. This includes details like the user's email. ```golang me, err := tado.Me(ctx) fmt.Printf("User Email: %s\n", me.Email) ``` -------------------------------- ### Get Home Information Source: https://github.com/gonzolino/gotado/blob/main/README.md Retrieve specific home information by its name using the GetHome() method on the user object. This returns details about the home's address. ```golang home, err := me.GetHome(ctx, "My Home Name") fmt.Printf("Home Address:\n%s\n%s %s\n", *home.Address.AddressLine1, *home.Address.ZipCode, *home.Address.City) ``` -------------------------------- ### Create gotado Client Source: https://github.com/gonzolino/gotado/blob/main/README.md Create a new gotado client instance using the provided context, OAuth 2.0 configuration, and access token. This client is used to make API requests. ```golang tado := gotado.New(ctx, config, token) ``` -------------------------------- ### Device Authorization Flow Source: https://github.com/gonzolino/gotado/blob/main/README.md Initiates the OAuth 2.0 device authorization flow. The user must visit the provided URI to authenticate and grant access. Requires a client ID. ```golang ctx := context.Background() config := gotado.AuthConfig(clientID) deviceAuth, err := config.DeviceAuth(ctx) // The user must visit the verification URI and authenticate with his personal credentials. // Afterwards an access token will be generated. fmt.Printf("To authenticate, visit %s\n", deviceAuth.VerificationURIComplete) token, err := config.DeviceAccessToken(ctx, deviceAuth) ``` -------------------------------- ### Configure Auth for Refresh Token Source: https://github.com/gonzolino/gotado/blob/main/README.md Configure the authentication to include the 'offline_access' scope, enabling the retrieval of a refresh token for longer-term authentication. ```golang config := gotado.AuthConfig(clientID, "offline_access") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.