internal static FB_ApprovalModeSet _parse(Session session, JToken data) { (FB_User author, FB_Thread thread, long at) = FB_ApprovalModeSet._parse_metadata(session, data); var approval_mode = long.Parse(data?.get("untypedData")?.get("APPROVAL_MODE")?.Value <string>()) != 0; return(new FB_ApprovalModeSet() { author = author, thread = thread, require_admin_approval = approval_mode, at = at }); }
public static FB_Event parse_delta(Session session, JToken data) { var type_ = data?.get("type")?.Value <string>(); if (type_ == "change_thread_theme") { return(FB_ColorSet._parse(session, data)); } else if (type_ == "change_thread_icon") { return(FB_EmojiSet._parse(session, data)); } else if (type_ == "change_thread_nickname") { return(FB_NicknameSet._parse(session, data)); } else if (type_ == "change_thread_admins") { var event_type = data?.get("untypedData")?.get("ADMIN_EVENT")?.Value <string>(); if (event_type == "add_admin") { return(FB_AdminsAdded._parse(session, data)); } else if (event_type == "remove_admin") { return(FB_AdminsRemoved._parse(session, data)); } } else if (type_ == "change_thread_approval_mode") { return(FB_ApprovalModeSet._parse(session, data)); } else if (type_ == "instant_game_update") { // TODO: This } else if (type_ == "messenger_call_log") // Previously "rtc_call_log" { var event_type = data?.get("untypedData")?.get("event")?.Value <string>(); if (event_type == "group_call_started") { return(FB_CallStarted._parse(session, data)); } else if (new string[] { "group_call_ended", "one_on_one_call_ended" }.Contains(event_type)) { return(FB_CallEnded._parse(session, data)); } } else if (type_ == "participant_joined_group_call") { return(FB_CallJoined._parse(session, data)); } else if (type_ == "group_poll") { var event_type = data?.get("untypedData")?.get("event_type")?.Value <string>(); if (event_type == "question_creation") { return(FB_PollCreated._parse(session, data)); } else if (event_type == "update_vote") { return(FB_PollVoted._parse(session, data)); } } else if (type_ == "lightweight_event_create") { return(FB_PlanCreated._parse(session, data)); } else if (type_ == "lightweight_event_notify") { return(FB_PlanEnded._parse(session, data)); } else if (type_ == "lightweight_event_update") { return(FB_PlanEdited._parse(session, data)); } else if (type_ == "lightweight_event_delete") { return(FB_PlanDeleted._parse(session, data)); } else if (type_ == "lightweight_event_rsvp") { return(FB_PlanResponded._parse(session, data)); } return(new FB_UnknownEvent() { source = "Delta type", data = data }); }