tree: 1cf6af7e559f6599b0d1488bc92cbb0ecf38d76b [path history] [tgz]
  1. adexchangebuyer/
  2. adexchangebuyer2/
  3. adexchangeseller/
  4. admin/
  5. adsense/
  6. adsensehost/
  7. analytics/
  8. androidenterprise/
  9. androidpublisher/
  10. appengine/
  11. appsactivity/
  12. appstate/
  13. autoscaler/
  14. bigquery/
  15. blogger/
  16. books/
  17. calendar/
  18. civicinfo/
  19. classroom/
  20. cloudbilling/
  21. cloudbuild/
  22. clouddebugger/
  23. cloudlatencytest/
  24. cloudmonitoring/
  25. cloudresourcemanager/
  26. cloudtrace/
  27. clouduseraccounts/
  28. compute/
  29. container/
  30. content/
  31. coordinate/
  32. customsearch/
  33. dataflow/
  34. dataproc/
  35. datastore/
  36. deploymentmanager/
  37. dfareporting/
  38. discovery/
  39. dns/
  40. doubleclickbidmanager/
  41. doubleclicksearch/
  42. drive/
  43. examples/
  44. fitness/
  45. freebase/
  46. fusiontables/
  47. games/
  48. gamesconfiguration/
  49. gamesmanagement/
  50. gan/
  51. genomics/
  52. gensupport/
  53. gmail/
  54. google-api-go-generator/
  55. googleapi/
  56. groupsmigration/
  57. groupssettings/
  58. iam/
  59. identitytoolkit/
  60. integration-tests/
  61. kgsearch/
  62. lib/
  63. licensing/
  64. logging/
  65. manager/
  66. mapsengine/
  67. mirror/
  68. monitoring/
  69. oauth2/
  70. pagespeedonline/
  71. partners/
  72. people/
  73. playmoviespartner/
  74. plus/
  75. plusdomains/
  76. prediction/
  77. proximitybeacon/
  78. pubsub/
  79. qpxexpress/
  80. replicapool/
  81. replicapoolupdater/
  82. reseller/
  83. resourceviews/
  84. script/
  85. serviceregistry/
  86. siteverification/
  87. spectrum/
  88. sqladmin/
  89. storage/
  90. storagetransfer/
  91. tagmanager/
  92. taskqueue/
  93. tasks/
  94. toolresults/
  95. translate/
  96. urlshortener/
  97. vision/
  98. webfonts/
  99. webmasters/
  100. youtube/
  101. youtubeanalytics/
  102. youtubereporting/
  103. api-list.json
  104. AUTHORS
  105. CONTRIBUTING.md
  106. CONTRIBUTORS
  107. GettingStarted.md
  108. key.json.enc
  109. LICENSE
  110. Makefile
  111. NOTES
  112. README.google
  113. README.md
  114. TODO
go/src/google.golang.org/api/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.