Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: resources/README.md

Issue 480063002: Update pacakge generation from configuration file (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Addressed review comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « resources/LICENSE ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: resources/README.md
diff --git a/resources/README.md b/resources/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..ad6b580165e961f00c697288bd3b3a9ad67e815b
--- /dev/null
+++ b/resources/README.md
@@ -0,0 +1,55 @@
+# Package of Google APIs
+
+## Description
+
+This repository contains auto-generated client libraries for accessing
+Google APIs using dart. It has the usual dart package layout.
+
+## Usage
+
+The first step is to obtain oauth2 access credentials. This can be done using
+the `googleapis_auth` package. Your application can access APIs on behalf of a
+user or using a service account.
+
+After obtaining credentials, an API from the `googleapis` package can be
+accessed with an authenticated HTTP client.
+
+The following is an example of a command line application which lists files
+in Google Drive by using a service account.
+
+Create a `pubspec.yaml` file with the `googleapis_auth` and `googleapis`
+dependencies.
+
+ ...
+ dependencies:
+ googleapis: any
+ googleapis_auth: any
+
+Create a service account in the Google Cloud Console and save the credential
+information. After that the Cloud Storage API can be accessed like this:
+
+ import 'package:googleapis/storage/v1.dart';
+ import 'package:googleapis_auth/auth_io.dart';
+
+ final Credentials = new ServiceAccountCredentials.fromJson(r'''
+ {
+ "private_key_id": ...,
+ "private_key": ...,
+ "client_email": ...,
+ "client_id": ...,
+ "type": "service_account"
+ }
+ ''');
+
+ void main() {
+ clientViaServiceAccount(Credentials,
+ [StorageApi.DevstorageReadOnlyScope]).then((http) {
+ var storage = new StorageApi(http);
+ storage.buckets.list('dart-on-cloud').then((buckets) {
+ print("Received ${buckets.items.length} bucket names:");
+ for (var file in buckets.items) {
+ print(file.name);
+ }
+ });
+ });
+ }
« no previous file with comments | « resources/LICENSE ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698