🚸 Lazy auth

This commit is contained in:
OpenWaygate committed 2024-03-13 10:17:25 +08:00
1 parent 16b2539044
commit 6e2ea02059
4 files changed
+12 -4

No files matched your search

+5 -4
View File
@@ -12,10 +12,10 @@ import (
)
var (
service *youtube.Service = auth.NewY2BService()
part []string = []string{"snippet", "statistics"}
errGetChannel error = errors.New("failed to get channel")
errUpdateChannel error = errors.New("failed to update channel")
service *youtube.Service
part []string = []string{"snippet", "statistics"}
errGetChannel error = errors.New("failed to get channel")
errUpdateChannel error = errors.New("failed to update channel")
)
type Channel struct {
@@ -35,6 +35,7 @@ type ChannelOption func(*Channel)
func NewChannel(opts ...ChannelOption) *Channel {
c := &Channel{}
service = auth.NewY2BService()
for _, opt := range opts {
opt(c)
+2
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"github.com/eat-pray-ai/yutu/pkg/auth"
"github.com/eat-pray-ai/yutu/pkg/utils"
"google.golang.org/api/youtube/v3"
@@ -37,6 +38,7 @@ type PlaylistOption func(*Playlist)
func NewPlaylist(opts ...PlaylistOption) *Playlist {
p := &Playlist{}
service = auth.NewY2BService()
for _, opt := range opts {
opt(p)
+2
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"github.com/eat-pray-ai/yutu/pkg/auth"
"github.com/eat-pray-ai/yutu/pkg/utils"
"google.golang.org/api/youtube/v3"
)
@@ -36,6 +37,7 @@ type PlaylistItemOption func(*PlaylistItem)
func NewPlaylistItem(opts ...PlaylistItemOption) *PlaylistItem {
p := &PlaylistItem{}
service = auth.NewY2BService()
for _, opt := range opts {
opt(p)
+3
View File
@@ -6,6 +6,7 @@ import (
"log"
"os"
"github.com/eat-pray-ai/yutu/pkg/auth"
"github.com/eat-pray-ai/yutu/pkg/utils"
"google.golang.org/api/youtube/v3"
)
@@ -48,6 +49,8 @@ type VideoOption func(*Video)
func NewVideo(opts ...VideoOption) *Video {
v := &Video{}
service = auth.NewY2BService()
for _, opt := range opts {
opt(v)
}