Skip to content

Commit 4574f50

Browse files
grjan7danieljbrucedanielbankheadsofislgcf-owl-bot[bot]
authored
docs: fixed typos and spaces (googleapis#3464)
* docs: fixed spaces for consistency * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: danieljbruce <[email protected]> Co-authored-by: Daniel Bankhead <[email protected]> Co-authored-by: sofisl <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c16d5c8 commit 4574f50

File tree

18 files changed

+72
-53
lines changed

18 files changed

+72
-53
lines changed

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@ This library supports the maintenance LTS, active LTS, and current release of no
4848
### Installation
4949
This library is distributed on `npm`. In order to add it as a dependency, run the following command:
5050

51-
``` sh
51+
```sh
5252
$ npm install googleapis
5353
```
5454

5555
If you need to reduce startup times, you can alternatively install a submodule as its own dependency. We make an effort to publish submodules that are __not__ in this [list](https://github.com/googleapis/google-cloud-node#google-cloud-nodejs-client-libraries). In order to add it as a dependency, run the following sample command, replacing with your preferred API:
5656

57-
``` sh
57+
```sh
5858
$ npm install @googleapis/docs
5959
```
6060

61-
You can run [this search](https://www.npmjs.com/search?q=scope%3Agoogleapis) on npm, to find a list of the submodules available.
61+
You can run [this search](https://www.npmjs.com/search?q=scope%3Agoogleapis) on `npm`, to find a list of the submodules available.
6262
### Using the client library
6363

6464
This is a very simple example. This creates a Blogger client and retrieves the details of a blog given the blog Id:
6565

66-
``` js
66+
```js
6767
const {google} = require('googleapis');
6868

6969
// Each API may support multiple versions. With this sample, we're getting
@@ -89,7 +89,7 @@ blogger.blogs.get(params, (err, res) => {
8989

9090
Instead of using callbacks you can also use promises!
9191

92-
``` js
92+
```js
9393
blogger.blogs.get(params)
9494
.then(res => {
9595
console.log(`The blog url is ${res.data.url}`);
@@ -101,17 +101,18 @@ blogger.blogs.get(params)
101101

102102
Or async/await:
103103

104-
``` js
104+
```js
105105
async function runSample() {
106106
const res = await blogger.blogs.get(params);
107107
console.log(`The blog url is ${res.data.url}`);
108108
}
109+
109110
runSample().catch(console.error);
110111
```
111112

112113
Alternatively, you can make calls directly to the APIs by installing a submodule:
113114

114-
``` js
115+
```js
115116
const docs = require('@googleapis/docs')
116117

117118
const auth = new docs.auth.GoogleAuth({
@@ -174,7 +175,7 @@ A complete sample application that authorizes and authenticates with the OAuth2
174175

175176
To ask for permissions from a user to retrieve an access token, you redirect them to a consent page. To create a consent page URL:
176177

177-
``` js
178+
```js
178179
const {google} = require('googleapis');
179180

180181
const oauth2Client = new google.auth.OAuth2(
@@ -193,7 +194,7 @@ const url = oauth2Client.generateAuthUrl({
193194
// 'online' (default) or 'offline' (gets refresh_token)
194195
access_type: 'offline',
195196

196-
// If you only need one scope you can pass it as a string
197+
// If you only need one scope, you can pass it as a string
197198
scope: scopes
198199
});
199200
```
@@ -204,13 +205,14 @@ const url = oauth2Client.generateAuthUrl({
204205

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

208+
```
207209
GET /oauthcallback?code={authorizationCode}
208-
210+
```
209211
#### Retrieve access token
210212

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

213-
``` js
215+
```js
214216
// This will provide an object with the access_token and refresh_token.
215217
// Save these somewhere safe so they can be used at a later time.
216218
const {tokens} = await oauth2Client.getToken(code)
@@ -231,7 +233,7 @@ oauth2Client.on('tokens', (tokens) => {
231233
console.log(tokens.access_token);
232234
});
233235
```
234-
This tokens event only occurs in the first authorization, and you need to have set your `access_type` to `offline` when calling the `generateAuthUrl` method to receive the refresh token. If you have already given your app the requisiste permissions without setting the appropriate constraints for receiving a refresh token, you will need to re-authorize the application to receive a fresh refresh token. You can revoke your app's access to your account [here](https://myaccount.google.com/permissions).
236+
This tokens event only occurs in the first authorization, and you need to have set your `access_type` to `offline` when calling the `generateAuthUrl` method to receive the refresh token. If you have already given your app the requisite permissions without setting the appropriate constraints for receiving a refresh token, you will need to re-authorize the application to receive a fresh refresh token. You can revoke your app's access to your account [here](https://myaccount.google.com/permissions).
235237

236238
To set the `refresh_token` at a later time, you can use the `setCredentials` method:
237239

@@ -256,7 +258,7 @@ As a developer, you should write your code to handle the case where a refresh to
256258
### Using API keys
257259
You may need to send an API key with the request you are going to make. The following uses an API key to make a request to the Blogger API service to retrieve a blog's name, url, and its total amount of posts:
258260

259-
``` js
261+
```js
260262
const {google} = require('googleapis');
261263
const blogger = google.blogger_v3({
262264
version: 'v3',
@@ -315,7 +317,7 @@ main().catch(console.error);
315317

316318
### Service account credentials
317319

318-
Service accounts allow you to perform server to server, app-level authentication using a robot account. You will create a service account, download a keyfile, and use that to authenticate to Google APIs. To create a service account:
320+
Service accounts allow you to perform server-to-server, app-level authentication using a robot account. You will create a service account, download a keyfile, and use that to authenticate to Google APIs. To create a service account:
319321
- Go to the [Create Service Account Key page](https://console.cloud.google.com/apis/credentials/serviceaccountkey)
320322
- Select `New Service Account` in the drop down
321323
- Click the `Create` button
@@ -325,7 +327,7 @@ Save the service account credential file somewhere safe, and *do not check this
325327
#### Using the `GOOGLE_APPLICATION_CREDENTIALS` env var
326328
You can start process with an environment variable named `GOOGLE_APPLICATION_CREDENTIALS`. The value of this env var should be the full path to the service account credential file:
327329

328-
```
330+
```sh
329331
$ GOOGLE_APPLICATION_CREDENTIALS=./your-secret-key.json node server.js
330332
```
331333

@@ -346,7 +348,7 @@ const auth = new google.auth.GoogleAuth({
346348

347349
You can set the `auth` as a global or service-level option so you don't need to specify it every request. For example, you can set `auth` as a global option:
348350

349-
``` js
351+
```js
350352
const {google} = require('googleapis');
351353

352354
const oauth2Client = new google.auth.OAuth2(
@@ -363,7 +365,7 @@ google.options({
363365

364366
Instead of setting the option globally, you can also set the authentication client at the service-level:
365367

366-
``` js
368+
```js
367369
const {google} = require('googleapis');
368370
const oauth2Client = new google.auth.OAuth2(
369371
YOUR_CLIENT_ID,
@@ -401,7 +403,7 @@ This client supports multipart media uploads. The resource parameters are specif
401403

402404
This example uploads a plain text file to Google Drive with the title "Test" and contents "Hello World".
403405

404-
``` js
406+
```js
405407
const drive = google.drive({
406408
version: 'v3',
407409
auth: oauth2Client

generator.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Using the Generator
2-
The clients in this repository are all automatically generated. They are generated using the [Google Discovery Service](https://developers.google.com/discovery). Most users of this library will not need to directly use the generator. This documentation is intended for users that need to maintain the repository, or build custom clients.
2+
The clients in this repository are all automatically generated. They are generated using the [Google Discovery Service](https://developers.google.com/discovery). Most users of this library will not need to directly use the generator. This documentation is intended for users that need to maintain the repository, or build custom clients.
33

44
## Running the generator locally
55
To run the generator locally:
@@ -10,43 +10,46 @@ To run the generator locally:
1010
This command will download all discovery files available via the [discovery index](https://www.googleapis.com/discovery/v1/apis/), and run the code generator against those files.
1111

1212
### Generatoring from the cache
13-
There are some situations where you don't want to re-download the discovery files before running the generator. This is particularly useful in situations where you're working on the generator itself, and want to isolate the change. To prevent the generator from re-downloading the discovery files, run:
13+
There are some situations where you don't want to re-download the discovery files before running the generator. This is particularly useful in situations where you're working on the generator itself, and want to isolate the change. To prevent the generator from re-downloading the discovery files, run:
14+
1415
```sh
1516
npm run generate -- --use-cache
1617
```
1718

1819
### Downloading discovery files
19-
As part of the `npm run generate` command, discovery docs are downloaded. To only download discovery file updates, and not re-run the generator, run:
20+
As part of the `npm run generate` command, discovery docs are downloaded. To only download discovery file updates, and not re-run the generator, run:
21+
2022
```sh
2123
npm run download
2224
```
2325

2426
## Submitting generator PRs
25-
This repository uses [synthtool](https://github.com/googleapis/synthtool/) to re-generate the API on a nightly basis. The command `npm run submit-prs` will perform a variety of steps:
27+
This repository uses [synthtool](https://github.com/googleapis/synthtool/) to re-generate the API on a nightly basis. The command `npm run submit-prs` will perform a variety of steps:
2628
1. Download all discovery files (`npm run download`)
2729
2. Run the generator (`npm run generate`)
2830
3. Iterate over each directory in `src/apis`, and create a commit with only those changes
2931
4. Submit a single PR with multiple commits, including a changelog
3032

3133
## Generating individual APIs
3234
You can generate a single API based on a discovery URL. Replace the url and API name below to match the API you'd like to generate:
33-
```
35+
36+
```sh
3437
npm run build-tools
3538
node build/src/generator/generator.js 'https://apigee.googleapis.com/$discovery/rest?version=v1' \
3639
--include-private false \
3740
--use-cache false
3841
```
3942

4043
Assuming that command completes successfully, you can access the output and test it out by navigating to the API subdirectory:
41-
```
44+
45+
```sh
4246
cd src/apis/apigee
4347
npm install
4448
```
4549

46-
47-
4850
If you want to distribute this package, which is common for APIs not listed in the discovery index, you can pack it to generate a tarball:
49-
```
51+
52+
```sh
5053
npm pack
5154
```
5255

samples/analytics/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ The Google Analytics API lets you collect, configure, and analyze your data to r
66

77
## Running the sample
88

9-
`node analytics.js`
9+
```sh
10+
node analytics.js
11+
```

samples/blogger/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ The Blogger API v3 allows client applications to view and update Blogger content
66

77
## Running the sample
88

9-
`node blogger.js`
9+
```sh
10+
node blogger.js
11+
```

samples/compute/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ The Google Compute Engine Metadata service lets you get and set key/value pairs
66

77
## Running the sample
88

9-
`node listVMs.js`
9+
```sh
10+
node listVMs.js
11+
```

samples/customsearch/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ Google Custom Search enables you to create a search engine for your website, you
66

77
## Running the sample
88

9-
`node customsearch.js`
9+
```sh
10+
node customsearch.js
11+
```

samples/defaultauth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const {google} = require('googleapis');
1717
const compute = google.compute('v1');
1818

1919
/**
20-
* The google.auth.getClient method creates the appropriate type of credential client for you,
20+
* The `google.auth.getClient` method creates the appropriate type of credential client for you,
2121
* depending upon whether the client is running in Google App Engine, Google Compute Engine, a
2222
* Managed VM, or on a local developer machine. This allows you to write one set of auth code that
2323
* will work in all cases. It most situations, it is advisable to use the getClient method rather
@@ -27,7 +27,7 @@ const compute = google.compute('v1');
2727
* file to your machine, and to set a local environment variable pointing to the location of the
2828
* file. Create a service account using the Google Developers Console using the section APIs & Auth.
2929
* Select "Generate new JSON key" and download the resulting file. Once this is done, set the
30-
* GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the location of the .json file.
30+
* `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to the location of the .json file.
3131
*
3232
* See also:
3333
* https://developers.google.com/accounts/docs/application-default-credentials

samples/drive/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,36 @@ You'll need to do the following before you can run this sample:
3434
* Enable the [Google Drive API](https://console.developers.google.com/apis/api/drive.googleapis.com/overview).
3535
* Set the redirect API in the Google Cloud Console application registration to `http://localhost:3000/oauth2callback`.
3636

37-
```
37+
```sh
3838
node quickstart.js
3939
```
4040

4141
__Run the `download.js` sample:__
4242

4343
Run the `quickstart.js` sample to get a list of files in your Google Drive.
4444

45-
```
45+
```sh
4646
node download.js <fileId>
4747
```
4848

4949
where `<fileId>` is the id of any file in Google Drive.
5050

5151
Example:
5252

53-
```
53+
```sh
5454
node download.js 0B_Klegupc5gUcXhFZjZVUV9NeE0
5555
```
5656

5757
__Run the `export.js` sample:__
5858

59-
```
59+
```sh
6060
node export.js <fileId>=
6161
```
6262

6363
where `<fileId>` is the id of a _Google Doc_ in Google Drive.
6464

6565
Example:
6666

67-
```
67+
```sh
6868
node export.js 0B_Klegupc5gUcXhFZjZVUV9NeE0 ./file.pdf
6969
```

samples/gmail/watch.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ const gmail = google.gmail('v1');
2121

2222
/**
2323
* NOTE: Before using this API, you need to do a few things.
24-
* 1. Create a new Pub/Sub topic. You can use the command:
25-
* gcloud pubsub topics create gmail
24+
* 1. Create a new Pub/Sub topic. You can use the command:
25+
* ```sh
26+
* $ gcloud pubsub topics create gmail
27+
* ```
2628
* 2. Go to the Cloud Developer Console, and give the gmail
27-
* service account [email protected]
29+
* service account `[email protected]`
2830
* Pub/Sub Publisher rights to your newly created topic.
2931
* https://console.cloud.google.com/cloudpubsub/topicList?project=${PROJECT_NAME}
3032
*/

samples/jwt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const path = require('path');
2323
* Suggested reading for Admin SDK users using service accounts:
2424
* https://developers.google.com/admin-sdk/directory/v1/guides/delegation
2525
*
26-
* See the defaultauth.js sample for an alternate way of fetching compute credentials.
26+
* See the `defaultauth.js` sample for an alternate way of fetching compute credentials.
2727
*/
2828
async function runSample() {
2929
// Create a new JWT client using the key file downloaded from the Google Developer Console

0 commit comments

Comments
 (0)