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: standardize the readme #171

Merged
merged 4 commits into from
Apr 3, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .cloud-repo-tools.json

This file was deleted.

4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
.coverage
.nyc_output
docs/
out/
system-test/secrets.js
system-test/*key.json
*.lock
*-lock.js*
google/
package-lock.json
build/
.vscode/
__pycache__
37 changes: 37 additions & 0 deletions .readme-partials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

body: |-
## Using the API

```js
const protoFiles = require('google-proto-files')
```

### Get a directory path by executing as a function
```js
protoFiles('logging', 'v2')
// node_modules/google-proto-files/google/logging/v2
```

### Get a path to the entry proto file for a specific API version
```js
protoFiles.pubsub.v1
// node_modules/google-proto-files/google/pubsub/v1/pubsub.proto
```

### load|loadSync(fileName, [options])

#### [options](https://github.com/dcodeIO/protobuf.js/blob/master/src/parse.js#L42-L44)

#### Load a proto which depends on google common protos.
##### Asynchronously
```js
protoFiles.load('path/to/file.proto').then(function(root) {
const MyService = root.lookup('example.MyService')
})
```

##### Synchronously
```js
const root = protoFiles.loadSync('path/to/file.proto');
const MyService = root.lookup('example.MyService');
```
9 changes: 9 additions & 0 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "nodejs-proto-files",
"name_pretty": "Google APIs Proto Files",
"release_level": "ga",
"language": "nodejs",
"repo": "googleapis/nodejs-proto-files",
"distribution_name": "google-proto-files",
"requires_billing": false
}
64 changes: 49 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
[//]: # "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"/>

# [googleapis Proto Files: Node.js Client](https://github.com/googleapis/nodejs-proto-files)
# [Google APIs Proto Files: Node.js Client](https://github.com/googleapis/nodejs-proto-files)

[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/google-proto-files.svg)](https://www.npmjs.org/package/google-proto-files)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-proto-files/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-proto-files)

> Get a copy of the [googleapis](https://github.com/googleapis/googleapis) proto files into your project.



All of the Google API's protocol buffer files




* [github.com/googleapis/nodejs-proto-files](https://github.com/googleapis/nodejs-proto-files)

Expand All @@ -17,16 +25,26 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

**Table of contents:**

* [Usage](#usage)

* [Quickstart](#quickstart)

* [Installing the client library](#installing-the-client-library)


* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)

## Usage
## Quickstart

### Installing the client library

```sh
$ npm install --save google-proto-files
```bash
npm install google-proto-files
```

## Using the API

```js
const protoFiles = require('google-proto-files')
```
Expand All @@ -43,31 +61,40 @@ protoFiles.pubsub.v1
// node_modules/google-proto-files/google/pubsub/v1/pubsub.proto
```

## load|loadSync(fileName, [options])
### load|loadSync(fileName, [options])

### [options](https://github.com/dcodeIO/protobuf.js/blob/master/src/parse.js#L42-L44)
#### [options](https://github.com/dcodeIO/protobuf.js/blob/master/src/parse.js#L42-L44)

### Load a proto which depends on google common protos.
#### Asynchronously
#### Load a proto which depends on google common protos.
##### Asynchronously
```js
protoFiles.load('path/to/file.proto').then(function(root) {
const MyService = root.lookup('example.MyService')
})
```

#### Synchronously
##### Synchronously
```js
const root = protoFiles.loadSync('path/to/file.proto');
const MyService = root.lookup('example.MyService');
```



## Versioning

This library follows [Semantic Versioning](http://semver.org/).

This library is considered to be in **alpha**. This means it is still a
work-in-progress and under active development. Any release is subject to
backwards-incompatible changes at any time.

This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.





More Information: [Google Cloud Platform Launch Stages][launch_stages]

Expand All @@ -83,3 +110,10 @@ Apache Version 2.0

See [LICENSE](https://github.com/googleapis/nodejs-proto-files/blob/master/LICENSE)



[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing

[auth]: https://cloud.google.com/docs/authentication/getting-started
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"grpc"
],
"scripts": {
"generate-scaffolding": "repo-tools generate all",
"prepare": "npm run compile && node ./build/tools/prepublish.js",
"lint": "gts check && eslint '**/*.js'",
"mocha": "nyc mocha build/test",
Expand All @@ -45,8 +44,6 @@
},
"devDependencies": {
"@compodoc/compodoc": "^1.1.7",
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"@types/async": "^2.0.50",
"@types/got": "^9.2.0",
"@types/mocha": "^5.2.5",
"@types/proxyquire": "^1.3.28",
Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"updateTime": "2019-03-08T00:45:43.786899Z",
"updateTime": "2019-04-02T22:49:43.062761Z",
"sources": [
{
"template": {
"name": "node_library",
"origin": "synthtool.gcp",
"version": "2019.1.16"
"version": "2019.2.26"
}
}
]
Expand Down