adapters

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseUrl     = "https://www.youtube.com/"
	FeedUrlBase = BaseUrl + "feeds/videos.xml"
)
View Source
const (
	YouTubeChannelsMaxResults = 3
	YouTubeChannelBaseURL     = "https://www.youtube.com/channel/"
)

Variables

View Source
var FeedUrl *url.URL

Functions

func NewYTDLRepository

func NewYTDLRepository() *ytdl.Client

func NewYouTube

func NewYouTube() (*youtube.Service, error)

Types

type Cache

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

Cache keeps firestore client and collection

func NewCacheRepository

func NewCacheRepository() (Cache, error)

NewCacheRepository establishes connection to Firebase and update singleton variable

func (*Cache) GetKey

func (c *Cache) GetKey(key string) (string, error)

GetKey retrieve value by key from cache store

func (*Cache) SetKey

func (c *Cache) SetKey(key, value string, exp time.Duration) error

SetKey saves value for key in cache store with expiration time

type CacheEntity

type CacheEntity struct {
	Key   string        `firestore:"key"`
	Value string        `firestore:"value"`
	Ttl   time.Duration `firestore:"ttl"`
}

CacheEntity is a model for Firestore that handles cache with ttl

type Feed

type Feed struct {
	Entry []FeedEntry `xml:"entry"`
}

type FeedEntry

type FeedEntry struct {
	ID      string `xml:"id"`
	VideoId string `xml:"videoId"`
	Title   string `xml:"title"`
	Link    struct {
		Text string `xml:",chardata"`
		Rel  string `xml:"rel,attr"`
		Href string `xml:"href,attr"`
	} `xml:"link"`
	Published string `xml:"published"`
	Group     struct {
		Thumbnail struct {
			URL    string `xml:"url,attr"`
			Width  string `xml:"width,attr"`
			Height string `xml:"height,attr"`
		} `xml:"thumbnail"`
		Description string `xml:"description"`
	} `xml:"group"`
}

type YouTubeAPIRepository

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

func NewYouTubeAPIRepository

func NewYouTubeAPIRepository(yt *youtube.Service) YouTubeAPIRepository

func (YouTubeAPIRepository) GetChannel

func (yt YouTubeAPIRepository) GetChannel(id string) (app.YouTubeChannel, error)

func (YouTubeAPIRepository) ListChannel

func (yt YouTubeAPIRepository) ListChannel(query string) ([]app.YouTubeChannel, error)

type YouTubeRepository

type YouTubeRepository struct {
	FeedURL *url.URL
}

func NewYouTubeRepository

func NewYouTubeRepository() (YouTubeRepository, error)

func (YouTubeRepository) ListEntry

func (y YouTubeRepository) ListEntry(channelId string) ([]app.YouTubeFeedEntry, error)

Jump to

Keyboard shortcuts

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