0.0.4 • Published 4 years ago

@stackb/bzl-sdk-node v0.0.4

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

bzl-sdk-node

NPM version

This repository contains the generated protobuf/grpc-js definitions for the Bzl gRPC API as well as a more developer-friendly index.js entrypoint.

Canonical API definitions are at https://github.com/stackb/apis/tree/master/build/stack/bzl/v1beta

Usage

npm install @stackb/bzl-sdk-node

Given a running process (e.g. bzl serve), connect to the server and retrieve metadata:

const grpc = require('@grpc/grpc-js');
const v1beta1 = require('@stackb/bzl-sdk-node').v1beta;

const client = new v1beta1.ApplicationClient(
        'localhost:1080', 
        grpc.credentials.createInsecure());

client.waitForReady(4000, () => printMetadata);

function printMetadata() {
    const request = new v1beta1.GetApplicationMetadataRequest();
    client.getApplicationMetadata(request, (err, metadata) => {
        if (err) {
            console.warn('could not get metadata', err);
        } else {
            console.log(`Connected to Bzl ${metadata.getVersion()}`);
        }
    });
}
0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago