Android client for hook.
#How to Use
In your application build.gradle
file, add the following lines:
dependencies {
// ...
compile 'com.doubleleft.hook:hook-android-client:0.2.3'
}
Context context = this;
String appId = "1";
String appKey = "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d";
String endpoint = "http://localhost:4665/";
Client client = new Client(context, endpoint, appKey, appId);
JSONObject data = new JSONObject();
data.put("name", "My Book Name");
data.put("edition", 1.0);
client.collection("books").create(data, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Log.d("success: ", response.toString());
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
Log.d("failure: ", errorResponse.toString());
}
});
client.collection("books").where("edition", 1).get(new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Log.d("success: ", response.toString());
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
Log.d("failure: ", errorResponse.toString());
}
});
sort
where
limit
offset
increment
decrement
avg
max
min
sum
JSONObject data = new JSONObject();
data.put("email", "[email protected]");
data.put("name", "Gabriel Laet");
data.put("password", "123");
client.auth.register(data, new JsonHttpResponseHandler() {...});
Once the user is created, you don't need to verify/login again. The library also takes care to store the current user internally.
JSONObject data = new JSONObject();
data.put("email", "[email protected]");
data.put("password", "123");
client.auth.login(data, new JsonHttpResponseHandler() {...});
forgotPassword
resetPassword
logout
getAuthToken
hasAuthToken
Creating a new release version
cd Hook
gradle generateRelease
Log-in on
bintray,
create a new version. Click on "Upload Files", from the recently version
created, and attach the .zip
file genereated via gradle generateRelease
task. Make sure to select "Explode this archive" from the "Attached Files" list.
MIT