google-api-go-client: add support for "repeated" params

Fixes #105 and #110.

Recommended reading order:
1) google-api-go-generator/gen.go
2) google-api-go-generator/gen_test.go
3) internal/params.go
4) google-api-go-generator/testdata/repeated.*
5) google-api-go-generator/testdata/param-rename.*
6) spot-check random APIs and/or other testdata/*

The problem with the last solution was that sometimes the generator
changes the argument name from the API name, and this was not being
handled properly. There is now a new test (param-rename.*) that
checks for the proper renaming of argument to API names.

Specifically, the only changes made since the last
review (apart from the new unit test) were to
lines 1577-1585 (arg.goname => arg.apiname) in
google-api-go-generator/gen.go.

The original implementation (which was reverted) and its review
is located here: https://code-review.googlesource.com/#/c/3520/

Change-Id: Iea5673a800f0e1aec4ad788fd2f621965d4386a1
Reviewed-on: https://code-review.googlesource.com/3610
Reviewed-by: Michael McGreevy <mcgreevy@golang.org>
149 files changed
tree: a845302e3309b5e48d8df460746323fdb90b6498
  1. adexchangebuyer/
  2. adexchangeseller/
  3. admin/
  4. adsense/
  5. adsensehost/
  6. analytics/
  7. androidenterprise/
  8. androidpublisher/
  9. appengine/
  10. appsactivity/
  11. appstate/
  12. autoscaler/
  13. bigquery/
  14. blogger/
  15. books/
  16. calendar/
  17. civicinfo/
  18. classroom/
  19. cloudbilling/
  20. clouddebugger/
  21. cloudlatencytest/
  22. cloudmonitoring/
  23. cloudresourcemanager/
  24. cloudtrace/
  25. clouduseraccounts/
  26. compute/
  27. container/
  28. content/
  29. coordinate/
  30. customsearch/
  31. dataflow/
  32. datastore/
  33. deploymentmanager/
  34. dfareporting/
  35. discovery/
  36. dns/
  37. doubleclickbidmanager/
  38. doubleclicksearch/
  39. drive/
  40. examples/
  41. fitness/
  42. freebase/
  43. fusiontables/
  44. games/
  45. gamesconfiguration/
  46. gamesmanagement/
  47. gan/
  48. genomics/
  49. gmail/
  50. google-api-go-generator/
  51. googleapi/
  52. groupsmigration/
  53. groupssettings/
  54. identitytoolkit/
  55. internal/
  56. lib/
  57. licensing/
  58. logging/
  59. manager/
  60. mapsengine/
  61. mirror/
  62. oauth2/
  63. pagespeedonline/
  64. partners/
  65. playmoviespartner/
  66. plus/
  67. plusdomains/
  68. prediction/
  69. proximitybeacon/
  70. pubsub/
  71. qpxexpress/
  72. replicapool/
  73. replicapoolupdater/
  74. reseller/
  75. resourceviews/
  76. script/
  77. siteverification/
  78. spectrum/
  79. sqladmin/
  80. storage/
  81. storagetransfer/
  82. tagmanager/
  83. taskqueue/
  84. tasks/
  85. translate/
  86. urlshortener/
  87. webfonts/
  88. webmasters/
  89. youtube/
  90. youtubeanalytics/
  91. youtubereporting/
  92. .hgignore
  93. .hgtags
  94. .travis.yml
  95. api-list.json
  96. AUTHORS
  97. CONTRIBUTING.md
  98. CONTRIBUTORS
  99. GettingStarted.md
  100. LICENSE
  101. Makefile
  102. NOTES
  103. README.md
  104. TODO
README.md

Google APIs Client Library for Go

Status

Build Status

These are auto-generated Go libraries from the Google Discovery Service's JSON description files of the available “new style” Google APIs.

Due to the auto-generated nature of this collection of libraries, complete APIs or specific versions can appear or go away without notice. As a result, you should always locally vendor any API(s) that your code relies upon.

Announcement email:

Getting started documentation:

In summary:

$ go get google.golang.org/api/storage/v1
$ go get google.golang.org/api/tasks/v1
$ go get google.golang.org/api/moderator/v1
... etc ...

For docs, see e.g.:

The package of a given import is the second-to-last component, before the version number.

For examples, see:

For support, use the golang-nuts@ mailing list:

Application Default Credentials Example

Application Default Credentials provide a simplified way to obtain credentials for authenticating with Google APIs.

The Application Default Credentials authenticate as the application itself, which make them great for working with Google Cloud APIs like Storage or Datastore. They are the recommended form of authentication when building applications that run on Google Compute Engine or Google App Engine.

Default credentials are provided by the golang.org/x/oauth2/google package. To use them, add the following import:

import "golang.org/x/oauth2/google"

Some credentials types require you to specify scopes, and service entry points may not inject them. If you encounter this situation you may need to specify scopes as follows:

import (
        "golang.org/x/net/context"
        "golang.org/x/oauth2/google"
        "google.golang.org/api/compute/v1"
)

func main() {
        // Use oauth2.NoContext if there isn't a good context to pass in.
        ctx := context.Background()

        client, err := google.DefaultClient(ctx, compute.ComputeScope)
        if err != nil {
                //...
        }
        computeService, err := compute.New(client)
        if err != nil {
                //...
        }
}

If you need a oauth2.TokenSource, use the DefaultTokenSource function:

ts, err := google.DefaultTokenSource(ctx, scope1, scope2, ...)
if err != nil {
        //...
}
client := oauth2.NewClient(ctx, ts)

See also: golang.org/x/oauth2/google package documentation.