spotify

package
v0.0.0-...-4e76757 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentType = "application/json; charset=UTF-8"
	Market      = "AU"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) AddSongsToPlaylist

func (sc *Client) AddSongsToPlaylist(ctx context.Context, songs []string, playlistId string) error

func (*Client) Do

func (sc *Client) Do(req *http.Request) (*http.Response, error)

Do wraps httpClient.Do and injects an access token into the request's header

func (*Client) GetCurrentPlaylist

func (sc *Client) GetCurrentPlaylist(ctx context.Context, playlistId string) ([]Track, error)

func (*Client) GetTrackBySongNameAndArtist

func (sc *Client) GetTrackBySongNameAndArtist(ctx context.Context, name string, artists []string) (Track, error)

func (*Client) RemoveSongsFromPlaylist

func (sc *Client) RemoveSongsFromPlaylist(ctx context.Context, songs []Track, playlistId string) error

type Clienter

type Clienter interface {
	GetCurrentPlaylist(ctx context.Context, playlistId string) ([]Track, error)
	GetTrackBySongNameAndArtist(ctx context.Context, name string, artist []string) (Track, error)
	RemoveSongsFromPlaylist(ctx context.Context, songs []Track, playlistId string) error
	AddSongsToPlaylist(ctx context.Context, songs []string, playlistId string) error
}

func NewSpotifyClient

func NewSpotifyClient(clientId, clientSecret, refreshToken string) Clienter

type PlaylistTrackItem

type PlaylistTrackItem struct {
	Track Track `json:"track"`
}

type PlaylistTracks

type PlaylistTracks struct {
	Items []PlaylistTrackItem `json:"items"`
}

type SearchTrackItem

type SearchTrackItem struct {
	Uri  string `json:"uri"`
	Name string `json:"name"`
}

type SearchTracks

type SearchTracks struct {
	Items []SearchTrackItem `json:"items"`
}

type SearchTracksResponse

type SearchTracksResponse struct {
	Tracks SearchTracks `json:"tracks"`
}

type TokenRefreshResponse

type TokenRefreshResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
}

type Track

type Track struct {
	Uri string `json:"uri"`
}

Directories

Path Synopsis
Package mock_spotify is a generated GoMock package.
Package mock_spotify is a generated GoMock package.

Jump to

Keyboard shortcuts

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