spotify

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxItemsPerGet = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Id                   string       `json:"id"`
	Name                 string       `json:"name"`
	Href                 string       `json:"href"`
	Uri                  string       `json:"uri"`
	Type                 string       `json:"type"`
	TotalTracks          int          `json:"total_tracks"`
	ReleaseDate          string       `json:"release_date"`
	ReleaseDatePrecision string       `json:"release_date_precision"`
	AlbumType            string       `json:"album_type"`
	ExternalUrls         ExternalUrls `json:"external_urls"`
	Artists              []Artist     `json:"artists"`
	Images               []Image      `json:"images"`
}

type Artist

type Artist struct {
	Id           string       `json:"id"`
	Name         string       `json:"name"`
	Href         string       `json:"href"`
	Uri          string       `json:"uri"`
	Type         string       `json:"type"`
	ExternalUrls ExternalUrls `json:"external_urls"`
}

type Client

type Client struct {
	HttpClient *resty.Client
}

func NewClient

func NewClient(token oauth2.TokenSource) Client

func (Client) RecentlyPlayedAfter

func (c Client) RecentlyPlayedAfter(after time.Time, limit int) (RecentlyPlayedResult, error)

func (Client) RecentlyPlayedBefore

func (c Client) RecentlyPlayedBefore(before time.Time, limit int) (RecentlyPlayedResult, error)

func (Client) UserTracks

func (c Client) UserTracks(offset int, limit int) (result TracksResult, err error)

type Cursors

type Cursors struct {
	After  string `json:"after"`
	Before string `json:"before"`
}

type ExternalIds

type ExternalIds struct {
	ISRC string `json:"isrc"`
	EAN  string `json:"ean"`
	UPC  string `json:"upc"`
}

type ExternalUrls

type ExternalUrls struct {
	Spotify string `json:"spotify"`
}

type Image

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

type Listen

type Listen struct {
	PlayedAt string `json:"played_at"`
	Track    Track  `json:"track"`
}

func (Listen) AsListen

func (l Listen) AsListen() models.Listen

type RecentlyPlayedResult

type RecentlyPlayedResult struct {
	Href    string   `json:"href"`
	Limit   int      `json:"limit"`
	Next    string   `json:"next"`
	Cursors Cursors  `json:"cursors"`
	Items   []Listen `json:"items"`
}

type SavedTrack

type SavedTrack struct {
	AddedAt string `json:"added_at"`
	Track   Track  `json:"track"`
}

func (SavedTrack) AsLove

func (t SavedTrack) AsLove() models.Love

type SpotifyApiBackend

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

func (*SpotifyApiBackend) ExportListens

func (b *SpotifyApiBackend) ExportListens(oldestTimestamp time.Time, results chan models.ListensResult, progress chan models.Progress)

func (*SpotifyApiBackend) ExportLoves

func (b *SpotifyApiBackend) ExportLoves(oldestTimestamp time.Time, results chan models.LovesResult, progress chan models.Progress)

func (*SpotifyApiBackend) FromConfig

func (b *SpotifyApiBackend) FromConfig(config *config.ServiceConfig) models.Backend

func (*SpotifyApiBackend) Name

func (b *SpotifyApiBackend) Name() string

func (*SpotifyApiBackend) OAuth2Config

func (b *SpotifyApiBackend) OAuth2Config(redirectUrl *url.URL) oauth2.Config

func (*SpotifyApiBackend) OAuth2Setup

func (b *SpotifyApiBackend) OAuth2Setup(token oauth2.TokenSource) error

func (*SpotifyApiBackend) OAuth2Strategy

func (b *SpotifyApiBackend) OAuth2Strategy(redirectUrl *url.URL) auth.OAuth2Strategy

func (*SpotifyApiBackend) Options added in v0.3.0

func (b *SpotifyApiBackend) Options() []models.BackendOption

type Track

type Track struct {
	Id           string       `json:"id"`
	Name         string       `json:"name"`
	Href         string       `json:"href"`
	Uri          string       `json:"uri"`
	Type         string       `json:"type"`
	DiscNumber   int          `json:"disc_number"`
	TrackNumber  int          `json:"track_number"`
	DurationMs   int          `json:"duration_ms"`
	Explicit     bool         `json:"explicit"`
	IsLocal      bool         `json:"is_local"`
	Popularity   int          `json:"popularity"`
	ExternalIds  ExternalIds  `json:"external_ids"`
	ExternalUrls ExternalUrls `json:"external_urls"`
	Album        Album        `json:"album"`
	Artists      []Artist     `json:"artists"`
}

func (Track) AsTrack

func (t Track) AsTrack() models.Track

type TracksResult

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

Jump to

Keyboard shortcuts

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