gotify

package module
v0.0.0-...-556bdb6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2015 License: MIT Imports: 9 Imported by: 0

README

gotify Build Status

Spotify Web API written in Go

Documentation

Index

Constants

View Source
const (
	ENV_CLIENT_ID     = "GOTIFY_CLIENT_ID"
	ENV_CLIENT_SECRET = "GOTIFY_CLIENT_SECRET"
	ENV_REDIRECT_URL  = "GOTIFY_REDIRECT_URL"
	SPOTIFY_AUTH_URL  = "https://accounts.spotify.com/authorize"
	SPOTIFY_TOKEN_URL = "https://accounts.spotify.com/api/token"
)

Variables

This section is empty.

Functions

func AuthorizeClient

func AuthorizeClient(auth *Oauth2Authenticator)

Types

type Album

type Album struct {
	Name string
	Uri  string
}

func SearchAlbum

func SearchAlbum(s string) []Album

type Artist

type Artist struct {
	Name string
	Uri  string
}

func SearchArtist

func SearchArtist(s string) []Artist

type Oauth2Authenticator

type Oauth2Authenticator struct {
	Conf  *oauth2.Config
	Token *oauth2.Token
}

func CreateAuthenticator

func CreateAuthenticator(scopes ...Scope) *Oauth2Authenticator

func (*Oauth2Authenticator) GetAuthURL

func (auth *Oauth2Authenticator) GetAuthURL() string

func (*Oauth2Authenticator) ParseToken

func (auth *Oauth2Authenticator) ParseToken(res *http.Request)

type Playlist

type Playlist interface {
	RemoveTrack(t *Track) (err error)
	AddTrack(t *Track) (err error)
}

func CreatePlaylist

func CreatePlaylist(name string, public bool, user User) (Playlist, error)

func GetPlaylist

func GetPlaylist(name string) (Playlist, error)

type Scope

type Scope string
const (
	PLAYLIST_READ_PRIVATE   Scope = "playlist-read-private"
	PLAYLIST_MODIFY_PRIVATE Scope = "playlist-modify-private"
	PLAYLIST_MODIFY_PUBLIC  Scope = "playlist-modify-public"
	STREAMING               Scope = "streaming"
	USER_FOLLOW_MODIFY      Scope = "user-follow-modify"
	USER_FOLLOW_READ        Scope = "user-follow-read"
	USER_LIBRARY_READ       Scope = "user-library-read"
	USER_LIBRARY_MODIFY     Scope = "user-library-modify"
	USER_READ_PRIVATE       Scope = "user-read-private"
	USER_READ_BIRTHDATE     Scope = "user-read-birthdate"
	USER_READ_EMAIL         Scope = "user-read-email"
)

type SearchResult

type SearchResult struct {
	Tracks  []Track
	Albums  []Album
	Artists []Artist
}
func Search(what string, types []SearchType) SearchResult

type SearchType

type SearchType string
const (
	TRACK  SearchType = "track"
	ARTIST SearchType = "artist"
	ALBUM  SearchType = "album"
)

type SpotifyPlaylist

type SpotifyPlaylist struct {
	Id     string  `json:"id,omitempty"`
	Name   string  `json:"name"`
	Tracks []Track `json:"-"`
	Public bool    `json:"public"`
	Owner  string  `json:"owner,omitempty"`
	Url    string  `json:"uri,omitempty"`
}

func (*SpotifyPlaylist) AddTrack

func (p *SpotifyPlaylist) AddTrack(t *Track) error

func (*SpotifyPlaylist) RemoveTrack

func (p *SpotifyPlaylist) RemoveTrack(t *Track) error

type Track

type Track struct {
	Name    string
	Uri     string
	Album   Album
	Artists []Artist
}

func SearchTrack

func SearchTrack(s string) []Track

type User

type User struct {
	Id      string
	Name    string
	Product string // premium status?
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL