From a729d0519c33738645b7bb7bd2b65122cfb03472 Mon Sep 17 00:00:00 2001 From: openwaygate <27287694+OpenWaygate@users.noreply.github.com> Date: Tue, 15 Apr 2025 22:29:37 +0800 Subject: [PATCH] :sparkles: Support list playlist image --- cmd/playlistImage/list.go | 33 +++++++++++++++++++++++++++ cmd/playlistImage/playlistImage.go | 36 ++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 cmd/playlistImage/list.go create mode 100644 cmd/playlistImage/playlistImage.go diff --git a/cmd/playlistImage/list.go b/cmd/playlistImage/list.go new file mode 100644 index 0000000..af12709 --- /dev/null +++ b/cmd/playlistImage/list.go @@ -0,0 +1,33 @@ +package playlistImage + +import ( + "github.com/eat-pray-ai/yutu/pkg/playlistImage" + "github.com/spf13/cobra" +) + +var listCmd = &cobra.Command{ + Use: "list", + Short: "List YouTube playlist images", + Long: "List YouTube playlist images' info", + Run: func(cmd *cobra.Command, args []string) { + pi := playlistImage.NewPlaylistImage( + playlistImage.WithParent(parent), + playlistImage.WithOnBehalfOfContentOwner(onBehalfOfContentOwner), + playlistImage.WithOnBehalfOfContentOwnerChannel(onBehalfOfContentOwnerChannel), + playlistImage.WithMaxResults(maxResults), + playlistImage.WithService(nil), + ) + pi.List(parts, output) + }, +} + +func init() { + playlistImageCmd.AddCommand(listCmd) + + listCmd.Flags().StringVarP(&parent, "parent", "p", "", "Return PlaylistImages for this playlist id") + listCmd.Flags().StringVarP(&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "") + listCmd.Flags().StringVarP(&onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "") + listCmd.Flags().Int64VarP(&maxResults, "maxResults", "n", 5, "The maximum number of items that should be returned") + listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"id", "kind", "snippet"}, "Comma separated parts") + listCmd.Flags().StringVarP(&output, "output", "o", "", "json or yaml") +} diff --git a/cmd/playlistImage/playlistImage.go b/cmd/playlistImage/playlistImage.go new file mode 100644 index 0000000..f91bc11 --- /dev/null +++ b/cmd/playlistImage/playlistImage.go @@ -0,0 +1,36 @@ +package playlistImage + +import ( + "github.com/eat-pray-ai/yutu/cmd" + "github.com/spf13/cobra" +) + +var ( + id string + kind string + height int64 + playlistId string + type_ string + width int64 + file string + parent string + maxResults int64 + parts []string + output string + + onBehalfOfContentOwner string + onBehalfOfContentOwnerChannel string +) + +var playlistImageCmd = &cobra.Command{ + Use: "playlistImage", + Short: "Manipulate YouTube playlist images", + Long: "List, insert, update, or delete YouTube playlist images.", + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, +} + +func init() { + cmd.RootCmd.AddCommand(playlistImageCmd) +}