spotify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TRACK_TYPE    = "track"
	ALBUM_TYPE    = "album"
	PLAYLIST_TYPE = "playlist"
)

Variables

This section is empty.

Functions

func AlbumTracks added in v0.2.0

func AlbumTracks(s *auth.Session, albumID string) (*[]AlbumTrack, error)

func PlaylistTracks added in v0.2.0

func PlaylistTracks(s *auth.Session, playlistID string) (*[]Track, error)

func UserPlaylists added in v0.2.0

func UserPlaylists(s *auth.Session) (*[]Playlist, error)

Types

type Album

type Album struct {
	Images      []Image  `json:"images"`
	Artists     []Artist `json:"artists"`
	TotalTracks int      `json:"total_tracks"`
	AlbumType   string   `json:"album_type"`
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	ReleaseDate string   `json:"release_date"`
	Type        string   `json:"type"`
	Uri         string   `json:"uri"`
}

type AlbumTrack added in v0.2.0

type AlbumTrack struct {
	Name       string   `json:"name"`
	Uri        string   `json:"uri"`
	Artists    []Artist `json:"artists"`
	DurationMs int      `json:"duration_ms"`
	ID         string   `json:"id"`
}

Simplified track struct that doesn't link back to the album.

type AlbumsResponse added in v0.2.0

type AlbumsResponse struct {
	Href     string  `json:"href"`
	Limit    int     `json:"limit"`
	Next     string  `json:"next"`
	Offset   int     `json:"offset"`
	Previous string  `json:"previous"`
	Total    int     `json:"total"`
	Items    []Album `json:"items"`
}

type Artist

type Artist struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Uri  string `json:"uri"`
}

func (*Artist) String

func (a *Artist) String() string

type ArtistsResponse added in v0.2.0

type ArtistsResponse struct {
	Href     string   `json:"href"`
	Limit    int      `json:"limit"`
	Next     string   `json:"next"`
	Offset   int      `json:"offset"`
	Previous string   `json:"previous"`
	Total    int      `json:"total"`
	Items    []Artist `json:"items"`
}

type Episode

type Episode struct {
	Description string      `json:"description"`
	DurationMs  int         `json:"duration_ms"`
	ID          string      `json:"id"`
	Images      []Image     `json:"images"`
	Name        string      `json:"name"`
	ReleaseDate string      `json:"release_date"`
	ResumePoint ResumePoint `json:"resume_point"`
	Uri         string      `json:"uri"`
}

func (*Episode) String

func (ep *Episode) String() string

type EpisodesResponse added in v0.2.0

type EpisodesResponse struct {
	Href     string    `json:"href"`
	Limit    int       `json:"limit"`
	Next     string    `json:"next"`
	Offset   int       `json:"offset"`
	Previous string    `json:"previous"`
	Total    int       `json:"total"`
	Items    []Episode `json:"items"`
}

type Followers

type Followers struct {
	Total int `json:"total"`
}

type Image

type Image struct {
	Url    string `json:"url"`
	Height int    `json:"height"`
	Width  int    `json:"width"`
}

type Playlist

type Playlist struct {
	Images       []Image        `json:"images"`
	Description  string         `json:"description"`
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Followers    Followers      `json:"followers"`
	Public       bool           `json:"public"`
	Tracks       TracksResponse `json:"tracks"`
	URI          string         `json:"uri"`
	ExternalUrls struct {
		Spotify string `json:"spotify"`
	} `json:"external_urls"`
	Owner struct {
		Followers   Followers `json:"followers"`
		ID          string    `json:"id"`
		Type        string    `json:"type"`
		URI         string    `json:"uri"`
		DisplayName string    `json:"display_name"`
	} `json:"owner"`
}

type PlaylistsResponse added in v0.2.0

type PlaylistsResponse struct {
	Href     string     `json:"href"`
	Limit    int        `json:"limit"`
	Next     string     `json:"next"`
	Offset   int        `json:"offset"`
	Previous string     `json:"previous"`
	Total    int        `json:"total"`
	Items    []Playlist `json:"items"`
}

type Response added in v0.2.0

type Response struct {
	Tracks    TracksResponse    `json:"tracks"`
	Artists   ArtistsResponse   `json:"artists"`
	Albums    AlbumsResponse    `json:"albums"`
	Playlists PlaylistsResponse `json:"playlists"`
	Shows     ShowsResponse     `json:"shows"`
	Episodes  EpisodesResponse  `json:"episodes"`
}

type ResumePoint

type ResumePoint struct {
	FullyPlayed      bool `json:"fully_played"`
	ResumePositionMs int  `json:"resume_position_ms"`
}

type SearchResult added in v0.2.0

type SearchResult struct {
	Tracks    []*Track
	Albums    []*Album
	Playlists []*Playlist
	Artists   []*Artist
	Shows     []*Show
	Episodes  []*Episode
}
func Search(input string, searchType []string, s *auth.Session) (*SearchResult, error)

type Show

type Show struct {
	Description   string  `json:"description"`
	ID            string  `json:"id"`
	Images        []Image `json:"images"`
	Name          string  `json:"name"`
	Uri           string  `json:"uri"`
	TotalEpisodes int     `json:"total_episodes"`
}

func (*Show) String

func (s *Show) String() string

type ShowsResponse added in v0.2.0

type ShowsResponse struct {
	Href     string `json:"href"`
	Limit    int    `json:"limit"`
	Next     string `json:"next"`
	Offset   int    `json:"offset"`
	Previous string `json:"previous"`
	Total    int    `json:"total"`
	Items    []Show `json:"items"`
}

type Track

type Track struct {
	Name       string   `json:"name"`
	Uri        string   `json:"uri"`
	Album      Album    `json:"album"`
	Artists    []Artist `json:"artists"`
	DurationMs int      `json:"duration_ms"`
	ID         string   `json:"id"`
}

func (*Track) InfoString added in v0.2.0

func (t *Track) InfoString(c *config.Config, progressMs int) (
	track string, artist string,
	progressMinutes string, progressSeconds string,
	durationMinutes string, durationSeconds string,
)

type TracksResponse added in v0.2.0

type TracksResponse struct {
	Href     string  `json:"href"`
	Limit    int     `json:"limit"`
	Next     string  `json:"next"`
	Offset   int     `json:"offset"`
	Previous string  `json:"previous"`
	Total    int     `json:"total"`
	Items    []Track `json:"items"`
}

type User added in v0.2.0

type User struct {
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
	ID          string `json:"id"`

	ExternalURLs struct {
		Spotify string `json:"spotify"`
	} `json:"external_urls"`

	Followers struct {
		Href string `json:"href"`

		Total int `json:"total"`
	} `json:"followers"`

	Images []struct {
		URL    string `json:"url"`
		Height int    `json:"height"`
		Width  int    `json:"width"`
	} `json:"images"`
}

func New added in v0.2.0

func New(s *auth.Session) (*User, error)

func (*User) Print added in v0.2.0

func (u *User) Print()

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