Created
July 27, 2016 23:56
-
-
Save nikhiljha/bc6ba499b202b425f9410dfc5a6470d2 to your computer and use it in GitHub Desktop.
NIS API for Android - Retrofit2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOT DONE YET! | |
// THIS IS FIRST REVISION, PLEASE CONTACT ME IF YOU DID WORK ON THIS SO I CAN MERGE CHANGES! | |
import java.util.List; | |
import retrofit2.Call; | |
import retrofit2.http.GET; | |
/** | |
* Created by Nikhil Jha on 7/27/2016. | |
* License: MIT | |
*/ | |
public class NIS { | |
public class Heartbeat { | |
int code; | |
int type; | |
String message; | |
public Heartbeat(int code, int type, String message) { | |
this.code = code; | |
this.type = type; | |
this.message = message; | |
} | |
} | |
public class GeneratedAccount { | |
String privateKey; | |
String address; | |
String publicKey; | |
public GeneratedAccount(String privateKey, String address, String publicKey) { | |
this.privateKey = privateKey; | |
this.address = address; | |
this.publicKey = publicKey; | |
} | |
} | |
public class Address { | |
String address; | |
public Address(String address) { | |
this.address = address; | |
} | |
} | |
public class AccountMetaDataPair { | |
public class Account { | |
public String address; | |
public long balance; | |
public long vestedBalance; | |
public double importance; | |
public String publicKey; | |
public String label; | |
public int harvestedBlocks; | |
public Account(String address, long balance, long vestedBalance, double importance, String publicKey, String label, int harvestedBlocks) { | |
this.address = address; | |
this.balance = balance; | |
this.vestedBalance = vestedBalance; | |
this.importance = importance; | |
this.publicKey = publicKey; | |
this.label = label; | |
this.harvestedBlocks = harvestedBlocks; | |
} | |
} | |
public class Meta { | |
public List<String> cosignatoryOf; | |
public List<String> cosignatories; | |
public String status; | |
public String remoteStatus; | |
public Meta(List<String> cosignatoryOf, List<String> cosignatories, String status, String remoteStatus) { | |
this.cosignatoryOf = cosignatoryOf; | |
this.cosignatories = cosignatories; | |
this.status = status; | |
this.remoteStatus = remoteStatus; | |
} | |
} | |
public class RootObject { | |
public Account account; | |
public Meta meta; | |
public RootObject(Account account, Meta meta){ | |
this.account = account; | |
this.meta = meta; | |
} | |
} | |
} | |
public interface API { | |
@GET("/heartbeat") | |
Call<Heartbeat> HEARTBEAT_CALL(); | |
@GET("/status") | |
Call<Heartbeat> STATUS_CALL(); | |
@GET("/account/generate") | |
Call<GeneratedAccount> GENERATE_ACCOUNT_CALL(); | |
@GET("/account/get") | |
Call<AccountMetaDataPair.RootObject> GET_ACCOUNT_CALL(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment