spotify

package
v0.0.0-...-8089a3f Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package spotify: go-spotify provides an easy-to-use API to access Spotify's WEB API

Index

Constants

View Source
const (
	BASE_URL     = "https://api.spotify.com"
	ACCOUNTS_URL = "https://accounts.spotify.com/api/token"
	API_VERSION  = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Spotify

type Spotify struct {
	// contains filtered or unexported fields
}

Spotify struct which we use to wrap our request operations.

func New

func New(clientID, clientSecret string) Spotify

Creates a New Spotify API object with the clientID and clientSecret Usage:

spotify.New("XXX","YYY")

func (*Spotify) Authorize

func (spotify *Spotify) Authorize() (bool, []error)

Authorizes your application against Spotify

func (*Spotify) Delete

func (spotify *Spotify) Delete(format string, args ...interface{}) ([]byte, []error)

This version does not support User Authentication so POST/PUT/DELETE Request won't work.

Creates a new DELETE Request to Spotify and returns the response as a map[string]interface{}.

format: target endpoint format like "me/tracks?ids=%s" - string

args: Arguments to be used based on format

Usage:

spotify.Delete("me/tracks?ids=%s","4iV5W9uYEdYUVa79Axb7Rh")

func (*Spotify) Get

func (spotify *Spotify) Get(format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

Creates a new GET Request to Spotify and returns the response as a map[string]interface{}.

format: target endpoint format like "albums/%s" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

spotify.Get("albums/%s",nil,0sNOF9WDwhWunNAHPD3Baj)

func (*Spotify) Post

func (spotify *Spotify) Post(format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

This version does not support User Authentication so POST/PUT/DELETE Request won't work.

Creates a new POST Request to Spotify and returns the response as a map[string]interface{}.

format: target endpoint format like "users/%s/playlists" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

spotify.Post("users/%s/playlists",map[string]interface{},"wizzler")

func (*Spotify) Put

func (spotify *Spotify) Put(format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

This version does not support User Authentication so POST/PUT/DELETE Request won't work.

Creates a new PUT Request to Spotify and returns the response as a map[string]interface{}.

format: target endpoint format like "me/tracks?ids=%s" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

spotify.Put("me/tracks?ids=%s",nil,"4iV5W9uYEdYUVa79Axb7Rh")

func (*Spotify) Request

func (spotify *Spotify) Request(method, format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

Creates a new Request to Spotify and returns the response as a map[string]interface{}.

method: GET/POST/PUT/DELETE - string

format: target endpoint format like "albums/%s" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

spotify.request("GET","albums/%s",nil,"0sNOF9WDwhWunNAHPD3Baj")

Jump to

Keyboard shortcuts

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