Skip to content
LBRY JSON-RPC bindings for Kotlin/Java.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE.md
README.md
pom.xml

README.md

LBRY JSON-RPC bindings for Kotlin/Java.

Prerequisits

Artifacts are published on maven:

    <dependency>
      <groupId>com.willwinder.lbry4j</groupId>
      <artifactId>lbry4j</artifactId>
      <version>1.0</version>
    </dependency>

Usage

The LbryApi object should be initialized once and cached by the client application. The Command object should be provided an Array or HashMap depending on the RPC method being invoked.

A Call may be executed synchronously with execute(), or asynchronously with enqueue(retrofit2.Callback). In either case the call can be canceled at any time with cancel(). A call that is busy writing its request or reading its response may receive a IOException.

A Response wraps the HTTP response, including the response code, body, and headers. Various convenience methods such as isSuccessful() exist.

Java API objects are accessed via the LBRY namespace:

    // Daemon API
    LbryApi api = LBRY.getDaemonApi();
    Call call = api.call(new Command("resolve", ImmutableMap.of("uri", "what")));
    Response response = call.execute();
    System.out.println(response.body());
 
    // lbrycrd server API
    LbryApi api = LBRY.getLbrycrdApi("<username>", "<password>");
    Call call = api.call(new Command("help"));
    Response response = call.execute();
    System.out.println(response.body());

Kotlin accesses api objects via top level methods.

    // Daemon API
    val api = getDaemonApi()
    val call = api.call(Command("resolve", mapOf("uri" to "what")))
    val response = call.execute()
    val data = response.body()
    println(data)

    // lbrycrd server API
    val api = getLbrycrdApi("<username>", "<password>")
    val call = api.call(Command("help"))
    val response = call.execute()
    val data = response.body()
    println(data)

Development

Leverages Retrofit2, Gson, Kotlin, and Maven.

Unit Tests

There are some unit tests, but they were mainly used to manually verify that the retrofit configuration wasn't completely broken.

Building

This project uses a standard Maven build process to package a jar library. Run mvn package to create the jar.

You can’t perform that action at this time.