deezer

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRateLimitWaitSeconds = 5
View Source
const MaxItemsPerGet = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Id        int    `json:"id"`
	Type      string `json:"type"`
	Link      string `json:"link"`
	Title     string `json:"title"`
	TrackList string `json:"tracklist"`
}

type Artist

type Artist struct {
	Id   int    `json:"id"`
	Type string `json:"type"`
	Link string `json:"link"`
	Name string `json:"name"`
}

type BaseResult

type BaseResult struct {
	Err *Error `json:"error,omitempty"`
}

func (BaseResult) Error

func (r BaseResult) Error() *Error

type Client

type Client struct {
	HttpClient *resty.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token oauth2.TokenSource) Client

func (Client) UserHistory

func (c Client) UserHistory(offset int, limit int) (result HistoryResult, err error)

func (Client) UserTracks

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

type DeezerApiBackend

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

func (*DeezerApiBackend) ExportListens

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

func (*DeezerApiBackend) ExportLoves

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

func (*DeezerApiBackend) FromConfig

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

func (*DeezerApiBackend) Name

func (b *DeezerApiBackend) Name() string

func (*DeezerApiBackend) OAuth2Setup

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

func (*DeezerApiBackend) OAuth2Strategy

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

func (*DeezerApiBackend) Options added in v0.3.0

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

type Error

type Error struct {
	// {"error":{"type":"OAuthException","message":"Invalid OAuth access token.","code":300}}
	Type    string `json:"type"`
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type HistoryResult

type HistoryResult struct {
	BaseResult
	Next     string   `json:"next"`
	Previous string   `json:"prev"`
	Total    int      `json:"total"`
	Tracks   []Listen `json:"data"`
}

type Listen

type Listen struct {
	Track
	Timestamp int64 `json:"timestamp"`
}

func (Listen) AsListen

func (t Listen) AsListen() models.Listen

type LovedTrack

type LovedTrack struct {
	Track
	AddedAt int64 `json:"time_add"`
}

func (LovedTrack) AsLove

func (t LovedTrack) AsLove() models.Love

type Result

type Result interface {
	Error() *Error
}

type Track

type Track struct {
	Id           int    `json:"id"`
	Type         string `json:"type"`
	Link         string `json:"link"`
	Title        string `json:"title"`
	TitleVersion string `json:"title_version"`
	Duration     int    `json:"duration"`
	Rank         int    `json:"rank"`
	Readable     bool   `json:"readable"`
	Explicit     bool   `json:"explicit_lyrics"`
	Album        Album  `json:"album"`
	Artist       Artist `json:"artist"`
}

func (Track) AsTrack

func (t Track) AsTrack() models.Track

type TracksResult

type TracksResult struct {
	BaseResult
	Next     string       `json:"next"`
	Previous string       `json:"prev"`
	Total    int          `json:"total"`
	Tracks   []LovedTrack `json:"data"`
}

Jump to

Keyboard shortcuts

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