examples: uncomment custom search example
This was previously blocking a build. This commit just uncommented
the code.
Fixes: #469
Change-Id: I9a39a5b227be5e28b17a5ebc8f40a436796304e3
Reviewed-on: https://code-review.googlesource.com/c/google-api-go-client/+/55190
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
diff --git a/examples/customsearch.go b/examples/customsearch.go
index 2f1609a..8199dfd 100644
--- a/examples/customsearch.go
+++ b/examples/customsearch.go
@@ -4,28 +4,36 @@
package main
-// TODO(codyoss): uncomment after next generation and fix
-// const (
-// apiKey = "some-api-key"
-// cx = "some-custom-search-engine-id"
-// query = "some-custom-query"
-// )
-//
-// func customSearchMain() {
-// client := &http.Client{Transport: &transport.APIKey{Key: apiKey}}
-//
-// svc, err := customsearch.New(client)
-// if err != nil {
-// log.Fatal(err)
-// }
-//
-// resp, err := svc.Cse.List().Q(query).Cx(cx).Do()
-// if err != nil {
-// log.Fatal(err)
-// }
-//
-// for i, result := range resp.Items {
-// fmt.Printf("#%d: %s\n", i+1, result.Title)
-// fmt.Printf("\t%s\n", result.Snippet)
-// }
-// }
+import (
+ "fmt"
+ "log"
+ "net/http"
+
+ "google.golang.org/api/customsearch/v1"
+ "google.golang.org/api/googleapi/transport"
+)
+
+const (
+ apiKey = "some-api-key"
+ cx = "some-custom-search-engine-id"
+ query = "some-custom-query"
+)
+
+func customSearchMain() {
+ client := &http.Client{Transport: &transport.APIKey{Key: apiKey}}
+
+ svc, err := customsearch.New(client)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ resp, err := svc.Cse.List().Q(query).Cx(cx).Do()
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ for i, result := range resp.Items {
+ fmt.Printf("#%d: %s\n", i+1, result.Title)
+ fmt.Printf("\t%s\n", result.Snippet)
+ }
+}