A Java SDK for Helium Blockchain APIs.
Easily integrate to Helium Blockhain API in your java applications for Android
, Backend
, Console
...
The SDK is based on Java 1.8
and uses the following dependencies:
- OkHttp3
- Gson
You can add helium-java-sdk
to your project by using popular build systems like Gradle or Maven.
Add JitPack repository in your root build.gradle file.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency in your module level build.gradle file.
dependencies {
implementation 'com.github.AppcentMobile:helium-java-sdk:1.0.0-SNAPSHOT'
}
Add JitPack repository to your build file.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add the dependency.
<dependency>
<groupId>com.github.AppcentMobile</groupId>
<artifactId>helium-java-sdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Create an instance by calling the constructor of HeliumApi
.
HeliumApi heliumApi = new HeliumApi();
If you need more configuration, use HeliumApi(OkHttpClient client)
.
Access the Blockchain APIs like hotspots
, accounts
and rewards
through corresponding methods of the HeliumApi
instance. The SDK uses builder pattern to create requests. And it is possible to get the response through the synchronous execute()
call.
HotspotResponse resp = heliumApi.hotspots().searchHotspotsByLocationBox()
.nelat(0)
.nelon(0)
.swlat(4f)
.swlon(5f)
.execute();
Some of the APIs return results in pages. In order to fetch multiple pages you should transfer previous response's cursor
property to the next request. Currently, this is responsibility of the SDK user.
HeliumApi heliumApi = new HeliumApi();
HotspotsResponse firstPage = heliumApi.hotspots().getHotspots().execute();
HotspotsResponse secondPage = heliumApi.hotspots().getHotspots().cursor(firstPage.cursor).execute();
System.out.println(secondPage.data);
We value all kind of contributions and try to be as welcoming as possible. Please see CONTRIBUTING.md.
Maven is used as the build tool. Currently build process is quite simple so not sharing much details here.
We use GitFlow Workflow and Semantic Versioning.
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.