musics

package
v0.0.0-...-f23b7a0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderByViewCount Order = "viewCount"
	OrderByDate            = "date"
	OrderByDefault         = "relevance"
)

Variables

View Source
var (
	EmptyMusic = Music{}
)

Functions

func GenerateCacheKey

func GenerateCacheKey(query, token string) string

Types

type Music

type Music struct {
	YoutubeVideoID string
	ThumbnailURL   string
	Title          string
	YoutubeTags    []string
}

func NewMusic

func NewMusic(youtubeVideoID, thumbnailURL, title string, tags []string) *Music
func (m *Music) DeepLink() string

func (*Music) IsEqual

func (m *Music) IsEqual(other *Music) bool

type MusicListDto

type MusicListDto struct {
	Musics        *Musics
	NextPageToken string // optional
}

type MusicRepository

type MusicRepository interface {
	GetMusic(videoID string) (*Music, error)
	GetMusicsByIDs(videoIDs []string) (Musics, error)
	GetMusicList(key, pageToken string) (*MusicListDto, bool, error)
	SaveMusicList(key string, musicList []byte) error
	GetPlayListBy(order, pageToken string) (*MusicListDto, error)
}

type Musics

type Musics []Music

type NotFoundError

type NotFoundError struct {
	Msg string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Order

type Order string

func (Order) String

func (o Order) String() string

type Service

type Service interface {
	GetMusic(videoID string) (*Music, error)
	GetMusics(videoIDs []string) (Musics, error)
	GetMusicList(query string, pageToken string) (*MusicListDto, error)
	GetPlayListBy(order Order, pageToken string) (*MusicListDto, error)
}

func NewMusicService

func NewMusicService(l *zap.SugaredLogger, mr MusicRepository) Service

Jump to

Keyboard shortcuts

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