all: add ForceSendFields support

Allow users to nominate fields that should be included in requests to
the server, regardless of field contents.  This makes it possible to
perform patch requests involving fields with emtpy values -- a common
use case.

This change will also enable immediate workarounds for APIs which expect
values to be present for particular fields in update requests (such as
those in #54).

The custom JSON marshaling code introduced here is applicable to both
update and patch payloads, and extends naturally to hierarchical
schemas.

Note: this change will result in non-deterministic ordering of fields in the JSON
representation of schemas, due to the intermediate use of a map.

Change-Id: I141cfabcbd500ca15b512cf17665344ba4a66887
Reviewed-on: https://code-review.googlesource.com/3386
Reviewed-by: Michael McGreevy <mcgreevy@golang.org>
149 files changed
tree: bcae7f670c2d90d76de41b0f329b05a33b2f237e
  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. clouduseraccounts/
  25. compute/
  26. container/
  27. content/
  28. coordinate/
  29. customsearch/
  30. dataflow/
  31. datastore/
  32. deploymentmanager/
  33. dfareporting/
  34. discovery/
  35. dns/
  36. doubleclickbidmanager/
  37. doubleclicksearch/
  38. drive/
  39. examples/
  40. fitness/
  41. freebase/
  42. fusiontables/
  43. games/
  44. gamesconfiguration/
  45. gamesmanagement/
  46. gan/
  47. genomics/
  48. gmail/
  49. google-api-go-generator/
  50. googleapi/
  51. groupsmigration/
  52. groupssettings/
  53. identitytoolkit/
  54. internal/
  55. lib/
  56. licensing/
  57. logging/
  58. manager/
  59. mapsengine/
  60. mirror/
  61. oauth2/
  62. pagespeedonline/
  63. partners/
  64. playmoviespartner/
  65. plus/
  66. plusdomains/
  67. prediction/
  68. proximitybeacon/
  69. pubsub/
  70. qpxexpress/
  71. replicapool/
  72. replicapoolupdater/
  73. reseller/
  74. resourceviews/
  75. script/
  76. siteverification/
  77. spectrum/
  78. sqladmin/
  79. storage/
  80. storagetransfer/
  81. tagmanager/
  82. taskqueue/
  83. tasks/
  84. translate/
  85. urlshortener/
  86. webfonts/
  87. webmasters/
  88. youtube/
  89. youtubeanalytics/
  90. .hgignore
  91. .hgtags
  92. .travis.yml
  93. api-list.json
  94. AUTHORS
  95. CONTRIBUTING.md
  96. CONTRIBUTORS
  97. GettingStarted.md
  98. LICENSE
  99. Makefile
  100. NOTES
  101. README.md
  102. 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.