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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « resources/LICENSE ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Package of Google APIs
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
9
10 The first step is to obtain oauth2 access credentials. This can be done using
11 the `googleapis_auth` package. Your application can access APIs on behalf of a
12 user or using a service account.
13
14 After obtaining credentials, an API from the `googleapis` package can be
15 accessed with an authenticated HTTP client.
16
17 The following is an example of a command line application which lists files
18 in Google Drive by using a service account.
19
20 Create a `pubspec.yaml` file with the `googleapis_auth` and `googleapis`
21 dependencies.
22
23 ...
24 dependencies:
25 googleapis: any
26 googleapis_auth: any
27
28 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:
30
31 import 'package:googleapis/storage/v1.dart';
32 import 'package:googleapis_auth/auth_io.dart';
33
34 final Credentials = new ServiceAccountCredentials.fromJson(r'''
35 {
36 "private_key_id": ...,
37 "private_key": ...,
38 "client_email": ...,
39 "client_id": ...,
40 "type": "service_account"
41 }
42 ''');
43
44 void main() {
45 clientViaServiceAccount(Credentials,
46 [StorageApi.DevstorageReadOnlyScope]).then((http) {
47 var storage = new StorageApi(http);
48 storage.buckets.list('dart-on-cloud').then((buckets) {
49 print("Received ${buckets.items.length} bucket names:");
50 for (var file in buckets.items) {
51 print(file.name);
52 }
53 });
54 });
55 }
OLDNEW
« 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