Skip to content

johangu/gotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gotify - a Go wrapper for the Spotify API

This is my first attempt at using Go, so I'm sure there are lots of things that could have been written differently, please feel free to let me know, and to improve upon it.

Documentation

Documentation will be available soon

Installation

Add the following to your project:

import (
  "github.com/johangu/gotify"
)

Quick start

To get an access token

var oauth = gotify.SpotifyOauth{
  ClientId,
  ClientSecret,
  CallbackURL,
  "",
  Scope,
  "<path for saving token>"
}
var token gotify.Token

func main() {
  url, err := gotify.GetAuthorizeURL(oauth)
  if err != nil {
    // Handle error
  }
  
  http.Handlefunc("/callback", callbackHandler)
  ... // add different handlers you may need.
  
  http.ListenAndServe(":8888", nil)
  http.Get(url)
}

func callbackHandler(w http.ResponseWriter, r *http.Request) {
  code, _ := gotify.ParseResponseCode(r.RequestURI)
  token, _ = gotify.GetAccessToken(code, oauth)
}

Report Issues

Feel free to report any issues here or send a pull request.

Version

  • 0.0.1 - 2014-06-21 - Initial pre-release

About

A Go client for the Spotify API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages