bdledger-apis/grpc
2021-01-19 20:46:21 +08:00
..
pb docs: update query APIs' docs 2021-01-19 20:46:21 +08:00
scripts docs: add OpenAPI docs 2020-12-05 11:11:36 +08:00
package-lock.json feat(grpc): add npm package, update Node.js & TypeScript gRPC code and gen scripts 2020-11-17 00:43:10 +08:00
package.json feat(grpc): add npm package, update Node.js & TypeScript gRPC code and gen scripts 2020-11-17 00:43:10 +08:00
README.md docs: update protoc-gen-go 2020-12-07 16:40:34 +08:00

BDLedger API

Documentation

See API documentation

Development

Generating gRPC code in languages

Installling tools

Download the Protocol Buffers compiler (protoc-3.13.0-*) for your platform and add protoc to PATH environment variable

For generating Go code, install protoc-gen-go (v1.4.3):

GIT_TAG="v1.4.3"
go get -d -u google.golang.org/protobuf/cmd/protoc-gen-go
git -C "$(go env GOPATH)"/src/google.golang.org/protobuf checkout $GIT_TAG
go install google.golang.org/protobuf/cmd/protoc-gen-go

Also install protoc-gen-go-grpc:

go get -u google.golang.org/protobuf/cmd/protoc-gen-go

Or install using gobin:

gobin google.golang.org/protobuf/cmd/protoc-gen-go
gobin google.golang.org/grpc/cmd/protoc-gen-go-grpc

For generating HTTP JSON APIs with grpc-gateway, follow the documentation.

For generating Java code: From bdledger-sdk-java run gradle generateProto

For generating Node.js code (and TypeScript definitions), install Node.js then run:

npm install

For frontend JavaScript:

git clone https://github.com/grpc/grpc-web
cd grpc-web
sudo make install-plugin

References:

TODO: Look into protobuf.js for Nodes.js and frontend TODO: Look into Kroto+ for Kotlin

Generating code

Run:

./scripts/gen [-a, --async] [go] [gohttp] [nodejs] [ts] [docs]

Use -a or --async to speed up generation by asynchronously and concurrently generating all code and documentation (script will exit without waiting for completion)

Generateing documentation

Install Go then run:

go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
./scripts/gen [-a, --async] docs