0

I've done the Oauth callback from which people said it's not needed, and just needs the cx code but I have yet to figure out how to add the cx parameter to the call.

package main

import (
    "fmt"
    "log"

    "github.com/vinniyo/authCallback"

    "github.com/google/google-api-go-client/customsearch/v1"
)

func main() {
    client, err := authCallback.BuildOAuthHTTPClient()
    if err != nil {
        log.Fatalf("Error building OAuth client: %v", err)
    }

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

    fmt.Println(service.Cse.List("bob").Do())

}

I know to upload a video to youtube you add parameters before do() but how do you figure out the formatting? eg:

    upload := &youtube.Query{
        Status: &youtube.VideoStatus{PrivacyStatus: *privacy},
    } 
Grokify
  • 15,092
  • 6
  • 60
  • 81
vinniyo
  • 787
  • 2
  • 8
  • 21
  • 1
    Your question seems a bit mixed up: are you talking about youtube or custom search? – djd Feb 04 '16 at 21:57

1 Answers1

1

The CseListCall struct has Cx method which lets you add that parameter: https://godoc.org/google.golang.org/api/customsearch/v1#CseListCall

fmt.Println(service.Cse.List("bob").Cx("my_cx_id").Do())
djd
  • 4,988
  • 2
  • 25
  • 35