Skip to content

Commit cbb2d63

Browse files
committed
Merge pull request googleapis#522 from google/cleanup
General cleanup.
2 parents ebeb820 + 7fd5913 commit cbb2d63

File tree

5 files changed

+143
-66
lines changed

5 files changed

+143
-66
lines changed

AUTHORS

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This is the official list of google-api-nodejs-client authors for copyright
2+
# purposes. This file is distinct from the CONTRIBUTORS files. See the latter
3+
# for an explanation.
4+
#
5+
# Names should be added to this file as:
6+
# Name or Organization <email address>
7+
# The email address is not required for organizations.
8+
Google Inc.

CONTRIBUTORS

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# People who have agreed to one of the CLAs and can contribute patches. The
2+
# AUTHORS file lists the copyright holders; this file lists people. For example,
3+
# Google employees are listed here but not in AUTHORS, because Google holds the
4+
# copyright.
5+
#
6+
# https://developers.google.com/open-source/cla/individual
7+
# https://developers.google.com/open-source/cla/corporate
8+
#
9+
# Names should be added to this file as:
10+
# Name <email address>
11+
Burcu Dogan <[email protected]>
12+
Jason Allor <[email protected]>
13+
Jason Dobry <[email protected]>
14+
Ryan Seys <[email protected]>
15+
Tim Emiola <[email protected]>

README.md

+83-34
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
1+
<img src="https://avatars0.githubusercontent.com/u/1342004?v=3&s=96" alt="Google Inc. logo" title="Google" align="right" height="96" width="96"/>
2+
13
# Google APIs Node.js Client
24

35
[![Build Status][travisimg]][travis]
46
[![Code Coverage][coverallsimg]][coveralls]
57

