npm install @chirpstack/chirpstack-api --save
Or with yarn:
yarn add @chirpstack/chirpstack-api
All messages, services, constants, etc. are auto-generated from the ChirpStack protobuf definitions. The result is that this package structure matches that of the protobuf definitions. There is no ES6 index gathering all of the exports, so full import/require paths should be used. The generated code is all callback based, but can be promisified.
The protobuf definitions can be found here: https://github.com/brocaar/chirpstack-api/tree/master/protobuf
The generated code all depends on the
grpc package, and for most use cases you will probably need to make use of the
grpc package directly as well. This is seen in the example below.
This example shows how to log in to ChirpStack via the gRPC API and then create a gRPC metadata object containing the JWT. This metadata could then be passed to any future requests that require authorization.
;;;// Create the client for the 'internal' serviceconst internalServiceClient ='localhost:8080'grpccredentials;// Create and build the login request messageconst loginRequest = ;loginRequest;loginRequest;// Send the login requestinternalServiceClient;