Skip to content

Commit a729d05

Browse files
committed
✨ Support list playlist image
1 parent 46f2fb1 commit a729d05

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

cmd/playlistImage/list.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package playlistImage
2+
3+
import (
4+
"github.com/eat-pray-ai/yutu/pkg/playlistImage"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var listCmd = &cobra.Command{
9+
Use: "list",
10+
Short: "List YouTube playlist images",
11+
Long: "List YouTube playlist images' info",
12+
Run: func(cmd *cobra.Command, args []string) {
13+
pi := playlistImage.NewPlaylistImage(
14+
playlistImage.WithParent(parent),
15+
playlistImage.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
16+
playlistImage.WithOnBehalfOfContentOwnerChannel(onBehalfOfContentOwnerChannel),
17+
playlistImage.WithMaxResults(maxResults),
18+
playlistImage.WithService(nil),
19+
)
20+
pi.List(parts, output)
21+
},
22+
}
23+
24+
func init() {
25+
playlistImageCmd.AddCommand(listCmd)
26+
27+
listCmd.Flags().StringVarP(&parent, "parent", "p", "", "Return PlaylistImages for this playlist id")
28+
listCmd.Flags().StringVarP(&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "")
29+
listCmd.Flags().StringVarP(&onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "")
30+
listCmd.Flags().Int64VarP(&maxResults, "maxResults", "n", 5, "The maximum number of items that should be returned")
31+
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"id", "kind", "snippet"}, "Comma separated parts")
32+
listCmd.Flags().StringVarP(&output, "output", "o", "", "json or yaml")
33+
}

cmd/playlistImage/playlistImage.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package playlistImage
2+
3+
import (
4+
"github.com/eat-pray-ai/yutu/cmd"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var (
9+
id string
10+
kind string
11+
height int64
12+
playlistId string
13+
type_ string
14+
width int64
15+
file string
16+
parent string
17+
maxResults int64
18+
parts []string
19+
output string
20+
21+
onBehalfOfContentOwner string
22+
onBehalfOfContentOwnerChannel string
23+
)
24+
25+
var playlistImageCmd = &cobra.Command{
26+
Use: "playlistImage",
27+
Short: "Manipulate YouTube playlist images",
28+
Long: "List, insert, update, or delete YouTube playlist images.",
29+
Run: func(cmd *cobra.Command, args []string) {
30+
cmd.Help()
31+
},
32+
}
33+
34+
func init() {
35+
cmd.RootCmd.AddCommand(playlistImageCmd)
36+
}

0 commit comments

Comments
 (0)