commit | 4d6c29dd67d8f208c6924fb66ce80b12a0db1920 | [log] [tgz] |
---|---|---|
author | Glenn Lewis <gmlewis@google.com> | Fri Nov 06 15:08:30 2015 -0800 |
committer | Glenn Lewis <gmlewis@google.com> | Mon Nov 16 04:51:22 2015 +0000 |
tree | 1cb53cb6d73b797c6b938896c565a36cb5d69830 | |
parent | c12ea1cd9ca9fc80d03f056ff6d1dea3eb41630c [diff] |
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/ and the accidentally-submitted version is located here: https://code-review.googlesource.com/#/c/3610/ which was also reverted. Change-Id: I8ccf11cd2ef62430beac842fb6ef237ef7c730ca Reviewed-on: https://code-review.googlesource.com/3732 Reviewed-by: Michael McGreevy <mcgreevy@golang.org>
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 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.