spotifyapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package spotifyapi interacts with the spotify api

Index

Constants

This section is empty.

Variables

View Source
var C *client
View Source
var ErrUnauthorized = errors.New("access and refresh token expired")

Functions

func Init

func Init() error

Types

type Album

type Album struct {
	SpotifyID   string   `json:"id"`
	Name        string   `json:"name"`
	TrackAmount int      `json:"total_tracks"`
	Popularity  int      `json:"popularity"`
	Images      []Image  `json:"images"`
	Artists     []Artist `json:"artists"`
}

func (Album) ToModel

func (a Album) ToModel() model.Album

type Artist

type Artist struct {
	SpotifyID string `json:"id"`
	Name      string `json:"name"`
	Followers struct {
		Total int `json:"total"`
	} `json:"followers"`
	Popularity int     `json:"popularity"`
	Images     []Image `json:"images"`
}

func (Artist) ToModel

func (a Artist) ToModel() model.Artist

type Context

type Context struct {
	Type string `json:"type"`
	URI  string `json:"uri"`
}

type Current

type Current struct {
	Track      Track   `json:"item"`
	ProgressMs int     `json:"progress_ms"`
	IsPlaying  bool    `json:"is_playing"`
	Context    Context `json:"context"`
}

type History

type History struct {
	Track    Track     `json:"track"`
	PlayedAt time.Time `json:"played_at"`
	Context  Context   `json:"context"`
}

func (History) ToModel

func (h History) ToModel(user model.User) model.History

type Image

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

type Playlist

type Playlist struct {
	SpotifyID string `json:"id"`
	Owner     struct {
		UID         string `json:"id"`
		DisplayName string `json:"display_name"`
	} `json:"owner"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Public      *bool  `json:"public"`
	Tracks      struct {
		Total int `json:"total"`
	} `json:"tracks"`
	Collaborative *bool   `json:"collaborative"`
	Images        []Image `json:"images"`
	SnapshotID    string  `json:"snapshot_id"`
}

func (*Playlist) ToModel

func (p *Playlist) ToModel() model.Playlist

type Show

type Show struct {
	SpotifyID     string  `json:"id"`
	Name          string  `json:"name"`
	EpisodeAmount int     `json:"total_episodes"`
	Images        []Image `json:"images"`
}

func (Show) ToModel

func (s Show) ToModel() model.Show

type Track

type Track struct {
	SpotifyID  string   `json:"id"`
	Name       string   `json:"name"`
	Popularity int      `json:"popularity"`
	Artists    []Artist `json:"artists"`
	DurationMs int      `json:"duration_ms"`
	LinkedFrom struct {
		SpotifyID string `json:"id"`
	} `json:"linked_from"`
}

func (*Track) ToModel

func (t *Track) ToModel() model.Track

Jump to

Keyboard shortcuts

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