tootle-linux-client/src/API/Relationship.vala

32 lines
1.1 KiB
Vala
Raw Normal View History

2018-10-27 10:29:25 +02:00
using GLib;
2019-03-11 15:14:37 +01:00
public class Tootle.API.Relationship : Object {
2018-04-30 19:56:02 +02:00
public int64 id;
public bool following;
public bool followed_by;
public bool blocking;
public bool muting;
public bool muting_notifications;
public bool requested;
public bool domain_blocking;
2018-10-27 10:29:25 +02:00
public Relationship (int64 _id) {
2018-10-23 12:05:24 +02:00
id = _id;
2018-04-30 19:56:02 +02:00
}
2019-03-11 15:14:37 +01:00
2018-10-27 10:29:25 +02:00
public static Relationship parse (Json.Object obj) {
2018-04-30 19:56:02 +02:00
var id = int64.parse (obj.get_string_member ("id"));
var relationship = new Relationship (id);
relationship.following = obj.get_boolean_member ("following");
relationship.followed_by = obj.get_boolean_member ("followed_by");
relationship.blocking = obj.get_boolean_member ("blocking");
relationship.muting = obj.get_boolean_member ("muting");
relationship.muting_notifications = obj.get_boolean_member ("muting_notifications");
relationship.requested = obj.get_boolean_member ("requested");
relationship.domain_blocking = obj.get_boolean_member ("domain_blocking");
return relationship;
}
}