@metrix-io/proto
v0.0.14
Published
Protobuf and gRPC-web definitions for metrix.io services
Downloads
21
Readme
metrix-io proto
This lib contains pre-generated grpc-web protobuf files.
This library is only a convenience; you can also generate these yourself by parsing the protofiles in this directory .
Example:
import { AccountServicePromiseClient } from '@metrix-io/proto/account-service-client';
import { CreateAccountRequest } from '@metrix-io/proto/account-service';
const accountService = new AccountServicePromiseClient('https://api.metrix.io', {}, {});
const req = new CreateAccountRequest();
req.setUsername('john');
req.setPassword('Password123');
req.setEmail('[email protected]');
accountService.createAccount(req, {}).then((res) => {
console.log('Response: ', res);
});
Maintenance and design notes
- Run the makefile from the root directory to generate javascript code and typescript definitions. Because typescript support is somewhat experimental only "commonjs+dts" works properly, the "typescript" method works only partially and should be avoided for now.
- All services are exported in the same module. Naming conflicts should be prevented regardless.
- After several attempts to create an npm run buildscript, it turns out it is extremely tricky to get protoc compile directories properly (see here for an example). The current setup is the easiest to manage I found to manage thus far.