Client Libraries

Getting client libraries up and running.

The API is organized around gRPC.

It is preferred to use the SDK generated below:

↗️

gRPC SDK repository

You can also generate the SDK yourself below in a variety of languages:

GOSUMDB=off \
  GO111MODULE=on \
     go get -u \
        github.com/knox-networks/grpc-sdks/...@main
// NPM
npm install \
    google-protobuf \
    @improbable-eng/grpc-web \
    @types/google-protobuf \
    git+https://github.com/knox-networks/grpc-sdks#main
    
// Yarn
yarn add \
    google-protobuf \
    @improbable-eng/grpc-web \
    @types/google-protobuf \
    https://github.com/knox-networks/grpc-sdks#main
// NPM
npm install \
    google-protobuf \
    @improbable-eng/grpc-web \
    git+https://github.com/knox-networks/grpc-sdks#main
    
// Yarn
yarn add \
     google-protobuf \
     @improbable-eng/grpc-web \
     https://github.com/knox-networks/grpc-sdks#main\
// Maven
mvn scm:checkout \
    -DconnectionUrl=scm:git:https://github.com/knox-networks/grpc-sdks \
    -DscmVersionType=main \
    -DcheckoutDirectory=sdk/grpc-sdks

// pom.xml
<dependency>
    <groupId>com.grpc-sdks</groupId>
    <artifactId>grpc-sdks</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/sdk/grpc-sdks/sdk/java/grpc-sdks.jar</systemPath>
</dependency>
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-netty</artifactId>
    <version>1.41.2</version>
</dependency>
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-protobuf</artifactId>
    <version>1.41.2</version>
</dependency>
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-stub</artifactId>
    <version>1.41.2</version>
</dependency>


// Gradle
// Download SDK with the command:
gradle downloadSDK
// Update SDK with the command:
gradle updateSDK

// build.gradle
plugins {
  id "org.ajoberstar.grgit" version "4.1.0"
  id "com.google.protobuf" version "0.8.17"
}
apply plugin: 'java'
repositories {
    mavenCentral()
}
dependencies {
    implementation "com.squareup.okhttp:okhttp:2.7.5"
    implementation "javax.annotation:javax.annotation-api:1.3.2"
    implementation "io.grpc:grpc-core:1.41.0"
    implementation "io.grpc:grpc-stub:1.41.0"
    implementation "io.grpc:grpc-okhttp:1.41.0"
    implementation "io.grpc:grpc-api:1.41.0"
    implementation "io.grpc:grpc-protobuf:1.41.0"
    implementation files("sdk/grpc-sdks/sdk/java/grpc-sdks.jar")
}
import org.ajoberstar.grgit.Grgit
task downloadSDK {
    doLast {
        def grgit = Grgit.clone(dir: System.getProperty("user.dir")+"/sdk/grpc-sdks",  refToCheckout: "main", uri: 'https://github.com/knox-networks/grpc-sdks')
        println grgit.describe()
    }
}
task updateSDK {
    doLast {
        def grgit = Grgit.open(dir: System.getProperty("user.dir")+"/sdk/grpc-sdks")
        grgit.pull()
   }
}

// NuGet
// In the project root (dir with yourproject.csproj file):
git clone \
    https://github.com/knox-networks/grpc-sdks \
    --branch main\
    ../grpcdocs

// YourProject.csproj
<Project>
....
  <ItemGroup>
    <ProjectReference Include="../grpcdocs/sdk/csharp/*.csproj"/>
  </ItemGroup>
....
</Project>
Python 3
$ pip3 install grpcio protobuf
$ git clone \
    https://github.com/knox-networks/grpc-sdks \
    --branch main  grpcdocs

# Then start with a code:
main.py

from grpcdocs.sdk.python3.<filepath> import <servicename>
Cargo
// Cargo.toml
[dependencies]
tonic = "0.8"
prost-types = "0.11"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
grpc-sdks = {  git = "https://github.com/knox-networks/grpc-sdks", branch = "main"}

// Gradle
// build.gradle

plugins {
  id "org.ajoberstar.grgit" version "4.1.0"
  id "com.google.protobuf" version "0.8.17"
}
apply plugin: 'java'
repositories {
    mavenCentral()
}
dependencies {
    implementation "com.squareup.okhttp:okhttp:2.7.5"
    implementation "javax.annotation:javax.annotation-api:1.3.2"
    implementation "io.grpc:grpc-core:1.41.0"
    implementation "io.grpc:grpc-stub:1.41.0"
    implementation "io.grpc:grpc-okhttp:1.41.0"
    implementation "io.grpc:grpc-api:1.41.0"
    implementation "io.grpc:grpc-protobuf:1.41.0"
    implementation files("sdk/grpc-sdks/sdk/java/grpc-sdks.jar")
}
import org.ajoberstar.grgit.Grgit
task downloadSDK {
    doLast {
        def grgit = Grgit.clone(dir: System.getProperty("user.dir")+"/app/sdk/grpc-sdks",  refToCheckout: "main", uri: 'https://github.com/knox-networks/grpc-sdks')
        println grgit.describe()
    }
}
task updateSDK {
    doLast {
        def grgit = Grgit.open(dir: System.getProperty("user.dir")+"/app/sdk/grpc-sdks")
        grgit.pull()
   }
}
application {
    // Define the main class for the application.
    mainClass = 'app.AppKt'
}


// Show full build.gradle
$ gradle downloadSDK
// Update SDK with the command:
$ gradle updateSDK

🚧

You must have downloaded the SDKs before you can begin interacting with the API!