public static User FromRPCModel(this THCreator creator, THPublicUser user = null) { if (creator.IsApp) { return(new User { Id = "app", AvatarUrl = GetSocialStateController.Info.IconUrl, DisplayName = GetSocialStateController.Info.Name, Identities = new Dictionary <string, string>(), Verified = true, PublicProperties = new Dictionary <string, string>() }); } if (user == null) { user = creator.PublicUser; } if (user == null) { return(null); } return(new User { PublicProperties = user.PublicProperties, Id = user.Id, Identities = IdentitiesToDictionary(user.Identities), Verified = creator.IsVerified, AvatarUrl = user.AvatarUrl, DisplayName = user.DisplayName }); }
private static Notification FromRPCModel(PNNotification notification, THPublicUser user) { if (user == null) { user = notification.Sender.PublicUser; } return(new Notification { Id = notification.Id, Customization = new NotificationCustomization { BackgroundImageConfiguration = notification.Media?.BackgroundImage, TextColor = notification.Media?.TextColor, TitleColor = notification.Media?.TitleColor }, ActionButtons = (notification.ActionButtons ?? new List <THActionButton>()).ConvertAll(it => it.FromRpcModel()), Attachment = null, // todo CreatedAt = notification.CreatedAt, Action = notification.Action?.FromRpcModel(), Sender = user.FromRPCModel(), Type = notification.Type, Status = notification.Status, Text = notification.Text, Title = notification.Title }); }
public static PublicUser ToPublicUser(this THPublicUser publicUser) { return(new PublicUser( publicProperties: publicUser.PublicProperties, id: publicUser.Id, displayName: publicUser.DisplayName, avatarUrl: publicUser.AvatarUrl, identities: IdentitiesToDictionary(publicUser.Identities) )); }
public static User FromRPCModel(this THPublicUser user) { return(new User { PublicProperties = user.PublicProperties, Id = user.Id, Identities = IdentitiesToDictionary(user.Identities), Verified = false, AvatarUrl = user.AvatarUrl, DisplayName = user.DisplayName }); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Map) { { Users = new Dictionary <string, THPublicUser>(); TMap _map59 = iprot.ReadMapBegin(); for (int _i60 = 0; _i60 < _map59.Count; ++_i60) { string _key61; THPublicUser _val62; _key61 = iprot.ReadString(); _val62 = new THPublicUser(); _val62.Read(iprot); Users[_key61] = _val62; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public static ReferredUser ToReferredUser(this THPublicUser publicUser) { return(new ReferredUser( publicProperties: publicUser.PublicProperties, id: publicUser.Id, displayName: publicUser.DisplayName, avatarUrl: publicUser.AvatarUrl, identities: IdentitiesToDictionary(publicUser.Identities), installationDate: DateUtils.FromUnixTime(long.Parse(publicUser.InstallDate)), installationChannel: publicUser.InstallProvider )); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { User = new THPublicUser(); User.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { Membership = new SGMembershipInfo(); Membership.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public static Activity FromRPCModel(this AFActivity activity, THPublicUser user = null, AFEntityReference source = null) { var content = activity.Content.FirstValue(new AFContent()); return(new Activity { Id = activity.Id, Type = activity.ContentType, Announcement = activity.IsAnnouncement, Button = content.Button.FromRPCModel(), Author = activity.Author.FromRPCModel(user), Properties = activity.Properties ?? new Dictionary <string, string>(), CreatedAt = activity.CreatedAt, ViewCount = activity.Reactions.ViewCount, CommentsCount = activity.Reactions.CommentCount, MediaAttachments = (content.Attachments ?? new List <AFAttachment>()).ConvertAll(FromRpc), Text = content.Text, ReactionsCount = activity.Reactions.ReactionCount, MyReactionsList = activity.Reactions.MyReactions ?? new List <string>(), Mentions = activity.Mentions.FirstValue(new List <AFMention>()).ConvertAll(FromRPCModel), Source = (source ?? activity.Source).FromRPCModel(), Status = activity.Status ?? "" }); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { CommentCount = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { KnownCommenters = new List <THPublicUser>(); TList _list12 = iprot.ReadListBegin(); for (int _i13 = 0; _i13 < _list12.Count; ++_i13) { THPublicUser _elem14; _elem14 = new THPublicUser(); _elem14.Read(iprot); KnownCommenters.Add(_elem14); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { ReactionCount = new Dictionary <string, int>(); TMap _map15 = iprot.ReadMapBegin(); for (int _i16 = 0; _i16 < _map15.Count; ++_i16) { string _key17; int _val18; _key17 = iprot.ReadString(); _val18 = iprot.ReadI32(); ReactionCount[_key17] = _val18; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.List) { { KnownReactors = new List <AFReaction>(); TList _list19 = iprot.ReadListBegin(); for (int _i20 = 0; _i20 < _list19.Count; ++_i20) { AFReaction _elem21; _elem21 = new AFReaction(); _elem21.Read(iprot); KnownReactors.Add(_elem21); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.List) { { MyReactions = new List <string>(); TList _list22 = iprot.ReadListBegin(); for (int _i23 = 0; _i23 < _list22.Count; ++_i23) { string _elem24; _elem24 = iprot.ReadString(); MyReactions.Add(_elem24); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.I32) { ViewCount = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Notifications = new List <PNNotification>(); TList _list111 = iprot.ReadListBegin(); for (int _i112 = 0; _i112 < _list111.Count; ++_i112) { PNNotification _elem113; _elem113 = new PNNotification(); _elem113.Read(iprot); Notifications.Add(_elem113); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { TotalNumber = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { NextCursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Map) { { Authors = new Dictionary <string, THPublicUser>(); TMap _map114 = iprot.ReadMapBegin(); for (int _i115 = 0; _i115 < _map114.Count; ++_i115) { string _key116; THPublicUser _val117; _key116 = iprot.ReadString(); _val117 = new THPublicUser(); _val117.Read(iprot); Authors[_key116] = _val117; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { User = new THPublicUser(); User.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { EventDate = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { Event = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Map) { { CustomData = new Dictionary <string, string>(); TMap _map38 = iprot.ReadMapBegin(); for (int _i39 = 0; _i39 < _map38.Count; ++_i39) { string _key40; string _val41; _key40 = iprot.ReadString(); _val41 = iprot.ReadString(); CustomData[_key40] = _val41; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Bool) { IsApp = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Bool) { IsVerified = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Struct) { PublicUser = new THPublicUser(); PublicUser.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { User = new THPublicUser(); User.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I64) { BanExpiry = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { BanReason = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Data = new List <AFActivity>(); TList _list105 = iprot.ReadListBegin(); for (int _i106 = 0; _i106 < _list105.Count; ++_i106) { AFActivity _elem107; _elem107 = new AFActivity(); _elem107.Read(iprot); Data.Add(_elem107); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { EntityDetails = new List <AFEntityReference>(); TList _list108 = iprot.ReadListBegin(); for (int _i109 = 0; _i109 < _list108.Count; ++_i109) { AFEntityReference _elem110; _elem110 = new AFEntityReference(); _elem110.Read(iprot); EntityDetails.Add(_elem110); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Authors = new Dictionary <string, THPublicUser>(); TMap _map111 = iprot.ReadMapBegin(); for (int _i112 = 0; _i112 < _map111.Count; ++_i112) { string _key113; THPublicUser _val114; _key113 = iprot.ReadString(); _val114 = new THPublicUser(); _val114.Read(iprot); Authors[_key113] = _val114; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { NextCursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Data = new List <AFAnnouncement>(); TList _list88 = iprot.ReadListBegin(); for (int _i89 = 0; _i89 < _list88.Count; ++_i89) { AFAnnouncement _elem90; _elem90 = new AFAnnouncement(); _elem90.Read(iprot); Data.Add(_elem90); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { EntityDetails = new List <AFEntityReference>(); TList _list91 = iprot.ReadListBegin(); for (int _i92 = 0; _i92 < _list91.Count; ++_i92) { AFEntityReference _elem93; _elem93 = new AFEntityReference(); _elem93.Read(iprot); EntityDetails.Add(_elem93); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Authors = new Dictionary <string, THPublicUser>(); TMap _map94 = iprot.ReadMapBegin(); for (int _i95 = 0; _i95 < _map94.Count; ++_i95) { string _key96; THPublicUser _val97; _key96 = iprot.ReadString(); _val97 = new THPublicUser(); _val97.Read(iprot); Authors[_key96] = _val97; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { NextCursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Data = new List <AFActivity>(); TList _list71 = iprot.ReadListBegin(); for (int _i72 = 0; _i72 < _list71.Count; ++_i72) { AFActivity _elem73; _elem73 = new AFActivity(); _elem73.Read(iprot); Data.Add(_elem73); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { EntityDetails = new List <AFEntityReference>(); TList _list74 = iprot.ReadListBegin(); for (int _i75 = 0; _i75 < _list74.Count; ++_i75) { AFEntityReference _elem76; _elem76 = new AFEntityReference(); _elem76.Read(iprot); EntityDetails.Add(_elem76); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Authors = new Dictionary <string, THPublicUser>(); TMap _map77 = iprot.ReadMapBegin(); for (int _i78 = 0; _i78 < _map77.Count; ++_i78) { string _key79; THPublicUser _val80; _key79 = iprot.ReadString(); _val80 = new THPublicUser(); _val80.Read(iprot); Authors[_key79] = _val80; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { NextCursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Followers = new List <THPublicUser>(); TList _list98 = iprot.ReadListBegin(); for (int _i99 = 0; _i99 < _list98.Count; ++_i99) { THPublicUser _elem100; _elem100 = new THPublicUser(); _elem100.Read(iprot); Followers.Add(_elem100); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { TotalNumber = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { NextCursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Data = new List <AFActivityForModeration>(); TList _list234 = iprot.ReadListBegin(); for (int _i235 = 0; _i235 < _list234.Count; ++_i235) { AFActivityForModeration _elem236; _elem236 = new AFActivityForModeration(); _elem236.Read(iprot); Data.Add(_elem236); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { EntityDetails = new List <AFEntityReference>(); TList _list237 = iprot.ReadListBegin(); for (int _i238 = 0; _i238 < _list237.Count; ++_i238) { AFEntityReference _elem239; _elem239 = new AFEntityReference(); _elem239.Read(iprot); EntityDetails.Add(_elem239); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Authors = new Dictionary <string, THPublicUser>(); TMap _map240 = iprot.ReadMapBegin(); for (int _i241 = 0; _i241 < _map240.Count; ++_i241) { string _key242; THPublicUser _val243; _key242 = iprot.ReadString(); _val243 = new THPublicUser(); _val243.Read(iprot); Authors[_key242] = _val243; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { NextCursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }