mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
implement get_msg_reactions()
JSON-RPC API
This commit is contained in:
parent
30d4febee7
commit
de1f1d4fe2
3 changed files with 71 additions and 2 deletions
37
src/com/b44t/messenger/rpc/Reaction.java
Normal file
37
src/com/b44t/messenger/rpc/Reaction.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
package com.b44t.messenger.rpc;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class Reaction {
|
||||
// The reaction text string.
|
||||
private final String text;
|
||||
// The count of users that have reacted with this reaction.
|
||||
private final int count;
|
||||
|
||||
public Reaction(String text, int count) {
|
||||
this.text = text;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public static class ReactionDeserializer implements JsonDeserializer<Reaction> {
|
||||
@Override
|
||||
public Reaction deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonArray tuple = json.getAsJsonArray();
|
||||
return new Reaction(tuple.get(0).getAsString(), tuple.get(1).getAsInt());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue