You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Example: Specifying a default proxy and `auth` to be used for each request](#example-specifying-a-default-proxy-and-auth-to-be-used-for-each-request)
42
+
*[Example: Specifying global request parameters](#example-specifying-global-request-parameters)
*[Example: Specifying a default `auth` option (API key or OAuth2 client)](#example-specifying-a-default-auth-option-api-key-or-oauth2-client)
45
+
*[Example: Specifying default service client query parameters](#example-specifying-default-service-client-query-parameters)
46
+
*[Request-level options](#request-level-options)
47
+
*[License](#license)
48
+
*[Contributing](#contributing)
8
49
9
50
### Alpha
10
51
@@ -21,18 +62,21 @@ as explained in the [Migration Guide][migrating].
21
62
22
63
### Supported APIs
23
64
24
-
The full list of supported APIs can be found [here][supported-list]. The API endpoints are automatically generated, so if the API is not in the list, it is currently not supported by this API client library.
65
+
The full list of supported APIs can be found [here][supported-list]. The API endpoints are automatically generated, so if the API is not in the list, it is currently not supported by this API client library.
25
66
26
67
### Questions/problems?
27
68
28
69
* Ask your development related questions on [![Ask a question on Stackoverflow][overflowimg]][stackoverflow]
29
70
* If you've found an bug/issue, please [file it on GitHub][bugs].
30
71
31
-
### Working with Google Cloud APIs?
72
+
### Working with Google Cloud Platform APIs?
32
73
33
74
If you're working with [Google Cloud Platform][cloudplatform] APIs such as
34
-
Datastore, Cloud Storage or Pub/Sub, consider using [`gcloud`][gcloud], a
35
-
Node idiomatic client for Google Cloud services.
75
+
Datastore, Cloud Storage or Pub/Sub, consider using [`gcloud`][gcloud], an
76
+
idiomatic Node.js client for Google Cloud Platform services.
77
+
78
+
You can find the list of Google Cloud Platform APIs supported by gcloud in the
79
+
[gcloud docs][gcloudapis].
36
80
37
81
## Installation
38
82
@@ -78,7 +122,9 @@ var urlshortener = google.urlshortener('v1');
78
122
79
123
Supported APIs are listed on the [Google APIs Explorer][apiexplorer].
80
124
81
-
### Authorizing and Authenticating
125
+
### Authorizing and authenticating
126
+
127
+
#### OAuth2 client
82
128
83
129
This client comes with an [OAuth2][oauth] client that allows you to retrieve an
84
130
access token and refreshes the token and retry the request seamlessly if token
@@ -94,7 +140,7 @@ For more information about OAuth2 and how it works, [see here][oauth].
94
140
A complete sample application that authorizes and authenticates with the OAuth2
95
141
client is available at [`examples/oauth2.js`][oauthexample].
96
142
97
-
#### Generating an authentication URL
143
+
#####Generating an authentication URL
98
144
99
145
To ask for permissions from a user to retrieve an access token, you
100
146
redirect them to a consent page. To create a consent page URL:
@@ -117,14 +163,14 @@ var url = oauth2Client.generateAuthUrl({
117
163
});
118
164
```
119
165
120
-
#### Retrieve authorization code
166
+
#####Retrieve authorization code
121
167
122
168
Once a user has given permissions on the consent page, Google will redirect
123
169
the page to the redirect URL you have provided with a code query parameter.
124
170
125
171
GET /oauthcallback?code={authorizationCode}
126
172
127
-
#### Retrieve access token
173
+
#####Retrieve access token
128
174
129
175
With the code returned, you can ask for an access token as shown below:
The body of the request is specified in the `resource` parameter object of the request. The resource/body is specified as a JavaScript object with key/value pairs. See the example in the next section below for an example on how it is specified.
297
343
298
-
### Media Uploads
344
+
### Media uploads
299
345
300
346
This client supports multipart media uploads. The resource parameters are
301
347
specified in the `resource` parameter object, and the media itself is
302
348
specified in the `media.body` parameter with mime-type specified in `media.mimeType`.
303
349
304
-
Example: Upload a plain text file to Google Drive with the title "Test" and
350
+
##### Example: Upload a plain text file to Google Drive
351
+
352
+
This example uploads a plain text file to Google Drive with the title "Test" and
305
353
contents "Hello World".
306
354
307
355
```js
@@ -324,9 +372,9 @@ This can allow you to upload very large files that cannot fit into memory.
324
372
325
373
Note: Your readable stream may be [unstable][stability]. Use at your own risk.
326
374
327
-
Example: Upload an image to Google Drive from a readable stream.
375
+
##### Example: Upload an image to Google Drive from a readable stream
328
376
329
-
```js
377
+
```js
330
378
var fs =require('fs');
331
379
var drive =google.drive({ version:'v2', auth: oauth2Client });
332
380
@@ -345,17 +393,17 @@ drive.files.insert({
345
393
For more examples of creation and modification requests with media attachments,
346
394
take a look at the `examples/mediaupload.js` sample.
347
395
348
-
## Exposing request object
396
+
###Exposing request object
349
397
350
398
Every request to the API returns a [`request`][request] object, allowing you to track
351
399
the request's progress or general information about the request.
352
400
353
-
```js
401
+
```js
354
402
var req =drive.files.insert(/* ... */);
355
403
console.log(req.uri.href); // print out the request's URL.
356
404
```
357
405
358
-
## Options
406
+
###Options
359
407
360
408
For more fine-tuned control over how your API calls are made,
361
409
we provide you with the ability to specify additional options that can
@@ -365,25 +413,25 @@ this library to make network calls to the API.
365
413
You may specify additional options either in the global `google` object or on a
366
414
service client basis.
367
415
368
-
### Available options
416
+
####Available options
369
417
370
418
The options you specify are attached to the `request` object so whatever
371
419
`request` supports, this library supports. You may also specify global or per-service request parameters that will be attached to all API calls you make.
372
420
373
421
A full list of supported options can be [found here][requestopts].
374
422
375
-
### Global options
423
+
####Global options
376
424
377
-
#### Example: Specifying a default proxy and `auth` to be used for each request.
425
+
#####Example: Specifying a default proxy and `auth` to be used for each request
0 commit comments