💬 Align id(s) cases

This commit is contained in:
OpenWaygate committed 2026-01-25 02:39:31 +08:00
1 parent 292b8e4c61
commit 386da7a938
54 files changed
+153 -153

No files matched your search

+1 -1
View File
@@ -65,7 +65,7 @@ var deleteCmd = &cobra.Command{
Long: deleteLong,
Run: func(cmd *cobra.Command, args []string) {
input := caption.NewCation(
caption.WithIDs(ids),
caption.WithIds(ids),
caption.WithOnBehalfOf(onBehalfOf),
caption.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
)
+1 -1
View File
@@ -77,7 +77,7 @@ var downloadCmd = &cobra.Command{
Long: downloadLong,
Run: func(cmd *cobra.Command, args []string) {
input := caption.NewCation(
caption.WithIDs(ids),
caption.WithIds(ids),
caption.WithFile(file),
caption.WithTfmt(tfmt),
caption.WithTlang(tlang),
+1 -1
View File
@@ -83,7 +83,7 @@ var listCmd = &cobra.Command{
Long: listLong,
Run: func(cmd *cobra.Command, args []string) {
input := caption.NewCation(
caption.WithIDs(ids),
caption.WithIds(ids),
caption.WithVideoId(videoId),
caption.WithOnBehalfOf(onBehalfOf),
caption.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
+2 -2
View File
@@ -22,7 +22,7 @@ const (
listTool = "channel-list"
listShort = "List channel's info"
listLong = "List channel's info, such as title, description, etc."
listIdsUsage = "Return the channels with the specified IDs"
listIdsUsage = "Return the channels with the specified Ids"
)
var listInSchema = &jsonschema.Schema{
@@ -121,7 +121,7 @@ var listCmd = &cobra.Command{
channel.WithForHandle(forHandle),
channel.WithForUsername(forUsername),
channel.WithHl(hl),
channel.WithIDs(ids),
channel.WithIds(ids),
channel.WithChannelManagedByMe(managedByMe),
channel.WithMaxResults(maxResults),
channel.WithMine(mine),
+1 -1
View File
@@ -82,7 +82,7 @@ var updateCmd = &cobra.Command{
Long: updateLong,
Run: func(cmd *cobra.Command, args []string) {
input := channel.NewChannel(
channel.WithIDs(ids),
channel.WithIds(ids),
channel.WithCountry(country),
channel.WithCustomUrl(customUrl),
channel.WithDefaultLanguage(defaultLanguage),
+1 -1
View File
@@ -70,7 +70,7 @@ var deleteCmd = &cobra.Command{
Long: deleteLong,
Run: func(cmd *cobra.Command, args []string) {
input := channelSection.NewChannelSection(
channelSection.WithIDs(ids),
channelSection.WithIds(ids),
channelSection.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
)
err := input.Delete(cmd.OutOrStdout())
+1 -1
View File
@@ -87,7 +87,7 @@ var listCmd = &cobra.Command{
Long: listLong,
Run: func(cmd *cobra.Command, args []string) {
input := channelSection.NewChannelSection(
channelSection.WithIDs(ids),
channelSection.WithIds(ids),
channelSection.WithChannelId(channelId),
channelSection.WithHl(hl),
channelSection.WithMine(mine),
+3 -3
View File
@@ -25,7 +25,7 @@ const (
)
type deleteIn struct {
IDs []string `json:"ids"`
Ids []string `json:"ids"`
}
var deleteInSchema = &jsonschema.Schema{
@@ -85,7 +85,7 @@ func deleteHandler(
),
)
ids = input.IDs
ids = input.Ids
var writer bytes.Buffer
err := del(&writer)
if err != nil {
@@ -97,7 +97,7 @@ func deleteHandler(
func del(writer io.Writer) error {
c := comment.NewComment(
comment.WithIDs(ids),
comment.WithIds(ids),
comment.WithService(nil),
)
+3 -3
View File
@@ -27,7 +27,7 @@ const (
)
type listIn struct {
IDs []string `json:"ids"`
Ids []string `json:"ids"`
MaxResults int64 `json:"maxResults"`
ParentId string `json:"parentId"`
TextFormat string `json:"textFormat"`
@@ -130,7 +130,7 @@ func listHandler(
),
)
ids = input.IDs
ids = input.Ids
maxResults = input.MaxResults
parentId = input.ParentId
textFormat = input.TextFormat
@@ -149,7 +149,7 @@ func listHandler(
func list(writer io.Writer) error {
c := comment.NewComment(
comment.WithIDs(ids),
comment.WithIds(ids),
comment.WithMaxResults(maxResults),
comment.WithParentId(parentId),
comment.WithTextFormat(textFormat),
+1 -1
View File
@@ -112,7 +112,7 @@ func markAsSpamHandler(
func markAsSpam(writer io.Writer) error {
c := comment.NewComment(
comment.WithIDs(ids),
comment.WithIds(ids),
comment.WithService(nil),
)
+1 -1
View File
@@ -139,7 +139,7 @@ func setModerationStatusHandler(
func setModerationStatus(writer io.Writer) error {
c := comment.NewComment(
comment.WithIDs(ids),
comment.WithIds(ids),
comment.WithModerationStatus(moderationStatus),
comment.WithBanAuthor(banAuthor),
comment.WithService(nil),
+1 -1
View File
@@ -141,7 +141,7 @@ func updateHandler(
func update(writer io.Writer) error {
c := comment.NewComment(
comment.WithIDs(ids),
comment.WithIds(ids),
comment.WithCanRate(canRate),
comment.WithTextOriginal(textOriginal),
comment.WithViewerRating(viewerRating),
+1 -1
View File
@@ -186,7 +186,7 @@ func listHandler(
func list(writer io.Writer) error {
ct := commentThread.NewCommentThread(
commentThread.WithIDs(ids),
commentThread.WithIds(ids),
commentThread.WithAllThreadsRelatedToChannelId(allThreadsRelatedToChannelId),
commentThread.WithChannelId(channelId),
commentThread.WithMaxResults(maxResults),
+1 -1
View File
@@ -11,7 +11,7 @@ import (
const (
short = "List channel's members' info"
long = "List channel's members' info, such as channelId, displayName, etc"
mcidUsage = "Comma separated list of channel IDs. Only data about members that are part of this list will be included"
mcidUsage = "Comma separated list of channel Ids. Only data about members that are part of this list will be included"
hatlUsage = "Filter members in the results set to the ones that have access to a level"
mmUsage = "listMembersModeUnknown, updates, or all_current"
)
+1 -1
View File
@@ -109,7 +109,7 @@ func deleteHandler(
func del(writer io.Writer) error {
p := playlist.NewPlaylist(
playlist.WithIDs(ids),
playlist.WithIds(ids),
playlist.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
playlist.WithService(nil),
)
+2 -2
View File
@@ -24,7 +24,7 @@ const (
listTool = "playlist-list"
listShort = "List playlist's info"
listLong = "List playlist's info, such as title, description, etc"
listIdsUsage = "Return the playlists with the given IDs for Stubby or Apiary"
listIdsUsage = "Return the playlists with the given Ids for Stubby or Apiary"
listCidUsage = "Return the playlists owned by the specified channel id"
)
@@ -172,7 +172,7 @@ func listHandler(
func list(writer io.Writer) error {
p := playlist.NewPlaylist(
playlist.WithIDs(ids),
playlist.WithIds(ids),
playlist.WithChannelId(channelId),
playlist.WithHl(hl),
playlist.WithMaxResults(maxResults),
+1 -1
View File
@@ -153,7 +153,7 @@ func updateHandler(
func update(writer io.Writer) error {
p := playlist.NewPlaylist(
playlist.WithIDs(ids),
playlist.WithIds(ids),
playlist.WithTitle(title),
playlist.WithDescription(description),
playlist.WithTags(tags),
+1 -1
View File
@@ -108,7 +108,7 @@ func deleteHandler(
func del(writer io.Writer) error {
pi := playlistImage.NewPlaylistImage(
playlistImage.WithIDs(ids),
playlistImage.WithIds(ids),
playlistImage.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
playlistImage.WithService(nil),
)
+1 -1
View File
@@ -143,7 +143,7 @@ func insertHandler(
func insert(writer io.Writer) error {
pi := playlistImage.NewPlaylistImage(
playlistImage.WithFile(file),
playlistImage.WithPlaylistID(playlistId),
playlistImage.WithPlaylistId(playlistId),
playlistImage.WithType(type_),
playlistImage.WithHeight(height),
playlistImage.WithWidth(width),
+1 -1
View File
@@ -134,7 +134,7 @@ func updateHandler(
func update(writer io.Writer) error {
pi := playlistImage.NewPlaylistImage(
playlistImage.WithPlaylistID(playlistId),
playlistImage.WithPlaylistId(playlistId),
playlistImage.WithType(type_),
playlistImage.WithHeight(height),
playlistImage.WithWidth(width),
+1 -1
View File
@@ -109,7 +109,7 @@ func deleteHandler(
func del(writer io.Writer) error {
pi := playlistItem.NewPlaylistItem(
playlistItem.WithIDs(ids),
playlistItem.WithIds(ids),
playlistItem.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
playlistItem.WithService(nil),
)
+1 -1
View File
@@ -155,7 +155,7 @@ func listHandler(
func list(writer io.Writer) error {
pi := playlistItem.NewPlaylistItem(
playlistItem.WithIDs(ids),
playlistItem.WithIds(ids),
playlistItem.WithPlaylistId(playlistId),
playlistItem.WithMaxResults(maxResults),
playlistItem.WithVideoId(videoId),
+1 -1
View File
@@ -145,7 +145,7 @@ func updateHandler(
func update(writer io.Writer) error {
pi := playlistItem.NewPlaylistItem(
playlistItem.WithIDs(ids),
playlistItem.WithIds(ids),
playlistItem.WithTitle(title),
playlistItem.WithDescription(description),
playlistItem.WithPrivacy(privacy),
+1 -1
View File
@@ -98,7 +98,7 @@ func deleteHandler(
func del(writer io.Writer) error {
s := subscription.NewSubscription(
subscription.WithIDs(ids), subscription.WithService(nil),
subscription.WithIds(ids), subscription.WithService(nil),
)
return s.Delete(writer)
+1 -1
View File
@@ -197,7 +197,7 @@ func listHandler(
func list(writer io.Writer) error {
s := subscription.NewSubscription(
subscription.WithIDs(ids),
subscription.WithIds(ids),
subscription.WithChannelId(channelId),
subscription.WithForChannelId(forChannelId),
subscription.WithMaxResults(maxResults),
+1 -1
View File
@@ -97,7 +97,7 @@ func deleteHandler(
}
func del(writer io.Writer) error {
v := video.NewVideo(video.WithIDs(ids))
v := video.NewVideo(video.WithIds(ids))
return v.Delete(writer)
}
+1 -1
View File
@@ -124,7 +124,7 @@ func getRatingHandler(
func getRating(writer io.Writer) error {
v := video.NewVideo(
video.WithIDs(ids),
video.WithIds(ids),
video.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
video.WithService(nil),
)
+1 -1
View File
@@ -199,7 +199,7 @@ func listHandler(
func list(writer io.Writer) error {
v := video.NewVideo(
video.WithIDs(ids),
video.WithIds(ids),
video.WithChart(chart),
video.WithHl(hl),
video.WithLocale(locale),
+1 -1
View File
@@ -107,7 +107,7 @@ func rateHandler(
func rate(writer io.Writer) error {
v := video.NewVideo(
video.WithIDs(ids),
video.WithIds(ids),
video.WithRating(rating),
video.WithService(nil),
)
+1 -1
View File
@@ -146,7 +146,7 @@ func reportAbuseHandler(
func reportAbuse(writer io.Writer) error {
v := video.NewVideo(
video.WithIDs(ids),
video.WithIds(ids),
video.WithReasonId(reasonId),
video.WithSecondaryReasonId(secondaryReasonId),
video.WithComments(comments),
+1 -1
View File
@@ -192,7 +192,7 @@ func updateHandler(
func update(writer io.Writer) error {
v := video.NewVideo(
video.WithIDs(ids),
video.WithIds(ids),
video.WithTitle(title),
video.WithDescription(description),
video.WithTags(tags),
+1 -1
View File
@@ -85,7 +85,7 @@ func categoriesHandler(
func list(writer io.Writer) error {
vc := videoCategory.NewVideoCategory(
videoCategory.WithIDs(ids),
videoCategory.WithIds(ids),
videoCategory.WithHl(hl),
videoCategory.WithRegionCode(regionCode),
videoCategory.WithService(nil),
+8 -8
View File
@@ -26,7 +26,7 @@ var (
type Caption struct {
service *youtube.Service
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
File string `yaml:"file" json:"file"`
AudioTrackType string `yaml:"audio_track_type" json:"audio_track_type"`
IsAutoSynced *bool `yaml:"is_auto_synced" json:"is_auto_synced"`
@@ -71,8 +71,8 @@ func NewCation(opts ...Option) ICaption[youtube.Caption] {
func (c *Caption) Get() ([]*youtube.Caption, error) {
c.preRun()
call := c.service.Captions.List(c.Parts, c.VideoId)
if len(c.IDs) > 0 {
call = call.Id(c.IDs...)
if len(c.Ids) > 0 {
call = call.Id(c.Ids...)
}
if c.OnBehalfOf != "" {
call = call.OnBehalfOf(c.OnBehalfOf)
@@ -248,7 +248,7 @@ func (c *Caption) Update(writer io.Writer) error {
func (c *Caption) Delete(writer io.Writer) error {
c.preRun()
for _, id := range c.IDs {
for _, id := range c.Ids {
call := c.service.Captions.Delete(id)
if c.OnBehalfOf != "" {
call = call.OnBehalfOf(c.OnBehalfOf)
@@ -269,7 +269,7 @@ func (c *Caption) Delete(writer io.Writer) error {
func (c *Caption) Download(writer io.Writer) error {
c.preRun()
call := c.service.Captions.Download(c.IDs[0])
call := c.service.Captions.Download(c.Ids[0])
if c.Tfmt != "" {
call = call.Tfmt(c.Tfmt)
}
@@ -309,7 +309,7 @@ func (c *Caption) Download(writer io.Writer) error {
return errors.Join(errDownloadCaption, err)
}
_, _ = fmt.Fprintf(writer, "Caption %s downloaded to %s\n", c.IDs[0], c.File)
_, _ = fmt.Fprintf(writer, "Caption %s downloaded to %s\n", c.Ids[0], c.File)
return nil
}
@@ -322,9 +322,9 @@ func (c *Caption) preRun() {
}
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(c *Caption) {
c.IDs = ids
c.Ids = ids
}
}
+4 -4
View File
@@ -36,7 +36,7 @@ func TestNewCation(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"caption1", "caption2"}),
WithIds([]string{"caption1", "caption2"}),
WithFile("/path/to/file.srt"),
WithAudioTrackType("primary"),
WithIsAutoSynced(&isAutoSyncedTrue),
@@ -57,7 +57,7 @@ func TestNewCation(t *testing.T) {
},
want: &Caption{
service: svc,
IDs: []string{"caption1", "caption2"},
Ids: []string{"caption1", "caption2"},
File: "/path/to/file.srt",
AudioTrackType: "primary",
IsAutoSynced: &isAutoSyncedTrue,
@@ -147,14 +147,14 @@ func TestNewCation(t *testing.T) {
name: "with partial options",
args: args{
opts: []Option{
WithIDs([]string{"caption1"}),
WithIds([]string{"caption1"}),
WithLanguage("fr"),
WithVideoId("video456"),
WithIsCC(&isCCTrue),
},
},
want: &Caption{
IDs: []string{"caption1"},
Ids: []string{"caption1"},
Language: "fr",
VideoId: "video456",
IsCC: &isCCTrue,
+5 -5
View File
@@ -28,7 +28,7 @@ type Channel struct {
ForHandle string `yaml:"for_handle" json:"for_handle"`
ForUsername string `yaml:"for_username" json:"for_username"`
Hl string `yaml:"hl" json:"hl"`
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
ManagedByMe *bool `yaml:"managed_by_me" json:"managed_by_me"`
MaxResults int64 `yaml:"max_results" json:"max_results"`
Mine *bool `yaml:"mine" json:"mine"`
@@ -80,8 +80,8 @@ func (c *Channel) Get() ([]*youtube.Channel, error) {
if c.Hl != "" {
call = call.Hl(c.Hl)
}
if len(c.IDs) > 0 {
call = call.Id(c.IDs...)
if len(c.Ids) > 0 {
call = call.Id(c.Ids...)
}
if c.ManagedByMe != nil {
call = call.ManagedByMe(*c.ManagedByMe)
@@ -223,9 +223,9 @@ func WithHl(hl string) Option {
}
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(c *Channel) {
c.IDs = ids
c.Ids = ids
}
}
+5 -5
View File
@@ -36,7 +36,7 @@ func TestNewChannel(t *testing.T) {
WithForHandle("@testhandle"),
WithForUsername("testuser"),
WithHl("en"),
WithIDs([]string{"channel1", "channel2"}),
WithIds([]string{"channel1", "channel2"}),
WithChannelManagedByMe(&managedByMeTrue),
WithMaxResults(100),
WithMine(&mineTrue),
@@ -55,7 +55,7 @@ func TestNewChannel(t *testing.T) {
ForHandle: "@testhandle",
ForUsername: "testuser",
Hl: "en",
IDs: []string{"channel1", "channel2"},
Ids: []string{"channel1", "channel2"},
ManagedByMe: &managedByMeTrue,
MaxResults: 100,
Mine: &mineTrue,
@@ -163,7 +163,7 @@ func TestNewChannel(t *testing.T) {
name: "with partial options",
args: args{
opts: []Option{
WithIDs([]string{"channel1"}),
WithIds([]string{"channel1"}),
WithTitle("My Channel"),
WithCountry("UK"),
WithMaxResults(50),
@@ -171,7 +171,7 @@ func TestNewChannel(t *testing.T) {
},
},
want: &Channel{
IDs: []string{"channel1"},
Ids: []string{"channel1"},
Title: "My Channel",
Country: "UK",
MaxResults: 50,
@@ -186,7 +186,7 @@ func TestNewChannel(t *testing.T) {
!reflect.DeepEqual(got.(*Channel).ForHandle, tt.want.(*Channel).ForHandle) ||
!reflect.DeepEqual(got.(*Channel).ForUsername, tt.want.(*Channel).ForUsername) ||
!reflect.DeepEqual(got.(*Channel).Hl, tt.want.(*Channel).Hl) ||
!reflect.DeepEqual(got.(*Channel).IDs, tt.want.(*Channel).IDs) ||
!reflect.DeepEqual(got.(*Channel).Ids, tt.want.(*Channel).Ids) ||
!reflect.DeepEqual(got.(*Channel).ManagedByMe, tt.want.(*Channel).ManagedByMe) ||
!reflect.DeepEqual(got.(*Channel).MaxResults, tt.want.(*Channel).MaxResults) ||
!reflect.DeepEqual(got.(*Channel).Mine, tt.want.(*Channel).Mine) ||
+6 -6
View File
@@ -22,7 +22,7 @@ var (
type ChannelSection struct {
service *youtube.Service
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
ChannelId string `yaml:"channel_id" json:"channel_id"`
Hl string `yaml:"hl" json:"hl"`
Mine *bool `yaml:"mine" json:"mine"`
@@ -58,8 +58,8 @@ func (cs *ChannelSection) Get() (
) {
cs.preRun()
call := cs.service.ChannelSections.List(cs.Parts)
if len(cs.IDs) > 0 {
call = call.Id(cs.IDs...)
if len(cs.Ids) > 0 {
call = call.Id(cs.Ids...)
}
if cs.ChannelId != "" {
call = call.ChannelId(cs.ChannelId)
@@ -107,7 +107,7 @@ func (cs *ChannelSection) List(writer io.Writer) error {
func (cs *ChannelSection) Delete(writer io.Writer) error {
cs.preRun()
for _, id := range cs.IDs {
for _, id := range cs.Ids {
call := cs.service.ChannelSections.Delete(id)
if cs.OnBehalfOfContentOwner != "" {
call = call.OnBehalfOfContentOwner(cs.OnBehalfOfContentOwner)
@@ -132,9 +132,9 @@ func (cs *ChannelSection) preRun() {
}
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(cs *ChannelSection) {
cs.IDs = ids
cs.Ids = ids
}
}
+4 -4
View File
@@ -28,7 +28,7 @@ func TestNewChannelSection(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"section1", "section2"}),
WithIds([]string{"section1", "section2"}),
WithChannelId("channel123"),
WithHl("en"),
WithMine(&mineTrue),
@@ -37,7 +37,7 @@ func TestNewChannelSection(t *testing.T) {
},
},
want: &ChannelSection{
IDs: []string{"section1", "section2"},
Ids: []string{"section1", "section2"},
ChannelId: "channel123",
Hl: "en",
Mine: &mineTrue,
@@ -91,13 +91,13 @@ func TestNewChannelSection(t *testing.T) {
name: "with partial options",
args: args{
opts: []Option{
WithIDs([]string{"section1"}),
WithIds([]string{"section1"}),
WithChannelId("partialChannel"),
WithHl("fr"),
},
},
want: &ChannelSection{
IDs: []string{"section1"},
Ids: []string{"section1"},
ChannelId: "partialChannel",
Hl: "fr",
},
+10 -10
View File
@@ -27,7 +27,7 @@ var (
)
type comment struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
AuthorChannelId string `yaml:"author_channel_id" json:"author_channel_id"`
CanRate *bool `yaml:"can_rate" json:"can_rate"`
ChannelId string `yaml:"channel_id" json:"channel_id"`
@@ -65,8 +65,8 @@ func NewComment(opts ...Option) Comment[youtube.Comment] {
func (c *comment) Get(parts []string) ([]*youtube.Comment, error) {
call := service.Comments.List(parts)
if c.IDs[0] != "" {
call = call.Id(c.IDs...)
if c.Ids[0] != "" {
call = call.Id(c.Ids...)
}
if c.ParentId != "" {
call = call.ParentId(c.ParentId)
@@ -208,7 +208,7 @@ func (c *comment) Update(output string, jsonpath string, writer io.Writer) error
func (c *comment) MarkAsSpam(
output string, jsonpath string, writer io.Writer,
) error {
call := service.Comments.MarkAsSpam(c.IDs)
call := service.Comments.MarkAsSpam(c.Ids)
err := call.Do()
if err != nil {
return errors.Join(errMarkAsSpam, err)
@@ -221,7 +221,7 @@ func (c *comment) MarkAsSpam(
utils.PrintYAML(c, jsonpath, writer)
case "silent":
default:
_, _ = fmt.Fprintf(writer, "Comment marked as spam: %s\n", c.IDs)
_, _ = fmt.Fprintf(writer, "Comment marked as spam: %s\n", c.Ids)
}
return nil
}
@@ -229,7 +229,7 @@ func (c *comment) MarkAsSpam(
func (c *comment) SetModerationStatus(
output string, jsonpath string, writer io.Writer,
) error {
call := service.Comments.SetModerationStatus(c.IDs, c.ModerationStatus)
call := service.Comments.SetModerationStatus(c.Ids, c.ModerationStatus)
if c.BanAuthor != nil {
call = call.BanAuthor(*c.BanAuthor)
@@ -249,14 +249,14 @@ func (c *comment) SetModerationStatus(
default:
_, _ = fmt.Fprintf(
writer, "Comment moderation status set to %s: %s\n",
c.ModerationStatus, c.IDs,
c.ModerationStatus, c.Ids,
)
}
return nil
}
func (c *comment) Delete(writer io.Writer) error {
for _, id := range c.IDs {
for _, id := range c.Ids {
call := service.Comments.Delete(id)
err := call.Do()
if err != nil {
@@ -267,9 +267,9 @@ func (c *comment) Delete(writer io.Writer) error {
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(c *comment) {
c.IDs = ids
c.Ids = ids
}
}
+4 -4
View File
@@ -30,7 +30,7 @@ func TestNewComment(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"comment1", "comment2"}),
WithIds([]string{"comment1", "comment2"}),
WithAuthorChannelId("author123"),
WithCanRate(&canRateTrue),
WithChannelId("channel123"),
@@ -46,7 +46,7 @@ func TestNewComment(t *testing.T) {
},
},
want: &comment{
IDs: []string{"comment1", "comment2"},
Ids: []string{"comment1", "comment2"},
AuthorChannelId: "author123",
CanRate: &canRateTrue,
ChannelId: "channel123",
@@ -141,14 +141,14 @@ func TestNewComment(t *testing.T) {
name: "with partial options",
args: args{
opts: []Option{
WithIDs([]string{"comment1"}),
WithIds([]string{"comment1"}),
WithTextOriginal("Partial comment"),
WithVideoId("video456"),
WithMaxResults(25),
},
},
want: &comment{
IDs: []string{"comment1"},
Ids: []string{"comment1"},
TextOriginal: "Partial comment",
VideoId: "video456",
MaxResults: 25,
+5 -5
View File
@@ -23,7 +23,7 @@ var (
)
type commentThread struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
AllThreadsRelatedToChannelId string `yaml:"all_threads_related_to_channel_id" json:"all_threads_related_to_channel_id"`
AuthorChannelId string `yaml:"author_channel_id" json:"author_channel_id"`
ChannelId string `yaml:"channel_id" json:"channel_id"`
@@ -56,8 +56,8 @@ func NewCommentThread(opts ...Option) CommentThread[youtube.CommentThread] {
func (c *commentThread) Get(parts []string) ([]*youtube.CommentThread, error) {
call := service.CommentThreads.List(parts)
if len(c.IDs) > 0 {
call = call.Id(c.IDs...)
if len(c.Ids) > 0 {
call = call.Id(c.Ids...)
}
if c.AllThreadsRelatedToChannelId != "" {
call = call.AllThreadsRelatedToChannelId(c.AllThreadsRelatedToChannelId)
@@ -191,9 +191,9 @@ func WithChannelId(channelId string) Option {
}
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(c *commentThread) {
c.IDs = ids
c.Ids = ids
}
}
+4 -4
View File
@@ -25,7 +25,7 @@ func TestNewCommentThread(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"thread1", "thread2"}),
WithIds([]string{"thread1", "thread2"}),
WithAllThreadsRelatedToChannelId("relatedChannel123"),
WithAuthorChannelId("author123"),
WithChannelId("channel123"),
@@ -40,7 +40,7 @@ func TestNewCommentThread(t *testing.T) {
},
},
want: &commentThread{
IDs: []string{"thread1", "thread2"},
Ids: []string{"thread1", "thread2"},
AllThreadsRelatedToChannelId: "relatedChannel123",
AuthorChannelId: "author123",
ChannelId: "channel123",
@@ -113,14 +113,14 @@ func TestNewCommentThread(t *testing.T) {
name: "with partial options",
args: args{
opts: []Option{
WithIDs([]string{"thread1"}),
WithIds([]string{"thread1"}),
WithVideoId("video456"),
WithTextOriginal("Partial comment thread"),
WithMaxResults(50),
},
},
want: &commentThread{
IDs: []string{"thread1"},
Ids: []string{"thread1"},
VideoId: "video456",
TextOriginal: "Partial comment thread",
MaxResults: 50,
+6 -6
View File
@@ -25,7 +25,7 @@ var (
)
type playlist struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
Title string `yaml:"title" json:"title"`
Description string `yaml:"description" json:"description"`
Hl string `yaml:"hl" json:"hl"`
@@ -63,8 +63,8 @@ func NewPlaylist(opts ...Option) Playlist[youtube.Playlist] {
func (p *playlist) Get(parts []string) ([]*youtube.Playlist, error) {
call := service.Playlists.List(parts)
if len(p.IDs) > 0 {
call = call.Id(p.IDs...)
if len(p.Ids) > 0 {
call = call.Id(p.Ids...)
}
if p.Hl != "" {
call = call.Hl(p.Hl)
@@ -206,7 +206,7 @@ func (p *playlist) Update(output string, jsonpath string, writer io.Writer) erro
}
func (p *playlist) Delete(writer io.Writer) error {
for _, id := range p.IDs {
for _, id := range p.Ids {
call := service.Playlists.Delete(id)
if p.OnBehalfOfContentOwner != "" {
call = call.OnBehalfOfContentOwner(p.OnBehalfOfContentOwner)
@@ -221,9 +221,9 @@ func (p *playlist) Delete(writer io.Writer) error {
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(p *playlist) {
p.IDs = ids
p.Ids = ids
}
}
+2 -2
View File
@@ -28,7 +28,7 @@ func TestNewPlaylist(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"playlist1", "playlist2"}),
WithIds([]string{"playlist1", "playlist2"}),
WithTitle("Test Playlist"),
WithDescription("Test playlist description"),
WithTags([]string{"tag1", "tag2", "tag3"}),
@@ -44,7 +44,7 @@ func TestNewPlaylist(t *testing.T) {
},
},
want: &playlist{
IDs: []string{"playlist1", "playlist2"},
Ids: []string{"playlist1", "playlist2"},
Title: "Test Playlist",
Description: "Test playlist description",
Tags: []string{"tag1", "tag2", "tag3"},
+10 -10
View File
@@ -26,9 +26,9 @@ var (
)
type playlistImage struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
Height int64 `yaml:"height" json:"height"`
PlaylistID string `yaml:"playlistId" json:"playlistId"`
PlaylistId string `yaml:"playlistId" json:"playlistId"`
Type string `yaml:"type" json:"type"`
Width int64 `yaml:"width" json:"width"`
File string `yaml:"file" json:"file"`
@@ -137,7 +137,7 @@ func (pi *playlistImage) Insert(
playlistImage := &youtube.PlaylistImage{
Kind: "youtube#playlistImages",
Snippet: &youtube.PlaylistImageSnippet{
PlaylistId: pi.PlaylistID,
PlaylistId: pi.PlaylistId,
Type: pi.Type,
Height: pi.Height,
Width: pi.Width,
@@ -182,8 +182,8 @@ func (pi *playlistImage) Update(
}
playlistImage := playlistImages[0]
if pi.PlaylistID != "" {
playlistImage.Snippet.PlaylistId = pi.PlaylistID
if pi.PlaylistId != "" {
playlistImage.Snippet.PlaylistId = pi.PlaylistId
}
if pi.Type != "" {
playlistImage.Snippet.Type = pi.Type
@@ -229,7 +229,7 @@ func (pi *playlistImage) Update(
}
func (pi *playlistImage) Delete(writer io.Writer) error {
for _, id := range pi.IDs {
for _, id := range pi.Ids {
call := service.PlaylistImages.Delete()
call = call.Id(id)
if pi.OnBehalfOfContentOwner != "" {
@@ -245,9 +245,9 @@ func (pi *playlistImage) Delete(writer io.Writer) error {
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(pi *playlistImage) {
pi.IDs = ids
pi.Ids = ids
}
}
@@ -257,9 +257,9 @@ func WithHeight(height int64) Option {
}
}
func WithPlaylistID(playlistID string) Option {
func WithPlaylistId(playlistId string) Option {
return func(pi *playlistImage) {
pi.PlaylistID = playlistID
pi.PlaylistId = playlistId
}
}
+8 -8
View File
@@ -25,9 +25,9 @@ func TestNewPlaylistImage(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"image1", "image2"}),
WithIds([]string{"image1", "image2"}),
WithHeight(1080),
WithPlaylistID("playlist123"),
WithPlaylistId("playlist123"),
WithType("hero"),
WithWidth(1920),
WithFile("/path/to/image.jpg"),
@@ -39,9 +39,9 @@ func TestNewPlaylistImage(t *testing.T) {
},
},
want: &playlistImage{
IDs: []string{"image1", "image2"},
Ids: []string{"image1", "image2"},
Height: 1080,
PlaylistID: "playlist123",
PlaylistId: "playlist123",
Type: "hero",
Width: 1920,
File: "/path/to/image.jpg",
@@ -84,7 +84,7 @@ func TestNewPlaylistImage(t *testing.T) {
name: "with empty string values",
args: args{
opts: []Option{
WithPlaylistID(""),
WithPlaylistId(""),
WithType(""),
WithFile(""),
WithParent(""),
@@ -93,7 +93,7 @@ func TestNewPlaylistImage(t *testing.T) {
},
},
want: &playlistImage{
PlaylistID: "",
PlaylistId: "",
Type: "",
File: "",
Parent: "",
@@ -105,14 +105,14 @@ func TestNewPlaylistImage(t *testing.T) {
name: "with partial options",
args: args{
opts: []Option{
WithPlaylistID("myPlaylist"),
WithPlaylistId("myPlaylist"),
WithType("hero"),
WithFile("/images/hero.png"),
WithMaxResults(25),
},
},
want: &playlistImage{
PlaylistID: "myPlaylist",
PlaylistId: "myPlaylist",
Type: "hero",
File: "/images/hero.png",
MaxResults: 25,
+6 -6
View File
@@ -25,7 +25,7 @@ var (
)
type playlistItem struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
Title string `yaml:"title" json:"title"`
Description string `yaml:"description" json:"description"`
Kind string `yaml:"kind" json:"kind"`
@@ -63,8 +63,8 @@ func NewPlaylistItem(opts ...Option) PlaylistItem[youtube.PlaylistItem] {
func (pi *playlistItem) Get(parts []string) ([]*youtube.PlaylistItem, error) {
call := service.PlaylistItems.List(parts)
if len(pi.IDs) > 0 {
call = call.Id(pi.IDs...)
if len(pi.Ids) > 0 {
call = call.Id(pi.Ids...)
}
if pi.PlaylistId != "" {
call = call.PlaylistId(pi.PlaylistId)
@@ -245,7 +245,7 @@ func (pi *playlistItem) Update(
}
func (pi *playlistItem) Delete(writer io.Writer) error {
for _, id := range pi.IDs {
for _, id := range pi.Ids {
call := service.PlaylistItems.Delete(id)
if pi.OnBehalfOfContentOwner != "" {
call = call.OnBehalfOfContentOwner(pi.OnBehalfOfContentOwner)
@@ -261,9 +261,9 @@ func (pi *playlistItem) Delete(writer io.Writer) error {
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(p *playlistItem) {
p.IDs = ids
p.Ids = ids
}
}
+2 -2
View File
@@ -25,7 +25,7 @@ func TestNewPlaylistItem(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"item1", "item2"}),
WithIds([]string{"item1", "item2"}),
WithTitle("Test Item"),
WithDescription("Test item description"),
WithKind("video"),
@@ -42,7 +42,7 @@ func TestNewPlaylistItem(t *testing.T) {
},
},
want: &playlistItem{
IDs: []string{"item1", "item2"},
Ids: []string{"item1", "item2"},
Title: "Test Item",
Description: "Test item description",
Kind: "video",
+6 -6
View File
@@ -24,7 +24,7 @@ var (
)
type subscription struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
SubscriberChannelId string `yaml:"subscriber_channel_id" json:"subscriber_channel_id"`
Description string `yaml:"description" json:"description"`
ChannelId string `yaml:"channel_id" json:"channel_id"`
@@ -60,8 +60,8 @@ func NewSubscription(opts ...Option) Subscription[youtube.Subscription] {
func (s *subscription) Get(parts []string) ([]*youtube.Subscription, error) {
call := service.Subscriptions.List(parts)
if len(s.IDs) > 0 {
call = call.Id(s.IDs...)
if len(s.Ids) > 0 {
call = call.Id(s.Ids...)
}
if s.ChannelId != "" {
call = call.ChannelId(s.ChannelId)
@@ -183,7 +183,7 @@ func (s *subscription) Insert(
}
func (s *subscription) Delete(writer io.Writer) error {
for _, id := range s.IDs {
for _, id := range s.Ids {
call := service.Subscriptions.Delete(id)
err := call.Do()
if err != nil {
@@ -195,9 +195,9 @@ func (s *subscription) Delete(writer io.Writer) error {
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(s *subscription) {
s.IDs = ids
s.Ids = ids
}
}
+2 -2
View File
@@ -32,7 +32,7 @@ func TestNewSubscription(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"sub1", "sub2"}),
WithIds([]string{"sub1", "sub2"}),
WithSubscriberChannelId("subscriber123"),
WithDescription("Test subscription description"),
WithChannelId("channel123"),
@@ -49,7 +49,7 @@ func TestNewSubscription(t *testing.T) {
},
},
want: &subscription{
IDs: []string{"sub1", "sub2"},
Ids: []string{"sub1", "sub2"},
SubscriberChannelId: "subscriber123",
Description: "Test subscription description",
ChannelId: "channel123",
+9 -9
View File
@@ -33,7 +33,7 @@ var (
)
type video struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
AutoLevels *bool `yaml:"auto_levels" json:"auto_levels"`
File string `yaml:"file" json:"file"`
Title string `yaml:"title" json:"title"`
@@ -93,8 +93,8 @@ func NewVideo(opts ...Option) Video[youtube.Video] {
func (v *video) Get(parts []string) ([]*youtube.Video, error) {
call := service.Videos.List(parts)
if len(v.IDs) > 0 {
call = call.Id(v.IDs...)
if len(v.Ids) > 0 {
call = call.Id(v.Ids...)
}
if v.Chart != "" {
call = call.Chart(v.Chart)
@@ -370,7 +370,7 @@ func (v *video) Update(output string, jsonpath string, writer io.Writer) error {
}
func (v *video) Rate(writer io.Writer) error {
for _, id := range v.IDs {
for _, id := range v.Ids {
call := service.Videos.Rate(id, v.Rating)
err := call.Do()
if err != nil {
@@ -382,7 +382,7 @@ func (v *video) Rate(writer io.Writer) error {
}
func (v *video) GetRating(output string, jsonpath string, writer io.Writer) error {
call := service.Videos.GetRating(v.IDs)
call := service.Videos.GetRating(v.Ids)
if v.OnBehalfOfContentOwner != "" {
call = call.OnBehalfOfContentOwner(v.OnBehalfOfContentOwnerChannel)
}
@@ -410,7 +410,7 @@ func (v *video) GetRating(output string, jsonpath string, writer io.Writer) erro
}
func (v *video) Delete(writer io.Writer) error {
for _, id := range v.IDs {
for _, id := range v.Ids {
call := service.Videos.Delete(id)
if v.OnBehalfOfContentOwner != "" {
call = call.OnBehalfOfContentOwner(v.OnBehalfOfContentOwner)
@@ -426,7 +426,7 @@ func (v *video) Delete(writer io.Writer) error {
}
func (v *video) ReportAbuse(writer io.Writer) error {
for _, id := range v.IDs {
for _, id := range v.Ids {
videoAbuseReport := &youtube.VideoAbuseReport{
Comments: v.Comments,
Language: v.Language,
@@ -450,9 +450,9 @@ func (v *video) ReportAbuse(writer io.Writer) error {
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(v *video) {
v.IDs = ids
v.Ids = ids
}
}
+2 -2
View File
@@ -38,7 +38,7 @@ func TestNewVideo(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"video1", "video2"}),
WithIds([]string{"video1", "video2"}),
WithAutoLevels(&autoLevelsTrue),
WithFile("/path/to/video.mp4"),
WithTitle("Test Video"),
@@ -74,7 +74,7 @@ func TestNewVideo(t *testing.T) {
},
},
want: &video{
IDs: []string{"video1", "video2"},
Ids: []string{"video1", "video2"},
AutoLevels: &autoLevelsTrue,
File: "/path/to/video.mp4",
Title: "Test Video",
+5 -5
View File
@@ -20,7 +20,7 @@ var (
)
type videoCategory struct {
IDs []string `yaml:"ids" json:"ids"`
Ids []string `yaml:"ids" json:"ids"`
Hl string `yaml:"hl" json:"hl"`
RegionCode string `yaml:"region_code" json:"region_code"`
}
@@ -42,8 +42,8 @@ func NewVideoCategory(opt ...Option) VideoCategory[youtube.VideoCategory] {
func (vc *videoCategory) Get(parts []string) ([]*youtube.VideoCategory, error) {
call := service.VideoCategories.List(parts)
if len(vc.IDs) > 0 {
call = call.Id(vc.IDs...)
if len(vc.Ids) > 0 {
call = call.Id(vc.Ids...)
}
if vc.Hl != "" {
call = call.Hl(vc.Hl)
@@ -86,9 +86,9 @@ func (vc *videoCategory) List(
return nil
}
func WithIDs(ids []string) Option {
func WithIds(ids []string) Option {
return func(vc *videoCategory) {
vc.IDs = ids
vc.Ids = ids
}
}
+2 -2
View File
@@ -24,14 +24,14 @@ func TestNewVideoCategory(t *testing.T) {
name: "with all options",
args: args{
opts: []Option{
WithIDs([]string{"cat1", "cat2"}),
WithIds([]string{"cat1", "cat2"}),
WithHl("en"),
WithRegionCode("US"),
WithService(&youtube.Service{}),
},
},
want: &videoCategory{
IDs: []string{"cat1", "cat2"},
Ids: []string{"cat1", "cat2"},
Hl: "en",
RegionCode: "US",
},