-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (31 loc) · 1.19 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"github.com/michplunkett/spotifyfm/api"
"github.com/michplunkett/spotifyfm/api/authentication"
"github.com/michplunkett/spotifyfm/api/endpoints"
"github.com/michplunkett/spotifyfm/cmd"
"github.com/michplunkett/spotifyfm/util/environment"
)
func main() {
// Starting the http server
api.Start()
// Getting the environment variables
envVars := environment.NewEnvVars()
spotifyAuth := authentication.NewSpotifyAuthHandlerAll(envVars)
spotifyClient := spotifyAuth.Authenticate()
spotifyHandler := endpoints.NewSpotifyHandler(spotifyClient)
fmt.Println("---------------------")
fmt.Println("SPOTIFY THANGS")
// use the client to make calls that require authorization
spotifyUser := spotifyHandler.GetUserInfo()
fmt.Println("You are logged in as ", spotifyUser.DisplayName)
lastFMAuth := authentication.NewLastFMAuthHandler(envVars)
lastFMClient := lastFMAuth.Authenticate()
lastFMHandler := endpoints.NewLastFMHandler(lastFMClient)
fmt.Println("---------------------")
fmt.Println("LAST.FM THANGS")
lastFMUser := lastFMHandler.GetUserInfo()
fmt.Println("You are logged in as ", lastFMUser.RealName)
cmd.NewRootCmd(lastFMHandler, spotifyHandler).Execute()
}