| OLD | NEW |
| 1 # Package of Google APIs | 1 Auto-generated Dart libraries for accessing [Google APIs][libs]. |
| 2 | 2 |
| 3 ## Description | |
| 4 | |
| 5 This repository contains auto-generated client libraries for accessing | |
| 6 Google APIs using dart. It has the usual dart package layout. | |
| 7 | |
| 8 ## Usage | 3 ## Usage |
| 9 | 4 |
| 10 The first step is to obtain oauth2 access credentials. This can be done using | 5 First, obtain OAuth 2.0 access credentials. This can be done using the |
| 11 the `googleapis_auth` package. Your application can access APIs on behalf of a | 6 `googleapis_auth` package. Your application can access APIs on behalf of a |
| 12 user or using a service account. | 7 user or using a service account. |
| 13 | 8 |
| 14 After obtaining credentials, an API from the `googleapis` package can be | 9 After obtaining credentials, an API from the `googleapis` package can be |
| 15 accessed with an authenticated HTTP client. | 10 accessed with an authenticated HTTP client. |
| 16 | 11 |
| 17 The following is an example of a command line application which lists files | 12 ## Example |
| 18 in Google Drive by using a service account. | 13 |
| 14 The following command line application lists files in Google Drive by using a |
| 15 service account. |
| 19 | 16 |
| 20 Create a `pubspec.yaml` file with the `googleapis_auth` and `googleapis` | 17 Create a `pubspec.yaml` file with the `googleapis_auth` and `googleapis` |
| 21 dependencies. | 18 dependencies. |
| 22 | 19 |
| 23 ... | 20 ```yaml |
| 24 dependencies: | 21 ... |
| 25 googleapis: any | 22 dependencies: |
| 26 googleapis_auth: any | 23 googleapis: any |
| 24 googleapis_auth: any |
| 25 ``` |
| 27 | 26 |
| 28 Create a service account in the Google Cloud Console and save the credential | 27 Create a service account in the Google Cloud Console and save the credential |
| 29 information. After that the Cloud Storage API can be accessed like this: | 28 information. |
| 30 | 29 |
| 31 import 'package:googleapis/storage/v1.dart'; | 30 Then create a Dart application to list files in a spececific project. *In the |
| 32 import 'package:googleapis_auth/auth_io.dart'; | 31 example below, files from the `dart-on-cloud` project are listed.* |
| 33 | 32 |
| 34 final Credentials = new ServiceAccountCredentials.fromJson(r''' | 33 ```dart |
| 35 { | 34 // bin/list_files.dart |
| 36 "private_key_id": ..., | |
| 37 "private_key": ..., | |
| 38 "client_email": ..., | |
| 39 "client_id": ..., | |
| 40 "type": "service_account" | |
| 41 } | |
| 42 '''); | |
| 43 | 35 |
| 44 void main() { | 36 import 'package:googleapis/storage/v1.dart'; |
| 45 clientViaServiceAccount(Credentials, | 37 import 'package:googleapis_auth/auth_io.dart'; |
| 46 [StorageApi.DevstorageReadOnlyScope]).then((http)
{ | 38 |
| 47 var storage = new StorageApi(http); | 39 final _credentials = new ServiceAccountCredentials.fromJson(r''' |
| 48 storage.buckets.list('dart-on-cloud').then((buckets) { | 40 { |
| 49 print("Received ${buckets.items.length} bucket names:"); | 41 "private_key_id": ..., |
| 50 for (var file in buckets.items) { | 42 "private_key": ..., |
| 51 print(file.name); | 43 "client_email": ..., |
| 52 } | 44 "client_id": ..., |
| 53 }); | 45 "type": "service_account" |
| 54 }); | 46 } |
| 55 } | 47 '''); |
| 48 |
| 49 const _SCOPES = const [StorageApi.DevstorageReadOnlyScope]; |
| 50 |
| 51 void main() { |
| 52 clientViaServiceAccount(_credentials, _SCOPES).then((http_client) { |
| 53 var storage = new StorageApi(http_client); |
| 54 storage.buckets.list('dart-on-cloud').then((buckets) { |
| 55 print("Received ${buckets.items.length} bucket names:"); |
| 56 for (var file in buckets.items) { |
| 57 print(file.name); |
| 58 } |
| 59 }); |
| 60 }); |
| 61 } |
| 62 ``` |
| 63 |
| 64 [libs]: https://developers.google.com/discovery/libraries/ |
| 56 | 65 |
| 57 ## Available Google APIs | 66 ## Available Google APIs |
| 58 | 67 |
| 59 The following is a list of APIs that are currently available inside this | 68 The following is a list of APIs that are currently available inside this |
| 60 package. | 69 package. |
| 61 | 70 |
| 62 ####  Google Co
mpute Engine Autoscaler API - autoscaler v1beta2 | 71 ####  Google Co
mpute Engine Autoscaler API - autoscaler v1beta2 |
| 63 | 72 |
| 64 The Google Compute Engine Autoscaler API provides autoscaling for groups of Clou
d VMs. | 73 The Google Compute Engine Autoscaler API provides autoscaling for groups of Clou
d VMs. |
| 65 | 74 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 ####  Google Co
mpute Engine Instance Group Manager API - replicapool v1beta2 | 123 ####  Google Co
mpute Engine Instance Group Manager API - replicapool v1beta2 |
| 115 | 124 |
| 116 The Google Compute Engine Instance Group Manager API provides groups of homogeno
us Compute Engine Instances. | 125 The Google Compute Engine Instance Group Manager API provides groups of homogeno
us Compute Engine Instances. |
| 117 | 126 |
| 118 Official API documentation: https://developers.google.com/compute/docs/instance-
groups/manager/v1beta2 | 127 Official API documentation: https://developers.google.com/compute/docs/instance-
groups/manager/v1beta2 |
| 119 | 128 |
| 120 ####  Google Co
mpute Engine Instance Group Updater API - replicapoolupdater v1beta1 | 129 ####  Google Co
mpute Engine Instance Group Updater API - replicapoolupdater v1beta1 |
| 121 | 130 |
| 122 The Google Compute Engine Instance Group Updater API provides services for updat
ing groups of Compute Engine Instances. | 131 The Google Compute Engine Instance Group Updater API provides services for updat
ing groups of Compute Engine Instances. |
| 123 | 132 |
| 124 Official API documentation: | 133 Official API documentation: https://developers.google.com/compute/docs/instance-
groups/manager/v1beta2 |
| 125 | 134 |
| 126 ####  Resource
Views API - resourceviews v1beta1 | 135 ####  Resource
Views API - resourceviews v1beta1 |
| 127 | 136 |
| 128 The Resource View API allows users to create and manage logical sets of Google C
ompute Engine instances. | 137 The Resource View API allows users to create and manage logical sets of Google C
ompute Engine instances. |
| 129 | 138 |
| 130 Official API documentation: https://developers.google.com/compute/ | 139 Official API documentation: https://developers.google.com/compute/ |
| 131 | 140 |
| 132 ####  Resource
Views API - resourceviews v1beta2 | 141 ####  Resource
Views API - resourceviews v1beta2 |
| 133 | 142 |
| 134 The Resource View API allows users to create and manage logical sets of Google C
ompute Engine instances. | 143 The Resource View API allows users to create and manage logical sets of Google C
ompute Engine instances. |
| 135 | 144 |
| 136 Official API documentation: https://developers.google.com/compute/ | 145 Official API documentation: https://developers.google.com/compute/ |
| 137 | 146 |
| 138 ####  Cloud SQL
Administration API - sqladmin v1beta3 | 147 ####  Cloud SQL
Administration API - sqladmin v1beta3 |
| 139 | 148 |
| 140 API for Cloud SQL database instance management. | 149 API for Cloud SQL database instance management. |
| 141 | 150 |
| 142 Official API documentation: https://developers.google.com/cloud-sql/docs/admin-a
pi/ | 151 Official API documentation: https://developers.google.com/cloud-sql/docs/admin-a
pi/ |
| 143 | 152 |
| 144 ####  TaskQ
ueue API - taskqueue v1beta2 | 153 ####  Task
Queue API - taskqueue v1beta2 |
| 145 | 154 |
| 146 Lets you access a Google App Engine Pull Task Queue over REST. | 155 Lets you access a Google App Engine Pull Task Queue over REST. |
| 147 | 156 |
| 148 Official API documentation: https://developers.google.com/appengine/docs/python/
taskqueue/rest | 157 Official API documentation: https://developers.google.com/appengine/docs/python/
taskqueue/rest |
| 149 | 158 |
| OLD | NEW |