1 | [//]: # "This README.md file is auto-generated, all changes to this file will be lost."
|
2 | [//]: # "To regenerate it, use `python -m synthtool`."
|
3 | <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"/>
|
4 |
|
5 | # [Google APIs Proto Files: Node.js Client](https://github.com/googleapis/nodejs-proto-files)
|
6 |
|
7 | [![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
|
8 | [![npm version](https://img.shields.io/npm/v/google-proto-files.svg)](https://www.npmjs.org/package/google-proto-files)
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | All of the Google API's protocol buffer files
|
14 |
|
15 |
|
16 | A comprehensive list of changes in each version may be found in
|
17 | [the CHANGELOG](https://github.com/googleapis/nodejs-proto-files/blob/main/CHANGELOG.md).
|
18 |
|
19 | * [Google APIs Proto Files Node.js Client API Reference][client-docs]
|
20 |
|
21 | * [github.com/googleapis/nodejs-proto-files](https://github.com/googleapis/nodejs-proto-files)
|
22 |
|
23 | Read more about the client libraries for Cloud APIs, including the older
|
24 | Google APIs Client Libraries, in [Client Libraries Explained][explained].
|
25 |
|
26 | [explained]: https://cloud.google.com/apis/docs/client-libraries-explained
|
27 |
|
28 | **Table of contents:**
|
29 |
|
30 |
|
31 | * [Quickstart](#quickstart)
|
32 |
|
33 | * [Installing the client library](#installing-the-client-library)
|
34 | * [Using the client library](#using-the-client-library)
|
35 | * [Samples](#samples)
|
36 | * [Versioning](#versioning)
|
37 | * [Contributing](#contributing)
|
38 | * [License](#license)
|
39 |
|
40 | ## Quickstart
|
41 |
|
42 | ### Installing the client library
|
43 |
|
44 | ```bash
|
45 | npm install google-proto-files
|
46 | ```
|
47 |
|
48 |
|
49 | ### Using the client library
|
50 |
|
51 | ```javascript
|
52 | const protos = require('google-proto-files');
|
53 |
|
54 | async function quickstart() {
|
55 | // Get a directory path by executing as a function
|
56 | const files = protos.getProtoPath('logging', 'v2');
|
57 | console.log(files);
|
58 | // node_modules/google-proto-files/google/logging/v2
|
59 |
|
60 | // Get a path to the entry proto file for a specific API version
|
61 | console.log(protos.pubsub.v1);
|
62 | // node_modules/google-proto-files/google/pubsub/v1/pubsub.proto
|
63 |
|
64 | // Load a proto which depends on google common protos.
|
65 | const root1 = await protos.load('./cloudcats.proto');
|
66 | const service1 = root1.lookup('example.MyService');
|
67 | console.log(service1);
|
68 |
|
69 | // Load protos synchronously
|
70 | const root2 = protos.loadSync('./cloudcats.proto');
|
71 | const service2 = root2.lookup('example.MyService');
|
72 | console.log(service2);
|
73 | }
|
74 | quickstart();
|
75 |
|
76 | ```
|
77 |
|
78 |
|
79 |
|
80 | ## Samples
|
81 |
|
82 | Samples are in the [`samples/`](https://github.com/googleapis/nodejs-proto-files/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample.
|
83 |
|
84 | | Sample | Source Code | Try it |
|
85 | | --------------------------- | --------------------------------- | ------ |
|
86 | | Quickstart | [source code](https://github.com/googleapis/nodejs-proto-files/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-proto-files&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
|
87 |
|
88 |
|
89 |
|
90 | The [Google APIs Proto Files Node.js Client API Reference][client-docs] documentation
|
91 | also contains samples.
|
92 |
|
93 | ## Supported Node.js Versions
|
94 |
|
95 | Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule).
|
96 | Libraries are compatible with all current _active_ and _maintenance_ versions of
|
97 | Node.js.
|
98 | If you are using an end-of-life version of Node.js, we recommend that you update
|
99 | as soon as possible to an actively supported LTS version.
|
100 |
|
101 | Google's client libraries support legacy versions of Node.js runtimes on a
|
102 | best-efforts basis with the following warnings:
|
103 |
|
104 | * Legacy versions are not tested in continuous integration.
|
105 | * Some security patches and features cannot be backported.
|
106 | * Dependencies cannot be kept up-to-date.
|
107 |
|
108 | Client libraries targeting some end-of-life versions of Node.js are available, and
|
109 | can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
|
110 | The dist-tags follow the naming convention `legacy-(version)`.
|
111 | For example, `npm install google-proto-files@legacy-8` installs client libraries
|
112 | for versions compatible with Node.js 8.
|
113 |
|
114 | ## Versioning
|
115 |
|
116 | This library follows [Semantic Versioning](http://semver.org/).
|
117 |
|
118 |
|
119 |
|
120 | This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways
|
121 | unless absolutely necessary (e.g. because of critical security issues) or with
|
122 | an extensive deprecation period. Issues and requests against **stable** libraries
|
123 | are addressed with the highest priority.
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | More Information: [Google Cloud Platform Launch Stages][launch_stages]
|
131 |
|
132 | [launch_stages]: https://cloud.google.com/terms/launch-stages
|
133 |
|
134 | ## Contributing
|
135 |
|
136 | Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-proto-files/blob/main/CONTRIBUTING.md).
|
137 |
|
138 | Please note that this `README.md`, the `samples/README.md`,
|
139 | and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
|
140 | are generated from a central template. To edit one of these files, make an edit
|
141 | to its templates in
|
142 | [directory](https://github.com/googleapis/synthtool).
|
143 |
|
144 | ## License
|
145 |
|
146 | Apache Version 2.0
|
147 |
|
148 | See [LICENSE](https://github.com/googleapis/nodejs-proto-files/blob/main/LICENSE)
|
149 |
|
150 | [client-docs]: https://cloud.google.com/nodejs/docs/reference/google-proto-files/latest
|
151 |
|
152 | [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
|
153 | [projects]: https://console.cloud.google.com/project
|
154 | [billing]: https://support.google.com/cloud/answer/6293499#enable-billing
|
155 |
|
156 | [auth]: https://cloud.google.com/docs/authentication/getting-started
|