diff --git a/tg/tl_channels_get_admined_public_channels_gen.go b/tg/tl_channels_get_admined_public_channels_gen.go index c46f588c74..d696966009 100644 --- a/tg/tl_channels_get_admined_public_channels_gen.go +++ b/tg/tl_channels_get_admined_public_channels_gen.go @@ -51,6 +51,8 @@ type ChannelsGetAdminedPublicChannelsRequest struct { // 3) https://core.telegram.org/method/channels.checkUsername // 4) https://core.telegram.org/method/channels.updateUsername CheckLimit bool + // ForGroupcall field of ChannelsGetAdminedPublicChannelsRequest. + ForGroupcall bool } // ChannelsGetAdminedPublicChannelsRequestTypeID is TL type id of ChannelsGetAdminedPublicChannelsRequest. @@ -69,6 +71,9 @@ func (g *ChannelsGetAdminedPublicChannelsRequest) Zero() bool { if !(g.CheckLimit == false) { return false } + if !(g.ForGroupcall == false) { + return false + } return true } @@ -86,9 +91,11 @@ func (g *ChannelsGetAdminedPublicChannelsRequest) String() string { func (g *ChannelsGetAdminedPublicChannelsRequest) FillFrom(from interface { GetByLocation() (value bool) GetCheckLimit() (value bool) + GetForGroupcall() (value bool) }) { g.ByLocation = from.GetByLocation() g.CheckLimit = from.GetCheckLimit() + g.ForGroupcall = from.GetForGroupcall() } // TypeID returns type id in TL schema. @@ -124,6 +131,11 @@ func (g *ChannelsGetAdminedPublicChannelsRequest) TypeInfo() tdp.Type { SchemaName: "check_limit", Null: !g.Flags.Has(1), }, + { + Name: "ForGroupcall", + SchemaName: "for_groupcall", + Null: !g.Flags.Has(2), + }, } return typ } @@ -140,6 +152,9 @@ func (g *ChannelsGetAdminedPublicChannelsRequest) Encode(b *bin.Buffer) error { if !(g.CheckLimit == false) { g.Flags.Set(1) } + if !(g.ForGroupcall == false) { + g.Flags.Set(2) + } if err := g.Flags.Encode(b); err != nil { return fmt.Errorf("unable to encode channels.getAdminedPublicChannels#f8b036af: field flags: %w", err) } @@ -178,6 +193,22 @@ func (g *ChannelsGetAdminedPublicChannelsRequest) GetCheckLimit() (value bool) { return g.Flags.Has(1) } +// SetForGroupcall sets value of ForGroupcall conditional field. +func (g *ChannelsGetAdminedPublicChannelsRequest) SetForGroupcall(value bool) { + if value { + g.Flags.Set(2) + g.ForGroupcall = true + } else { + g.Flags.Unset(2) + g.ForGroupcall = false + } +} + +// GetForGroupcall returns value of ForGroupcall conditional field. +func (g *ChannelsGetAdminedPublicChannelsRequest) GetForGroupcall() (value bool) { + return g.Flags.Has(2) +} + // Decode implements bin.Decoder. func (g *ChannelsGetAdminedPublicChannelsRequest) Decode(b *bin.Buffer) error { if g == nil { @@ -193,6 +224,7 @@ func (g *ChannelsGetAdminedPublicChannelsRequest) Decode(b *bin.Buffer) error { } g.ByLocation = g.Flags.Has(0) g.CheckLimit = g.Flags.Has(1) + g.ForGroupcall = g.Flags.Has(2) return nil } diff --git a/tg/tl_chat_full_gen.go b/tg/tl_chat_full_gen.go index ec6b905b56..013686b131 100644 --- a/tg/tl_chat_full_gen.go +++ b/tg/tl_chat_full_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// ChatFull represents TL type `chatFull#f06c4018`. +// ChatFull represents TL type `chatFull#8a1e2983`. // Detailed chat info // // See https://core.telegram.org/constructor/chatFull for reference. @@ -85,10 +85,14 @@ type ChatFull struct { // // Use SetTTLPeriod and GetTTLPeriod helpers. TTLPeriod int + // GroupcallDefaultJoinAs field of ChatFull. + // + // Use SetGroupcallDefaultJoinAs and GetGroupcallDefaultJoinAs helpers. + GroupcallDefaultJoinAs PeerClass } // ChatFullTypeID is TL type id of ChatFull. -const ChatFullTypeID = 0xf06c4018 +const ChatFullTypeID = 0x8a1e2983 func (c *ChatFull) Zero() bool { if c == nil { @@ -136,6 +140,9 @@ func (c *ChatFull) Zero() bool { if !(c.TTLPeriod == 0) { return false } + if !(c.GroupcallDefaultJoinAs == nil) { + return false + } return true } @@ -164,6 +171,7 @@ func (c *ChatFull) FillFrom(from interface { GetFolderID() (value int, ok bool) GetCall() (value InputGroupCall, ok bool) GetTTLPeriod() (value int, ok bool) + GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) }) { c.CanSetUsername = from.GetCanSetUsername() c.HasScheduled = from.GetHasScheduled() @@ -199,6 +207,10 @@ func (c *ChatFull) FillFrom(from interface { c.TTLPeriod = val } + if val, ok := from.GetGroupcallDefaultJoinAs(); ok { + c.GroupcallDefaultJoinAs = val + } + } // TypeID returns type id in TL schema. @@ -285,6 +297,11 @@ func (c *ChatFull) TypeInfo() tdp.Type { SchemaName: "ttl_period", Null: !c.Flags.Has(14), }, + { + Name: "GroupcallDefaultJoinAs", + SchemaName: "groupcall_default_join_as", + Null: !c.Flags.Has(15), + }, } return typ } @@ -292,7 +309,7 @@ func (c *ChatFull) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatFull) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatFull#f06c4018 as nil") + return fmt.Errorf("can't encode chatFull#8a1e2983 as nil") } b.PutID(ChatFullTypeID) if !(c.CanSetUsername == false) { @@ -322,38 +339,41 @@ func (c *ChatFull) Encode(b *bin.Buffer) error { if !(c.TTLPeriod == 0) { c.Flags.Set(14) } + if !(c.GroupcallDefaultJoinAs == nil) { + c.Flags.Set(15) + } if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field flags: %w", err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field flags: %w", err) } b.PutInt(c.ID) b.PutString(c.About) if c.Participants == nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field participants is nil") + return fmt.Errorf("unable to encode chatFull#8a1e2983: field participants is nil") } if err := c.Participants.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field participants: %w", err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field participants: %w", err) } if c.Flags.Has(2) { if c.ChatPhoto == nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field chat_photo is nil") + return fmt.Errorf("unable to encode chatFull#8a1e2983: field chat_photo is nil") } if err := c.ChatPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field chat_photo: %w", err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field chat_photo: %w", err) } } if err := c.NotifySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field notify_settings: %w", err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field notify_settings: %w", err) } if c.Flags.Has(13) { if err := c.ExportedInvite.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field exported_invite: %w", err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field exported_invite: %w", err) } } if c.Flags.Has(3) { b.PutVectorHeader(len(c.BotInfo)) for idx, v := range c.BotInfo { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field bot_info element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field bot_info element with index %d: %w", idx, err) } } } @@ -365,12 +385,20 @@ func (c *ChatFull) Encode(b *bin.Buffer) error { } if c.Flags.Has(12) { if err := c.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFull#f06c4018: field call: %w", err) + return fmt.Errorf("unable to encode chatFull#8a1e2983: field call: %w", err) } } if c.Flags.Has(14) { b.PutInt(c.TTLPeriod) } + if c.Flags.Has(15) { + if c.GroupcallDefaultJoinAs == nil { + return fmt.Errorf("unable to encode chatFull#8a1e2983: field groupcall_default_join_as is nil") + } + if err := c.GroupcallDefaultJoinAs.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatFull#8a1e2983: field groupcall_default_join_as: %w", err) + } + } return nil } @@ -531,17 +559,32 @@ func (c *ChatFull) GetTTLPeriod() (value int, ok bool) { return c.TTLPeriod, true } +// SetGroupcallDefaultJoinAs sets value of GroupcallDefaultJoinAs conditional field. +func (c *ChatFull) SetGroupcallDefaultJoinAs(value PeerClass) { + c.Flags.Set(15) + c.GroupcallDefaultJoinAs = value +} + +// GetGroupcallDefaultJoinAs returns value of GroupcallDefaultJoinAs conditional field and +// boolean which is true if field was set. +func (c *ChatFull) GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) { + if !c.Flags.Has(15) { + return value, false + } + return c.GroupcallDefaultJoinAs, true +} + // Decode implements bin.Decoder. func (c *ChatFull) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatFull#f06c4018 to nil") + return fmt.Errorf("can't decode chatFull#8a1e2983 to nil") } if err := b.ConsumeID(ChatFullTypeID); err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: %w", err) } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field flags: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field flags: %w", err) } } c.CanSetUsername = c.Flags.Has(7) @@ -549,50 +592,50 @@ func (c *ChatFull) Decode(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field id: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field id: %w", err) } c.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field about: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field about: %w", err) } c.About = value } { value, err := DecodeChatParticipants(b) if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field participants: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field participants: %w", err) } c.Participants = value } if c.Flags.Has(2) { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field chat_photo: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field chat_photo: %w", err) } c.ChatPhoto = value } { if err := c.NotifySettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field notify_settings: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field notify_settings: %w", err) } } if c.Flags.Has(13) { if err := c.ExportedInvite.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field exported_invite: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field exported_invite: %w", err) } } if c.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field bot_info: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field bot_info: %w", err) } for idx := 0; idx < headerLen; idx++ { var value BotInfo if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field bot_info: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field bot_info: %w", err) } c.BotInfo = append(c.BotInfo, value) } @@ -600,29 +643,36 @@ func (c *ChatFull) Decode(b *bin.Buffer) error { if c.Flags.Has(6) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field pinned_msg_id: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field pinned_msg_id: %w", err) } c.PinnedMsgID = value } if c.Flags.Has(11) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field folder_id: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field folder_id: %w", err) } c.FolderID = value } if c.Flags.Has(12) { if err := c.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field call: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field call: %w", err) } } if c.Flags.Has(14) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatFull#f06c4018: field ttl_period: %w", err) + return fmt.Errorf("unable to decode chatFull#8a1e2983: field ttl_period: %w", err) } c.TTLPeriod = value } + if c.Flags.Has(15) { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode chatFull#8a1e2983: field groupcall_default_join_as: %w", err) + } + c.GroupcallDefaultJoinAs = value + } return nil } @@ -637,7 +687,7 @@ var ( _ ChatFullClass = &ChatFull{} ) -// ChannelFull represents TL type `channelFull#2548c037`. +// ChannelFull represents TL type `channelFull#548c3f93`. // Full info about a channel/supergroup¹ // // Links: @@ -797,10 +847,14 @@ type ChannelFull struct { // // Use SetPendingSuggestions and GetPendingSuggestions helpers. PendingSuggestions []string + // GroupcallDefaultJoinAs field of ChannelFull. + // + // Use SetGroupcallDefaultJoinAs and GetGroupcallDefaultJoinAs helpers. + GroupcallDefaultJoinAs PeerClass } // ChannelFullTypeID is TL type id of ChannelFull. -const ChannelFullTypeID = 0x2548c037 +const ChannelFullTypeID = 0x548c3f93 func (c *ChannelFull) Zero() bool { if c == nil { @@ -920,6 +974,9 @@ func (c *ChannelFull) Zero() bool { if !(c.PendingSuggestions == nil) { return false } + if !(c.GroupcallDefaultJoinAs == nil) { + return false + } return true } @@ -972,6 +1029,7 @@ func (c *ChannelFull) FillFrom(from interface { GetCall() (value InputGroupCall, ok bool) GetTTLPeriod() (value int, ok bool) GetPendingSuggestions() (value []string, ok bool) + GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) }) { c.CanViewParticipants = from.GetCanViewParticipants() c.CanSetUsername = from.GetCanSetUsername() @@ -1070,6 +1128,10 @@ func (c *ChannelFull) FillFrom(from interface { c.PendingSuggestions = val } + if val, ok := from.GetGroupcallDefaultJoinAs(); ok { + c.GroupcallDefaultJoinAs = val + } + } // TypeID returns type id in TL schema. @@ -1271,6 +1333,11 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "pending_suggestions", Null: !c.Flags.Has(25), }, + { + Name: "GroupcallDefaultJoinAs", + SchemaName: "groupcall_default_join_as", + Null: !c.Flags.Has(26), + }, } return typ } @@ -1278,7 +1345,7 @@ func (c *ChannelFull) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChannelFull) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelFull#2548c037 as nil") + return fmt.Errorf("can't encode channelFull#548c3f93 as nil") } b.PutID(ChannelFullTypeID) if !(c.CanViewParticipants == false) { @@ -1365,8 +1432,11 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { if !(c.PendingSuggestions == nil) { c.Flags.Set(25) } + if !(c.GroupcallDefaultJoinAs == nil) { + c.Flags.Set(26) + } if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field flags: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field flags: %w", err) } b.PutInt(c.ID) b.PutString(c.About) @@ -1389,23 +1459,23 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { b.PutInt(c.ReadOutboxMaxID) b.PutInt(c.UnreadCount) if c.ChatPhoto == nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field chat_photo is nil") + return fmt.Errorf("unable to encode channelFull#548c3f93: field chat_photo is nil") } if err := c.ChatPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field chat_photo: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field chat_photo: %w", err) } if err := c.NotifySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field notify_settings: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field notify_settings: %w", err) } if c.Flags.Has(23) { if err := c.ExportedInvite.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field exported_invite: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field exported_invite: %w", err) } } b.PutVectorHeader(len(c.BotInfo)) for idx, v := range c.BotInfo { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field bot_info element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field bot_info element with index %d: %w", idx, err) } } if c.Flags.Has(4) { @@ -1419,7 +1489,7 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { } if c.Flags.Has(8) { if err := c.Stickerset.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field stickerset: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field stickerset: %w", err) } } if c.Flags.Has(9) { @@ -1433,10 +1503,10 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { } if c.Flags.Has(15) { if c.Location == nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field location is nil") + return fmt.Errorf("unable to encode channelFull#548c3f93: field location is nil") } if err := c.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field location: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field location: %w", err) } } if c.Flags.Has(17) { @@ -1451,7 +1521,7 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { b.PutInt(c.Pts) if c.Flags.Has(21) { if err := c.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#2548c037: field call: %w", err) + return fmt.Errorf("unable to encode channelFull#548c3f93: field call: %w", err) } } if c.Flags.Has(24) { @@ -1463,6 +1533,14 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { b.PutString(v) } } + if c.Flags.Has(26) { + if c.GroupcallDefaultJoinAs == nil { + return fmt.Errorf("unable to encode channelFull#548c3f93: field groupcall_default_join_as is nil") + } + if err := c.GroupcallDefaultJoinAs.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelFull#548c3f93: field groupcall_default_join_as: %w", err) + } + } return nil } @@ -1939,17 +2017,32 @@ func (c *ChannelFull) GetPendingSuggestions() (value []string, ok bool) { return c.PendingSuggestions, true } +// SetGroupcallDefaultJoinAs sets value of GroupcallDefaultJoinAs conditional field. +func (c *ChannelFull) SetGroupcallDefaultJoinAs(value PeerClass) { + c.Flags.Set(26) + c.GroupcallDefaultJoinAs = value +} + +// GetGroupcallDefaultJoinAs returns value of GroupcallDefaultJoinAs conditional field and +// boolean which is true if field was set. +func (c *ChannelFull) GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) { + if !c.Flags.Has(26) { + return value, false + } + return c.GroupcallDefaultJoinAs, true +} + // Decode implements bin.Decoder. func (c *ChannelFull) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelFull#2548c037 to nil") + return fmt.Errorf("can't decode channelFull#548c3f93 to nil") } if err := b.ConsumeID(ChannelFullTypeID); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: %w", err) } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field flags: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field flags: %w", err) } } c.CanViewParticipants = c.Flags.Has(3) @@ -1963,99 +2056,99 @@ func (c *ChannelFull) Decode(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field id: %w", err) } c.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field about: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field about: %w", err) } c.About = value } if c.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field participants_count: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field participants_count: %w", err) } c.ParticipantsCount = value } if c.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field admins_count: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field admins_count: %w", err) } c.AdminsCount = value } if c.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field kicked_count: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field kicked_count: %w", err) } c.KickedCount = value } if c.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field banned_count: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field banned_count: %w", err) } c.BannedCount = value } if c.Flags.Has(13) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field online_count: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field online_count: %w", err) } c.OnlineCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field read_inbox_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field read_inbox_max_id: %w", err) } c.ReadInboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field read_outbox_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field read_outbox_max_id: %w", err) } c.ReadOutboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field unread_count: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field unread_count: %w", err) } c.UnreadCount = value } { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field chat_photo: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field chat_photo: %w", err) } c.ChatPhoto = value } { if err := c.NotifySettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field notify_settings: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field notify_settings: %w", err) } } if c.Flags.Has(23) { if err := c.ExportedInvite.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field exported_invite: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field exported_invite: %w", err) } } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field bot_info: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field bot_info: %w", err) } for idx := 0; idx < headerLen; idx++ { var value BotInfo if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field bot_info: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field bot_info: %w", err) } c.BotInfo = append(c.BotInfo, value) } @@ -2063,110 +2156,117 @@ func (c *ChannelFull) Decode(b *bin.Buffer) error { if c.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field migrated_from_chat_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field migrated_from_chat_id: %w", err) } c.MigratedFromChatID = value } if c.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field migrated_from_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field migrated_from_max_id: %w", err) } c.MigratedFromMaxID = value } if c.Flags.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field pinned_msg_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field pinned_msg_id: %w", err) } c.PinnedMsgID = value } if c.Flags.Has(8) { if err := c.Stickerset.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field stickerset: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field stickerset: %w", err) } } if c.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field available_min_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field available_min_id: %w", err) } c.AvailableMinID = value } if c.Flags.Has(11) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field folder_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field folder_id: %w", err) } c.FolderID = value } if c.Flags.Has(14) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field linked_chat_id: %w", err) } c.LinkedChatID = value } if c.Flags.Has(15) { value, err := DecodeChannelLocation(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field location: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field location: %w", err) } c.Location = value } if c.Flags.Has(17) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field slowmode_seconds: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field slowmode_seconds: %w", err) } c.SlowmodeSeconds = value } if c.Flags.Has(18) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field slowmode_next_send_date: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field slowmode_next_send_date: %w", err) } c.SlowmodeNextSendDate = value } if c.Flags.Has(12) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field stats_dc: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field stats_dc: %w", err) } c.StatsDC = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field pts: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field pts: %w", err) } c.Pts = value } if c.Flags.Has(21) { if err := c.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field call: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field call: %w", err) } } if c.Flags.Has(24) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field ttl_period: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field ttl_period: %w", err) } c.TTLPeriod = value } if c.Flags.Has(25) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field pending_suggestions: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field pending_suggestions: %w", err) } for idx := 0; idx < headerLen; idx++ { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channelFull#2548c037: field pending_suggestions: %w", err) + return fmt.Errorf("unable to decode channelFull#548c3f93: field pending_suggestions: %w", err) } c.PendingSuggestions = append(c.PendingSuggestions, value) } } + if c.Flags.Has(26) { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode channelFull#548c3f93: field groupcall_default_join_as: %w", err) + } + c.GroupcallDefaultJoinAs = value + } return nil } @@ -2191,8 +2291,8 @@ var ( // panic(err) // } // switch v := g.(type) { -// case *tg.ChatFull: // chatFull#f06c4018 -// case *tg.ChannelFull: // channelFull#2548c037 +// case *tg.ChatFull: // chatFull#8a1e2983 +// case *tg.ChannelFull: // channelFull#548c3f93 // default: panic(v) // } type ChatFullClass interface { @@ -2240,6 +2340,8 @@ type ChatFullClass interface { GetCall() (value InputGroupCall, ok bool) // TTLPeriod field of ChatFull. GetTTLPeriod() (value int, ok bool) + // GroupcallDefaultJoinAs field of ChatFull. + GetGroupcallDefaultJoinAs() (value PeerClass, ok bool) } // DecodeChatFull implements binary de-serialization for ChatFullClass. @@ -2250,14 +2352,14 @@ func DecodeChatFull(buf *bin.Buffer) (ChatFullClass, error) { } switch id { case ChatFullTypeID: - // Decoding chatFull#f06c4018. + // Decoding chatFull#8a1e2983. v := ChatFull{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatFullClass: %w", err) } return &v, nil case ChannelFullTypeID: - // Decoding channelFull#2548c037. + // Decoding channelFull#548c3f93. v := ChannelFull{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatFullClass: %w", err) diff --git a/tg/tl_group_call_gen.go b/tg/tl_group_call_gen.go index 7be23d034b..ee116bfaa8 100644 --- a/tg/tl_group_call_gen.go +++ b/tg/tl_group_call_gen.go @@ -187,7 +187,7 @@ var ( _ GroupCallClass = &GroupCallDiscarded{} ) -// GroupCall represents TL type `groupCall#55903081`. +// GroupCall represents TL type `groupCall#c0c2052e`. // // See https://core.telegram.org/constructor/groupCall for reference. type GroupCall struct { @@ -207,12 +207,24 @@ type GroupCall struct { // // Use SetParams and GetParams helpers. Params DataJSON + // Title field of GroupCall. + // + // Use SetTitle and GetTitle helpers. + Title string + // StreamDCID field of GroupCall. + // + // Use SetStreamDCID and GetStreamDCID helpers. + StreamDCID int + // RecordStartDate field of GroupCall. + // + // Use SetRecordStartDate and GetRecordStartDate helpers. + RecordStartDate int // Version field of GroupCall. Version int } // GroupCallTypeID is TL type id of GroupCall. -const GroupCallTypeID = 0x55903081 +const GroupCallTypeID = 0xc0c2052e func (g *GroupCall) Zero() bool { if g == nil { @@ -239,6 +251,15 @@ func (g *GroupCall) Zero() bool { if !(g.Params.Zero()) { return false } + if !(g.Title == "") { + return false + } + if !(g.StreamDCID == 0) { + return false + } + if !(g.RecordStartDate == 0) { + return false + } if !(g.Version == 0) { return false } @@ -263,6 +284,9 @@ func (g *GroupCall) FillFrom(from interface { GetAccessHash() (value int64) GetParticipantsCount() (value int) GetParams() (value DataJSON, ok bool) + GetTitle() (value string, ok bool) + GetStreamDCID() (value int, ok bool) + GetRecordStartDate() (value int, ok bool) GetVersion() (value int) }) { g.JoinMuted = from.GetJoinMuted() @@ -274,6 +298,18 @@ func (g *GroupCall) FillFrom(from interface { g.Params = val } + if val, ok := from.GetTitle(); ok { + g.Title = val + } + + if val, ok := from.GetStreamDCID(); ok { + g.StreamDCID = val + } + + if val, ok := from.GetRecordStartDate(); ok { + g.RecordStartDate = val + } + g.Version = from.GetVersion() } @@ -327,6 +363,21 @@ func (g *GroupCall) TypeInfo() tdp.Type { SchemaName: "params", Null: !g.Flags.Has(0), }, + { + Name: "Title", + SchemaName: "title", + Null: !g.Flags.Has(3), + }, + { + Name: "StreamDCID", + SchemaName: "stream_dc_id", + Null: !g.Flags.Has(4), + }, + { + Name: "RecordStartDate", + SchemaName: "record_start_date", + Null: !g.Flags.Has(5), + }, { Name: "Version", SchemaName: "version", @@ -338,7 +389,7 @@ func (g *GroupCall) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GroupCall) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode groupCall#55903081 as nil") + return fmt.Errorf("can't encode groupCall#c0c2052e as nil") } b.PutID(GroupCallTypeID) if !(g.JoinMuted == false) { @@ -350,17 +401,35 @@ func (g *GroupCall) Encode(b *bin.Buffer) error { if !(g.Params.Zero()) { g.Flags.Set(0) } + if !(g.Title == "") { + g.Flags.Set(3) + } + if !(g.StreamDCID == 0) { + g.Flags.Set(4) + } + if !(g.RecordStartDate == 0) { + g.Flags.Set(5) + } if err := g.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCall#55903081: field flags: %w", err) + return fmt.Errorf("unable to encode groupCall#c0c2052e: field flags: %w", err) } b.PutLong(g.ID) b.PutLong(g.AccessHash) b.PutInt(g.ParticipantsCount) if g.Flags.Has(0) { if err := g.Params.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCall#55903081: field params: %w", err) + return fmt.Errorf("unable to encode groupCall#c0c2052e: field params: %w", err) } } + if g.Flags.Has(3) { + b.PutString(g.Title) + } + if g.Flags.Has(4) { + b.PutInt(g.StreamDCID) + } + if g.Flags.Has(5) { + b.PutInt(g.RecordStartDate) + } b.PutInt(g.Version) return nil } @@ -427,6 +496,51 @@ func (g *GroupCall) GetParams() (value DataJSON, ok bool) { return g.Params, true } +// SetTitle sets value of Title conditional field. +func (g *GroupCall) SetTitle(value string) { + g.Flags.Set(3) + g.Title = value +} + +// GetTitle returns value of Title conditional field and +// boolean which is true if field was set. +func (g *GroupCall) GetTitle() (value string, ok bool) { + if !g.Flags.Has(3) { + return value, false + } + return g.Title, true +} + +// SetStreamDCID sets value of StreamDCID conditional field. +func (g *GroupCall) SetStreamDCID(value int) { + g.Flags.Set(4) + g.StreamDCID = value +} + +// GetStreamDCID returns value of StreamDCID conditional field and +// boolean which is true if field was set. +func (g *GroupCall) GetStreamDCID() (value int, ok bool) { + if !g.Flags.Has(4) { + return value, false + } + return g.StreamDCID, true +} + +// SetRecordStartDate sets value of RecordStartDate conditional field. +func (g *GroupCall) SetRecordStartDate(value int) { + g.Flags.Set(5) + g.RecordStartDate = value +} + +// GetRecordStartDate returns value of RecordStartDate conditional field and +// boolean which is true if field was set. +func (g *GroupCall) GetRecordStartDate() (value int, ok bool) { + if !g.Flags.Has(5) { + return value, false + } + return g.RecordStartDate, true +} + // GetVersion returns value of Version field. func (g *GroupCall) GetVersion() (value int) { return g.Version @@ -435,14 +549,14 @@ func (g *GroupCall) GetVersion() (value int) { // Decode implements bin.Decoder. func (g *GroupCall) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode groupCall#55903081 to nil") + return fmt.Errorf("can't decode groupCall#c0c2052e to nil") } if err := b.ConsumeID(GroupCallTypeID); err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: %w", err) } { if err := g.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: field flags: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: field flags: %w", err) } } g.JoinMuted = g.Flags.Has(1) @@ -450,33 +564,54 @@ func (g *GroupCall) Decode(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: field id: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: field id: %w", err) } g.ID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: field access_hash: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: field access_hash: %w", err) } g.AccessHash = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: field participants_count: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: field participants_count: %w", err) } g.ParticipantsCount = value } if g.Flags.Has(0) { if err := g.Params.Decode(b); err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: field params: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: field params: %w", err) + } + } + if g.Flags.Has(3) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode groupCall#c0c2052e: field title: %w", err) + } + g.Title = value + } + if g.Flags.Has(4) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode groupCall#c0c2052e: field stream_dc_id: %w", err) + } + g.StreamDCID = value + } + if g.Flags.Has(5) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode groupCall#c0c2052e: field record_start_date: %w", err) } + g.RecordStartDate = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode groupCall#55903081: field version: %w", err) + return fmt.Errorf("unable to decode groupCall#c0c2052e: field version: %w", err) } g.Version = value } @@ -505,7 +640,7 @@ var ( // } // switch v := g.(type) { // case *tg.GroupCallDiscarded: // groupCallDiscarded#7780bcb4 -// case *tg.GroupCall: // groupCall#55903081 +// case *tg.GroupCall: // groupCall#c0c2052e // default: panic(v) // } type GroupCallClass interface { @@ -554,7 +689,7 @@ func DecodeGroupCall(buf *bin.Buffer) (GroupCallClass, error) { } return &v, nil case GroupCallTypeID: - // Decoding groupCall#55903081. + // Decoding groupCall#c0c2052e. v := GroupCall{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode GroupCallClass: %w", err) diff --git a/tg/tl_group_call_participant_gen.go b/tg/tl_group_call_participant_gen.go index 017d709c03..91e9456171 100644 --- a/tg/tl_group_call_participant_gen.go +++ b/tg/tl_group_call_participant_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// GroupCallParticipant represents TL type `groupCallParticipant#64c62a15`. +// GroupCallParticipant represents TL type `groupCallParticipant#19adba89`. // // See https://core.telegram.org/constructor/groupCallParticipant for reference. type GroupCallParticipant struct { @@ -48,8 +48,10 @@ type GroupCallParticipant struct { MutedByYou bool // VolumeByAdmin field of GroupCallParticipant. VolumeByAdmin bool - // UserID field of GroupCallParticipant. - UserID int + // Self field of GroupCallParticipant. + Self bool + // Peer field of GroupCallParticipant. + Peer PeerClass // Date field of GroupCallParticipant. Date int // ActiveDate field of GroupCallParticipant. @@ -62,10 +64,18 @@ type GroupCallParticipant struct { // // Use SetVolume and GetVolume helpers. Volume int + // About field of GroupCallParticipant. + // + // Use SetAbout and GetAbout helpers. + About string + // RaiseHandRating field of GroupCallParticipant. + // + // Use SetRaiseHandRating and GetRaiseHandRating helpers. + RaiseHandRating int64 } // GroupCallParticipantTypeID is TL type id of GroupCallParticipant. -const GroupCallParticipantTypeID = 0x64c62a15 +const GroupCallParticipantTypeID = 0x19adba89 func (g *GroupCallParticipant) Zero() bool { if g == nil { @@ -98,7 +108,10 @@ func (g *GroupCallParticipant) Zero() bool { if !(g.VolumeByAdmin == false) { return false } - if !(g.UserID == 0) { + if !(g.Self == false) { + return false + } + if !(g.Peer == nil) { return false } if !(g.Date == 0) { @@ -113,6 +126,12 @@ func (g *GroupCallParticipant) Zero() bool { if !(g.Volume == 0) { return false } + if !(g.About == "") { + return false + } + if !(g.RaiseHandRating == 0) { + return false + } return true } @@ -136,11 +155,14 @@ func (g *GroupCallParticipant) FillFrom(from interface { GetMin() (value bool) GetMutedByYou() (value bool) GetVolumeByAdmin() (value bool) - GetUserID() (value int) + GetSelf() (value bool) + GetPeer() (value PeerClass) GetDate() (value int) GetActiveDate() (value int, ok bool) GetSource() (value int) GetVolume() (value int, ok bool) + GetAbout() (value string, ok bool) + GetRaiseHandRating() (value int64, ok bool) }) { g.Muted = from.GetMuted() g.Left = from.GetLeft() @@ -150,7 +172,8 @@ func (g *GroupCallParticipant) FillFrom(from interface { g.Min = from.GetMin() g.MutedByYou = from.GetMutedByYou() g.VolumeByAdmin = from.GetVolumeByAdmin() - g.UserID = from.GetUserID() + g.Self = from.GetSelf() + g.Peer = from.GetPeer() g.Date = from.GetDate() if val, ok := from.GetActiveDate(); ok { g.ActiveDate = val @@ -161,6 +184,14 @@ func (g *GroupCallParticipant) FillFrom(from interface { g.Volume = val } + if val, ok := from.GetAbout(); ok { + g.About = val + } + + if val, ok := from.GetRaiseHandRating(); ok { + g.RaiseHandRating = val + } + } // TypeID returns type id in TL schema. @@ -227,8 +258,13 @@ func (g *GroupCallParticipant) TypeInfo() tdp.Type { Null: !g.Flags.Has(10), }, { - Name: "UserID", - SchemaName: "user_id", + Name: "Self", + SchemaName: "self", + Null: !g.Flags.Has(12), + }, + { + Name: "Peer", + SchemaName: "peer", }, { Name: "Date", @@ -248,6 +284,16 @@ func (g *GroupCallParticipant) TypeInfo() tdp.Type { SchemaName: "volume", Null: !g.Flags.Has(7), }, + { + Name: "About", + SchemaName: "about", + Null: !g.Flags.Has(11), + }, + { + Name: "RaiseHandRating", + SchemaName: "raise_hand_rating", + Null: !g.Flags.Has(13), + }, } return typ } @@ -255,7 +301,7 @@ func (g *GroupCallParticipant) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *GroupCallParticipant) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode groupCallParticipant#64c62a15 as nil") + return fmt.Errorf("can't encode groupCallParticipant#19adba89 as nil") } b.PutID(GroupCallParticipantTypeID) if !(g.Muted == false) { @@ -282,16 +328,30 @@ func (g *GroupCallParticipant) Encode(b *bin.Buffer) error { if !(g.VolumeByAdmin == false) { g.Flags.Set(10) } + if !(g.Self == false) { + g.Flags.Set(12) + } if !(g.ActiveDate == 0) { g.Flags.Set(3) } if !(g.Volume == 0) { g.Flags.Set(7) } + if !(g.About == "") { + g.Flags.Set(11) + } + if !(g.RaiseHandRating == 0) { + g.Flags.Set(13) + } if err := g.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#64c62a15: field flags: %w", err) + return fmt.Errorf("unable to encode groupCallParticipant#19adba89: field flags: %w", err) + } + if g.Peer == nil { + return fmt.Errorf("unable to encode groupCallParticipant#19adba89: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode groupCallParticipant#19adba89: field peer: %w", err) } - b.PutInt(g.UserID) b.PutInt(g.Date) if g.Flags.Has(3) { b.PutInt(g.ActiveDate) @@ -300,6 +360,12 @@ func (g *GroupCallParticipant) Encode(b *bin.Buffer) error { if g.Flags.Has(7) { b.PutInt(g.Volume) } + if g.Flags.Has(11) { + b.PutString(g.About) + } + if g.Flags.Has(13) { + b.PutLong(g.RaiseHandRating) + } return nil } @@ -431,9 +497,25 @@ func (g *GroupCallParticipant) GetVolumeByAdmin() (value bool) { return g.Flags.Has(10) } -// GetUserID returns value of UserID field. -func (g *GroupCallParticipant) GetUserID() (value int) { - return g.UserID +// SetSelf sets value of Self conditional field. +func (g *GroupCallParticipant) SetSelf(value bool) { + if value { + g.Flags.Set(12) + g.Self = true + } else { + g.Flags.Unset(12) + g.Self = false + } +} + +// GetSelf returns value of Self conditional field. +func (g *GroupCallParticipant) GetSelf() (value bool) { + return g.Flags.Has(12) +} + +// GetPeer returns value of Peer field. +func (g *GroupCallParticipant) GetPeer() (value PeerClass) { + return g.Peer } // GetDate returns value of Date field. @@ -476,17 +558,47 @@ func (g *GroupCallParticipant) GetVolume() (value int, ok bool) { return g.Volume, true } +// SetAbout sets value of About conditional field. +func (g *GroupCallParticipant) SetAbout(value string) { + g.Flags.Set(11) + g.About = value +} + +// GetAbout returns value of About conditional field and +// boolean which is true if field was set. +func (g *GroupCallParticipant) GetAbout() (value string, ok bool) { + if !g.Flags.Has(11) { + return value, false + } + return g.About, true +} + +// SetRaiseHandRating sets value of RaiseHandRating conditional field. +func (g *GroupCallParticipant) SetRaiseHandRating(value int64) { + g.Flags.Set(13) + g.RaiseHandRating = value +} + +// GetRaiseHandRating returns value of RaiseHandRating conditional field and +// boolean which is true if field was set. +func (g *GroupCallParticipant) GetRaiseHandRating() (value int64, ok bool) { + if !g.Flags.Has(13) { + return value, false + } + return g.RaiseHandRating, true +} + // Decode implements bin.Decoder. func (g *GroupCallParticipant) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode groupCallParticipant#64c62a15 to nil") + return fmt.Errorf("can't decode groupCallParticipant#19adba89 to nil") } if err := b.ConsumeID(GroupCallParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: %w", err) } { if err := g.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: field flags: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field flags: %w", err) } } g.Muted = g.Flags.Has(0) @@ -497,41 +609,56 @@ func (g *GroupCallParticipant) Decode(b *bin.Buffer) error { g.Min = g.Flags.Has(8) g.MutedByYou = g.Flags.Has(9) g.VolumeByAdmin = g.Flags.Has(10) + g.Self = g.Flags.Has(12) { - value, err := b.Int() + value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: field user_id: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field peer: %w", err) } - g.UserID = value + g.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: field date: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field date: %w", err) } g.Date = value } if g.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: field active_date: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field active_date: %w", err) } g.ActiveDate = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: field source: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field source: %w", err) } g.Source = value } if g.Flags.Has(7) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#64c62a15: field volume: %w", err) + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field volume: %w", err) } g.Volume = value } + if g.Flags.Has(11) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field about: %w", err) + } + g.About = value + } + if g.Flags.Has(13) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode groupCallParticipant#19adba89: field raise_hand_rating: %w", err) + } + g.RaiseHandRating = value + } return nil } diff --git a/tg/tl_input_file_location_gen.go b/tg/tl_input_file_location_gen.go index 8239c97e7d..fe733071a6 100644 --- a/tg/tl_input_file_location_gen.go +++ b/tg/tl_input_file_location_gen.go @@ -1609,6 +1609,167 @@ var ( _ InputFileLocationClass = &InputStickerSetThumb{} ) +// InputGroupCallStream represents TL type `inputGroupCallStream#bba51639`. +// +// See https://core.telegram.org/constructor/inputGroupCallStream for reference. +type InputGroupCallStream struct { + // Call field of InputGroupCallStream. + Call InputGroupCall + // TimeMs field of InputGroupCallStream. + TimeMs int64 + // Scale field of InputGroupCallStream. + Scale int +} + +// InputGroupCallStreamTypeID is TL type id of InputGroupCallStream. +const InputGroupCallStreamTypeID = 0xbba51639 + +func (i *InputGroupCallStream) Zero() bool { + if i == nil { + return true + } + if !(i.Call.Zero()) { + return false + } + if !(i.TimeMs == 0) { + return false + } + if !(i.Scale == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputGroupCallStream) String() string { + if i == nil { + return "InputGroupCallStream(nil)" + } + type Alias InputGroupCallStream + return fmt.Sprintf("InputGroupCallStream%+v", Alias(*i)) +} + +// FillFrom fills InputGroupCallStream from given interface. +func (i *InputGroupCallStream) FillFrom(from interface { + GetCall() (value InputGroupCall) + GetTimeMs() (value int64) + GetScale() (value int) +}) { + i.Call = from.GetCall() + i.TimeMs = from.GetTimeMs() + i.Scale = from.GetScale() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputGroupCallStream) TypeID() uint32 { + return InputGroupCallStreamTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputGroupCallStream) TypeName() string { + return "inputGroupCallStream" +} + +// TypeInfo returns info about TL type. +func (i *InputGroupCallStream) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputGroupCallStream", + ID: InputGroupCallStreamTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Call", + SchemaName: "call", + }, + { + Name: "TimeMs", + SchemaName: "time_ms", + }, + { + Name: "Scale", + SchemaName: "scale", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputGroupCallStream) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputGroupCallStream#bba51639 as nil") + } + b.PutID(InputGroupCallStreamTypeID) + if err := i.Call.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputGroupCallStream#bba51639: field call: %w", err) + } + b.PutLong(i.TimeMs) + b.PutInt(i.Scale) + return nil +} + +// GetCall returns value of Call field. +func (i *InputGroupCallStream) GetCall() (value InputGroupCall) { + return i.Call +} + +// GetTimeMs returns value of TimeMs field. +func (i *InputGroupCallStream) GetTimeMs() (value int64) { + return i.TimeMs +} + +// GetScale returns value of Scale field. +func (i *InputGroupCallStream) GetScale() (value int) { + return i.Scale +} + +// Decode implements bin.Decoder. +func (i *InputGroupCallStream) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputGroupCallStream#bba51639 to nil") + } + if err := b.ConsumeID(InputGroupCallStreamTypeID); err != nil { + return fmt.Errorf("unable to decode inputGroupCallStream#bba51639: %w", err) + } + { + if err := i.Call.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputGroupCallStream#bba51639: field call: %w", err) + } + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputGroupCallStream#bba51639: field time_ms: %w", err) + } + i.TimeMs = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputGroupCallStream#bba51639: field scale: %w", err) + } + i.Scale = value + } + return nil +} + +// construct implements constructor of InputFileLocationClass. +func (i InputGroupCallStream) construct() InputFileLocationClass { return &i } + +// Ensuring interfaces in compile-time for InputGroupCallStream. +var ( + _ bin.Encoder = &InputGroupCallStream{} + _ bin.Decoder = &InputGroupCallStream{} + + _ InputFileLocationClass = &InputGroupCallStream{} +) + // InputFileLocationClass represents InputFileLocation generic type. // // See https://core.telegram.org/type/InputFileLocation for reference. @@ -1628,6 +1789,7 @@ var ( // case *tg.InputPhotoLegacyFileLocation: // inputPhotoLegacyFileLocation#d83466f3 // case *tg.InputPeerPhotoFileLocation: // inputPeerPhotoFileLocation#27d69997 // case *tg.InputStickerSetThumb: // inputStickerSetThumb#dbaeae9 +// case *tg.InputGroupCallStream: // inputGroupCallStream#bba51639 // default: panic(v) // } type InputFileLocationClass interface { @@ -1717,6 +1879,13 @@ func DecodeInputFileLocation(buf *bin.Buffer) (InputFileLocationClass, error) { return nil, fmt.Errorf("unable to decode InputFileLocationClass: %w", err) } return &v, nil + case InputGroupCallStreamTypeID: + // Decoding inputGroupCallStream#bba51639. + v := InputGroupCallStream{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputFileLocationClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputFileLocationClass: %w", bin.NewUnexpectedID(id)) } @@ -1934,6 +2103,19 @@ func (s InputFileLocationClassArray) AsInputStickerSetThumb() (to InputStickerSe return to } +// AsInputGroupCallStream returns copy with only InputGroupCallStream constructors. +func (s InputFileLocationClassArray) AsInputGroupCallStream() (to InputGroupCallStreamArray) { + for _, elem := range s { + value, ok := elem.(*InputGroupCallStream) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // InputFileLocationArray is adapter for slice of InputFileLocation. type InputFileLocationArray []InputFileLocation @@ -2589,3 +2771,85 @@ func (s *InputStickerSetThumbArray) Pop() (v InputStickerSetThumb, ok bool) { return v, true } + +// InputGroupCallStreamArray is adapter for slice of InputGroupCallStream. +type InputGroupCallStreamArray []InputGroupCallStream + +// Sort sorts slice of InputGroupCallStream. +func (s InputGroupCallStreamArray) Sort(less func(a, b InputGroupCallStream) bool) InputGroupCallStreamArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputGroupCallStream. +func (s InputGroupCallStreamArray) SortStable(less func(a, b InputGroupCallStream) bool) InputGroupCallStreamArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputGroupCallStream. +func (s InputGroupCallStreamArray) Retain(keep func(x InputGroupCallStream) bool) InputGroupCallStreamArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputGroupCallStreamArray) First() (v InputGroupCallStream, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputGroupCallStreamArray) Last() (v InputGroupCallStream, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputGroupCallStreamArray) PopFirst() (v InputGroupCallStream, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputGroupCallStream + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputGroupCallStreamArray) Pop() (v InputGroupCallStream, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_messages_accept_url_auth_gen.go b/tg/tl_messages_accept_url_auth_gen.go index 1503d85975..b739f640d2 100644 --- a/tg/tl_messages_accept_url_auth_gen.go +++ b/tg/tl_messages_accept_url_auth_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// MessagesAcceptURLAuthRequest represents TL type `messages.acceptUrlAuth#f729ea98`. +// MessagesAcceptURLAuthRequest represents TL type `messages.acceptUrlAuth#b12c7125`. // Use this to accept a Seamless Telegram Login authorization request, for more info click here »¹ // // Links: @@ -42,15 +42,25 @@ type MessagesAcceptURLAuthRequest struct { // Set this flag to allow the bot to send messages to you (if requested) WriteAllowed bool // The location of the message + // + // Use SetPeer and GetPeer helpers. Peer InputPeerClass // Message ID of the message with the login button + // + // Use SetMsgID and GetMsgID helpers. MsgID int // ID of the login button + // + // Use SetButtonID and GetButtonID helpers. ButtonID int + // URL field of MessagesAcceptURLAuthRequest. + // + // Use SetURL and GetURL helpers. + URL string } // MessagesAcceptURLAuthRequestTypeID is TL type id of MessagesAcceptURLAuthRequest. -const MessagesAcceptURLAuthRequestTypeID = 0xf729ea98 +const MessagesAcceptURLAuthRequestTypeID = 0xb12c7125 func (a *MessagesAcceptURLAuthRequest) Zero() bool { if a == nil { @@ -71,6 +81,9 @@ func (a *MessagesAcceptURLAuthRequest) Zero() bool { if !(a.ButtonID == 0) { return false } + if !(a.URL == "") { + return false + } return true } @@ -87,14 +100,28 @@ func (a *MessagesAcceptURLAuthRequest) String() string { // FillFrom fills MessagesAcceptURLAuthRequest from given interface. func (a *MessagesAcceptURLAuthRequest) FillFrom(from interface { GetWriteAllowed() (value bool) - GetPeer() (value InputPeerClass) - GetMsgID() (value int) - GetButtonID() (value int) + GetPeer() (value InputPeerClass, ok bool) + GetMsgID() (value int, ok bool) + GetButtonID() (value int, ok bool) + GetURL() (value string, ok bool) }) { a.WriteAllowed = from.GetWriteAllowed() - a.Peer = from.GetPeer() - a.MsgID = from.GetMsgID() - a.ButtonID = from.GetButtonID() + if val, ok := from.GetPeer(); ok { + a.Peer = val + } + + if val, ok := from.GetMsgID(); ok { + a.MsgID = val + } + + if val, ok := from.GetButtonID(); ok { + a.ButtonID = val + } + + if val, ok := from.GetURL(); ok { + a.URL = val + } + } // TypeID returns type id in TL schema. @@ -128,14 +155,22 @@ func (a *MessagesAcceptURLAuthRequest) TypeInfo() tdp.Type { { Name: "Peer", SchemaName: "peer", + Null: !a.Flags.Has(1), }, { Name: "MsgID", SchemaName: "msg_id", + Null: !a.Flags.Has(1), }, { Name: "ButtonID", SchemaName: "button_id", + Null: !a.Flags.Has(1), + }, + { + Name: "URL", + SchemaName: "url", + Null: !a.Flags.Has(2), }, } return typ @@ -144,23 +179,44 @@ func (a *MessagesAcceptURLAuthRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (a *MessagesAcceptURLAuthRequest) Encode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode messages.acceptUrlAuth#f729ea98 as nil") + return fmt.Errorf("can't encode messages.acceptUrlAuth#b12c7125 as nil") } b.PutID(MessagesAcceptURLAuthRequestTypeID) if !(a.WriteAllowed == false) { a.Flags.Set(0) } + if !(a.Peer == nil) { + a.Flags.Set(1) + } + if !(a.MsgID == 0) { + a.Flags.Set(1) + } + if !(a.ButtonID == 0) { + a.Flags.Set(1) + } + if !(a.URL == "") { + a.Flags.Set(2) + } if err := a.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.acceptUrlAuth#f729ea98: field flags: %w", err) + return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field flags: %w", err) } - if a.Peer == nil { - return fmt.Errorf("unable to encode messages.acceptUrlAuth#f729ea98: field peer is nil") + if a.Flags.Has(1) { + if a.Peer == nil { + return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field peer is nil") + } + if err := a.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field peer: %w", err) + } + } + if a.Flags.Has(1) { + b.PutInt(a.MsgID) + } + if a.Flags.Has(1) { + b.PutInt(a.ButtonID) } - if err := a.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.acceptUrlAuth#f729ea98: field peer: %w", err) + if a.Flags.Has(2) { + b.PutString(a.URL) } - b.PutInt(a.MsgID) - b.PutInt(a.ButtonID) return nil } @@ -180,56 +236,108 @@ func (a *MessagesAcceptURLAuthRequest) GetWriteAllowed() (value bool) { return a.Flags.Has(0) } -// GetPeer returns value of Peer field. -func (a *MessagesAcceptURLAuthRequest) GetPeer() (value InputPeerClass) { - return a.Peer +// SetPeer sets value of Peer conditional field. +func (a *MessagesAcceptURLAuthRequest) SetPeer(value InputPeerClass) { + a.Flags.Set(1) + a.Peer = value +} + +// GetPeer returns value of Peer conditional field and +// boolean which is true if field was set. +func (a *MessagesAcceptURLAuthRequest) GetPeer() (value InputPeerClass, ok bool) { + if !a.Flags.Has(1) { + return value, false + } + return a.Peer, true +} + +// SetMsgID sets value of MsgID conditional field. +func (a *MessagesAcceptURLAuthRequest) SetMsgID(value int) { + a.Flags.Set(1) + a.MsgID = value +} + +// GetMsgID returns value of MsgID conditional field and +// boolean which is true if field was set. +func (a *MessagesAcceptURLAuthRequest) GetMsgID() (value int, ok bool) { + if !a.Flags.Has(1) { + return value, false + } + return a.MsgID, true } -// GetMsgID returns value of MsgID field. -func (a *MessagesAcceptURLAuthRequest) GetMsgID() (value int) { - return a.MsgID +// SetButtonID sets value of ButtonID conditional field. +func (a *MessagesAcceptURLAuthRequest) SetButtonID(value int) { + a.Flags.Set(1) + a.ButtonID = value } -// GetButtonID returns value of ButtonID field. -func (a *MessagesAcceptURLAuthRequest) GetButtonID() (value int) { - return a.ButtonID +// GetButtonID returns value of ButtonID conditional field and +// boolean which is true if field was set. +func (a *MessagesAcceptURLAuthRequest) GetButtonID() (value int, ok bool) { + if !a.Flags.Has(1) { + return value, false + } + return a.ButtonID, true +} + +// SetURL sets value of URL conditional field. +func (a *MessagesAcceptURLAuthRequest) SetURL(value string) { + a.Flags.Set(2) + a.URL = value +} + +// GetURL returns value of URL conditional field and +// boolean which is true if field was set. +func (a *MessagesAcceptURLAuthRequest) GetURL() (value string, ok bool) { + if !a.Flags.Has(2) { + return value, false + } + return a.URL, true } // Decode implements bin.Decoder. func (a *MessagesAcceptURLAuthRequest) Decode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode messages.acceptUrlAuth#f729ea98 to nil") + return fmt.Errorf("can't decode messages.acceptUrlAuth#b12c7125 to nil") } if err := b.ConsumeID(MessagesAcceptURLAuthRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#f729ea98: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: %w", err) } { if err := a.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#f729ea98: field flags: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field flags: %w", err) } } a.WriteAllowed = a.Flags.Has(0) - { + if a.Flags.Has(1) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#f729ea98: field peer: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field peer: %w", err) } a.Peer = value } - { + if a.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#f729ea98: field msg_id: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field msg_id: %w", err) } a.MsgID = value } - { + if a.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#f729ea98: field button_id: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field button_id: %w", err) } a.ButtonID = value } + if a.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field url: %w", err) + } + a.URL = value + } return nil } @@ -239,7 +347,7 @@ var ( _ bin.Decoder = &MessagesAcceptURLAuthRequest{} ) -// MessagesAcceptURLAuth invokes method messages.acceptUrlAuth#f729ea98 returning error if any. +// MessagesAcceptURLAuth invokes method messages.acceptUrlAuth#b12c7125 returning error if any. // Use this to accept a Seamless Telegram Login authorization request, for more info click here »¹ // // Links: diff --git a/tg/tl_messages_check_history_import_peer_gen.go b/tg/tl_messages_check_history_import_peer_gen.go new file mode 100644 index 0000000000..93458d7e76 --- /dev/null +++ b/tg/tl_messages_check_history_import_peer_gen.go @@ -0,0 +1,155 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// MessagesCheckHistoryImportPeerRequest represents TL type `messages.checkHistoryImportPeer#5dc60f03`. +// +// See https://core.telegram.org/method/messages.checkHistoryImportPeer for reference. +type MessagesCheckHistoryImportPeerRequest struct { + // Peer field of MessagesCheckHistoryImportPeerRequest. + Peer InputPeerClass +} + +// MessagesCheckHistoryImportPeerRequestTypeID is TL type id of MessagesCheckHistoryImportPeerRequest. +const MessagesCheckHistoryImportPeerRequestTypeID = 0x5dc60f03 + +func (c *MessagesCheckHistoryImportPeerRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Peer == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *MessagesCheckHistoryImportPeerRequest) String() string { + if c == nil { + return "MessagesCheckHistoryImportPeerRequest(nil)" + } + type Alias MessagesCheckHistoryImportPeerRequest + return fmt.Sprintf("MessagesCheckHistoryImportPeerRequest%+v", Alias(*c)) +} + +// FillFrom fills MessagesCheckHistoryImportPeerRequest from given interface. +func (c *MessagesCheckHistoryImportPeerRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) +}) { + c.Peer = from.GetPeer() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesCheckHistoryImportPeerRequest) TypeID() uint32 { + return MessagesCheckHistoryImportPeerRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesCheckHistoryImportPeerRequest) TypeName() string { + return "messages.checkHistoryImportPeer" +} + +// TypeInfo returns info about TL type. +func (c *MessagesCheckHistoryImportPeerRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.checkHistoryImportPeer", + ID: MessagesCheckHistoryImportPeerRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *MessagesCheckHistoryImportPeerRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.checkHistoryImportPeer#5dc60f03 as nil") + } + b.PutID(MessagesCheckHistoryImportPeerRequestTypeID) + if c.Peer == nil { + return fmt.Errorf("unable to encode messages.checkHistoryImportPeer#5dc60f03: field peer is nil") + } + if err := c.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.checkHistoryImportPeer#5dc60f03: field peer: %w", err) + } + return nil +} + +// GetPeer returns value of Peer field. +func (c *MessagesCheckHistoryImportPeerRequest) GetPeer() (value InputPeerClass) { + return c.Peer +} + +// Decode implements bin.Decoder. +func (c *MessagesCheckHistoryImportPeerRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.checkHistoryImportPeer#5dc60f03 to nil") + } + if err := b.ConsumeID(MessagesCheckHistoryImportPeerRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.checkHistoryImportPeer#5dc60f03: %w", err) + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.checkHistoryImportPeer#5dc60f03: field peer: %w", err) + } + c.Peer = value + } + return nil +} + +// Ensuring interfaces in compile-time for MessagesCheckHistoryImportPeerRequest. +var ( + _ bin.Encoder = &MessagesCheckHistoryImportPeerRequest{} + _ bin.Decoder = &MessagesCheckHistoryImportPeerRequest{} +) + +// MessagesCheckHistoryImportPeer invokes method messages.checkHistoryImportPeer#5dc60f03 returning error if any. +// +// See https://core.telegram.org/method/messages.checkHistoryImportPeer for reference. +func (c *Client) MessagesCheckHistoryImportPeer(ctx context.Context, peer InputPeerClass) (*MessagesCheckedHistoryImportPeer, error) { + var result MessagesCheckedHistoryImportPeer + + request := &MessagesCheckHistoryImportPeerRequest{ + Peer: peer, + } + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_messages_checked_history_import_peer_gen.go b/tg/tl_messages_checked_history_import_peer_gen.go new file mode 100644 index 0000000000..c9ce0b4704 --- /dev/null +++ b/tg/tl_messages_checked_history_import_peer_gen.go @@ -0,0 +1,135 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// MessagesCheckedHistoryImportPeer represents TL type `messages.checkedHistoryImportPeer#a24de717`. +// +// See https://core.telegram.org/constructor/messages.checkedHistoryImportPeer for reference. +type MessagesCheckedHistoryImportPeer struct { + // ConfirmText field of MessagesCheckedHistoryImportPeer. + ConfirmText string +} + +// MessagesCheckedHistoryImportPeerTypeID is TL type id of MessagesCheckedHistoryImportPeer. +const MessagesCheckedHistoryImportPeerTypeID = 0xa24de717 + +func (c *MessagesCheckedHistoryImportPeer) Zero() bool { + if c == nil { + return true + } + if !(c.ConfirmText == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *MessagesCheckedHistoryImportPeer) String() string { + if c == nil { + return "MessagesCheckedHistoryImportPeer(nil)" + } + type Alias MessagesCheckedHistoryImportPeer + return fmt.Sprintf("MessagesCheckedHistoryImportPeer%+v", Alias(*c)) +} + +// FillFrom fills MessagesCheckedHistoryImportPeer from given interface. +func (c *MessagesCheckedHistoryImportPeer) FillFrom(from interface { + GetConfirmText() (value string) +}) { + c.ConfirmText = from.GetConfirmText() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesCheckedHistoryImportPeer) TypeID() uint32 { + return MessagesCheckedHistoryImportPeerTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesCheckedHistoryImportPeer) TypeName() string { + return "messages.checkedHistoryImportPeer" +} + +// TypeInfo returns info about TL type. +func (c *MessagesCheckedHistoryImportPeer) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.checkedHistoryImportPeer", + ID: MessagesCheckedHistoryImportPeerTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ConfirmText", + SchemaName: "confirm_text", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *MessagesCheckedHistoryImportPeer) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.checkedHistoryImportPeer#a24de717 as nil") + } + b.PutID(MessagesCheckedHistoryImportPeerTypeID) + b.PutString(c.ConfirmText) + return nil +} + +// GetConfirmText returns value of ConfirmText field. +func (c *MessagesCheckedHistoryImportPeer) GetConfirmText() (value string) { + return c.ConfirmText +} + +// Decode implements bin.Decoder. +func (c *MessagesCheckedHistoryImportPeer) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.checkedHistoryImportPeer#a24de717 to nil") + } + if err := b.ConsumeID(MessagesCheckedHistoryImportPeerTypeID); err != nil { + return fmt.Errorf("unable to decode messages.checkedHistoryImportPeer#a24de717: %w", err) + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.checkedHistoryImportPeer#a24de717: field confirm_text: %w", err) + } + c.ConfirmText = value + } + return nil +} + +// Ensuring interfaces in compile-time for MessagesCheckedHistoryImportPeer. +var ( + _ bin.Encoder = &MessagesCheckedHistoryImportPeer{} + _ bin.Decoder = &MessagesCheckedHistoryImportPeer{} +) diff --git a/tg/tl_messages_get_exported_chat_invite_gen.go b/tg/tl_messages_get_exported_chat_invite_gen.go new file mode 100644 index 0000000000..8c64fbc1ad --- /dev/null +++ b/tg/tl_messages_get_exported_chat_invite_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// MessagesGetExportedChatInviteRequest represents TL type `messages.getExportedChatInvite#73746f5c`. +// +// See https://core.telegram.org/method/messages.getExportedChatInvite for reference. +type MessagesGetExportedChatInviteRequest struct { + // Peer field of MessagesGetExportedChatInviteRequest. + Peer InputPeerClass + // Link field of MessagesGetExportedChatInviteRequest. + Link string +} + +// MessagesGetExportedChatInviteRequestTypeID is TL type id of MessagesGetExportedChatInviteRequest. +const MessagesGetExportedChatInviteRequestTypeID = 0x73746f5c + +func (g *MessagesGetExportedChatInviteRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + if !(g.Link == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetExportedChatInviteRequest) String() string { + if g == nil { + return "MessagesGetExportedChatInviteRequest(nil)" + } + type Alias MessagesGetExportedChatInviteRequest + return fmt.Sprintf("MessagesGetExportedChatInviteRequest%+v", Alias(*g)) +} + +// FillFrom fills MessagesGetExportedChatInviteRequest from given interface. +func (g *MessagesGetExportedChatInviteRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetLink() (value string) +}) { + g.Peer = from.GetPeer() + g.Link = from.GetLink() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetExportedChatInviteRequest) TypeID() uint32 { + return MessagesGetExportedChatInviteRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetExportedChatInviteRequest) TypeName() string { + return "messages.getExportedChatInvite" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetExportedChatInviteRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getExportedChatInvite", + ID: MessagesGetExportedChatInviteRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Link", + SchemaName: "link", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetExportedChatInviteRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getExportedChatInvite#73746f5c as nil") + } + b.PutID(MessagesGetExportedChatInviteRequestTypeID) + if g.Peer == nil { + return fmt.Errorf("unable to encode messages.getExportedChatInvite#73746f5c: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.getExportedChatInvite#73746f5c: field peer: %w", err) + } + b.PutString(g.Link) + return nil +} + +// GetPeer returns value of Peer field. +func (g *MessagesGetExportedChatInviteRequest) GetPeer() (value InputPeerClass) { + return g.Peer +} + +// GetLink returns value of Link field. +func (g *MessagesGetExportedChatInviteRequest) GetLink() (value string) { + return g.Link +} + +// Decode implements bin.Decoder. +func (g *MessagesGetExportedChatInviteRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getExportedChatInvite#73746f5c to nil") + } + if err := b.ConsumeID(MessagesGetExportedChatInviteRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getExportedChatInvite#73746f5c: %w", err) + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.getExportedChatInvite#73746f5c: field peer: %w", err) + } + g.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.getExportedChatInvite#73746f5c: field link: %w", err) + } + g.Link = value + } + return nil +} + +// Ensuring interfaces in compile-time for MessagesGetExportedChatInviteRequest. +var ( + _ bin.Encoder = &MessagesGetExportedChatInviteRequest{} + _ bin.Decoder = &MessagesGetExportedChatInviteRequest{} +) + +// MessagesGetExportedChatInvite invokes method messages.getExportedChatInvite#73746f5c returning error if any. +// +// See https://core.telegram.org/method/messages.getExportedChatInvite for reference. +func (c *Client) MessagesGetExportedChatInvite(ctx context.Context, request *MessagesGetExportedChatInviteRequest) (MessagesExportedChatInviteClass, error) { + var result MessagesExportedChatInviteBox + + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return result.ExportedChatInvite, nil +} diff --git a/tg/tl_messages_request_url_auth_gen.go b/tg/tl_messages_request_url_auth_gen.go index acffed3dd2..2773b84a06 100644 --- a/tg/tl_messages_request_url_auth_gen.go +++ b/tg/tl_messages_request_url_auth_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// MessagesRequestURLAuthRequest represents TL type `messages.requestUrlAuth#e33f5613`. +// MessagesRequestURLAuthRequest represents TL type `messages.requestUrlAuth#198fb446`. // Get more info about a Seamless Telegram Login authorization request, for more info click here »¹ // // Links: @@ -34,21 +34,36 @@ var ( // // See https://core.telegram.org/method/messages.requestUrlAuth for reference. type MessagesRequestURLAuthRequest struct { + // Flags field of MessagesRequestURLAuthRequest. + Flags bin.Fields // Peer where the message is located + // + // Use SetPeer and GetPeer helpers. Peer InputPeerClass // The message + // + // Use SetMsgID and GetMsgID helpers. MsgID int // The ID of the button with the authorization request + // + // Use SetButtonID and GetButtonID helpers. ButtonID int + // URL field of MessagesRequestURLAuthRequest. + // + // Use SetURL and GetURL helpers. + URL string } // MessagesRequestURLAuthRequestTypeID is TL type id of MessagesRequestURLAuthRequest. -const MessagesRequestURLAuthRequestTypeID = 0xe33f5613 +const MessagesRequestURLAuthRequestTypeID = 0x198fb446 func (r *MessagesRequestURLAuthRequest) Zero() bool { if r == nil { return true } + if !(r.Flags.Zero()) { + return false + } if !(r.Peer == nil) { return false } @@ -58,6 +73,9 @@ func (r *MessagesRequestURLAuthRequest) Zero() bool { if !(r.ButtonID == 0) { return false } + if !(r.URL == "") { + return false + } return true } @@ -73,13 +91,27 @@ func (r *MessagesRequestURLAuthRequest) String() string { // FillFrom fills MessagesRequestURLAuthRequest from given interface. func (r *MessagesRequestURLAuthRequest) FillFrom(from interface { - GetPeer() (value InputPeerClass) - GetMsgID() (value int) - GetButtonID() (value int) + GetPeer() (value InputPeerClass, ok bool) + GetMsgID() (value int, ok bool) + GetButtonID() (value int, ok bool) + GetURL() (value string, ok bool) }) { - r.Peer = from.GetPeer() - r.MsgID = from.GetMsgID() - r.ButtonID = from.GetButtonID() + if val, ok := from.GetPeer(); ok { + r.Peer = val + } + + if val, ok := from.GetMsgID(); ok { + r.MsgID = val + } + + if val, ok := from.GetButtonID(); ok { + r.ButtonID = val + } + + if val, ok := from.GetURL(); ok { + r.URL = val + } + } // TypeID returns type id in TL schema. @@ -108,14 +140,22 @@ func (r *MessagesRequestURLAuthRequest) TypeInfo() tdp.Type { { Name: "Peer", SchemaName: "peer", + Null: !r.Flags.Has(1), }, { Name: "MsgID", SchemaName: "msg_id", + Null: !r.Flags.Has(1), }, { Name: "ButtonID", SchemaName: "button_id", + Null: !r.Flags.Has(1), + }, + { + Name: "URL", + SchemaName: "url", + Null: !r.Flags.Has(2), }, } return typ @@ -124,64 +164,145 @@ func (r *MessagesRequestURLAuthRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (r *MessagesRequestURLAuthRequest) Encode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestUrlAuth#e33f5613 as nil") + return fmt.Errorf("can't encode messages.requestUrlAuth#198fb446 as nil") } b.PutID(MessagesRequestURLAuthRequestTypeID) - if r.Peer == nil { - return fmt.Errorf("unable to encode messages.requestUrlAuth#e33f5613: field peer is nil") + if !(r.Peer == nil) { + r.Flags.Set(1) + } + if !(r.MsgID == 0) { + r.Flags.Set(1) + } + if !(r.ButtonID == 0) { + r.Flags.Set(1) + } + if !(r.URL == "") { + r.Flags.Set(2) + } + if err := r.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field flags: %w", err) + } + if r.Flags.Has(1) { + if r.Peer == nil { + return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field peer is nil") + } + if err := r.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field peer: %w", err) + } } - if err := r.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestUrlAuth#e33f5613: field peer: %w", err) + if r.Flags.Has(1) { + b.PutInt(r.MsgID) + } + if r.Flags.Has(1) { + b.PutInt(r.ButtonID) + } + if r.Flags.Has(2) { + b.PutString(r.URL) } - b.PutInt(r.MsgID) - b.PutInt(r.ButtonID) return nil } -// GetPeer returns value of Peer field. -func (r *MessagesRequestURLAuthRequest) GetPeer() (value InputPeerClass) { - return r.Peer +// SetPeer sets value of Peer conditional field. +func (r *MessagesRequestURLAuthRequest) SetPeer(value InputPeerClass) { + r.Flags.Set(1) + r.Peer = value +} + +// GetPeer returns value of Peer conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestURLAuthRequest) GetPeer() (value InputPeerClass, ok bool) { + if !r.Flags.Has(1) { + return value, false + } + return r.Peer, true +} + +// SetMsgID sets value of MsgID conditional field. +func (r *MessagesRequestURLAuthRequest) SetMsgID(value int) { + r.Flags.Set(1) + r.MsgID = value +} + +// GetMsgID returns value of MsgID conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestURLAuthRequest) GetMsgID() (value int, ok bool) { + if !r.Flags.Has(1) { + return value, false + } + return r.MsgID, true } -// GetMsgID returns value of MsgID field. -func (r *MessagesRequestURLAuthRequest) GetMsgID() (value int) { - return r.MsgID +// SetButtonID sets value of ButtonID conditional field. +func (r *MessagesRequestURLAuthRequest) SetButtonID(value int) { + r.Flags.Set(1) + r.ButtonID = value } -// GetButtonID returns value of ButtonID field. -func (r *MessagesRequestURLAuthRequest) GetButtonID() (value int) { - return r.ButtonID +// GetButtonID returns value of ButtonID conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestURLAuthRequest) GetButtonID() (value int, ok bool) { + if !r.Flags.Has(1) { + return value, false + } + return r.ButtonID, true +} + +// SetURL sets value of URL conditional field. +func (r *MessagesRequestURLAuthRequest) SetURL(value string) { + r.Flags.Set(2) + r.URL = value +} + +// GetURL returns value of URL conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestURLAuthRequest) GetURL() (value string, ok bool) { + if !r.Flags.Has(2) { + return value, false + } + return r.URL, true } // Decode implements bin.Decoder. func (r *MessagesRequestURLAuthRequest) Decode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestUrlAuth#e33f5613 to nil") + return fmt.Errorf("can't decode messages.requestUrlAuth#198fb446 to nil") } if err := b.ConsumeID(MessagesRequestURLAuthRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#e33f5613: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: %w", err) } { + if err := r.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field flags: %w", err) + } + } + if r.Flags.Has(1) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#e33f5613: field peer: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field peer: %w", err) } r.Peer = value } - { + if r.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#e33f5613: field msg_id: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field msg_id: %w", err) } r.MsgID = value } - { + if r.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#e33f5613: field button_id: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field button_id: %w", err) } r.ButtonID = value } + if r.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field url: %w", err) + } + r.URL = value + } return nil } @@ -191,7 +312,7 @@ var ( _ bin.Decoder = &MessagesRequestURLAuthRequest{} ) -// MessagesRequestURLAuth invokes method messages.requestUrlAuth#e33f5613 returning error if any. +// MessagesRequestURLAuth invokes method messages.requestUrlAuth#198fb446 returning error if any. // Get more info about a Seamless Telegram Login authorization request, for more info click here »¹ // // Links: diff --git a/tg/tl_phone_edit_group_call_member_gen.go b/tg/tl_phone_edit_group_call_member_gen.go deleted file mode 100644 index e874d07c42..0000000000 --- a/tg/tl_phone_edit_group_call_member_gen.go +++ /dev/null @@ -1,266 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} -) - -// PhoneEditGroupCallMemberRequest represents TL type `phone.editGroupCallMember#a5e76cd8`. -// -// See https://core.telegram.org/method/phone.editGroupCallMember for reference. -type PhoneEditGroupCallMemberRequest struct { - // Flags field of PhoneEditGroupCallMemberRequest. - Flags bin.Fields - // Muted field of PhoneEditGroupCallMemberRequest. - Muted bool - // Call field of PhoneEditGroupCallMemberRequest. - Call InputGroupCall - // UserID field of PhoneEditGroupCallMemberRequest. - UserID InputUserClass - // Volume field of PhoneEditGroupCallMemberRequest. - // - // Use SetVolume and GetVolume helpers. - Volume int -} - -// PhoneEditGroupCallMemberRequestTypeID is TL type id of PhoneEditGroupCallMemberRequest. -const PhoneEditGroupCallMemberRequestTypeID = 0xa5e76cd8 - -func (e *PhoneEditGroupCallMemberRequest) Zero() bool { - if e == nil { - return true - } - if !(e.Flags.Zero()) { - return false - } - if !(e.Muted == false) { - return false - } - if !(e.Call.Zero()) { - return false - } - if !(e.UserID == nil) { - return false - } - if !(e.Volume == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *PhoneEditGroupCallMemberRequest) String() string { - if e == nil { - return "PhoneEditGroupCallMemberRequest(nil)" - } - type Alias PhoneEditGroupCallMemberRequest - return fmt.Sprintf("PhoneEditGroupCallMemberRequest%+v", Alias(*e)) -} - -// FillFrom fills PhoneEditGroupCallMemberRequest from given interface. -func (e *PhoneEditGroupCallMemberRequest) FillFrom(from interface { - GetMuted() (value bool) - GetCall() (value InputGroupCall) - GetUserID() (value InputUserClass) - GetVolume() (value int, ok bool) -}) { - e.Muted = from.GetMuted() - e.Call = from.GetCall() - e.UserID = from.GetUserID() - if val, ok := from.GetVolume(); ok { - e.Volume = val - } - -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhoneEditGroupCallMemberRequest) TypeID() uint32 { - return PhoneEditGroupCallMemberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhoneEditGroupCallMemberRequest) TypeName() string { - return "phone.editGroupCallMember" -} - -// TypeInfo returns info about TL type. -func (e *PhoneEditGroupCallMemberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "phone.editGroupCallMember", - ID: PhoneEditGroupCallMemberRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Muted", - SchemaName: "muted", - Null: !e.Flags.Has(0), - }, - { - Name: "Call", - SchemaName: "call", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Volume", - SchemaName: "volume", - Null: !e.Flags.Has(1), - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *PhoneEditGroupCallMemberRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode phone.editGroupCallMember#a5e76cd8 as nil") - } - b.PutID(PhoneEditGroupCallMemberRequestTypeID) - if !(e.Muted == false) { - e.Flags.Set(0) - } - if !(e.Volume == 0) { - e.Flags.Set(1) - } - if err := e.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.editGroupCallMember#a5e76cd8: field flags: %w", err) - } - if err := e.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.editGroupCallMember#a5e76cd8: field call: %w", err) - } - if e.UserID == nil { - return fmt.Errorf("unable to encode phone.editGroupCallMember#a5e76cd8: field user_id is nil") - } - if err := e.UserID.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.editGroupCallMember#a5e76cd8: field user_id: %w", err) - } - if e.Flags.Has(1) { - b.PutInt(e.Volume) - } - return nil -} - -// SetMuted sets value of Muted conditional field. -func (e *PhoneEditGroupCallMemberRequest) SetMuted(value bool) { - if value { - e.Flags.Set(0) - e.Muted = true - } else { - e.Flags.Unset(0) - e.Muted = false - } -} - -// GetMuted returns value of Muted conditional field. -func (e *PhoneEditGroupCallMemberRequest) GetMuted() (value bool) { - return e.Flags.Has(0) -} - -// GetCall returns value of Call field. -func (e *PhoneEditGroupCallMemberRequest) GetCall() (value InputGroupCall) { - return e.Call -} - -// GetUserID returns value of UserID field. -func (e *PhoneEditGroupCallMemberRequest) GetUserID() (value InputUserClass) { - return e.UserID -} - -// SetVolume sets value of Volume conditional field. -func (e *PhoneEditGroupCallMemberRequest) SetVolume(value int) { - e.Flags.Set(1) - e.Volume = value -} - -// GetVolume returns value of Volume conditional field and -// boolean which is true if field was set. -func (e *PhoneEditGroupCallMemberRequest) GetVolume() (value int, ok bool) { - if !e.Flags.Has(1) { - return value, false - } - return e.Volume, true -} - -// Decode implements bin.Decoder. -func (e *PhoneEditGroupCallMemberRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode phone.editGroupCallMember#a5e76cd8 to nil") - } - if err := b.ConsumeID(PhoneEditGroupCallMemberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode phone.editGroupCallMember#a5e76cd8: %w", err) - } - { - if err := e.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.editGroupCallMember#a5e76cd8: field flags: %w", err) - } - } - e.Muted = e.Flags.Has(0) - { - if err := e.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.editGroupCallMember#a5e76cd8: field call: %w", err) - } - } - { - value, err := DecodeInputUser(b) - if err != nil { - return fmt.Errorf("unable to decode phone.editGroupCallMember#a5e76cd8: field user_id: %w", err) - } - e.UserID = value - } - if e.Flags.Has(1) { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode phone.editGroupCallMember#a5e76cd8: field volume: %w", err) - } - e.Volume = value - } - return nil -} - -// Ensuring interfaces in compile-time for PhoneEditGroupCallMemberRequest. -var ( - _ bin.Encoder = &PhoneEditGroupCallMemberRequest{} - _ bin.Decoder = &PhoneEditGroupCallMemberRequest{} -) - -// PhoneEditGroupCallMember invokes method phone.editGroupCallMember#a5e76cd8 returning error if any. -// -// See https://core.telegram.org/method/phone.editGroupCallMember for reference. -func (c *Client) PhoneEditGroupCallMember(ctx context.Context, request *PhoneEditGroupCallMemberRequest) (UpdatesClass, error) { - var result UpdatesBox - - if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { - return nil, err - } - return result.Updates, nil -} diff --git a/tg/tl_phone_edit_group_call_participant_gen.go b/tg/tl_phone_edit_group_call_participant_gen.go new file mode 100644 index 0000000000..129f73a2f9 --- /dev/null +++ b/tg/tl_phone_edit_group_call_participant_gen.go @@ -0,0 +1,311 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneEditGroupCallParticipantRequest represents TL type `phone.editGroupCallParticipant#d975eb80`. +// +// See https://core.telegram.org/method/phone.editGroupCallParticipant for reference. +type PhoneEditGroupCallParticipantRequest struct { + // Flags field of PhoneEditGroupCallParticipantRequest. + Flags bin.Fields + // Muted field of PhoneEditGroupCallParticipantRequest. + Muted bool + // Call field of PhoneEditGroupCallParticipantRequest. + Call InputGroupCall + // Participant field of PhoneEditGroupCallParticipantRequest. + Participant InputPeerClass + // Volume field of PhoneEditGroupCallParticipantRequest. + // + // Use SetVolume and GetVolume helpers. + Volume int + // RaiseHand field of PhoneEditGroupCallParticipantRequest. + // + // Use SetRaiseHand and GetRaiseHand helpers. + RaiseHand bool +} + +// PhoneEditGroupCallParticipantRequestTypeID is TL type id of PhoneEditGroupCallParticipantRequest. +const PhoneEditGroupCallParticipantRequestTypeID = 0xd975eb80 + +func (e *PhoneEditGroupCallParticipantRequest) Zero() bool { + if e == nil { + return true + } + if !(e.Flags.Zero()) { + return false + } + if !(e.Muted == false) { + return false + } + if !(e.Call.Zero()) { + return false + } + if !(e.Participant == nil) { + return false + } + if !(e.Volume == 0) { + return false + } + if !(e.RaiseHand == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *PhoneEditGroupCallParticipantRequest) String() string { + if e == nil { + return "PhoneEditGroupCallParticipantRequest(nil)" + } + type Alias PhoneEditGroupCallParticipantRequest + return fmt.Sprintf("PhoneEditGroupCallParticipantRequest%+v", Alias(*e)) +} + +// FillFrom fills PhoneEditGroupCallParticipantRequest from given interface. +func (e *PhoneEditGroupCallParticipantRequest) FillFrom(from interface { + GetMuted() (value bool) + GetCall() (value InputGroupCall) + GetParticipant() (value InputPeerClass) + GetVolume() (value int, ok bool) + GetRaiseHand() (value bool, ok bool) +}) { + e.Muted = from.GetMuted() + e.Call = from.GetCall() + e.Participant = from.GetParticipant() + if val, ok := from.GetVolume(); ok { + e.Volume = val + } + + if val, ok := from.GetRaiseHand(); ok { + e.RaiseHand = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneEditGroupCallParticipantRequest) TypeID() uint32 { + return PhoneEditGroupCallParticipantRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneEditGroupCallParticipantRequest) TypeName() string { + return "phone.editGroupCallParticipant" +} + +// TypeInfo returns info about TL type. +func (e *PhoneEditGroupCallParticipantRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.editGroupCallParticipant", + ID: PhoneEditGroupCallParticipantRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Muted", + SchemaName: "muted", + Null: !e.Flags.Has(0), + }, + { + Name: "Call", + SchemaName: "call", + }, + { + Name: "Participant", + SchemaName: "participant", + }, + { + Name: "Volume", + SchemaName: "volume", + Null: !e.Flags.Has(1), + }, + { + Name: "RaiseHand", + SchemaName: "raise_hand", + Null: !e.Flags.Has(2), + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *PhoneEditGroupCallParticipantRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode phone.editGroupCallParticipant#d975eb80 as nil") + } + b.PutID(PhoneEditGroupCallParticipantRequestTypeID) + if !(e.Muted == false) { + e.Flags.Set(0) + } + if !(e.Volume == 0) { + e.Flags.Set(1) + } + if !(e.RaiseHand == false) { + e.Flags.Set(2) + } + if err := e.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.editGroupCallParticipant#d975eb80: field flags: %w", err) + } + if err := e.Call.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.editGroupCallParticipant#d975eb80: field call: %w", err) + } + if e.Participant == nil { + return fmt.Errorf("unable to encode phone.editGroupCallParticipant#d975eb80: field participant is nil") + } + if err := e.Participant.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.editGroupCallParticipant#d975eb80: field participant: %w", err) + } + if e.Flags.Has(1) { + b.PutInt(e.Volume) + } + if e.Flags.Has(2) { + b.PutBool(e.RaiseHand) + } + return nil +} + +// SetMuted sets value of Muted conditional field. +func (e *PhoneEditGroupCallParticipantRequest) SetMuted(value bool) { + if value { + e.Flags.Set(0) + e.Muted = true + } else { + e.Flags.Unset(0) + e.Muted = false + } +} + +// GetMuted returns value of Muted conditional field. +func (e *PhoneEditGroupCallParticipantRequest) GetMuted() (value bool) { + return e.Flags.Has(0) +} + +// GetCall returns value of Call field. +func (e *PhoneEditGroupCallParticipantRequest) GetCall() (value InputGroupCall) { + return e.Call +} + +// GetParticipant returns value of Participant field. +func (e *PhoneEditGroupCallParticipantRequest) GetParticipant() (value InputPeerClass) { + return e.Participant +} + +// SetVolume sets value of Volume conditional field. +func (e *PhoneEditGroupCallParticipantRequest) SetVolume(value int) { + e.Flags.Set(1) + e.Volume = value +} + +// GetVolume returns value of Volume conditional field and +// boolean which is true if field was set. +func (e *PhoneEditGroupCallParticipantRequest) GetVolume() (value int, ok bool) { + if !e.Flags.Has(1) { + return value, false + } + return e.Volume, true +} + +// SetRaiseHand sets value of RaiseHand conditional field. +func (e *PhoneEditGroupCallParticipantRequest) SetRaiseHand(value bool) { + e.Flags.Set(2) + e.RaiseHand = value +} + +// GetRaiseHand returns value of RaiseHand conditional field and +// boolean which is true if field was set. +func (e *PhoneEditGroupCallParticipantRequest) GetRaiseHand() (value bool, ok bool) { + if !e.Flags.Has(2) { + return value, false + } + return e.RaiseHand, true +} + +// Decode implements bin.Decoder. +func (e *PhoneEditGroupCallParticipantRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode phone.editGroupCallParticipant#d975eb80 to nil") + } + if err := b.ConsumeID(PhoneEditGroupCallParticipantRequestTypeID); err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallParticipant#d975eb80: %w", err) + } + { + if err := e.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallParticipant#d975eb80: field flags: %w", err) + } + } + e.Muted = e.Flags.Has(0) + { + if err := e.Call.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallParticipant#d975eb80: field call: %w", err) + } + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallParticipant#d975eb80: field participant: %w", err) + } + e.Participant = value + } + if e.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallParticipant#d975eb80: field volume: %w", err) + } + e.Volume = value + } + if e.Flags.Has(2) { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallParticipant#d975eb80: field raise_hand: %w", err) + } + e.RaiseHand = value + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneEditGroupCallParticipantRequest. +var ( + _ bin.Encoder = &PhoneEditGroupCallParticipantRequest{} + _ bin.Decoder = &PhoneEditGroupCallParticipantRequest{} +) + +// PhoneEditGroupCallParticipant invokes method phone.editGroupCallParticipant#d975eb80 returning error if any. +// +// See https://core.telegram.org/method/phone.editGroupCallParticipant for reference. +func (c *Client) PhoneEditGroupCallParticipant(ctx context.Context, request *PhoneEditGroupCallParticipantRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_phone_edit_group_call_title_gen.go b/tg/tl_phone_edit_group_call_title_gen.go new file mode 100644 index 0000000000..f6266ec7f1 --- /dev/null +++ b/tg/tl_phone_edit_group_call_title_gen.go @@ -0,0 +1,171 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneEditGroupCallTitleRequest represents TL type `phone.editGroupCallTitle#1ca6ac0a`. +// +// See https://core.telegram.org/method/phone.editGroupCallTitle for reference. +type PhoneEditGroupCallTitleRequest struct { + // Call field of PhoneEditGroupCallTitleRequest. + Call InputGroupCall + // Title field of PhoneEditGroupCallTitleRequest. + Title string +} + +// PhoneEditGroupCallTitleRequestTypeID is TL type id of PhoneEditGroupCallTitleRequest. +const PhoneEditGroupCallTitleRequestTypeID = 0x1ca6ac0a + +func (e *PhoneEditGroupCallTitleRequest) Zero() bool { + if e == nil { + return true + } + if !(e.Call.Zero()) { + return false + } + if !(e.Title == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *PhoneEditGroupCallTitleRequest) String() string { + if e == nil { + return "PhoneEditGroupCallTitleRequest(nil)" + } + type Alias PhoneEditGroupCallTitleRequest + return fmt.Sprintf("PhoneEditGroupCallTitleRequest%+v", Alias(*e)) +} + +// FillFrom fills PhoneEditGroupCallTitleRequest from given interface. +func (e *PhoneEditGroupCallTitleRequest) FillFrom(from interface { + GetCall() (value InputGroupCall) + GetTitle() (value string) +}) { + e.Call = from.GetCall() + e.Title = from.GetTitle() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneEditGroupCallTitleRequest) TypeID() uint32 { + return PhoneEditGroupCallTitleRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneEditGroupCallTitleRequest) TypeName() string { + return "phone.editGroupCallTitle" +} + +// TypeInfo returns info about TL type. +func (e *PhoneEditGroupCallTitleRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.editGroupCallTitle", + ID: PhoneEditGroupCallTitleRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Call", + SchemaName: "call", + }, + { + Name: "Title", + SchemaName: "title", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *PhoneEditGroupCallTitleRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode phone.editGroupCallTitle#1ca6ac0a as nil") + } + b.PutID(PhoneEditGroupCallTitleRequestTypeID) + if err := e.Call.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.editGroupCallTitle#1ca6ac0a: field call: %w", err) + } + b.PutString(e.Title) + return nil +} + +// GetCall returns value of Call field. +func (e *PhoneEditGroupCallTitleRequest) GetCall() (value InputGroupCall) { + return e.Call +} + +// GetTitle returns value of Title field. +func (e *PhoneEditGroupCallTitleRequest) GetTitle() (value string) { + return e.Title +} + +// Decode implements bin.Decoder. +func (e *PhoneEditGroupCallTitleRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode phone.editGroupCallTitle#1ca6ac0a to nil") + } + if err := b.ConsumeID(PhoneEditGroupCallTitleRequestTypeID); err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallTitle#1ca6ac0a: %w", err) + } + { + if err := e.Call.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallTitle#1ca6ac0a: field call: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode phone.editGroupCallTitle#1ca6ac0a: field title: %w", err) + } + e.Title = value + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneEditGroupCallTitleRequest. +var ( + _ bin.Encoder = &PhoneEditGroupCallTitleRequest{} + _ bin.Decoder = &PhoneEditGroupCallTitleRequest{} +) + +// PhoneEditGroupCallTitle invokes method phone.editGroupCallTitle#1ca6ac0a returning error if any. +// +// See https://core.telegram.org/method/phone.editGroupCallTitle for reference. +func (c *Client) PhoneEditGroupCallTitle(ctx context.Context, request *PhoneEditGroupCallTitleRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_phone_export_group_call_invite_gen.go b/tg/tl_phone_export_group_call_invite_gen.go new file mode 100644 index 0000000000..803ca3f52b --- /dev/null +++ b/tg/tl_phone_export_group_call_invite_gen.go @@ -0,0 +1,192 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneExportGroupCallInviteRequest represents TL type `phone.exportGroupCallInvite#e6aa647f`. +// +// See https://core.telegram.org/method/phone.exportGroupCallInvite for reference. +type PhoneExportGroupCallInviteRequest struct { + // Flags field of PhoneExportGroupCallInviteRequest. + Flags bin.Fields + // CanSelfUnmute field of PhoneExportGroupCallInviteRequest. + CanSelfUnmute bool + // Call field of PhoneExportGroupCallInviteRequest. + Call InputGroupCall +} + +// PhoneExportGroupCallInviteRequestTypeID is TL type id of PhoneExportGroupCallInviteRequest. +const PhoneExportGroupCallInviteRequestTypeID = 0xe6aa647f + +func (e *PhoneExportGroupCallInviteRequest) Zero() bool { + if e == nil { + return true + } + if !(e.Flags.Zero()) { + return false + } + if !(e.CanSelfUnmute == false) { + return false + } + if !(e.Call.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *PhoneExportGroupCallInviteRequest) String() string { + if e == nil { + return "PhoneExportGroupCallInviteRequest(nil)" + } + type Alias PhoneExportGroupCallInviteRequest + return fmt.Sprintf("PhoneExportGroupCallInviteRequest%+v", Alias(*e)) +} + +// FillFrom fills PhoneExportGroupCallInviteRequest from given interface. +func (e *PhoneExportGroupCallInviteRequest) FillFrom(from interface { + GetCanSelfUnmute() (value bool) + GetCall() (value InputGroupCall) +}) { + e.CanSelfUnmute = from.GetCanSelfUnmute() + e.Call = from.GetCall() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneExportGroupCallInviteRequest) TypeID() uint32 { + return PhoneExportGroupCallInviteRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneExportGroupCallInviteRequest) TypeName() string { + return "phone.exportGroupCallInvite" +} + +// TypeInfo returns info about TL type. +func (e *PhoneExportGroupCallInviteRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.exportGroupCallInvite", + ID: PhoneExportGroupCallInviteRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CanSelfUnmute", + SchemaName: "can_self_unmute", + Null: !e.Flags.Has(0), + }, + { + Name: "Call", + SchemaName: "call", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *PhoneExportGroupCallInviteRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode phone.exportGroupCallInvite#e6aa647f as nil") + } + b.PutID(PhoneExportGroupCallInviteRequestTypeID) + if !(e.CanSelfUnmute == false) { + e.Flags.Set(0) + } + if err := e.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.exportGroupCallInvite#e6aa647f: field flags: %w", err) + } + if err := e.Call.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.exportGroupCallInvite#e6aa647f: field call: %w", err) + } + return nil +} + +// SetCanSelfUnmute sets value of CanSelfUnmute conditional field. +func (e *PhoneExportGroupCallInviteRequest) SetCanSelfUnmute(value bool) { + if value { + e.Flags.Set(0) + e.CanSelfUnmute = true + } else { + e.Flags.Unset(0) + e.CanSelfUnmute = false + } +} + +// GetCanSelfUnmute returns value of CanSelfUnmute conditional field. +func (e *PhoneExportGroupCallInviteRequest) GetCanSelfUnmute() (value bool) { + return e.Flags.Has(0) +} + +// GetCall returns value of Call field. +func (e *PhoneExportGroupCallInviteRequest) GetCall() (value InputGroupCall) { + return e.Call +} + +// Decode implements bin.Decoder. +func (e *PhoneExportGroupCallInviteRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode phone.exportGroupCallInvite#e6aa647f to nil") + } + if err := b.ConsumeID(PhoneExportGroupCallInviteRequestTypeID); err != nil { + return fmt.Errorf("unable to decode phone.exportGroupCallInvite#e6aa647f: %w", err) + } + { + if err := e.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.exportGroupCallInvite#e6aa647f: field flags: %w", err) + } + } + e.CanSelfUnmute = e.Flags.Has(0) + { + if err := e.Call.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.exportGroupCallInvite#e6aa647f: field call: %w", err) + } + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneExportGroupCallInviteRequest. +var ( + _ bin.Encoder = &PhoneExportGroupCallInviteRequest{} + _ bin.Decoder = &PhoneExportGroupCallInviteRequest{} +) + +// PhoneExportGroupCallInvite invokes method phone.exportGroupCallInvite#e6aa647f returning error if any. +// +// See https://core.telegram.org/method/phone.exportGroupCallInvite for reference. +func (c *Client) PhoneExportGroupCallInvite(ctx context.Context, request *PhoneExportGroupCallInviteRequest) (*PhoneExportedGroupCallInvite, error) { + var result PhoneExportedGroupCallInvite + + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_phone_exported_group_call_invite_gen.go b/tg/tl_phone_exported_group_call_invite_gen.go new file mode 100644 index 0000000000..de1acfefc5 --- /dev/null +++ b/tg/tl_phone_exported_group_call_invite_gen.go @@ -0,0 +1,135 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneExportedGroupCallInvite represents TL type `phone.exportedGroupCallInvite#204bd158`. +// +// See https://core.telegram.org/constructor/phone.exportedGroupCallInvite for reference. +type PhoneExportedGroupCallInvite struct { + // Link field of PhoneExportedGroupCallInvite. + Link string +} + +// PhoneExportedGroupCallInviteTypeID is TL type id of PhoneExportedGroupCallInvite. +const PhoneExportedGroupCallInviteTypeID = 0x204bd158 + +func (e *PhoneExportedGroupCallInvite) Zero() bool { + if e == nil { + return true + } + if !(e.Link == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *PhoneExportedGroupCallInvite) String() string { + if e == nil { + return "PhoneExportedGroupCallInvite(nil)" + } + type Alias PhoneExportedGroupCallInvite + return fmt.Sprintf("PhoneExportedGroupCallInvite%+v", Alias(*e)) +} + +// FillFrom fills PhoneExportedGroupCallInvite from given interface. +func (e *PhoneExportedGroupCallInvite) FillFrom(from interface { + GetLink() (value string) +}) { + e.Link = from.GetLink() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneExportedGroupCallInvite) TypeID() uint32 { + return PhoneExportedGroupCallInviteTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneExportedGroupCallInvite) TypeName() string { + return "phone.exportedGroupCallInvite" +} + +// TypeInfo returns info about TL type. +func (e *PhoneExportedGroupCallInvite) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.exportedGroupCallInvite", + ID: PhoneExportedGroupCallInviteTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Link", + SchemaName: "link", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *PhoneExportedGroupCallInvite) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode phone.exportedGroupCallInvite#204bd158 as nil") + } + b.PutID(PhoneExportedGroupCallInviteTypeID) + b.PutString(e.Link) + return nil +} + +// GetLink returns value of Link field. +func (e *PhoneExportedGroupCallInvite) GetLink() (value string) { + return e.Link +} + +// Decode implements bin.Decoder. +func (e *PhoneExportedGroupCallInvite) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode phone.exportedGroupCallInvite#204bd158 to nil") + } + if err := b.ConsumeID(PhoneExportedGroupCallInviteTypeID); err != nil { + return fmt.Errorf("unable to decode phone.exportedGroupCallInvite#204bd158: %w", err) + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode phone.exportedGroupCallInvite#204bd158: field link: %w", err) + } + e.Link = value + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneExportedGroupCallInvite. +var ( + _ bin.Encoder = &PhoneExportedGroupCallInvite{} + _ bin.Decoder = &PhoneExportedGroupCallInvite{} +) diff --git a/tg/tl_phone_get_group_call_join_as_gen.go b/tg/tl_phone_get_group_call_join_as_gen.go new file mode 100644 index 0000000000..41532575f8 --- /dev/null +++ b/tg/tl_phone_get_group_call_join_as_gen.go @@ -0,0 +1,155 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneGetGroupCallJoinAsRequest represents TL type `phone.getGroupCallJoinAs#ef7c213a`. +// +// See https://core.telegram.org/method/phone.getGroupCallJoinAs for reference. +type PhoneGetGroupCallJoinAsRequest struct { + // Peer field of PhoneGetGroupCallJoinAsRequest. + Peer InputPeerClass +} + +// PhoneGetGroupCallJoinAsRequestTypeID is TL type id of PhoneGetGroupCallJoinAsRequest. +const PhoneGetGroupCallJoinAsRequestTypeID = 0xef7c213a + +func (g *PhoneGetGroupCallJoinAsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PhoneGetGroupCallJoinAsRequest) String() string { + if g == nil { + return "PhoneGetGroupCallJoinAsRequest(nil)" + } + type Alias PhoneGetGroupCallJoinAsRequest + return fmt.Sprintf("PhoneGetGroupCallJoinAsRequest%+v", Alias(*g)) +} + +// FillFrom fills PhoneGetGroupCallJoinAsRequest from given interface. +func (g *PhoneGetGroupCallJoinAsRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) +}) { + g.Peer = from.GetPeer() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneGetGroupCallJoinAsRequest) TypeID() uint32 { + return PhoneGetGroupCallJoinAsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneGetGroupCallJoinAsRequest) TypeName() string { + return "phone.getGroupCallJoinAs" +} + +// TypeInfo returns info about TL type. +func (g *PhoneGetGroupCallJoinAsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.getGroupCallJoinAs", + ID: PhoneGetGroupCallJoinAsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PhoneGetGroupCallJoinAsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode phone.getGroupCallJoinAs#ef7c213a as nil") + } + b.PutID(PhoneGetGroupCallJoinAsRequestTypeID) + if g.Peer == nil { + return fmt.Errorf("unable to encode phone.getGroupCallJoinAs#ef7c213a: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.getGroupCallJoinAs#ef7c213a: field peer: %w", err) + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *PhoneGetGroupCallJoinAsRequest) GetPeer() (value InputPeerClass) { + return g.Peer +} + +// Decode implements bin.Decoder. +func (g *PhoneGetGroupCallJoinAsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode phone.getGroupCallJoinAs#ef7c213a to nil") + } + if err := b.ConsumeID(PhoneGetGroupCallJoinAsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode phone.getGroupCallJoinAs#ef7c213a: %w", err) + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode phone.getGroupCallJoinAs#ef7c213a: field peer: %w", err) + } + g.Peer = value + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneGetGroupCallJoinAsRequest. +var ( + _ bin.Encoder = &PhoneGetGroupCallJoinAsRequest{} + _ bin.Decoder = &PhoneGetGroupCallJoinAsRequest{} +) + +// PhoneGetGroupCallJoinAs invokes method phone.getGroupCallJoinAs#ef7c213a returning error if any. +// +// See https://core.telegram.org/method/phone.getGroupCallJoinAs for reference. +func (c *Client) PhoneGetGroupCallJoinAs(ctx context.Context, peer InputPeerClass) (*PhoneJoinAsPeers, error) { + var result PhoneJoinAsPeers + + request := &PhoneGetGroupCallJoinAsRequest{ + Peer: peer, + } + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_phone_get_group_participants_gen.go b/tg/tl_phone_get_group_participants_gen.go index c18d3a6c4c..e213ac0449 100644 --- a/tg/tl_phone_get_group_participants_gen.go +++ b/tg/tl_phone_get_group_participants_gen.go @@ -26,14 +26,14 @@ var ( _ = tgerr.Error{} ) -// PhoneGetGroupParticipantsRequest represents TL type `phone.getGroupParticipants#c9f1d285`. +// PhoneGetGroupParticipantsRequest represents TL type `phone.getGroupParticipants#c558d8ab`. // // See https://core.telegram.org/method/phone.getGroupParticipants for reference. type PhoneGetGroupParticipantsRequest struct { // Call field of PhoneGetGroupParticipantsRequest. Call InputGroupCall // IDs field of PhoneGetGroupParticipantsRequest. - IDs []int + IDs []InputPeerClass // Sources field of PhoneGetGroupParticipantsRequest. Sources []int // Offset field of PhoneGetGroupParticipantsRequest. @@ -43,7 +43,7 @@ type PhoneGetGroupParticipantsRequest struct { } // PhoneGetGroupParticipantsRequestTypeID is TL type id of PhoneGetGroupParticipantsRequest. -const PhoneGetGroupParticipantsRequestTypeID = 0xc9f1d285 +const PhoneGetGroupParticipantsRequestTypeID = 0xc558d8ab func (g *PhoneGetGroupParticipantsRequest) Zero() bool { if g == nil { @@ -80,7 +80,7 @@ func (g *PhoneGetGroupParticipantsRequest) String() string { // FillFrom fills PhoneGetGroupParticipantsRequest from given interface. func (g *PhoneGetGroupParticipantsRequest) FillFrom(from interface { GetCall() (value InputGroupCall) - GetIDs() (value []int) + GetIDs() (value []InputPeerClass) GetSources() (value []int) GetOffset() (value string) GetLimit() (value int) @@ -142,15 +142,20 @@ func (g *PhoneGetGroupParticipantsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *PhoneGetGroupParticipantsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode phone.getGroupParticipants#c9f1d285 as nil") + return fmt.Errorf("can't encode phone.getGroupParticipants#c558d8ab as nil") } b.PutID(PhoneGetGroupParticipantsRequestTypeID) if err := g.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.getGroupParticipants#c9f1d285: field call: %w", err) + return fmt.Errorf("unable to encode phone.getGroupParticipants#c558d8ab: field call: %w", err) } b.PutVectorHeader(len(g.IDs)) - for _, v := range g.IDs { - b.PutInt(v) + for idx, v := range g.IDs { + if v == nil { + return fmt.Errorf("unable to encode phone.getGroupParticipants#c558d8ab: field ids element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.getGroupParticipants#c558d8ab: field ids element with index %d: %w", idx, err) + } } b.PutVectorHeader(len(g.Sources)) for _, v := range g.Sources { @@ -167,10 +172,15 @@ func (g *PhoneGetGroupParticipantsRequest) GetCall() (value InputGroupCall) { } // GetIDs returns value of IDs field. -func (g *PhoneGetGroupParticipantsRequest) GetIDs() (value []int) { +func (g *PhoneGetGroupParticipantsRequest) GetIDs() (value []InputPeerClass) { return g.IDs } +// MapIDs returns field IDs wrapped in InputPeerClassArray helper. +func (g *PhoneGetGroupParticipantsRequest) MapIDs() (value InputPeerClassArray) { + return InputPeerClassArray(g.IDs) +} + // GetSources returns value of Sources field. func (g *PhoneGetGroupParticipantsRequest) GetSources() (value []int) { return g.Sources @@ -189,25 +199,25 @@ func (g *PhoneGetGroupParticipantsRequest) GetLimit() (value int) { // Decode implements bin.Decoder. func (g *PhoneGetGroupParticipantsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode phone.getGroupParticipants#c9f1d285 to nil") + return fmt.Errorf("can't decode phone.getGroupParticipants#c558d8ab to nil") } if err := b.ConsumeID(PhoneGetGroupParticipantsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: %w", err) } { if err := g.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field call: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field call: %w", err) } } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field ids: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field ids: %w", err) } for idx := 0; idx < headerLen; idx++ { - value, err := b.Int() + value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field ids: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field ids: %w", err) } g.IDs = append(g.IDs, value) } @@ -215,12 +225,12 @@ func (g *PhoneGetGroupParticipantsRequest) Decode(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field sources: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field sources: %w", err) } for idx := 0; idx < headerLen; idx++ { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field sources: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field sources: %w", err) } g.Sources = append(g.Sources, value) } @@ -228,14 +238,14 @@ func (g *PhoneGetGroupParticipantsRequest) Decode(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field offset: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field offset: %w", err) } g.Offset = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode phone.getGroupParticipants#c9f1d285: field limit: %w", err) + return fmt.Errorf("unable to decode phone.getGroupParticipants#c558d8ab: field limit: %w", err) } g.Limit = value } @@ -248,7 +258,7 @@ var ( _ bin.Decoder = &PhoneGetGroupParticipantsRequest{} ) -// PhoneGetGroupParticipants invokes method phone.getGroupParticipants#c9f1d285 returning error if any. +// PhoneGetGroupParticipants invokes method phone.getGroupParticipants#c558d8ab returning error if any. // // See https://core.telegram.org/method/phone.getGroupParticipants for reference. func (c *Client) PhoneGetGroupParticipants(ctx context.Context, request *PhoneGetGroupParticipantsRequest) (*PhoneGroupParticipants, error) { diff --git a/tg/tl_phone_group_call_gen.go b/tg/tl_phone_group_call_gen.go index 0b6b04f0b2..9f7e2adff6 100644 --- a/tg/tl_phone_group_call_gen.go +++ b/tg/tl_phone_group_call_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// PhoneGroupCall represents TL type `phone.groupCall#66ab0bfc`. +// PhoneGroupCall represents TL type `phone.groupCall#9e727aad`. // // See https://core.telegram.org/constructor/phone.groupCall for reference. type PhoneGroupCall struct { @@ -36,12 +36,14 @@ type PhoneGroupCall struct { Participants []GroupCallParticipant // ParticipantsNextOffset field of PhoneGroupCall. ParticipantsNextOffset string + // Chats field of PhoneGroupCall. + Chats []ChatClass // Users field of PhoneGroupCall. Users []UserClass } // PhoneGroupCallTypeID is TL type id of PhoneGroupCall. -const PhoneGroupCallTypeID = 0x66ab0bfc +const PhoneGroupCallTypeID = 0x9e727aad func (g *PhoneGroupCall) Zero() bool { if g == nil { @@ -56,6 +58,9 @@ func (g *PhoneGroupCall) Zero() bool { if !(g.ParticipantsNextOffset == "") { return false } + if !(g.Chats == nil) { + return false + } if !(g.Users == nil) { return false } @@ -77,11 +82,13 @@ func (g *PhoneGroupCall) FillFrom(from interface { GetCall() (value GroupCallClass) GetParticipants() (value []GroupCallParticipant) GetParticipantsNextOffset() (value string) + GetChats() (value []ChatClass) GetUsers() (value []UserClass) }) { g.Call = from.GetCall() g.Participants = from.GetParticipants() g.ParticipantsNextOffset = from.GetParticipantsNextOffset() + g.Chats = from.GetChats() g.Users = from.GetUsers() } @@ -120,6 +127,10 @@ func (g *PhoneGroupCall) TypeInfo() tdp.Type { Name: "ParticipantsNextOffset", SchemaName: "participants_next_offset", }, + { + Name: "Chats", + SchemaName: "chats", + }, { Name: "Users", SchemaName: "users", @@ -131,29 +142,38 @@ func (g *PhoneGroupCall) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *PhoneGroupCall) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode phone.groupCall#66ab0bfc as nil") + return fmt.Errorf("can't encode phone.groupCall#9e727aad as nil") } b.PutID(PhoneGroupCallTypeID) if g.Call == nil { - return fmt.Errorf("unable to encode phone.groupCall#66ab0bfc: field call is nil") + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field call is nil") } if err := g.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.groupCall#66ab0bfc: field call: %w", err) + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field call: %w", err) } b.PutVectorHeader(len(g.Participants)) for idx, v := range g.Participants { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.groupCall#66ab0bfc: field participants element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field participants element with index %d: %w", idx, err) } } b.PutString(g.ParticipantsNextOffset) + b.PutVectorHeader(len(g.Chats)) + for idx, v := range g.Chats { + if v == nil { + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field chats element with index %d: %w", idx, err) + } + } b.PutVectorHeader(len(g.Users)) for idx, v := range g.Users { if v == nil { - return fmt.Errorf("unable to encode phone.groupCall#66ab0bfc: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.groupCall#66ab0bfc: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode phone.groupCall#9e727aad: field users element with index %d: %w", idx, err) } } return nil @@ -174,6 +194,16 @@ func (g *PhoneGroupCall) GetParticipantsNextOffset() (value string) { return g.ParticipantsNextOffset } +// GetChats returns value of Chats field. +func (g *PhoneGroupCall) GetChats() (value []ChatClass) { + return g.Chats +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (g *PhoneGroupCall) MapChats() (value ChatClassArray) { + return ChatClassArray(g.Chats) +} + // GetUsers returns value of Users field. func (g *PhoneGroupCall) GetUsers() (value []UserClass) { return g.Users @@ -187,27 +217,27 @@ func (g *PhoneGroupCall) MapUsers() (value UserClassArray) { // Decode implements bin.Decoder. func (g *PhoneGroupCall) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode phone.groupCall#66ab0bfc to nil") + return fmt.Errorf("can't decode phone.groupCall#9e727aad to nil") } if err := b.ConsumeID(PhoneGroupCallTypeID); err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: %w", err) } { value, err := DecodeGroupCall(b) if err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: field call: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field call: %w", err) } g.Call = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: field participants: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field participants: %w", err) } for idx := 0; idx < headerLen; idx++ { var value GroupCallParticipant if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: field participants: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field participants: %w", err) } g.Participants = append(g.Participants, value) } @@ -215,19 +245,32 @@ func (g *PhoneGroupCall) Decode(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: field participants_next_offset: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field participants_next_offset: %w", err) } g.ParticipantsNextOffset = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: field users: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field chats: %w", err) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field chats: %w", err) + } + g.Chats = append(g.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field users: %w", err) } for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode phone.groupCall#66ab0bfc: field users: %w", err) + return fmt.Errorf("unable to decode phone.groupCall#9e727aad: field users: %w", err) } g.Users = append(g.Users, value) } diff --git a/tg/tl_phone_group_participants_gen.go b/tg/tl_phone_group_participants_gen.go index 32e8418c4e..b489c221dc 100644 --- a/tg/tl_phone_group_participants_gen.go +++ b/tg/tl_phone_group_participants_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// PhoneGroupParticipants represents TL type `phone.groupParticipants#9cfeb92d`. +// PhoneGroupParticipants represents TL type `phone.groupParticipants#f47751b6`. // // See https://core.telegram.org/constructor/phone.groupParticipants for reference. type PhoneGroupParticipants struct { @@ -36,6 +36,8 @@ type PhoneGroupParticipants struct { Participants []GroupCallParticipant // NextOffset field of PhoneGroupParticipants. NextOffset string + // Chats field of PhoneGroupParticipants. + Chats []ChatClass // Users field of PhoneGroupParticipants. Users []UserClass // Version field of PhoneGroupParticipants. @@ -43,7 +45,7 @@ type PhoneGroupParticipants struct { } // PhoneGroupParticipantsTypeID is TL type id of PhoneGroupParticipants. -const PhoneGroupParticipantsTypeID = 0x9cfeb92d +const PhoneGroupParticipantsTypeID = 0xf47751b6 func (g *PhoneGroupParticipants) Zero() bool { if g == nil { @@ -58,6 +60,9 @@ func (g *PhoneGroupParticipants) Zero() bool { if !(g.NextOffset == "") { return false } + if !(g.Chats == nil) { + return false + } if !(g.Users == nil) { return false } @@ -82,12 +87,14 @@ func (g *PhoneGroupParticipants) FillFrom(from interface { GetCount() (value int) GetParticipants() (value []GroupCallParticipant) GetNextOffset() (value string) + GetChats() (value []ChatClass) GetUsers() (value []UserClass) GetVersion() (value int) }) { g.Count = from.GetCount() g.Participants = from.GetParticipants() g.NextOffset = from.GetNextOffset() + g.Chats = from.GetChats() g.Users = from.GetUsers() g.Version = from.GetVersion() } @@ -127,6 +134,10 @@ func (g *PhoneGroupParticipants) TypeInfo() tdp.Type { Name: "NextOffset", SchemaName: "next_offset", }, + { + Name: "Chats", + SchemaName: "chats", + }, { Name: "Users", SchemaName: "users", @@ -142,24 +153,33 @@ func (g *PhoneGroupParticipants) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *PhoneGroupParticipants) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode phone.groupParticipants#9cfeb92d as nil") + return fmt.Errorf("can't encode phone.groupParticipants#f47751b6 as nil") } b.PutID(PhoneGroupParticipantsTypeID) b.PutInt(g.Count) b.PutVectorHeader(len(g.Participants)) for idx, v := range g.Participants { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.groupParticipants#9cfeb92d: field participants element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode phone.groupParticipants#f47751b6: field participants element with index %d: %w", idx, err) } } b.PutString(g.NextOffset) + b.PutVectorHeader(len(g.Chats)) + for idx, v := range g.Chats { + if v == nil { + return fmt.Errorf("unable to encode phone.groupParticipants#f47751b6: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.groupParticipants#f47751b6: field chats element with index %d: %w", idx, err) + } + } b.PutVectorHeader(len(g.Users)) for idx, v := range g.Users { if v == nil { - return fmt.Errorf("unable to encode phone.groupParticipants#9cfeb92d: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode phone.groupParticipants#f47751b6: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.groupParticipants#9cfeb92d: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode phone.groupParticipants#f47751b6: field users element with index %d: %w", idx, err) } } b.PutInt(g.Version) @@ -181,6 +201,16 @@ func (g *PhoneGroupParticipants) GetNextOffset() (value string) { return g.NextOffset } +// GetChats returns value of Chats field. +func (g *PhoneGroupParticipants) GetChats() (value []ChatClass) { + return g.Chats +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (g *PhoneGroupParticipants) MapChats() (value ChatClassArray) { + return ChatClassArray(g.Chats) +} + // GetUsers returns value of Users field. func (g *PhoneGroupParticipants) GetUsers() (value []UserClass) { return g.Users @@ -199,27 +229,27 @@ func (g *PhoneGroupParticipants) GetVersion() (value int) { // Decode implements bin.Decoder. func (g *PhoneGroupParticipants) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode phone.groupParticipants#9cfeb92d to nil") + return fmt.Errorf("can't decode phone.groupParticipants#f47751b6 to nil") } if err := b.ConsumeID(PhoneGroupParticipantsTypeID); err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: %w", err) } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field count: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field count: %w", err) } g.Count = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field participants: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field participants: %w", err) } for idx := 0; idx < headerLen; idx++ { var value GroupCallParticipant if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field participants: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field participants: %w", err) } g.Participants = append(g.Participants, value) } @@ -227,19 +257,32 @@ func (g *PhoneGroupParticipants) Decode(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field next_offset: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field next_offset: %w", err) } g.NextOffset = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field users: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field chats: %w", err) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field chats: %w", err) + } + g.Chats = append(g.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field users: %w", err) } for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field users: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field users: %w", err) } g.Users = append(g.Users, value) } @@ -247,7 +290,7 @@ func (g *PhoneGroupParticipants) Decode(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode phone.groupParticipants#9cfeb92d: field version: %w", err) + return fmt.Errorf("unable to decode phone.groupParticipants#f47751b6: field version: %w", err) } g.Version = value } diff --git a/tg/tl_phone_join_as_peers_gen.go b/tg/tl_phone_join_as_peers_gen.go new file mode 100644 index 0000000000..6feaacf7ec --- /dev/null +++ b/tg/tl_phone_join_as_peers_gen.go @@ -0,0 +1,240 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneJoinAsPeers represents TL type `phone.joinAsPeers#afe5623f`. +// +// See https://core.telegram.org/constructor/phone.joinAsPeers for reference. +type PhoneJoinAsPeers struct { + // Peers field of PhoneJoinAsPeers. + Peers []PeerClass + // Chats field of PhoneJoinAsPeers. + Chats []ChatClass + // Users field of PhoneJoinAsPeers. + Users []UserClass +} + +// PhoneJoinAsPeersTypeID is TL type id of PhoneJoinAsPeers. +const PhoneJoinAsPeersTypeID = 0xafe5623f + +func (j *PhoneJoinAsPeers) Zero() bool { + if j == nil { + return true + } + if !(j.Peers == nil) { + return false + } + if !(j.Chats == nil) { + return false + } + if !(j.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (j *PhoneJoinAsPeers) String() string { + if j == nil { + return "PhoneJoinAsPeers(nil)" + } + type Alias PhoneJoinAsPeers + return fmt.Sprintf("PhoneJoinAsPeers%+v", Alias(*j)) +} + +// FillFrom fills PhoneJoinAsPeers from given interface. +func (j *PhoneJoinAsPeers) FillFrom(from interface { + GetPeers() (value []PeerClass) + GetChats() (value []ChatClass) + GetUsers() (value []UserClass) +}) { + j.Peers = from.GetPeers() + j.Chats = from.GetChats() + j.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneJoinAsPeers) TypeID() uint32 { + return PhoneJoinAsPeersTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneJoinAsPeers) TypeName() string { + return "phone.joinAsPeers" +} + +// TypeInfo returns info about TL type. +func (j *PhoneJoinAsPeers) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.joinAsPeers", + ID: PhoneJoinAsPeersTypeID, + } + if j == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peers", + SchemaName: "peers", + }, + { + Name: "Chats", + SchemaName: "chats", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (j *PhoneJoinAsPeers) Encode(b *bin.Buffer) error { + if j == nil { + return fmt.Errorf("can't encode phone.joinAsPeers#afe5623f as nil") + } + b.PutID(PhoneJoinAsPeersTypeID) + b.PutVectorHeader(len(j.Peers)) + for idx, v := range j.Peers { + if v == nil { + return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field peers element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field peers element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(j.Chats)) + for idx, v := range j.Chats { + if v == nil { + return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field chats element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(j.Users)) + for idx, v := range j.Users { + if v == nil { + return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// GetPeers returns value of Peers field. +func (j *PhoneJoinAsPeers) GetPeers() (value []PeerClass) { + return j.Peers +} + +// MapPeers returns field Peers wrapped in PeerClassArray helper. +func (j *PhoneJoinAsPeers) MapPeers() (value PeerClassArray) { + return PeerClassArray(j.Peers) +} + +// GetChats returns value of Chats field. +func (j *PhoneJoinAsPeers) GetChats() (value []ChatClass) { + return j.Chats +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (j *PhoneJoinAsPeers) MapChats() (value ChatClassArray) { + return ChatClassArray(j.Chats) +} + +// GetUsers returns value of Users field. +func (j *PhoneJoinAsPeers) GetUsers() (value []UserClass) { + return j.Users +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (j *PhoneJoinAsPeers) MapUsers() (value UserClassArray) { + return UserClassArray(j.Users) +} + +// Decode implements bin.Decoder. +func (j *PhoneJoinAsPeers) Decode(b *bin.Buffer) error { + if j == nil { + return fmt.Errorf("can't decode phone.joinAsPeers#afe5623f to nil") + } + if err := b.ConsumeID(PhoneJoinAsPeersTypeID); err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: %w", err) + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: field peers: %w", err) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: field peers: %w", err) + } + j.Peers = append(j.Peers, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: field chats: %w", err) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: field chats: %w", err) + } + j.Chats = append(j.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: field users: %w", err) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode phone.joinAsPeers#afe5623f: field users: %w", err) + } + j.Users = append(j.Users, value) + } + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneJoinAsPeers. +var ( + _ bin.Encoder = &PhoneJoinAsPeers{} + _ bin.Decoder = &PhoneJoinAsPeers{} +) diff --git a/tg/tl_phone_join_group_call_gen.go b/tg/tl_phone_join_group_call_gen.go index 57980b3f47..4a1e3c74f2 100644 --- a/tg/tl_phone_join_group_call_gen.go +++ b/tg/tl_phone_join_group_call_gen.go @@ -26,7 +26,7 @@ var ( _ = tgerr.Error{} ) -// PhoneJoinGroupCallRequest represents TL type `phone.joinGroupCall#5f9c8e62`. +// PhoneJoinGroupCallRequest represents TL type `phone.joinGroupCall#b132ff7b`. // // See https://core.telegram.org/method/phone.joinGroupCall for reference. type PhoneJoinGroupCallRequest struct { @@ -36,12 +36,18 @@ type PhoneJoinGroupCallRequest struct { Muted bool // Call field of PhoneJoinGroupCallRequest. Call InputGroupCall + // JoinAs field of PhoneJoinGroupCallRequest. + JoinAs InputPeerClass + // InviteHash field of PhoneJoinGroupCallRequest. + // + // Use SetInviteHash and GetInviteHash helpers. + InviteHash string // Params field of PhoneJoinGroupCallRequest. Params DataJSON } // PhoneJoinGroupCallRequestTypeID is TL type id of PhoneJoinGroupCallRequest. -const PhoneJoinGroupCallRequestTypeID = 0x5f9c8e62 +const PhoneJoinGroupCallRequestTypeID = 0xb132ff7b func (j *PhoneJoinGroupCallRequest) Zero() bool { if j == nil { @@ -56,6 +62,12 @@ func (j *PhoneJoinGroupCallRequest) Zero() bool { if !(j.Call.Zero()) { return false } + if !(j.JoinAs == nil) { + return false + } + if !(j.InviteHash == "") { + return false + } if !(j.Params.Zero()) { return false } @@ -76,10 +88,17 @@ func (j *PhoneJoinGroupCallRequest) String() string { func (j *PhoneJoinGroupCallRequest) FillFrom(from interface { GetMuted() (value bool) GetCall() (value InputGroupCall) + GetJoinAs() (value InputPeerClass) + GetInviteHash() (value string, ok bool) GetParams() (value DataJSON) }) { j.Muted = from.GetMuted() j.Call = from.GetCall() + j.JoinAs = from.GetJoinAs() + if val, ok := from.GetInviteHash(); ok { + j.InviteHash = val + } + j.Params = from.GetParams() } @@ -115,6 +134,15 @@ func (j *PhoneJoinGroupCallRequest) TypeInfo() tdp.Type { Name: "Call", SchemaName: "call", }, + { + Name: "JoinAs", + SchemaName: "join_as", + }, + { + Name: "InviteHash", + SchemaName: "invite_hash", + Null: !j.Flags.Has(1), + }, { Name: "Params", SchemaName: "params", @@ -126,20 +154,32 @@ func (j *PhoneJoinGroupCallRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (j *PhoneJoinGroupCallRequest) Encode(b *bin.Buffer) error { if j == nil { - return fmt.Errorf("can't encode phone.joinGroupCall#5f9c8e62 as nil") + return fmt.Errorf("can't encode phone.joinGroupCall#b132ff7b as nil") } b.PutID(PhoneJoinGroupCallRequestTypeID) if !(j.Muted == false) { j.Flags.Set(0) } + if !(j.InviteHash == "") { + j.Flags.Set(1) + } if err := j.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.joinGroupCall#5f9c8e62: field flags: %w", err) + return fmt.Errorf("unable to encode phone.joinGroupCall#b132ff7b: field flags: %w", err) } if err := j.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.joinGroupCall#5f9c8e62: field call: %w", err) + return fmt.Errorf("unable to encode phone.joinGroupCall#b132ff7b: field call: %w", err) + } + if j.JoinAs == nil { + return fmt.Errorf("unable to encode phone.joinGroupCall#b132ff7b: field join_as is nil") + } + if err := j.JoinAs.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.joinGroupCall#b132ff7b: field join_as: %w", err) + } + if j.Flags.Has(1) { + b.PutString(j.InviteHash) } if err := j.Params.Encode(b); err != nil { - return fmt.Errorf("unable to encode phone.joinGroupCall#5f9c8e62: field params: %w", err) + return fmt.Errorf("unable to encode phone.joinGroupCall#b132ff7b: field params: %w", err) } return nil } @@ -165,6 +205,26 @@ func (j *PhoneJoinGroupCallRequest) GetCall() (value InputGroupCall) { return j.Call } +// GetJoinAs returns value of JoinAs field. +func (j *PhoneJoinGroupCallRequest) GetJoinAs() (value InputPeerClass) { + return j.JoinAs +} + +// SetInviteHash sets value of InviteHash conditional field. +func (j *PhoneJoinGroupCallRequest) SetInviteHash(value string) { + j.Flags.Set(1) + j.InviteHash = value +} + +// GetInviteHash returns value of InviteHash conditional field and +// boolean which is true if field was set. +func (j *PhoneJoinGroupCallRequest) GetInviteHash() (value string, ok bool) { + if !j.Flags.Has(1) { + return value, false + } + return j.InviteHash, true +} + // GetParams returns value of Params field. func (j *PhoneJoinGroupCallRequest) GetParams() (value DataJSON) { return j.Params @@ -173,25 +233,39 @@ func (j *PhoneJoinGroupCallRequest) GetParams() (value DataJSON) { // Decode implements bin.Decoder. func (j *PhoneJoinGroupCallRequest) Decode(b *bin.Buffer) error { if j == nil { - return fmt.Errorf("can't decode phone.joinGroupCall#5f9c8e62 to nil") + return fmt.Errorf("can't decode phone.joinGroupCall#b132ff7b to nil") } if err := b.ConsumeID(PhoneJoinGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode phone.joinGroupCall#5f9c8e62: %w", err) + return fmt.Errorf("unable to decode phone.joinGroupCall#b132ff7b: %w", err) } { if err := j.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.joinGroupCall#5f9c8e62: field flags: %w", err) + return fmt.Errorf("unable to decode phone.joinGroupCall#b132ff7b: field flags: %w", err) } } j.Muted = j.Flags.Has(0) { if err := j.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.joinGroupCall#5f9c8e62: field call: %w", err) + return fmt.Errorf("unable to decode phone.joinGroupCall#b132ff7b: field call: %w", err) + } + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode phone.joinGroupCall#b132ff7b: field join_as: %w", err) + } + j.JoinAs = value + } + if j.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode phone.joinGroupCall#b132ff7b: field invite_hash: %w", err) } + j.InviteHash = value } { if err := j.Params.Decode(b); err != nil { - return fmt.Errorf("unable to decode phone.joinGroupCall#5f9c8e62: field params: %w", err) + return fmt.Errorf("unable to decode phone.joinGroupCall#b132ff7b: field params: %w", err) } } return nil @@ -203,7 +277,7 @@ var ( _ bin.Decoder = &PhoneJoinGroupCallRequest{} ) -// PhoneJoinGroupCall invokes method phone.joinGroupCall#5f9c8e62 returning error if any. +// PhoneJoinGroupCall invokes method phone.joinGroupCall#b132ff7b returning error if any. // // See https://core.telegram.org/method/phone.joinGroupCall for reference. func (c *Client) PhoneJoinGroupCall(ctx context.Context, request *PhoneJoinGroupCallRequest) (UpdatesClass, error) { diff --git a/tg/tl_phone_toggle_group_call_record_gen.go b/tg/tl_phone_toggle_group_call_record_gen.go new file mode 100644 index 0000000000..ed2302ef43 --- /dev/null +++ b/tg/tl_phone_toggle_group_call_record_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} +) + +// PhoneToggleGroupCallRecordRequest represents TL type `phone.toggleGroupCallRecord#c02a66d7`. +// +// See https://core.telegram.org/method/phone.toggleGroupCallRecord for reference. +type PhoneToggleGroupCallRecordRequest struct { + // Flags field of PhoneToggleGroupCallRecordRequest. + Flags bin.Fields + // Start field of PhoneToggleGroupCallRecordRequest. + Start bool + // Call field of PhoneToggleGroupCallRecordRequest. + Call InputGroupCall + // Title field of PhoneToggleGroupCallRecordRequest. + // + // Use SetTitle and GetTitle helpers. + Title string +} + +// PhoneToggleGroupCallRecordRequestTypeID is TL type id of PhoneToggleGroupCallRecordRequest. +const PhoneToggleGroupCallRecordRequestTypeID = 0xc02a66d7 + +func (t *PhoneToggleGroupCallRecordRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Flags.Zero()) { + return false + } + if !(t.Start == false) { + return false + } + if !(t.Call.Zero()) { + return false + } + if !(t.Title == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *PhoneToggleGroupCallRecordRequest) String() string { + if t == nil { + return "PhoneToggleGroupCallRecordRequest(nil)" + } + type Alias PhoneToggleGroupCallRecordRequest + return fmt.Sprintf("PhoneToggleGroupCallRecordRequest%+v", Alias(*t)) +} + +// FillFrom fills PhoneToggleGroupCallRecordRequest from given interface. +func (t *PhoneToggleGroupCallRecordRequest) FillFrom(from interface { + GetStart() (value bool) + GetCall() (value InputGroupCall) + GetTitle() (value string, ok bool) +}) { + t.Start = from.GetStart() + t.Call = from.GetCall() + if val, ok := from.GetTitle(); ok { + t.Title = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PhoneToggleGroupCallRecordRequest) TypeID() uint32 { + return PhoneToggleGroupCallRecordRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PhoneToggleGroupCallRecordRequest) TypeName() string { + return "phone.toggleGroupCallRecord" +} + +// TypeInfo returns info about TL type. +func (t *PhoneToggleGroupCallRecordRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "phone.toggleGroupCallRecord", + ID: PhoneToggleGroupCallRecordRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Start", + SchemaName: "start", + Null: !t.Flags.Has(0), + }, + { + Name: "Call", + SchemaName: "call", + }, + { + Name: "Title", + SchemaName: "title", + Null: !t.Flags.Has(1), + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *PhoneToggleGroupCallRecordRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode phone.toggleGroupCallRecord#c02a66d7 as nil") + } + b.PutID(PhoneToggleGroupCallRecordRequestTypeID) + if !(t.Start == false) { + t.Flags.Set(0) + } + if !(t.Title == "") { + t.Flags.Set(1) + } + if err := t.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.toggleGroupCallRecord#c02a66d7: field flags: %w", err) + } + if err := t.Call.Encode(b); err != nil { + return fmt.Errorf("unable to encode phone.toggleGroupCallRecord#c02a66d7: field call: %w", err) + } + if t.Flags.Has(1) { + b.PutString(t.Title) + } + return nil +} + +// SetStart sets value of Start conditional field. +func (t *PhoneToggleGroupCallRecordRequest) SetStart(value bool) { + if value { + t.Flags.Set(0) + t.Start = true + } else { + t.Flags.Unset(0) + t.Start = false + } +} + +// GetStart returns value of Start conditional field. +func (t *PhoneToggleGroupCallRecordRequest) GetStart() (value bool) { + return t.Flags.Has(0) +} + +// GetCall returns value of Call field. +func (t *PhoneToggleGroupCallRecordRequest) GetCall() (value InputGroupCall) { + return t.Call +} + +// SetTitle sets value of Title conditional field. +func (t *PhoneToggleGroupCallRecordRequest) SetTitle(value string) { + t.Flags.Set(1) + t.Title = value +} + +// GetTitle returns value of Title conditional field and +// boolean which is true if field was set. +func (t *PhoneToggleGroupCallRecordRequest) GetTitle() (value string, ok bool) { + if !t.Flags.Has(1) { + return value, false + } + return t.Title, true +} + +// Decode implements bin.Decoder. +func (t *PhoneToggleGroupCallRecordRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode phone.toggleGroupCallRecord#c02a66d7 to nil") + } + if err := b.ConsumeID(PhoneToggleGroupCallRecordRequestTypeID); err != nil { + return fmt.Errorf("unable to decode phone.toggleGroupCallRecord#c02a66d7: %w", err) + } + { + if err := t.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.toggleGroupCallRecord#c02a66d7: field flags: %w", err) + } + } + t.Start = t.Flags.Has(0) + { + if err := t.Call.Decode(b); err != nil { + return fmt.Errorf("unable to decode phone.toggleGroupCallRecord#c02a66d7: field call: %w", err) + } + } + if t.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode phone.toggleGroupCallRecord#c02a66d7: field title: %w", err) + } + t.Title = value + } + return nil +} + +// Ensuring interfaces in compile-time for PhoneToggleGroupCallRecordRequest. +var ( + _ bin.Encoder = &PhoneToggleGroupCallRecordRequest{} + _ bin.Decoder = &PhoneToggleGroupCallRecordRequest{} +) + +// PhoneToggleGroupCallRecord invokes method phone.toggleGroupCallRecord#c02a66d7 returning error if any. +// +// See https://core.telegram.org/method/phone.toggleGroupCallRecord for reference. +func (c *Client) PhoneToggleGroupCallRecord(ctx context.Context, request *PhoneToggleGroupCallRecordRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.InvokeRaw(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_phone_toggle_group_call_settings_gen.go b/tg/tl_phone_toggle_group_call_settings_gen.go index e607cf2cbc..5ff46d0719 100644 --- a/tg/tl_phone_toggle_group_call_settings_gen.go +++ b/tg/tl_phone_toggle_group_call_settings_gen.go @@ -32,6 +32,8 @@ var ( type PhoneToggleGroupCallSettingsRequest struct { // Flags field of PhoneToggleGroupCallSettingsRequest. Flags bin.Fields + // ResetInviteHash field of PhoneToggleGroupCallSettingsRequest. + ResetInviteHash bool // Call field of PhoneToggleGroupCallSettingsRequest. Call InputGroupCall // JoinMuted field of PhoneToggleGroupCallSettingsRequest. @@ -50,6 +52,9 @@ func (t *PhoneToggleGroupCallSettingsRequest) Zero() bool { if !(t.Flags.Zero()) { return false } + if !(t.ResetInviteHash == false) { + return false + } if !(t.Call.Zero()) { return false } @@ -71,9 +76,11 @@ func (t *PhoneToggleGroupCallSettingsRequest) String() string { // FillFrom fills PhoneToggleGroupCallSettingsRequest from given interface. func (t *PhoneToggleGroupCallSettingsRequest) FillFrom(from interface { + GetResetInviteHash() (value bool) GetCall() (value InputGroupCall) GetJoinMuted() (value bool, ok bool) }) { + t.ResetInviteHash = from.GetResetInviteHash() t.Call = from.GetCall() if val, ok := from.GetJoinMuted(); ok { t.JoinMuted = val @@ -104,6 +111,11 @@ func (t *PhoneToggleGroupCallSettingsRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "ResetInviteHash", + SchemaName: "reset_invite_hash", + Null: !t.Flags.Has(1), + }, { Name: "Call", SchemaName: "call", @@ -123,6 +135,9 @@ func (t *PhoneToggleGroupCallSettingsRequest) Encode(b *bin.Buffer) error { return fmt.Errorf("can't encode phone.toggleGroupCallSettings#74bbb43d as nil") } b.PutID(PhoneToggleGroupCallSettingsRequestTypeID) + if !(t.ResetInviteHash == false) { + t.Flags.Set(1) + } if !(t.JoinMuted == false) { t.Flags.Set(0) } @@ -138,6 +153,22 @@ func (t *PhoneToggleGroupCallSettingsRequest) Encode(b *bin.Buffer) error { return nil } +// SetResetInviteHash sets value of ResetInviteHash conditional field. +func (t *PhoneToggleGroupCallSettingsRequest) SetResetInviteHash(value bool) { + if value { + t.Flags.Set(1) + t.ResetInviteHash = true + } else { + t.Flags.Unset(1) + t.ResetInviteHash = false + } +} + +// GetResetInviteHash returns value of ResetInviteHash conditional field. +func (t *PhoneToggleGroupCallSettingsRequest) GetResetInviteHash() (value bool) { + return t.Flags.Has(1) +} + // GetCall returns value of Call field. func (t *PhoneToggleGroupCallSettingsRequest) GetCall() (value InputGroupCall) { return t.Call @@ -171,6 +202,7 @@ func (t *PhoneToggleGroupCallSettingsRequest) Decode(b *bin.Buffer) error { return fmt.Errorf("unable to decode phone.toggleGroupCallSettings#74bbb43d: field flags: %w", err) } } + t.ResetInviteHash = t.Flags.Has(1) { if err := t.Call.Decode(b); err != nil { return fmt.Errorf("unable to decode phone.toggleGroupCallSettings#74bbb43d: field call: %w", err) diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index 2a2529fbe9..34a7b8e740 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -27,7 +27,7 @@ var ( ) // Layer version of schema. -const Layer = 124 +const Layer = 125 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -82,6 +82,7 @@ func TypesMap() map[uint32]string { 0xd83466f3: "inputPhotoLegacyFileLocation#d83466f3", 0x27d69997: "inputPeerPhotoFileLocation#27d69997", 0xdbaeae9: "inputStickerSetThumb#dbaeae9", + 0xbba51639: "inputGroupCallStream#bba51639", 0x9db1bc6d: "peerUser#9db1bc6d", 0xbad0e5bb: "peerChat#bad0e5bb", 0xbddde532: "peerChannel#bddde532", @@ -110,8 +111,8 @@ func TypesMap() map[uint32]string { 0x7328bdb: "chatForbidden#7328bdb", 0xd31a961e: "channel#d31a961e", 0x289da732: "channelForbidden#289da732", - 0xf06c4018: "chatFull#f06c4018", - 0x2548c037: "channelFull#2548c037", + 0x8a1e2983: "chatFull#8a1e2983", + 0x548c3f93: "channelFull#548c3f93", 0xc8d7493e: "chatParticipant#c8d7493e", 0xda13538a: "chatParticipantCreator#da13538a", 0xe2d6e436: "chatParticipantAdmin#e2d6e436", @@ -236,7 +237,7 @@ func TypesMap() map[uint32]string { 0x4e90bfd6: "updateMessageID#4e90bfd6", 0xa20db0e5: "updateDeleteMessages#a20db0e5", 0x5c486927: "updateUserTyping#5c486927", - 0x9a65ea1f: "updateChatUserTyping#9a65ea1f", + 0x86cadb6c: "updateChatUserTyping#86cadb6c", 0x7761198: "updateChatParticipants#7761198", 0x1bfbd823: "updateUserStatus#1bfbd823", 0xa7332b73: "updateUserName#a7332b73", @@ -313,16 +314,16 @@ func TypesMap() map[uint32]string { 0x1cc7de54: "updateReadChannelDiscussionInbox#1cc7de54", 0x4638a26c: "updateReadChannelDiscussionOutbox#4638a26c", 0x246a4b22: "updatePeerBlocked#246a4b22", - 0xff2abe9f: "updateChannelUserTyping#ff2abe9f", + 0x6b171718: "updateChannelUserTyping#6b171718", 0xed85eab5: "updatePinnedMessages#ed85eab5", 0x8588878b: "updatePinnedChannelMessages#8588878b", 0x1330a196: "updateChat#1330a196", 0xf2ebdb4e: "updateGroupCallParticipants#f2ebdb4e", 0xa45eb99b: "updateGroupCall#a45eb99b", 0xbb9bb9a5: "updatePeerHistoryTTL#bb9bb9a5", - 0x609a6ed4: "updateChatParticipant#609a6ed4", - 0x65d2b464: "updateChannelParticipant#65d2b464", - 0x30ec6ebc: "updateBotStopped#30ec6ebc", + 0xf3b3781f: "updateChatParticipant#f3b3781f", + 0x7fecb1ec: "updateChannelParticipant#7fecb1ec", + 0x7f9488a: "updateBotStopped#7f9488a", 0xa56c2a3e: "updates.state#a56c2a3e", 0x5d75a138: "updates.differenceEmpty#5d75a138", 0xf49ca0: "updates.difference#f49ca0", @@ -905,11 +906,11 @@ func TypesMap() map[uint32]string { 0xe8fd8014: "peerBlocked#e8fd8014", 0x8999f295: "stats.messageStats#8999f295", 0x7780bcb4: "groupCallDiscarded#7780bcb4", - 0x55903081: "groupCall#55903081", + 0xc0c2052e: "groupCall#c0c2052e", 0xd8aa840f: "inputGroupCall#d8aa840f", - 0x64c62a15: "groupCallParticipant#64c62a15", - 0x66ab0bfc: "phone.groupCall#66ab0bfc", - 0x9cfeb92d: "phone.groupParticipants#9cfeb92d", + 0x19adba89: "groupCallParticipant#19adba89", + 0x9e727aad: "phone.groupCall#9e727aad", + 0xf47751b6: "phone.groupParticipants#f47751b6", 0x3081ed9d: "inlineQueryPeerTypeSameBotPM#3081ed9d", 0x833c0fac: "inlineQueryPeerTypePM#833c0fac", 0xd766c50a: "inlineQueryPeerTypeChat#d766c50a", @@ -925,6 +926,9 @@ func TypesMap() map[uint32]string { 0x81b6b00a: "messages.chatInviteImporters#81b6b00a", 0xdfd2330f: "chatAdminWithInvites#dfd2330f", 0xb69b72d7: "messages.chatAdminsWithInvites#b69b72d7", + 0xa24de717: "messages.checkedHistoryImportPeer#a24de717", + 0xafe5623f: "phone.joinAsPeers#afe5623f", + 0x204bd158: "phone.exportedGroupCallInvite#204bd158", 0xcb9f372d: "invokeAfterMsg#cb9f372d", 0x3dc4b4f0: "invokeAfterMsgs#3dc4b4f0", 0xc1cd5ea9: "initConnection#c1cd5ea9", @@ -1150,8 +1154,8 @@ func TypesMap() map[uint32]string { 0x4e9963b2: "messages.getEmojiKeywordsLanguages#4e9963b2", 0xd5b10c26: "messages.getEmojiURL#d5b10c26", 0x732eef00: "messages.getSearchCounters#732eef00", - 0xe33f5613: "messages.requestUrlAuth#e33f5613", - 0xf729ea98: "messages.acceptUrlAuth#f729ea98", + 0x198fb446: "messages.requestUrlAuth#198fb446", + 0xb12c7125: "messages.acceptUrlAuth#b12c7125", 0x4facb138: "messages.hidePeerSettingsBar#4facb138", 0xe2c2685b: "messages.getScheduledHistory#e2c2685b", 0xbdbb0464: "messages.getScheduledMessages#bdbb0464", @@ -1175,12 +1179,14 @@ func TypesMap() map[uint32]string { 0x2a862092: "messages.uploadImportedMedia#2a862092", 0xb43df344: "messages.startHistoryImport#b43df344", 0xa2b5a3f6: "messages.getExportedChatInvites#a2b5a3f6", + 0x73746f5c: "messages.getExportedChatInvite#73746f5c", 0x2e4ffbe: "messages.editExportedChatInvite#2e4ffbe", 0x56987bd5: "messages.deleteRevokedExportedChatInvites#56987bd5", 0xd464a42b: "messages.deleteExportedChatInvite#d464a42b", 0x3920e6ef: "messages.getAdminsWithInvites#3920e6ef", 0x26fb7289: "messages.getChatInviteImporters#26fb7289", 0xb80e5fe4: "messages.setHistoryTTL#b80e5fe4", + 0x5dc60f03: "messages.checkHistoryImportPeer#5dc60f03", 0xedd4882a: "updates.getState#edd4882a", 0x25939651: "updates.getDifference#25939651", 0x3173d78: "updates.getChannelDifference#3173d78", @@ -1279,15 +1285,19 @@ func TypesMap() map[uint32]string { 0x277add7e: "phone.saveCallDebug#277add7e", 0xff7a9383: "phone.sendSignalingData#ff7a9383", 0xbd3dabe0: "phone.createGroupCall#bd3dabe0", - 0x5f9c8e62: "phone.joinGroupCall#5f9c8e62", + 0xb132ff7b: "phone.joinGroupCall#b132ff7b", 0x500377f9: "phone.leaveGroupCall#500377f9", - 0xa5e76cd8: "phone.editGroupCallMember#a5e76cd8", 0x7b393160: "phone.inviteToGroupCall#7b393160", 0x7a777135: "phone.discardGroupCall#7a777135", 0x74bbb43d: "phone.toggleGroupCallSettings#74bbb43d", 0xc7cb017: "phone.getGroupCall#c7cb017", - 0xc9f1d285: "phone.getGroupParticipants#c9f1d285", + 0xc558d8ab: "phone.getGroupParticipants#c558d8ab", 0xb74a7bea: "phone.checkGroupCall#b74a7bea", + 0xc02a66d7: "phone.toggleGroupCallRecord#c02a66d7", + 0xd975eb80: "phone.editGroupCallParticipant#d975eb80", + 0x1ca6ac0a: "phone.editGroupCallTitle#1ca6ac0a", + 0xef7c213a: "phone.getGroupCallJoinAs#ef7c213a", + 0xe6aa647f: "phone.exportGroupCallInvite#e6aa647f", 0xf2f2330a: "langpack.getLangPack#f2f2330a", 0xefea3803: "langpack.getStrings#efea3803", 0xcd984aa5: "langpack.getDifference#cd984aa5", @@ -1356,6 +1366,7 @@ func NamesMap() map[string]uint32 { "inputPhotoLegacyFileLocation": 0xd83466f3, "inputPeerPhotoFileLocation": 0x27d69997, "inputStickerSetThumb": 0xdbaeae9, + "inputGroupCallStream": 0xbba51639, "peerUser": 0x9db1bc6d, "peerChat": 0xbad0e5bb, "peerChannel": 0xbddde532, @@ -1384,8 +1395,8 @@ func NamesMap() map[string]uint32 { "chatForbidden": 0x7328bdb, "channel": 0xd31a961e, "channelForbidden": 0x289da732, - "chatFull": 0xf06c4018, - "channelFull": 0x2548c037, + "chatFull": 0x8a1e2983, + "channelFull": 0x548c3f93, "chatParticipant": 0xc8d7493e, "chatParticipantCreator": 0xda13538a, "chatParticipantAdmin": 0xe2d6e436, @@ -1510,7 +1521,7 @@ func NamesMap() map[string]uint32 { "updateMessageID": 0x4e90bfd6, "updateDeleteMessages": 0xa20db0e5, "updateUserTyping": 0x5c486927, - "updateChatUserTyping": 0x9a65ea1f, + "updateChatUserTyping": 0x86cadb6c, "updateChatParticipants": 0x7761198, "updateUserStatus": 0x1bfbd823, "updateUserName": 0xa7332b73, @@ -1587,16 +1598,16 @@ func NamesMap() map[string]uint32 { "updateReadChannelDiscussionInbox": 0x1cc7de54, "updateReadChannelDiscussionOutbox": 0x4638a26c, "updatePeerBlocked": 0x246a4b22, - "updateChannelUserTyping": 0xff2abe9f, + "updateChannelUserTyping": 0x6b171718, "updatePinnedMessages": 0xed85eab5, "updatePinnedChannelMessages": 0x8588878b, "updateChat": 0x1330a196, "updateGroupCallParticipants": 0xf2ebdb4e, "updateGroupCall": 0xa45eb99b, "updatePeerHistoryTTL": 0xbb9bb9a5, - "updateChatParticipant": 0x609a6ed4, - "updateChannelParticipant": 0x65d2b464, - "updateBotStopped": 0x30ec6ebc, + "updateChatParticipant": 0xf3b3781f, + "updateChannelParticipant": 0x7fecb1ec, + "updateBotStopped": 0x7f9488a, "updates.state": 0xa56c2a3e, "updates.differenceEmpty": 0x5d75a138, "updates.difference": 0xf49ca0, @@ -2179,11 +2190,11 @@ func NamesMap() map[string]uint32 { "peerBlocked": 0xe8fd8014, "stats.messageStats": 0x8999f295, "groupCallDiscarded": 0x7780bcb4, - "groupCall": 0x55903081, + "groupCall": 0xc0c2052e, "inputGroupCall": 0xd8aa840f, - "groupCallParticipant": 0x64c62a15, - "phone.groupCall": 0x66ab0bfc, - "phone.groupParticipants": 0x9cfeb92d, + "groupCallParticipant": 0x19adba89, + "phone.groupCall": 0x9e727aad, + "phone.groupParticipants": 0xf47751b6, "inlineQueryPeerTypeSameBotPM": 0x3081ed9d, "inlineQueryPeerTypePM": 0x833c0fac, "inlineQueryPeerTypeChat": 0xd766c50a, @@ -2199,6 +2210,9 @@ func NamesMap() map[string]uint32 { "messages.chatInviteImporters": 0x81b6b00a, "chatAdminWithInvites": 0xdfd2330f, "messages.chatAdminsWithInvites": 0xb69b72d7, + "messages.checkedHistoryImportPeer": 0xa24de717, + "phone.joinAsPeers": 0xafe5623f, + "phone.exportedGroupCallInvite": 0x204bd158, "invokeAfterMsg": 0xcb9f372d, "invokeAfterMsgs": 0x3dc4b4f0, "initConnection": 0xc1cd5ea9, @@ -2424,8 +2438,8 @@ func NamesMap() map[string]uint32 { "messages.getEmojiKeywordsLanguages": 0x4e9963b2, "messages.getEmojiURL": 0xd5b10c26, "messages.getSearchCounters": 0x732eef00, - "messages.requestUrlAuth": 0xe33f5613, - "messages.acceptUrlAuth": 0xf729ea98, + "messages.requestUrlAuth": 0x198fb446, + "messages.acceptUrlAuth": 0xb12c7125, "messages.hidePeerSettingsBar": 0x4facb138, "messages.getScheduledHistory": 0xe2c2685b, "messages.getScheduledMessages": 0xbdbb0464, @@ -2449,12 +2463,14 @@ func NamesMap() map[string]uint32 { "messages.uploadImportedMedia": 0x2a862092, "messages.startHistoryImport": 0xb43df344, "messages.getExportedChatInvites": 0xa2b5a3f6, + "messages.getExportedChatInvite": 0x73746f5c, "messages.editExportedChatInvite": 0x2e4ffbe, "messages.deleteRevokedExportedChatInvites": 0x56987bd5, "messages.deleteExportedChatInvite": 0xd464a42b, "messages.getAdminsWithInvites": 0x3920e6ef, "messages.getChatInviteImporters": 0x26fb7289, "messages.setHistoryTTL": 0xb80e5fe4, + "messages.checkHistoryImportPeer": 0x5dc60f03, "updates.getState": 0xedd4882a, "updates.getDifference": 0x25939651, "updates.getChannelDifference": 0x3173d78, @@ -2553,15 +2569,19 @@ func NamesMap() map[string]uint32 { "phone.saveCallDebug": 0x277add7e, "phone.sendSignalingData": 0xff7a9383, "phone.createGroupCall": 0xbd3dabe0, - "phone.joinGroupCall": 0x5f9c8e62, + "phone.joinGroupCall": 0xb132ff7b, "phone.leaveGroupCall": 0x500377f9, - "phone.editGroupCallMember": 0xa5e76cd8, "phone.inviteToGroupCall": 0x7b393160, "phone.discardGroupCall": 0x7a777135, "phone.toggleGroupCallSettings": 0x74bbb43d, "phone.getGroupCall": 0xc7cb017, - "phone.getGroupParticipants": 0xc9f1d285, + "phone.getGroupParticipants": 0xc558d8ab, "phone.checkGroupCall": 0xb74a7bea, + "phone.toggleGroupCallRecord": 0xc02a66d7, + "phone.editGroupCallParticipant": 0xd975eb80, + "phone.editGroupCallTitle": 0x1ca6ac0a, + "phone.getGroupCallJoinAs": 0xef7c213a, + "phone.exportGroupCallInvite": 0xe6aa647f, "langpack.getLangPack": 0xf2f2330a, "langpack.getStrings": 0xefea3803, "langpack.getDifference": 0xcd984aa5, @@ -2630,6 +2650,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0xd83466f3: func() bin.Object { return &InputPhotoLegacyFileLocation{} }, 0x27d69997: func() bin.Object { return &InputPeerPhotoFileLocation{} }, 0xdbaeae9: func() bin.Object { return &InputStickerSetThumb{} }, + 0xbba51639: func() bin.Object { return &InputGroupCallStream{} }, 0x9db1bc6d: func() bin.Object { return &PeerUser{} }, 0xbad0e5bb: func() bin.Object { return &PeerChat{} }, 0xbddde532: func() bin.Object { return &PeerChannel{} }, @@ -2658,8 +2679,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x7328bdb: func() bin.Object { return &ChatForbidden{} }, 0xd31a961e: func() bin.Object { return &Channel{} }, 0x289da732: func() bin.Object { return &ChannelForbidden{} }, - 0xf06c4018: func() bin.Object { return &ChatFull{} }, - 0x2548c037: func() bin.Object { return &ChannelFull{} }, + 0x8a1e2983: func() bin.Object { return &ChatFull{} }, + 0x548c3f93: func() bin.Object { return &ChannelFull{} }, 0xc8d7493e: func() bin.Object { return &ChatParticipant{} }, 0xda13538a: func() bin.Object { return &ChatParticipantCreator{} }, 0xe2d6e436: func() bin.Object { return &ChatParticipantAdmin{} }, @@ -2784,7 +2805,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x4e90bfd6: func() bin.Object { return &UpdateMessageID{} }, 0xa20db0e5: func() bin.Object { return &UpdateDeleteMessages{} }, 0x5c486927: func() bin.Object { return &UpdateUserTyping{} }, - 0x9a65ea1f: func() bin.Object { return &UpdateChatUserTyping{} }, + 0x86cadb6c: func() bin.Object { return &UpdateChatUserTyping{} }, 0x7761198: func() bin.Object { return &UpdateChatParticipants{} }, 0x1bfbd823: func() bin.Object { return &UpdateUserStatus{} }, 0xa7332b73: func() bin.Object { return &UpdateUserName{} }, @@ -2861,16 +2882,16 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x1cc7de54: func() bin.Object { return &UpdateReadChannelDiscussionInbox{} }, 0x4638a26c: func() bin.Object { return &UpdateReadChannelDiscussionOutbox{} }, 0x246a4b22: func() bin.Object { return &UpdatePeerBlocked{} }, - 0xff2abe9f: func() bin.Object { return &UpdateChannelUserTyping{} }, + 0x6b171718: func() bin.Object { return &UpdateChannelUserTyping{} }, 0xed85eab5: func() bin.Object { return &UpdatePinnedMessages{} }, 0x8588878b: func() bin.Object { return &UpdatePinnedChannelMessages{} }, 0x1330a196: func() bin.Object { return &UpdateChat{} }, 0xf2ebdb4e: func() bin.Object { return &UpdateGroupCallParticipants{} }, 0xa45eb99b: func() bin.Object { return &UpdateGroupCall{} }, 0xbb9bb9a5: func() bin.Object { return &UpdatePeerHistoryTTL{} }, - 0x609a6ed4: func() bin.Object { return &UpdateChatParticipant{} }, - 0x65d2b464: func() bin.Object { return &UpdateChannelParticipant{} }, - 0x30ec6ebc: func() bin.Object { return &UpdateBotStopped{} }, + 0xf3b3781f: func() bin.Object { return &UpdateChatParticipant{} }, + 0x7fecb1ec: func() bin.Object { return &UpdateChannelParticipant{} }, + 0x7f9488a: func() bin.Object { return &UpdateBotStopped{} }, 0xa56c2a3e: func() bin.Object { return &UpdatesState{} }, 0x5d75a138: func() bin.Object { return &UpdatesDifferenceEmpty{} }, 0xf49ca0: func() bin.Object { return &UpdatesDifference{} }, @@ -3453,11 +3474,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0xe8fd8014: func() bin.Object { return &PeerBlocked{} }, 0x8999f295: func() bin.Object { return &StatsMessageStats{} }, 0x7780bcb4: func() bin.Object { return &GroupCallDiscarded{} }, - 0x55903081: func() bin.Object { return &GroupCall{} }, + 0xc0c2052e: func() bin.Object { return &GroupCall{} }, 0xd8aa840f: func() bin.Object { return &InputGroupCall{} }, - 0x64c62a15: func() bin.Object { return &GroupCallParticipant{} }, - 0x66ab0bfc: func() bin.Object { return &PhoneGroupCall{} }, - 0x9cfeb92d: func() bin.Object { return &PhoneGroupParticipants{} }, + 0x19adba89: func() bin.Object { return &GroupCallParticipant{} }, + 0x9e727aad: func() bin.Object { return &PhoneGroupCall{} }, + 0xf47751b6: func() bin.Object { return &PhoneGroupParticipants{} }, 0x3081ed9d: func() bin.Object { return &InlineQueryPeerTypeSameBotPM{} }, 0x833c0fac: func() bin.Object { return &InlineQueryPeerTypePM{} }, 0xd766c50a: func() bin.Object { return &InlineQueryPeerTypeChat{} }, @@ -3473,6 +3494,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x81b6b00a: func() bin.Object { return &MessagesChatInviteImporters{} }, 0xdfd2330f: func() bin.Object { return &ChatAdminWithInvites{} }, 0xb69b72d7: func() bin.Object { return &MessagesChatAdminsWithInvites{} }, + 0xa24de717: func() bin.Object { return &MessagesCheckedHistoryImportPeer{} }, + 0xafe5623f: func() bin.Object { return &PhoneJoinAsPeers{} }, + 0x204bd158: func() bin.Object { return &PhoneExportedGroupCallInvite{} }, 0xcb9f372d: func() bin.Object { return &InvokeAfterMsgRequest{} }, 0x3dc4b4f0: func() bin.Object { return &InvokeAfterMsgsRequest{} }, 0xc1cd5ea9: func() bin.Object { return &InitConnectionRequest{} }, @@ -3698,8 +3722,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x4e9963b2: func() bin.Object { return &MessagesGetEmojiKeywordsLanguagesRequest{} }, 0xd5b10c26: func() bin.Object { return &MessagesGetEmojiURLRequest{} }, 0x732eef00: func() bin.Object { return &MessagesGetSearchCountersRequest{} }, - 0xe33f5613: func() bin.Object { return &MessagesRequestURLAuthRequest{} }, - 0xf729ea98: func() bin.Object { return &MessagesAcceptURLAuthRequest{} }, + 0x198fb446: func() bin.Object { return &MessagesRequestURLAuthRequest{} }, + 0xb12c7125: func() bin.Object { return &MessagesAcceptURLAuthRequest{} }, 0x4facb138: func() bin.Object { return &MessagesHidePeerSettingsBarRequest{} }, 0xe2c2685b: func() bin.Object { return &MessagesGetScheduledHistoryRequest{} }, 0xbdbb0464: func() bin.Object { return &MessagesGetScheduledMessagesRequest{} }, @@ -3723,12 +3747,14 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x2a862092: func() bin.Object { return &MessagesUploadImportedMediaRequest{} }, 0xb43df344: func() bin.Object { return &MessagesStartHistoryImportRequest{} }, 0xa2b5a3f6: func() bin.Object { return &MessagesGetExportedChatInvitesRequest{} }, + 0x73746f5c: func() bin.Object { return &MessagesGetExportedChatInviteRequest{} }, 0x2e4ffbe: func() bin.Object { return &MessagesEditExportedChatInviteRequest{} }, 0x56987bd5: func() bin.Object { return &MessagesDeleteRevokedExportedChatInvitesRequest{} }, 0xd464a42b: func() bin.Object { return &MessagesDeleteExportedChatInviteRequest{} }, 0x3920e6ef: func() bin.Object { return &MessagesGetAdminsWithInvitesRequest{} }, 0x26fb7289: func() bin.Object { return &MessagesGetChatInviteImportersRequest{} }, 0xb80e5fe4: func() bin.Object { return &MessagesSetHistoryTTLRequest{} }, + 0x5dc60f03: func() bin.Object { return &MessagesCheckHistoryImportPeerRequest{} }, 0xedd4882a: func() bin.Object { return &UpdatesGetStateRequest{} }, 0x25939651: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, 0x3173d78: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -3827,15 +3853,19 @@ func TypesConstructorMap() map[uint32]func() bin.Object { 0x277add7e: func() bin.Object { return &PhoneSaveCallDebugRequest{} }, 0xff7a9383: func() bin.Object { return &PhoneSendSignalingDataRequest{} }, 0xbd3dabe0: func() bin.Object { return &PhoneCreateGroupCallRequest{} }, - 0x5f9c8e62: func() bin.Object { return &PhoneJoinGroupCallRequest{} }, + 0xb132ff7b: func() bin.Object { return &PhoneJoinGroupCallRequest{} }, 0x500377f9: func() bin.Object { return &PhoneLeaveGroupCallRequest{} }, - 0xa5e76cd8: func() bin.Object { return &PhoneEditGroupCallMemberRequest{} }, 0x7b393160: func() bin.Object { return &PhoneInviteToGroupCallRequest{} }, 0x7a777135: func() bin.Object { return &PhoneDiscardGroupCallRequest{} }, 0x74bbb43d: func() bin.Object { return &PhoneToggleGroupCallSettingsRequest{} }, 0xc7cb017: func() bin.Object { return &PhoneGetGroupCallRequest{} }, - 0xc9f1d285: func() bin.Object { return &PhoneGetGroupParticipantsRequest{} }, + 0xc558d8ab: func() bin.Object { return &PhoneGetGroupParticipantsRequest{} }, 0xb74a7bea: func() bin.Object { return &PhoneCheckGroupCallRequest{} }, + 0xc02a66d7: func() bin.Object { return &PhoneToggleGroupCallRecordRequest{} }, + 0xd975eb80: func() bin.Object { return &PhoneEditGroupCallParticipantRequest{} }, + 0x1ca6ac0a: func() bin.Object { return &PhoneEditGroupCallTitleRequest{} }, + 0xef7c213a: func() bin.Object { return &PhoneGetGroupCallJoinAsRequest{} }, + 0xe6aa647f: func() bin.Object { return &PhoneExportGroupCallInviteRequest{} }, 0xf2f2330a: func() bin.Object { return &LangpackGetLangPackRequest{} }, 0xefea3803: func() bin.Object { return &LangpackGetStringsRequest{} }, 0xcd984aa5: func() bin.Object { return &LangpackGetDifferenceRequest{} }, diff --git a/tg/tl_update_gen.go b/tg/tl_update_gen.go index 7f0c01bf81..fdccba563a 100644 --- a/tg/tl_update_gen.go +++ b/tg/tl_update_gen.go @@ -657,15 +657,15 @@ var ( _ UpdateClass = &UpdateUserTyping{} ) -// UpdateChatUserTyping represents TL type `updateChatUserTyping#9a65ea1f`. +// UpdateChatUserTyping represents TL type `updateChatUserTyping#86cadb6c`. // The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. // // See https://core.telegram.org/constructor/updateChatUserTyping for reference. type UpdateChatUserTyping struct { // Group id ChatID int - // User id - UserID int + // FromID field of UpdateChatUserTyping. + FromID PeerClass // Type of actionParameter added in Layer 17¹. // // Links: @@ -674,7 +674,7 @@ type UpdateChatUserTyping struct { } // UpdateChatUserTypingTypeID is TL type id of UpdateChatUserTyping. -const UpdateChatUserTypingTypeID = 0x9a65ea1f +const UpdateChatUserTypingTypeID = 0x86cadb6c func (u *UpdateChatUserTyping) Zero() bool { if u == nil { @@ -683,7 +683,7 @@ func (u *UpdateChatUserTyping) Zero() bool { if !(u.ChatID == 0) { return false } - if !(u.UserID == 0) { + if !(u.FromID == nil) { return false } if !(u.Action == nil) { @@ -705,11 +705,11 @@ func (u *UpdateChatUserTyping) String() string { // FillFrom fills UpdateChatUserTyping from given interface. func (u *UpdateChatUserTyping) FillFrom(from interface { GetChatID() (value int) - GetUserID() (value int) + GetFromID() (value PeerClass) GetAction() (value SendMessageActionClass) }) { u.ChatID = from.GetChatID() - u.UserID = from.GetUserID() + u.FromID = from.GetFromID() u.Action = from.GetAction() } @@ -741,8 +741,8 @@ func (u *UpdateChatUserTyping) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "UserID", - SchemaName: "user_id", + Name: "FromID", + SchemaName: "from_id", }, { Name: "Action", @@ -755,16 +755,21 @@ func (u *UpdateChatUserTyping) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateChatUserTyping) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUserTyping#9a65ea1f as nil") + return fmt.Errorf("can't encode updateChatUserTyping#86cadb6c as nil") } b.PutID(UpdateChatUserTypingTypeID) b.PutInt(u.ChatID) - b.PutInt(u.UserID) + if u.FromID == nil { + return fmt.Errorf("unable to encode updateChatUserTyping#86cadb6c: field from_id is nil") + } + if err := u.FromID.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatUserTyping#86cadb6c: field from_id: %w", err) + } if u.Action == nil { - return fmt.Errorf("unable to encode updateChatUserTyping#9a65ea1f: field action is nil") + return fmt.Errorf("unable to encode updateChatUserTyping#86cadb6c: field action is nil") } if err := u.Action.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatUserTyping#9a65ea1f: field action: %w", err) + return fmt.Errorf("unable to encode updateChatUserTyping#86cadb6c: field action: %w", err) } return nil } @@ -774,9 +779,9 @@ func (u *UpdateChatUserTyping) GetChatID() (value int) { return u.ChatID } -// GetUserID returns value of UserID field. -func (u *UpdateChatUserTyping) GetUserID() (value int) { - return u.UserID +// GetFromID returns value of FromID field. +func (u *UpdateChatUserTyping) GetFromID() (value PeerClass) { + return u.FromID } // GetAction returns value of Action field. @@ -787,29 +792,29 @@ func (u *UpdateChatUserTyping) GetAction() (value SendMessageActionClass) { // Decode implements bin.Decoder. func (u *UpdateChatUserTyping) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUserTyping#9a65ea1f to nil") + return fmt.Errorf("can't decode updateChatUserTyping#86cadb6c to nil") } if err := b.ConsumeID(UpdateChatUserTypingTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatUserTyping#9a65ea1f: %w", err) + return fmt.Errorf("unable to decode updateChatUserTyping#86cadb6c: %w", err) } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChatUserTyping#9a65ea1f: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUserTyping#86cadb6c: field chat_id: %w", err) } u.ChatID = value } { - value, err := b.Int() + value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode updateChatUserTyping#9a65ea1f: field user_id: %w", err) + return fmt.Errorf("unable to decode updateChatUserTyping#86cadb6c: field from_id: %w", err) } - u.UserID = value + u.FromID = value } { value, err := DecodeSendMessageAction(b) if err != nil { - return fmt.Errorf("unable to decode updateChatUserTyping#9a65ea1f: field action: %w", err) + return fmt.Errorf("unable to decode updateChatUserTyping#86cadb6c: field action: %w", err) } u.Action = value } @@ -13367,7 +13372,7 @@ var ( _ UpdateClass = &UpdatePeerBlocked{} ) -// UpdateChannelUserTyping represents TL type `updateChannelUserTyping#ff2abe9f`. +// UpdateChannelUserTyping represents TL type `updateChannelUserTyping#6b171718`. // A user is typing in a supergroup, channel¹ or message thread² // // Links: @@ -13390,14 +13395,14 @@ type UpdateChannelUserTyping struct { // // Use SetTopMsgID and GetTopMsgID helpers. TopMsgID int - // User ID - UserID int + // FromID field of UpdateChannelUserTyping. + FromID PeerClass // Whether the user is typing, sending a media or doing something else Action SendMessageActionClass } // UpdateChannelUserTypingTypeID is TL type id of UpdateChannelUserTyping. -const UpdateChannelUserTypingTypeID = 0xff2abe9f +const UpdateChannelUserTypingTypeID = 0x6b171718 func (u *UpdateChannelUserTyping) Zero() bool { if u == nil { @@ -13412,7 +13417,7 @@ func (u *UpdateChannelUserTyping) Zero() bool { if !(u.TopMsgID == 0) { return false } - if !(u.UserID == 0) { + if !(u.FromID == nil) { return false } if !(u.Action == nil) { @@ -13435,7 +13440,7 @@ func (u *UpdateChannelUserTyping) String() string { func (u *UpdateChannelUserTyping) FillFrom(from interface { GetChannelID() (value int) GetTopMsgID() (value int, ok bool) - GetUserID() (value int) + GetFromID() (value PeerClass) GetAction() (value SendMessageActionClass) }) { u.ChannelID = from.GetChannelID() @@ -13443,7 +13448,7 @@ func (u *UpdateChannelUserTyping) FillFrom(from interface { u.TopMsgID = val } - u.UserID = from.GetUserID() + u.FromID = from.GetFromID() u.Action = from.GetAction() } @@ -13480,8 +13485,8 @@ func (u *UpdateChannelUserTyping) TypeInfo() tdp.Type { Null: !u.Flags.Has(0), }, { - Name: "UserID", - SchemaName: "user_id", + Name: "FromID", + SchemaName: "from_id", }, { Name: "Action", @@ -13494,25 +13499,30 @@ func (u *UpdateChannelUserTyping) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateChannelUserTyping) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChannelUserTyping#ff2abe9f as nil") + return fmt.Errorf("can't encode updateChannelUserTyping#6b171718 as nil") } b.PutID(UpdateChannelUserTypingTypeID) if !(u.TopMsgID == 0) { u.Flags.Set(0) } if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChannelUserTyping#ff2abe9f: field flags: %w", err) + return fmt.Errorf("unable to encode updateChannelUserTyping#6b171718: field flags: %w", err) } b.PutInt(u.ChannelID) if u.Flags.Has(0) { b.PutInt(u.TopMsgID) } - b.PutInt(u.UserID) + if u.FromID == nil { + return fmt.Errorf("unable to encode updateChannelUserTyping#6b171718: field from_id is nil") + } + if err := u.FromID.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChannelUserTyping#6b171718: field from_id: %w", err) + } if u.Action == nil { - return fmt.Errorf("unable to encode updateChannelUserTyping#ff2abe9f: field action is nil") + return fmt.Errorf("unable to encode updateChannelUserTyping#6b171718: field action is nil") } if err := u.Action.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChannelUserTyping#ff2abe9f: field action: %w", err) + return fmt.Errorf("unable to encode updateChannelUserTyping#6b171718: field action: %w", err) } return nil } @@ -13537,9 +13547,9 @@ func (u *UpdateChannelUserTyping) GetTopMsgID() (value int, ok bool) { return u.TopMsgID, true } -// GetUserID returns value of UserID field. -func (u *UpdateChannelUserTyping) GetUserID() (value int) { - return u.UserID +// GetFromID returns value of FromID field. +func (u *UpdateChannelUserTyping) GetFromID() (value PeerClass) { + return u.FromID } // GetAction returns value of Action field. @@ -13550,41 +13560,41 @@ func (u *UpdateChannelUserTyping) GetAction() (value SendMessageActionClass) { // Decode implements bin.Decoder. func (u *UpdateChannelUserTyping) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChannelUserTyping#ff2abe9f to nil") + return fmt.Errorf("can't decode updateChannelUserTyping#6b171718 to nil") } if err := b.ConsumeID(UpdateChannelUserTypingTypeID); err != nil { - return fmt.Errorf("unable to decode updateChannelUserTyping#ff2abe9f: %w", err) + return fmt.Errorf("unable to decode updateChannelUserTyping#6b171718: %w", err) } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChannelUserTyping#ff2abe9f: field flags: %w", err) + return fmt.Errorf("unable to decode updateChannelUserTyping#6b171718: field flags: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChannelUserTyping#ff2abe9f: field channel_id: %w", err) + return fmt.Errorf("unable to decode updateChannelUserTyping#6b171718: field channel_id: %w", err) } u.ChannelID = value } if u.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChannelUserTyping#ff2abe9f: field top_msg_id: %w", err) + return fmt.Errorf("unable to decode updateChannelUserTyping#6b171718: field top_msg_id: %w", err) } u.TopMsgID = value } { - value, err := b.Int() + value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode updateChannelUserTyping#ff2abe9f: field user_id: %w", err) + return fmt.Errorf("unable to decode updateChannelUserTyping#6b171718: field from_id: %w", err) } - u.UserID = value + u.FromID = value } { value, err := DecodeSendMessageAction(b) if err != nil { - return fmt.Errorf("unable to decode updateChannelUserTyping#ff2abe9f: field action: %w", err) + return fmt.Errorf("unable to decode updateChannelUserTyping#6b171718: field action: %w", err) } u.Action = value } @@ -14711,7 +14721,7 @@ var ( _ UpdateClass = &UpdatePeerHistoryTTL{} ) -// UpdateChatParticipant represents TL type `updateChatParticipant#609a6ed4`. +// UpdateChatParticipant represents TL type `updateChatParticipant#f3b3781f`. // // See https://core.telegram.org/constructor/updateChatParticipant for reference. type UpdateChatParticipant struct { @@ -14721,6 +14731,8 @@ type UpdateChatParticipant struct { ChatID int // Date field of UpdateChatParticipant. Date int + // ActorID field of UpdateChatParticipant. + ActorID int // UserID field of UpdateChatParticipant. UserID int // PrevParticipant field of UpdateChatParticipant. @@ -14731,12 +14743,16 @@ type UpdateChatParticipant struct { // // Use SetNewParticipant and GetNewParticipant helpers. NewParticipant ChatParticipantClass + // Invite field of UpdateChatParticipant. + // + // Use SetInvite and GetInvite helpers. + Invite ChatInviteExported // Qts field of UpdateChatParticipant. Qts int } // UpdateChatParticipantTypeID is TL type id of UpdateChatParticipant. -const UpdateChatParticipantTypeID = 0x609a6ed4 +const UpdateChatParticipantTypeID = 0xf3b3781f func (u *UpdateChatParticipant) Zero() bool { if u == nil { @@ -14751,6 +14767,9 @@ func (u *UpdateChatParticipant) Zero() bool { if !(u.Date == 0) { return false } + if !(u.ActorID == 0) { + return false + } if !(u.UserID == 0) { return false } @@ -14760,6 +14779,9 @@ func (u *UpdateChatParticipant) Zero() bool { if !(u.NewParticipant == nil) { return false } + if !(u.Invite.Zero()) { + return false + } if !(u.Qts == 0) { return false } @@ -14780,13 +14802,16 @@ func (u *UpdateChatParticipant) String() string { func (u *UpdateChatParticipant) FillFrom(from interface { GetChatID() (value int) GetDate() (value int) + GetActorID() (value int) GetUserID() (value int) GetPrevParticipant() (value ChatParticipantClass, ok bool) GetNewParticipant() (value ChatParticipantClass, ok bool) + GetInvite() (value ChatInviteExported, ok bool) GetQts() (value int) }) { u.ChatID = from.GetChatID() u.Date = from.GetDate() + u.ActorID = from.GetActorID() u.UserID = from.GetUserID() if val, ok := from.GetPrevParticipant(); ok { u.PrevParticipant = val @@ -14796,6 +14821,10 @@ func (u *UpdateChatParticipant) FillFrom(from interface { u.NewParticipant = val } + if val, ok := from.GetInvite(); ok { + u.Invite = val + } + u.Qts = from.GetQts() } @@ -14830,6 +14859,10 @@ func (u *UpdateChatParticipant) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "ActorID", + SchemaName: "actor_id", + }, { Name: "UserID", SchemaName: "user_id", @@ -14844,6 +14877,11 @@ func (u *UpdateChatParticipant) TypeInfo() tdp.Type { SchemaName: "new_participant", Null: !u.Flags.Has(1), }, + { + Name: "Invite", + SchemaName: "invite", + Null: !u.Flags.Has(2), + }, { Name: "Qts", SchemaName: "qts", @@ -14855,7 +14893,7 @@ func (u *UpdateChatParticipant) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateChatParticipant) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatParticipant#609a6ed4 as nil") + return fmt.Errorf("can't encode updateChatParticipant#f3b3781f as nil") } b.PutID(UpdateChatParticipantTypeID) if !(u.PrevParticipant == nil) { @@ -14864,26 +14902,35 @@ func (u *UpdateChatParticipant) Encode(b *bin.Buffer) error { if !(u.NewParticipant == nil) { u.Flags.Set(1) } + if !(u.Invite.Zero()) { + u.Flags.Set(2) + } if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatParticipant#609a6ed4: field flags: %w", err) + return fmt.Errorf("unable to encode updateChatParticipant#f3b3781f: field flags: %w", err) } b.PutInt(u.ChatID) b.PutInt(u.Date) + b.PutInt(u.ActorID) b.PutInt(u.UserID) if u.Flags.Has(0) { if u.PrevParticipant == nil { - return fmt.Errorf("unable to encode updateChatParticipant#609a6ed4: field prev_participant is nil") + return fmt.Errorf("unable to encode updateChatParticipant#f3b3781f: field prev_participant is nil") } if err := u.PrevParticipant.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatParticipant#609a6ed4: field prev_participant: %w", err) + return fmt.Errorf("unable to encode updateChatParticipant#f3b3781f: field prev_participant: %w", err) } } if u.Flags.Has(1) { if u.NewParticipant == nil { - return fmt.Errorf("unable to encode updateChatParticipant#609a6ed4: field new_participant is nil") + return fmt.Errorf("unable to encode updateChatParticipant#f3b3781f: field new_participant is nil") } if err := u.NewParticipant.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatParticipant#609a6ed4: field new_participant: %w", err) + return fmt.Errorf("unable to encode updateChatParticipant#f3b3781f: field new_participant: %w", err) + } + } + if u.Flags.Has(2) { + if err := u.Invite.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatParticipant#f3b3781f: field invite: %w", err) } } b.PutInt(u.Qts) @@ -14900,6 +14947,11 @@ func (u *UpdateChatParticipant) GetDate() (value int) { return u.Date } +// GetActorID returns value of ActorID field. +func (u *UpdateChatParticipant) GetActorID() (value int) { + return u.ActorID +} + // GetUserID returns value of UserID field. func (u *UpdateChatParticipant) GetUserID() (value int) { return u.UserID @@ -14935,6 +14987,21 @@ func (u *UpdateChatParticipant) GetNewParticipant() (value ChatParticipantClass, return u.NewParticipant, true } +// SetInvite sets value of Invite conditional field. +func (u *UpdateChatParticipant) SetInvite(value ChatInviteExported) { + u.Flags.Set(2) + u.Invite = value +} + +// GetInvite returns value of Invite conditional field and +// boolean which is true if field was set. +func (u *UpdateChatParticipant) GetInvite() (value ChatInviteExported, ok bool) { + if !u.Flags.Has(2) { + return value, false + } + return u.Invite, true +} + // GetQts returns value of Qts field. func (u *UpdateChatParticipant) GetQts() (value int) { return u.Qts @@ -14943,55 +15010,67 @@ func (u *UpdateChatParticipant) GetQts() (value int) { // Decode implements bin.Decoder. func (u *UpdateChatParticipant) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatParticipant#609a6ed4 to nil") + return fmt.Errorf("can't decode updateChatParticipant#f3b3781f to nil") } if err := b.ConsumeID(UpdateChatParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: %w", err) } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field flags: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field flags: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field chat_id: %w", err) } u.ChatID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field date: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field date: %w", err) } u.Date = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field user_id: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field actor_id: %w", err) + } + u.ActorID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field user_id: %w", err) } u.UserID = value } if u.Flags.Has(0) { value, err := DecodeChatParticipant(b) if err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field prev_participant: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field prev_participant: %w", err) } u.PrevParticipant = value } if u.Flags.Has(1) { value, err := DecodeChatParticipant(b) if err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field new_participant: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field new_participant: %w", err) } u.NewParticipant = value } + if u.Flags.Has(2) { + if err := u.Invite.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field invite: %w", err) + } + } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChatParticipant#609a6ed4: field qts: %w", err) + return fmt.Errorf("unable to decode updateChatParticipant#f3b3781f: field qts: %w", err) } u.Qts = value } @@ -15009,7 +15088,7 @@ var ( _ UpdateClass = &UpdateChatParticipant{} ) -// UpdateChannelParticipant represents TL type `updateChannelParticipant#65d2b464`. +// UpdateChannelParticipant represents TL type `updateChannelParticipant#7fecb1ec`. // A participant has left, joined, was banned or admined in a channel or supergroup¹. // // Links: @@ -15026,6 +15105,8 @@ type UpdateChannelParticipant struct { ChannelID int // Date of the event Date int + // ActorID field of UpdateChannelParticipant. + ActorID int // User in question UserID int // Previous participant status @@ -15036,6 +15117,10 @@ type UpdateChannelParticipant struct { // // Use SetNewParticipant and GetNewParticipant helpers. NewParticipant ChannelParticipantClass + // Invite field of UpdateChannelParticipant. + // + // Use SetInvite and GetInvite helpers. + Invite ChatInviteExported // PTS¹ // // Links: @@ -15044,7 +15129,7 @@ type UpdateChannelParticipant struct { } // UpdateChannelParticipantTypeID is TL type id of UpdateChannelParticipant. -const UpdateChannelParticipantTypeID = 0x65d2b464 +const UpdateChannelParticipantTypeID = 0x7fecb1ec func (u *UpdateChannelParticipant) Zero() bool { if u == nil { @@ -15059,6 +15144,9 @@ func (u *UpdateChannelParticipant) Zero() bool { if !(u.Date == 0) { return false } + if !(u.ActorID == 0) { + return false + } if !(u.UserID == 0) { return false } @@ -15068,6 +15156,9 @@ func (u *UpdateChannelParticipant) Zero() bool { if !(u.NewParticipant == nil) { return false } + if !(u.Invite.Zero()) { + return false + } if !(u.Qts == 0) { return false } @@ -15088,13 +15179,16 @@ func (u *UpdateChannelParticipant) String() string { func (u *UpdateChannelParticipant) FillFrom(from interface { GetChannelID() (value int) GetDate() (value int) + GetActorID() (value int) GetUserID() (value int) GetPrevParticipant() (value ChannelParticipantClass, ok bool) GetNewParticipant() (value ChannelParticipantClass, ok bool) + GetInvite() (value ChatInviteExported, ok bool) GetQts() (value int) }) { u.ChannelID = from.GetChannelID() u.Date = from.GetDate() + u.ActorID = from.GetActorID() u.UserID = from.GetUserID() if val, ok := from.GetPrevParticipant(); ok { u.PrevParticipant = val @@ -15104,6 +15198,10 @@ func (u *UpdateChannelParticipant) FillFrom(from interface { u.NewParticipant = val } + if val, ok := from.GetInvite(); ok { + u.Invite = val + } + u.Qts = from.GetQts() } @@ -15138,6 +15236,10 @@ func (u *UpdateChannelParticipant) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "ActorID", + SchemaName: "actor_id", + }, { Name: "UserID", SchemaName: "user_id", @@ -15152,6 +15254,11 @@ func (u *UpdateChannelParticipant) TypeInfo() tdp.Type { SchemaName: "new_participant", Null: !u.Flags.Has(1), }, + { + Name: "Invite", + SchemaName: "invite", + Null: !u.Flags.Has(2), + }, { Name: "Qts", SchemaName: "qts", @@ -15163,7 +15270,7 @@ func (u *UpdateChannelParticipant) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateChannelParticipant) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChannelParticipant#65d2b464 as nil") + return fmt.Errorf("can't encode updateChannelParticipant#7fecb1ec as nil") } b.PutID(UpdateChannelParticipantTypeID) if !(u.PrevParticipant == nil) { @@ -15172,26 +15279,35 @@ func (u *UpdateChannelParticipant) Encode(b *bin.Buffer) error { if !(u.NewParticipant == nil) { u.Flags.Set(1) } + if !(u.Invite.Zero()) { + u.Flags.Set(2) + } if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChannelParticipant#65d2b464: field flags: %w", err) + return fmt.Errorf("unable to encode updateChannelParticipant#7fecb1ec: field flags: %w", err) } b.PutInt(u.ChannelID) b.PutInt(u.Date) + b.PutInt(u.ActorID) b.PutInt(u.UserID) if u.Flags.Has(0) { if u.PrevParticipant == nil { - return fmt.Errorf("unable to encode updateChannelParticipant#65d2b464: field prev_participant is nil") + return fmt.Errorf("unable to encode updateChannelParticipant#7fecb1ec: field prev_participant is nil") } if err := u.PrevParticipant.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChannelParticipant#65d2b464: field prev_participant: %w", err) + return fmt.Errorf("unable to encode updateChannelParticipant#7fecb1ec: field prev_participant: %w", err) } } if u.Flags.Has(1) { if u.NewParticipant == nil { - return fmt.Errorf("unable to encode updateChannelParticipant#65d2b464: field new_participant is nil") + return fmt.Errorf("unable to encode updateChannelParticipant#7fecb1ec: field new_participant is nil") } if err := u.NewParticipant.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChannelParticipant#65d2b464: field new_participant: %w", err) + return fmt.Errorf("unable to encode updateChannelParticipant#7fecb1ec: field new_participant: %w", err) + } + } + if u.Flags.Has(2) { + if err := u.Invite.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChannelParticipant#7fecb1ec: field invite: %w", err) } } b.PutInt(u.Qts) @@ -15208,6 +15324,11 @@ func (u *UpdateChannelParticipant) GetDate() (value int) { return u.Date } +// GetActorID returns value of ActorID field. +func (u *UpdateChannelParticipant) GetActorID() (value int) { + return u.ActorID +} + // GetUserID returns value of UserID field. func (u *UpdateChannelParticipant) GetUserID() (value int) { return u.UserID @@ -15243,6 +15364,21 @@ func (u *UpdateChannelParticipant) GetNewParticipant() (value ChannelParticipant return u.NewParticipant, true } +// SetInvite sets value of Invite conditional field. +func (u *UpdateChannelParticipant) SetInvite(value ChatInviteExported) { + u.Flags.Set(2) + u.Invite = value +} + +// GetInvite returns value of Invite conditional field and +// boolean which is true if field was set. +func (u *UpdateChannelParticipant) GetInvite() (value ChatInviteExported, ok bool) { + if !u.Flags.Has(2) { + return value, false + } + return u.Invite, true +} + // GetQts returns value of Qts field. func (u *UpdateChannelParticipant) GetQts() (value int) { return u.Qts @@ -15251,55 +15387,67 @@ func (u *UpdateChannelParticipant) GetQts() (value int) { // Decode implements bin.Decoder. func (u *UpdateChannelParticipant) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChannelParticipant#65d2b464 to nil") + return fmt.Errorf("can't decode updateChannelParticipant#7fecb1ec to nil") } if err := b.ConsumeID(UpdateChannelParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: %w", err) } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field flags: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field flags: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field channel_id: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field channel_id: %w", err) } u.ChannelID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field date: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field date: %w", err) } u.Date = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field user_id: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field actor_id: %w", err) + } + u.ActorID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field user_id: %w", err) } u.UserID = value } if u.Flags.Has(0) { value, err := DecodeChannelParticipant(b) if err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field prev_participant: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field prev_participant: %w", err) } u.PrevParticipant = value } if u.Flags.Has(1) { value, err := DecodeChannelParticipant(b) if err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field new_participant: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field new_participant: %w", err) } u.NewParticipant = value } + if u.Flags.Has(2) { + if err := u.Invite.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field invite: %w", err) + } + } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateChannelParticipant#65d2b464: field qts: %w", err) + return fmt.Errorf("unable to decode updateChannelParticipant#7fecb1ec: field qts: %w", err) } u.Qts = value } @@ -15317,12 +15465,14 @@ var ( _ UpdateClass = &UpdateChannelParticipant{} ) -// UpdateBotStopped represents TL type `updateBotStopped#30ec6ebc`. +// UpdateBotStopped represents TL type `updateBotStopped#7f9488a`. // // See https://core.telegram.org/constructor/updateBotStopped for reference. type UpdateBotStopped struct { // UserID field of UpdateBotStopped. UserID int + // Date field of UpdateBotStopped. + Date int // Stopped field of UpdateBotStopped. Stopped bool // Qts field of UpdateBotStopped. @@ -15330,7 +15480,7 @@ type UpdateBotStopped struct { } // UpdateBotStoppedTypeID is TL type id of UpdateBotStopped. -const UpdateBotStoppedTypeID = 0x30ec6ebc +const UpdateBotStoppedTypeID = 0x7f9488a func (u *UpdateBotStopped) Zero() bool { if u == nil { @@ -15339,6 +15489,9 @@ func (u *UpdateBotStopped) Zero() bool { if !(u.UserID == 0) { return false } + if !(u.Date == 0) { + return false + } if !(u.Stopped == false) { return false } @@ -15361,10 +15514,12 @@ func (u *UpdateBotStopped) String() string { // FillFrom fills UpdateBotStopped from given interface. func (u *UpdateBotStopped) FillFrom(from interface { GetUserID() (value int) + GetDate() (value int) GetStopped() (value bool) GetQts() (value int) }) { u.UserID = from.GetUserID() + u.Date = from.GetDate() u.Stopped = from.GetStopped() u.Qts = from.GetQts() } @@ -15396,6 +15551,10 @@ func (u *UpdateBotStopped) TypeInfo() tdp.Type { Name: "UserID", SchemaName: "user_id", }, + { + Name: "Date", + SchemaName: "date", + }, { Name: "Stopped", SchemaName: "stopped", @@ -15411,10 +15570,11 @@ func (u *UpdateBotStopped) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateBotStopped) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateBotStopped#30ec6ebc as nil") + return fmt.Errorf("can't encode updateBotStopped#7f9488a as nil") } b.PutID(UpdateBotStoppedTypeID) b.PutInt(u.UserID) + b.PutInt(u.Date) b.PutBool(u.Stopped) b.PutInt(u.Qts) return nil @@ -15425,6 +15585,11 @@ func (u *UpdateBotStopped) GetUserID() (value int) { return u.UserID } +// GetDate returns value of Date field. +func (u *UpdateBotStopped) GetDate() (value int) { + return u.Date +} + // GetStopped returns value of Stopped field. func (u *UpdateBotStopped) GetStopped() (value bool) { return u.Stopped @@ -15438,29 +15603,36 @@ func (u *UpdateBotStopped) GetQts() (value int) { // Decode implements bin.Decoder. func (u *UpdateBotStopped) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateBotStopped#30ec6ebc to nil") + return fmt.Errorf("can't decode updateBotStopped#7f9488a to nil") } if err := b.ConsumeID(UpdateBotStoppedTypeID); err != nil { - return fmt.Errorf("unable to decode updateBotStopped#30ec6ebc: %w", err) + return fmt.Errorf("unable to decode updateBotStopped#7f9488a: %w", err) } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateBotStopped#30ec6ebc: field user_id: %w", err) + return fmt.Errorf("unable to decode updateBotStopped#7f9488a: field user_id: %w", err) } u.UserID = value } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotStopped#7f9488a: field date: %w", err) + } + u.Date = value + } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode updateBotStopped#30ec6ebc: field stopped: %w", err) + return fmt.Errorf("unable to decode updateBotStopped#7f9488a: field stopped: %w", err) } u.Stopped = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateBotStopped#30ec6ebc: field qts: %w", err) + return fmt.Errorf("unable to decode updateBotStopped#7f9488a: field qts: %w", err) } u.Qts = value } @@ -15492,7 +15664,7 @@ var ( // case *tg.UpdateMessageID: // updateMessageID#4e90bfd6 // case *tg.UpdateDeleteMessages: // updateDeleteMessages#a20db0e5 // case *tg.UpdateUserTyping: // updateUserTyping#5c486927 -// case *tg.UpdateChatUserTyping: // updateChatUserTyping#9a65ea1f +// case *tg.UpdateChatUserTyping: // updateChatUserTyping#86cadb6c // case *tg.UpdateChatParticipants: // updateChatParticipants#7761198 // case *tg.UpdateUserStatus: // updateUserStatus#1bfbd823 // case *tg.UpdateUserName: // updateUserName#a7332b73 @@ -15569,16 +15741,16 @@ var ( // case *tg.UpdateReadChannelDiscussionInbox: // updateReadChannelDiscussionInbox#1cc7de54 // case *tg.UpdateReadChannelDiscussionOutbox: // updateReadChannelDiscussionOutbox#4638a26c // case *tg.UpdatePeerBlocked: // updatePeerBlocked#246a4b22 -// case *tg.UpdateChannelUserTyping: // updateChannelUserTyping#ff2abe9f +// case *tg.UpdateChannelUserTyping: // updateChannelUserTyping#6b171718 // case *tg.UpdatePinnedMessages: // updatePinnedMessages#ed85eab5 // case *tg.UpdatePinnedChannelMessages: // updatePinnedChannelMessages#8588878b // case *tg.UpdateChat: // updateChat#1330a196 // case *tg.UpdateGroupCallParticipants: // updateGroupCallParticipants#f2ebdb4e // case *tg.UpdateGroupCall: // updateGroupCall#a45eb99b // case *tg.UpdatePeerHistoryTTL: // updatePeerHistoryTTL#bb9bb9a5 -// case *tg.UpdateChatParticipant: // updateChatParticipant#609a6ed4 -// case *tg.UpdateChannelParticipant: // updateChannelParticipant#65d2b464 -// case *tg.UpdateBotStopped: // updateBotStopped#30ec6ebc +// case *tg.UpdateChatParticipant: // updateChatParticipant#f3b3781f +// case *tg.UpdateChannelParticipant: // updateChannelParticipant#7fecb1ec +// case *tg.UpdateBotStopped: // updateBotStopped#7f9488a // default: panic(v) // } type UpdateClass interface { @@ -15634,7 +15806,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateChatUserTypingTypeID: - // Decoding updateChatUserTyping#9a65ea1f. + // Decoding updateChatUserTyping#86cadb6c. v := UpdateChatUserTyping{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -16173,7 +16345,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateChannelUserTypingTypeID: - // Decoding updateChannelUserTyping#ff2abe9f. + // Decoding updateChannelUserTyping#6b171718. v := UpdateChannelUserTyping{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -16222,21 +16394,21 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateChatParticipantTypeID: - // Decoding updateChatParticipant#609a6ed4. + // Decoding updateChatParticipant#f3b3781f. v := UpdateChatParticipant{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil case UpdateChannelParticipantTypeID: - // Decoding updateChannelParticipant#65d2b464. + // Decoding updateChannelParticipant#7fecb1ec. v := UpdateChannelParticipant{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil case UpdateBotStoppedTypeID: - // Decoding updateBotStopped#30ec6ebc. + // Decoding updateBotStopped#7f9488a. v := UpdateBotStopped{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -24245,3 +24417,17 @@ func (s *UpdateBotStoppedArray) Pop() (v UpdateBotStopped, ok bool) { return v, true } + +// SortByDate sorts slice of UpdateBotStopped by Date. +func (s UpdateBotStoppedArray) SortByDate() UpdateBotStoppedArray { + return s.Sort(func(a, b UpdateBotStopped) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of UpdateBotStopped by Date. +func (s UpdateBotStoppedArray) SortStableByDate() UpdateBotStoppedArray { + return s.SortStable(func(a, b UpdateBotStopped) bool { + return a.GetDate() < b.GetDate() + }) +}