0

I come from Tcl and I'm trying to move over to golang. I'm having a hard time grasping the entire structure of the youtube-api.json file, but my primary focus is making a call to Channels.Update("invideoPromotion") to add a annotation in the video.

youtube, err := youtube.New(httpClient)
if err != nil {
    log.Fatalf("Error creating YouTube client: %v", err)
}
call := youtube.Channels.Update("invideoPromotion")

Error: not enough arguments in call to youtube.Channels.Update

To retrieve InvideoPromotion I can call the channels service but channels service doesn't have update or Insert methods so I can't update InvideoPromotion using the google-api-go-client correct?

Eg: service.Channels.List("invideoPromotion").Id("Channel-Name") but not service.Channels.Insert("invideoPromotion").Id("Channel-Name")

Grokify
  • 15,092
  • 6
  • 60
  • 81
vinniyo
  • 787
  • 2
  • 8
  • 21

1 Answers1

0

Second argument of Update function should be a channel you want to update

service, err := youtube.New(client)
if err != nil {
    log.Fatalf("Error creating YouTube client: %v", err)
}

channel := &youtube.Channel{
    //you channel details here
}

call := service.Channels.Update("invideoPromotion", channel)

channel, err = call.Do()

if err != nil {
    log.Fatalf("Error updating YouTube channel: %v", err)
}
Sundrique
  • 627
  • 1
  • 9
  • 14