Parent directory

youtube.go

668 bytes
 1package youtube
 2
 3import (
 4	"context"
 5	"log/slog"
 6
 7	"github.com/TheEdgeOfRage/ytrssil-api/models"
 8)
 9
10type Client interface {
11	GetVideoDurations(ctx context.Context, videos map[string]*models.Video) error
12	GetVideoMetadata(ctx context.Context, videoID string) (*models.Video, error)
13	GetChannelImageURL(ctx context.Context, channelID string) (string, error)
14	ResolveChannelID(ctx context.Context, handle string) (string, error)
15}
16
17type youTubeClient struct {
18	log    *slog.Logger
19	apiKey string
20}
21
22var _ Client = (*youTubeClient)(nil)
23
24func NewYouTubeClient(log *slog.Logger, apiKey string) *youTubeClient {
25	return &youTubeClient{
26		log:    log,
27		apiKey: apiKey,
28	}
29}