Skip to content

Commit 67a19ed

Browse files
committed
🐛 Add missing youtube service
1 parent 445b1fa commit 67a19ed

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

cmd/superChatEvent/list.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var listCmd = &cobra.Command{
1313
sc := superChatEvent.NewSuperChatEvent(
1414
superChatEvent.WithHl(hl),
1515
superChatEvent.WithMaxResults(maxResults),
16+
superChatEvent.WithService(nil),
1617
)
1718
sc.List(parts, output)
1819
},
@@ -25,8 +26,11 @@ func init() {
2526
&hl, "hl", "l", "", "Return rendered funding amounts in specified language",
2627
)
2728
listCmd.Flags().Int64VarP(
28-
&maxResults, "maxResults", "n", 5, "The maximum number of items that should be returned",
29+
&maxResults, "maxResults", "n", 5,
30+
"The maximum number of items that should be returned",
31+
)
32+
listCmd.Flags().StringSliceVarP(
33+
&parts, "parts", "p", []string{"id", "snippet"}, "Comma separated parts",
2934
)
30-
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"id", "snippet"}, "Comma separated parts")
3135
listCmd.Flags().StringVarP(&output, "output", "o", "", "json or yaml")
3236
}

pkg/superChatEvent/superChatEvent.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package superChatEvent
33
import (
44
"errors"
55
"fmt"
6+
"github.com/eat-pray-ai/yutu/pkg/auth"
67
"github.com/eat-pray-ai/yutu/pkg/utils"
78
"google.golang.org/api/youtube/v3"
89
"log"
@@ -80,3 +81,15 @@ func WithMaxResults(maxResults int64) Option {
8081
s.MaxResults = maxResults
8182
}
8283
}
84+
85+
func WithService(svc *youtube.Service) Option {
86+
return func(_ *superChatEvent) {
87+
if svc == nil {
88+
svc = auth.NewY2BService(
89+
auth.WithCredential(""),
90+
auth.WithCacheToken(""),
91+
)
92+
}
93+
service = svc
94+
}
95+
}

0 commit comments

Comments
 (0)