6-
Google's officially supported [node.js][node] client library for using
7-
Google APIs. It also supports authorization and authentication with OAuth 2.0.
8+
Google's officially supported [Node.js][node] client library for using Google
9+
APIs. Support for authorization and authentication with OAuth 2.0, API Keys and
10+
JWT (Service Tokens) is included.
11+
12+
## Table of Contents
13+
14+
* [Alpha](#alpha)
15+
* [Migrating to version `2.x` of this library](#migrating-to-version-2x-of-this-library)
16+
* [Supported APIs](#supported-apis)
17+
* [Questions/problems?](#questionsproblems)
18+
* [Working with Google Cloud Platform APIs?](#working-with-google-cloud-platform-apis)
19+
* [Installation](#installation)
20+
* [Usage](#usage)
21+
* [Create a service client](#create-a-service-client)
22+
* [Authorizing and authenticating](#authorizing-and-authenticating)
23+
* [OAuth2 client](#oauth2-client)
24+
* [Generating an authentication URL](#generating an authentication URL)
25+
* [Retrieve authorization code](#retrieve-authorization-code)
26+
* [Retrieve access token](#retrieve-access-token)
27+
* [Setting global or service-level auth](#setting-global-or-service-level-auth)
28+
* [Making authenticated requests](#making-authenticated-requests)
29+
* [Manually refreshing access token](#manually-refreshing-access-token)
30+
* [Using API keys](#using-api-keys)
31+
* [Using JWT (Service Tokens)](#using-jwt-service-tokens)
32+
* [Choosing the correct credential type automatically](#choosing-the-correct-credential-type-automatically)
33+
* [Specifying request body](#specifying-request-body)
34+
* [Media uploads](#media-uploads)
35+
* [Example: Upload a plain text file to Google Drive](#example-upload-a-plain-text-file-to-google-drive)
36+
* [Example: Upload an image to Google Drive from a readable stream](#example-upload-an-image-to-google-drive-from-a-readable-stream)
37+
* [Exposing request object](#exposing-request-object)
38+
* [Options](#options)
39+
* [Available options](#available-options)
40+
* [Global options](#global-options)
41+
* [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)
43+
* [Service-client options](#service-client-options)
44+
* [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)
849

950
### Alpha
1051

@@ -21,18 +62,21 @@ as explained in the [Migration Guide][migrating].
2162

2263
### Supported APIs
2364

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.
2566

2667
### Questions/problems?
2768

2869
* Ask your development related questions on [![Ask a question on Stackoverflow][overflowimg]][stackoverflow]
2970
* If you've found an bug/issue, please [file it on GitHub][bugs].
3071

31-
### Working with Google Cloud APIs?
72+
### Working with Google Cloud Platform APIs?
3273

3374
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].
3680

3781
## Installation
3882

@@ -78,7 +122,9 @@ var urlshortener = google.urlshortener('v1');
78122

79123
Supported APIs are listed on the [Google APIs Explorer][apiexplorer].
80124

81-
### Authorizing and Authenticating
125+
### Authorizing and authenticating
126+
127+
#### OAuth2 client
82128

83129
This client comes with an [OAuth2][oauth] client that allows you to retrieve an
84130
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].
94140
A complete sample application that authorizes and authenticates with the OAuth2
95141
client is available at [`examples/oauth2.js`][oauthexample].
96142

97-
#### Generating an authentication URL
143+
##### Generating an authentication URL
98144

99145
To ask for permissions from a user to retrieve an access token, you
100146
redirect them to a consent page. To create a consent page URL:
@@ -117,14 +163,14 @@ var url = oauth2Client.generateAuthUrl({
117163
});
118164
```
119165

120-
#### Retrieve authorization code
166+
##### Retrieve authorization code
121167

122168
Once a user has given permissions on the consent page, Google will redirect
123169
the page to the redirect URL you have provided with a code query parameter.
124170

125171
GET /oauthcallback?code={authorizationCode}
126172

127-
#### Retrieve access token
173+
##### Retrieve access token
128174

129175
With the code returned, you can ask for an access token as shown below:
130176

@@ -137,7 +183,7 @@ oauth2Client.getToken(code, function(err, tokens) {
137183
});
138184
```
139185

140-
#### Setting global or service-level auth
186+
##### Setting global or service-level auth
141187

142188
You can set the `auth` as a global or service-level option so you don't need to
143189
specify it every request.
@@ -163,7 +209,7 @@ var drive = google.drive({ version: 'v2', auth: oauth2Client });
163209

164210
See the [Options section][options] for more information.
165211

166-
#### Making Authenticated Requests
212+
##### Making authenticated requests
167213

168214
You can start using OAuth2 to authorize and authenticate your
169215
requests to Google APIs with the retrieved tokens. If you provide a
@@ -189,7 +235,7 @@ plus.people.get({ userId: 'me', auth: oauth2Client }, function(err, response) {
189235
});
190236
```
191237

192-
#### Manually refreshing access token
238+
##### Manually refreshing access token
193239

194240
If you need to manually refresh the `access_token` associated with your OAuth2
195241
client, make sure you have a `refresh_token` set in your credentials first and
@@ -264,10 +310,10 @@ is running on a configured instance of Google Compute Engine.
264310

265311
The code below shows how to retrieve a default credential type, depending upon the runtime
266312
environment. The createScopedRequired must be called to determine when you need to pass
267-
in the scopes manually, and when they have been set for you automatically based on the
313+
in the scopes manually, and when they have been set for you automatically based on the
268314
configured runtime environment.
269315

270-
``` js
316+
```js
271317
google.auth.getApplicationDefault(function(err, authClient) {
272318
if (err) {
273319
res.send('Failed to get the default credentials: ' + String(err));
@@ -291,17 +337,19 @@ google.auth.getApplicationDefault(function(err, authClient) {
291337
});
292338
```
293339

294-
### Specifying Request Body
340+
### Specifying request body
295341

296342
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.
297343

298-
### Media Uploads
344+
### Media uploads
299345

300346
This client supports multipart media uploads. The resource parameters are
301347
specified in the `resource` parameter object, and the media itself is
302348
specified in the `media.body` parameter with mime-type specified in `media.mimeType`.
303349

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
305353
contents "Hello World".
306354

307355
``` js
@@ -324,9 +372,9 @@ This can allow you to upload very large files that cannot fit into memory.
324372

325373
Note: Your readable stream may be [unstable][stability]. Use at your own risk.
326374

327-
Example: Upload an image to Google Drive from a readable stream.
375+
##### Example: Upload an image to Google Drive from a readable stream
328376

329-
``` js
377+
```js
330378
var fs = require('fs');
331379
var drive = google.drive({ version: 'v2', auth: oauth2Client });
332380

@@ -345,17 +393,17 @@ drive.files.insert({
345393
For more examples of creation and modification requests with media attachments,
346394
take a look at the `examples/mediaupload.js` sample.
347395

348-
## Exposing request object
396+
### Exposing request object
349397

350398
Every request to the API returns a [`request`][request] object, allowing you to track
351399
the request's progress or general information about the request.
352400

353-
``` js
401+
```js
354402
var req = drive.files.insert(/* ... */);
355403
console.log(req.uri.href); // print out the request's URL.
356404
```
357405

358-
## Options
406+
### Options
359407

360408
For more fine-tuned control over how your API calls are made,
361409
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.
365413
You may specify additional options either in the global `google` object or on a
366414
service client basis.
367415

368-
### Available options
416+
#### Available options
369417

370418
The options you specify are attached to the `request` object so whatever
371419
`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.
372420

373421
A full list of supported options can be [found here][requestopts].
374422

375-
### Global options
423+
#### Global options
376424

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
378426

379-
``` js
427+
```js
380428
var google = require('googleapis');
381429
google.options({ proxy: 'http://proxy.example.com', auth: auth });
382430

383431
// All requests made with this object will use these settings unless overridden.
384432
```
385433

386-
#### Example: Specifying global request parameters.
434+
##### Example: Specifying global request parameters
387435

388436
```js
389437
var google = require('googleapis');
@@ -393,11 +441,11 @@ google.options({ params: { quotaUser: '[email protected]' } });
393441
// unless overridden either in a service client or in individual API calls.
394442
```
395443

396-
### Service-client options
444+
#### Service-client options
397445

398446
You can also specify options when creating a service client.
399447

400-
#### Example: Specifying a default `auth` option (API key or OAuth2 client)
448+
##### Example: Specifying a default `auth` option (API key or OAuth2 client)
401449

402450
```js
403451
var auth = 'API KEY'; // or you could use oauth2Client
@@ -412,7 +460,7 @@ to authenticate.
412460
**Note:** Created clients are **immutable** so you must create a new one if you
413461
want to specify different options.
414462

415-
#### Example: Specifying default service client query parameters
463+
##### Example: Specifying default service client query parameters
416464

417465
```js
418466
var urlshortener = google.urlshortener({
@@ -426,7 +474,7 @@ var urlshortener = google.urlshortener({
426474
var drive = google.drive('v2');
427475
```
428476

429-
### Request-level options
477+
#### Request-level options
430478

431479
You can specify an `auth` object to be used per request. Each request also
432480
inherits the options specified at the service level and global level.
@@ -463,6 +511,7 @@ See [CONTRIBUTING][contributing].
463511
[oauthexample]: https://github.com/google/google-api-nodejs-client/tree/master/examples/oauth2.js
464512
[options]: https://github.com/google/google-api-nodejs-client/tree/master#options
465513
[gcloud]: https://github.com/GoogleCloudPlatform/gcloud-node
514+
[gcloudapis]: https://googlecloudplatform.github.io/gcloud-node/#/docs/gcloud
466515
[cloudplatform]: https://cloud.google.com/docs/
467-
[coveralls]: https://coveralls.io/r/google/google-api-nodejs-client?branch=master
468-
[coverallsimg]: https://img.shields.io/coveralls/google/google-api-nodejs-client.svg
516+
[coverallsimg]: https://coveralls.io/repos/github/google/google-api-nodejs-client/badge.svg?branch=master
517+
[coveralls]: https://coveralls.io/github/google/google-api-nodejs-client?branch=master

jsdoc-conf.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"encoding": "utf8",
1818
"destination": "./docs/",
1919
"recurse": true,
20-
"tutorials": "examples/"
20+
"readme": "./README.md",
21+
"package": "./package.json"
2122
}
2223
}

0 commit comments

Comments
 (0)