2018-04-14 14:09:06 +02:00
|
|
|
public class Tootle.Account{
|
|
|
|
|
2018-04-14 19:18:42 +02:00
|
|
|
public int64 id;
|
2018-04-14 14:09:06 +02:00
|
|
|
public string username;
|
2018-04-14 19:18:42 +02:00
|
|
|
public string acct;
|
2018-04-14 14:09:06 +02:00
|
|
|
public string display_name;
|
|
|
|
public string note;
|
2018-04-25 16:30:44 +02:00
|
|
|
public string header;
|
2018-04-14 19:18:42 +02:00
|
|
|
public string avatar;
|
2018-04-17 14:01:55 +02:00
|
|
|
public string url;
|
2018-04-25 16:30:44 +02:00
|
|
|
public int64 followers_count;
|
|
|
|
public int64 following_count;
|
|
|
|
public int64 statuses_count;
|
2018-04-14 14:09:06 +02:00
|
|
|
|
2018-04-14 19:18:42 +02:00
|
|
|
public Account(int64 id){
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Account parse(Json.Object obj) {
|
|
|
|
var id = int64.parse (obj.get_string_member ("id"));
|
|
|
|
var account = new Account (id);
|
2018-04-14 14:09:06 +02:00
|
|
|
|
2018-04-14 19:18:42 +02:00
|
|
|
account.username = obj.get_string_member ("username");
|
|
|
|
account.acct = obj.get_string_member ("acct");
|
|
|
|
account.display_name = obj.get_string_member ("display_name");
|
2018-04-21 11:21:03 +02:00
|
|
|
if (account.display_name == "")
|
|
|
|
account.display_name = account.username;
|
2018-04-14 19:18:42 +02:00
|
|
|
account.note = obj.get_string_member ("note");
|
|
|
|
account.avatar = obj.get_string_member ("avatar");
|
2018-04-25 16:30:44 +02:00
|
|
|
account.header = obj.get_string_member ("header");
|
2018-04-28 19:16:23 +02:00
|
|
|
if ("missing.png" in account.header)
|
|
|
|
account.header = "https://files.mastodon.social/accounts/headers/000/320/555/original/cebce998b571acf2.jpeg";
|
2018-04-17 14:01:55 +02:00
|
|
|
account.url = obj.get_string_member ("url");
|
2018-04-25 16:30:44 +02:00
|
|
|
|
|
|
|
account.followers_count = obj.get_int_member ("followers_count");
|
|
|
|
account.following_count = obj.get_int_member ("following_count");
|
|
|
|
account.statuses_count = obj.get_int_member ("statuses_count");
|
2018-04-14 19:18:42 +02:00
|
|
|
|
|
|
|
return account;
|
2018-04-14 14:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|