chirpstack/api/java
Orne Brocaar 3f1a47e1e2 Integrate Gateway Mesh feature.
This adds a Gateway Mesh section to the web-interface (+ API endpoints)
to see the status op each Relay Gateway within the Gateway Mesh.

The Gateway Mesh (https://github.com/chirpstack/chirpstack-gateway-mesh)
is an experimental feature to extend LoRaWAN coverage throug Relay
Gateways.
2024-06-25 11:37:57 +01:00
..
gradle/wrapper Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
.gitignore api: Remove generated API files from repo + update build. 2024-04-01 14:27:15 +01:00
build.gradle.kts Integrate Gateway Mesh feature. 2024-06-25 11:37:57 +01:00
gradlew Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
gradlew.bat Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
Makefile Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
README.md Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
settings.gradle.kts Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00

chirpstack-api

ChirpStack gRPC API message and service wrappers for Java.

Install

An artifact is not yet public on Maven Central. You can build your own jar with

make jar

or install the artifact in your local Maven repository $HOME/.m2 with

make install

Usage

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.

The protobuf definitions can be found here: https://github.com/chirpstack/chirpstack/tree/master/api/proto

Example

Maven

<dependency>
  <groupId>io.chirpstack</groupId>
  <artifactId>chirpstack-api</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Gradle

dependencies {
    implementation("io.chirpstack:chirpstack-api:1.0-SNAPSHOT")
}

Example #1: List tenants

import io.chirpstack.api.*;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.Metadata;
import io.grpc.stub.MetadataUtils;

public class ChirpStack {
    public static void main(String[] args) {
        ManagedChannel channel = ManagedChannelBuilder
            .forAddress("localhost", 8080)
            .usePlaintext()
            .build();
        Metadata metadata = new Metadata();
        Metadata.Key<String> key = Metadata.Key.of("authorization", Metadata.ASCII_STRING_MARSHALLER);
        String token = "Bearer <INSERT_TOKEN_HERE>";
        metadata.put(key, token);
        TenantServiceGrpc.TenantServiceBlockingStub stub = TenantServiceGrpc
            .newBlockingStub(channel)
            .withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata));
        ListTenantsRequest request = ListTenantsRequest.newBuilder()
            .setLimit(10)
            .build();
        ListTenantsResponse response = stub.list(request);
        System.out.println("Number of tenants: " + response.getResultCount());
    }
}