Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: generate docs for dfareporting and add repo-metadata #1728

Merged
merged 4 commits into from Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,3 +11,4 @@ samples/*.keys.json
samples/**/credentials.json
package-lock.json
yarn.lock
__pycache__
8 changes: 8 additions & 0 deletions .repo-metadata.json
@@ -0,0 +1,8 @@
{
"name": "googleapis",
"name_pretty": "Google APIs Node.js Client",
"release_level": "beta",
"language": "nodejs",
"repo": "googleapis/google-api-nodejs-client",
"distribution_name": "googleapis"
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -81,6 +81,7 @@
"hard-rejection": "^2.1.0",
"intelli-espower-loader": "^1.0.1",
"js-green-licenses": "^1.0.0",
"linkinator": "^1.4.2",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"mocha": "^6.1.4",
Expand All @@ -96,7 +97,6 @@
"server-destroy": "^1.0.1",
"source-map-support": "^0.5.12",
"tmp": "^0.1.0",
"typescript": "~3.4.5",
"linkinator": "^1.4.2"
"typescript": "~3.4.5"
}
}
172 changes: 106 additions & 66 deletions samples/README.md
@@ -1,94 +1,134 @@
# Samples by API
The following samples show basic usage of various APIs. **All samples require Node.js 8.x or greater**.
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

Throughout these samples, you will find code that relies on various authentication methods.
- **OAuth2** - To use the OAuth2 samples, create a credential in the cloud developer console, and save the file as `oauth2.keys.json` in the samples directory.
- **Service account** - To use the service account based samples, create a new service account in the cloud developer console, and save the file as `jwt.keys.json` in the samples directory.
- **API Key** - To use simple API keys, create a new API Key in the cloud developer console, then store the key in the `api_key` field of `config.json`.
# [Google APIs Node.js Client: Node.js Samples](https://github.com/googleapis/google-api-nodejs-client)

[![Open in Cloud Shell][shell_img]][shell_link]

## ![](http://www.google.com/images/icons/product/analytics-32.png) Google Analytics API

View and manage your Google Analytics data.

<!--Documentation for the Google Analytics API in
[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_analytics_v3_.analytics.html).-->
## Table of Contents

* [Before you begin](#before-you-begin)
* [Samples](#samples)
* [Defaultauth](#defaultauth)
* [Jwt](#jwt)
* [Mediaupload](#mediaupload)
* [Multiple](#multiple)
* [Oauth2](#oauth2)
* [Sampleclient](#sampleclient)

<table>
<tr>
<td><a href="analytics">samples/analytics</a></td>
<td>Command-line samples for producing reports with the Analytics API</td>
</tr>
</table>
## Before you begin

## ![](http://www.google.com/images/icons/product/blogger-32.png) Blogger API
Before running the samples, make sure you've followed the steps outlined in
[Using the client library](https://github.com/googleapis/google-api-nodejs-client#using-the-client-library).

View and manage Blogger data.
## Samples

<!--Documentation for the Blogger API in
[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_blogger_v3_.blogger.html).-->

<table>
<tr>
<td><a href="blogger">samples/blogger</a></td>
<td>Command-line samples for reading data with the Blogger API</td>
</tr>
</table>

## ![](https://www.google.com/images/icons/product/compute_engine-32.png) Google Compute Engine Metadata API
### Defaultauth

Lets you set key/value pairs using the GCE metadata service.
View the [source code](https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/defaultauth.js).

<!--Documentation for the Google Compute Engine Metadata API in
[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_compute_v1_.compute.html).-->
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/defaultauth.js,samples/README.md)

<table>
<tr>
<td><a href="compute">samples/compute</a></td>
<td>Demonstrates how to use the Google Compute Engine Metadata API</td>
</tr>
</table>
__Usage:__

## ![](http://www.google.com/images/icons/product/customsearch-32.png) CustomSearch API

Lets you search over a website or collection of websites.
`node defaultauth.js`

<!--Documentation for the CustomSearch API in
[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_customsearch_v1_.customsearch.html).-->

<table>
<tr>
<td><a href="customsearch">samples/customsearch</a></td>
<td>Search from the command-line</td>
</tr>
</table>
-----


## ![](http://www.google.com/images/icons/product/search-32.png) Glass Mirror API

The Google Mirror API allows you to build web-based services that interact with Google Glass. It provides this functionality over a cloud-based API and does not require running code on Glass.

<!--Documentation for the Glass Mirror API in
[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_mirror_v1_.mirror.html).-->
### Jwt

<table>
<tr>
<td><a href="mirror">samples/mirror</a></td>
<td>Obtains a list of locations from glass data</td>
</tr>
</table>
View the [source code](https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/jwt.js).

## ![](http://www.google.com/images/icons/product/youtube-32.png) YouTube API
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/jwt.js,samples/README.md)

With the YouTube Data API, you can add a variety of YouTube features to your application. Use the API to upload videos, manage playlists and subscriptions, update channel settings, and more.
__Usage:__

<!--Documentation for the YouTube Data API in
[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_youtube_v3_.youtube.html).-->

<table>
<tr>
<td><a href="youtube">samples/youtube</a></td>
<td>Samples for working with playlists, search and videos.</td>
</tr>
</table>
`node jwt.js`


-----




### Mediaupload

View the [source code](https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/mediaupload.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/mediaupload.js,samples/README.md)

__Usage:__


`node mediaupload.js`


-----




### Multiple

View the [source code](https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/multiple.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/multiple.js,samples/README.md)

__Usage:__


`node multiple.js`


-----




### Oauth2

View the [source code](https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/oauth2.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/oauth2.js,samples/README.md)

__Usage:__


`node oauth2.js`


-----




### Sampleclient

View the [source code](https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/sampleclient.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/sampleclient.js,samples/README.md)

__Usage:__


`node sampleclient.js`






[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-api-nodejs-client&page=editor&open_in_editor=samples/README.md
[product-docs]:
14 changes: 8 additions & 6 deletions src/generator/docs.ts
Expand Up @@ -43,11 +43,7 @@ if (!fs.existsSync(docsPath)) {
async function main() {
const children = await readdir(apiPath);
const dirs = children.filter(x => {
return (
!x.endsWith('.ts') &&
!x.includes('dfareporting') &&
!x.includes('compute')
);
return !x.endsWith('.ts') && !x.includes('compute');
});
const contents = nunjucks.render(templatePath, {apis: dirs});
await writeFile(indexPath, contents);
Expand All @@ -57,7 +53,13 @@ async function main() {
const promises = dirs.map(dir => {
return q
.add(() =>
execa('npx', ['compodoc', `src/apis/${dir}`, '-d', `./docs/${dir}`])
execa(process.execPath, [
'--max-old-space-size=8192',
'./node_modules/.bin/compodoc',
`src/apis/${dir}`,
'-d',
`./docs/${dir}`,
])
)
.then(() => {
i++;
Expand Down