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 }); }
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.String) { Id = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { AppId = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Struct) { Creator = new THCreator(); Creator.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { Code = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Map) { { Properties = new Dictionary <string, string>(); TMap _map91 = iprot.ReadMapBegin(); for (int _i92 = 0; _i92 < _map91.Count; ++_i92) { string _key93; string _val94; _key93 = iprot.ReadString(); _val94 = iprot.ReadString(); Properties[_key93] = _val94; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.I32) { MaxClaims = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.I32) { NumClaims = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.I64) { ValidFrom = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.I64) { ValidUntil = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.I64) { CreatedAt = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.Bool) { MakeFriends = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.Bool) { MakeReferrer = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 13: if (field.Type == TType.Bool) { Enabled = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 14: if (field.Type == TType.Bool) { Claimable = iprot.ReadBool(); } 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) { Creator = new THCreator(); Creator.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { Reactions = new List <string>(); TList _list8 = iprot.ReadListBegin(); for (int _i9 = 0; _i9 < _list8.Count; ++_i9) { string _elem10; _elem10 = iprot.ReadString(); Reactions.Add(_elem10); } iprot.ReadListEnd(); } } 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.String) { Id = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Map) { { Content = new Dictionary <string, AFContent>(); TMap _map29 = iprot.ReadMapBegin(); for (int _i30 = 0; _i30 < _map29.Count; ++_i30) { string _key31; AFContent _val32; _key31 = iprot.ReadString(); _val32 = new AFContent(); _val32.Read(iprot); Content[_key31] = _val32; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { ContentType = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Struct) { Reactions = new AFUserReactions(); Reactions.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Map) { { Properties = new Dictionary <string, string>(); TMap _map33 = iprot.ReadMapBegin(); for (int _i34 = 0; _i34 < _map33.Count; ++_i34) { string _key35; string _val36; _key35 = iprot.ReadString(); _val36 = iprot.ReadString(); Properties[_key35] = _val36; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { Author = new THCreator(); Author.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.I64) { CreatedAt = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.Bool) { IsAnnouncement = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Map) { { Mentions = new Dictionary <string, List <AFMention> >(); TMap _map37 = iprot.ReadMapBegin(); for (int _i38 = 0; _i38 < _map37.Count; ++_i38) { string _key39; List <AFMention> _val40; _key39 = iprot.ReadString(); { _val40 = new List <AFMention>(); TList _list41 = iprot.ReadListBegin(); for (int _i42 = 0; _i42 < _list41.Count; ++_i42) { AFMention _elem43; _elem43 = new AFMention(); _elem43.Read(iprot); _val40.Add(_elem43); } iprot.ReadListEnd(); } Mentions[_key39] = _val40; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.Struct) { Source = new AFEntityReference(); Source.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.String) { Status = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 13: if (field.Type == TType.I64) { StatusUpdatedAt = iprot.ReadI64(); } 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.String) { Id = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { Media = new THNotificationTemplateMedia(); Media.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { CreatedAt = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { Text = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.String) { Title = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Struct) { Sender = new THCreator(); Sender.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { Action = new THAction(); Action.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.String) { Type = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.String) { Status = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.List) { { ActionButtons = new List <THActionButton>(); TList _list120 = iprot.ReadListBegin(); for (int _i121 = 0; _i121 < _list120.Count; ++_i121) { THActionButton _elem122; _elem122 = new THActionButton(); _elem122.Read(iprot); ActionButtons.Add(_elem122); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.I32) { Expiration = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }