package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type ChannelParticipant struct {
UserID int64
Date int
}
const ChannelParticipantTypeID = 0xc00c07c0
func (c ChannelParticipant ) construct () ChannelParticipantClass { return &c }
var (
_ bin .Encoder = &ChannelParticipant {}
_ bin .Decoder = &ChannelParticipant {}
_ bin .BareEncoder = &ChannelParticipant {}
_ bin .BareDecoder = &ChannelParticipant {}
_ ChannelParticipantClass = &ChannelParticipant {}
)
func (c *ChannelParticipant ) Zero () bool {
if c == nil {
return true
}
if !(c .UserID == 0 ) {
return false
}
if !(c .Date == 0 ) {
return false
}
return true
}
func (c *ChannelParticipant ) String () string {
if c == nil {
return "ChannelParticipant(nil)"
}
type Alias ChannelParticipant
return fmt .Sprintf ("ChannelParticipant%+v" , Alias (*c ))
}
func (c *ChannelParticipant ) FillFrom (from interface {
GetUserID () (value int64 )
GetDate () (value int )
}) {
c .UserID = from .GetUserID ()
c .Date = from .GetDate ()
}
func (*ChannelParticipant ) TypeID () uint32 {
return ChannelParticipantTypeID
}
func (*ChannelParticipant ) TypeName () string {
return "channelParticipant"
}
func (c *ChannelParticipant ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelParticipant" ,
ID : ChannelParticipantTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
}
return typ
}
func (c *ChannelParticipant ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipant#c00c07c0 as nil" )
}
b .PutID (ChannelParticipantTypeID )
return c .EncodeBare (b )
}
func (c *ChannelParticipant ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipant#c00c07c0 as nil" )
}
b .PutLong (c .UserID )
b .PutInt (c .Date )
return nil
}
func (c *ChannelParticipant ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipant#c00c07c0 to nil" )
}
if err := b .ConsumeID (ChannelParticipantTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelParticipant#c00c07c0: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelParticipant ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipant#c00c07c0 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipant#c00c07c0: field user_id: %w" , err )
}
c .UserID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipant#c00c07c0: field date: %w" , err )
}
c .Date = value
}
return nil
}
func (c *ChannelParticipant ) GetUserID () (value int64 ) {
if c == nil {
return
}
return c .UserID
}
func (c *ChannelParticipant ) GetDate () (value int ) {
if c == nil {
return
}
return c .Date
}
type ChannelParticipantSelf struct {
Flags bin .Fields
ViaRequest bool
UserID int64
InviterID int64
Date int
}
const ChannelParticipantSelfTypeID = 0x35a8bfa7
func (c ChannelParticipantSelf ) construct () ChannelParticipantClass { return &c }
var (
_ bin .Encoder = &ChannelParticipantSelf {}
_ bin .Decoder = &ChannelParticipantSelf {}
_ bin .BareEncoder = &ChannelParticipantSelf {}
_ bin .BareDecoder = &ChannelParticipantSelf {}
_ ChannelParticipantClass = &ChannelParticipantSelf {}
)
func (c *ChannelParticipantSelf ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .ViaRequest == false ) {
return false
}
if !(c .UserID == 0 ) {
return false
}
if !(c .InviterID == 0 ) {
return false
}
if !(c .Date == 0 ) {
return false
}
return true
}
func (c *ChannelParticipantSelf ) String () string {
if c == nil {
return "ChannelParticipantSelf(nil)"
}
type Alias ChannelParticipantSelf
return fmt .Sprintf ("ChannelParticipantSelf%+v" , Alias (*c ))
}
func (c *ChannelParticipantSelf ) FillFrom (from interface {
GetViaRequest () (value bool )
GetUserID () (value int64 )
GetInviterID () (value int64 )
GetDate () (value int )
}) {
c .ViaRequest = from .GetViaRequest ()
c .UserID = from .GetUserID ()
c .InviterID = from .GetInviterID ()
c .Date = from .GetDate ()
}
func (*ChannelParticipantSelf ) TypeID () uint32 {
return ChannelParticipantSelfTypeID
}
func (*ChannelParticipantSelf ) TypeName () string {
return "channelParticipantSelf"
}
func (c *ChannelParticipantSelf ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelParticipantSelf" ,
ID : ChannelParticipantSelfTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ViaRequest" ,
SchemaName : "via_request" ,
Null : !c .Flags .Has (0 ),
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "InviterID" ,
SchemaName : "inviter_id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
}
return typ
}
func (c *ChannelParticipantSelf ) SetFlags () {
if !(c .ViaRequest == false ) {
c .Flags .Set (0 )
}
}
func (c *ChannelParticipantSelf ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantSelf#35a8bfa7 as nil" )
}
b .PutID (ChannelParticipantSelfTypeID )
return c .EncodeBare (b )
}
func (c *ChannelParticipantSelf ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantSelf#35a8bfa7 as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantSelf#35a8bfa7: field flags: %w" , err )
}
b .PutLong (c .UserID )
b .PutLong (c .InviterID )
b .PutInt (c .Date )
return nil
}
func (c *ChannelParticipantSelf ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantSelf#35a8bfa7 to nil" )
}
if err := b .ConsumeID (ChannelParticipantSelfTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantSelf#35a8bfa7: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelParticipantSelf ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantSelf#35a8bfa7 to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantSelf#35a8bfa7: field flags: %w" , err )
}
}
c .ViaRequest = c .Flags .Has (0 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantSelf#35a8bfa7: field user_id: %w" , err )
}
c .UserID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantSelf#35a8bfa7: field inviter_id: %w" , err )
}
c .InviterID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantSelf#35a8bfa7: field date: %w" , err )
}
c .Date = value
}
return nil
}
func (c *ChannelParticipantSelf ) SetViaRequest (value bool ) {
if value {
c .Flags .Set (0 )
c .ViaRequest = true
} else {
c .Flags .Unset (0 )
c .ViaRequest = false
}
}
func (c *ChannelParticipantSelf ) GetViaRequest () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (0 )
}
func (c *ChannelParticipantSelf ) GetUserID () (value int64 ) {
if c == nil {
return
}
return c .UserID
}
func (c *ChannelParticipantSelf ) GetInviterID () (value int64 ) {
if c == nil {
return
}
return c .InviterID
}
func (c *ChannelParticipantSelf ) GetDate () (value int ) {
if c == nil {
return
}
return c .Date
}
type ChannelParticipantCreator struct {
Flags bin .Fields
UserID int64
AdminRights ChatAdminRights
Rank string
}
const ChannelParticipantCreatorTypeID = 0x2fe601d3
func (c ChannelParticipantCreator ) construct () ChannelParticipantClass { return &c }
var (
_ bin .Encoder = &ChannelParticipantCreator {}
_ bin .Decoder = &ChannelParticipantCreator {}
_ bin .BareEncoder = &ChannelParticipantCreator {}
_ bin .BareDecoder = &ChannelParticipantCreator {}
_ ChannelParticipantClass = &ChannelParticipantCreator {}
)
func (c *ChannelParticipantCreator ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .UserID == 0 ) {
return false
}
if !(c .AdminRights .Zero ()) {
return false
}
if !(c .Rank == "" ) {
return false
}
return true
}
func (c *ChannelParticipantCreator ) String () string {
if c == nil {
return "ChannelParticipantCreator(nil)"
}
type Alias ChannelParticipantCreator
return fmt .Sprintf ("ChannelParticipantCreator%+v" , Alias (*c ))
}
func (c *ChannelParticipantCreator ) FillFrom (from interface {
GetUserID () (value int64 )
GetAdminRights () (value ChatAdminRights )
GetRank () (value string , ok bool )
}) {
c .UserID = from .GetUserID ()
c .AdminRights = from .GetAdminRights ()
if val , ok := from .GetRank (); ok {
c .Rank = val
}
}
func (*ChannelParticipantCreator ) TypeID () uint32 {
return ChannelParticipantCreatorTypeID
}
func (*ChannelParticipantCreator ) TypeName () string {
return "channelParticipantCreator"
}
func (c *ChannelParticipantCreator ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelParticipantCreator" ,
ID : ChannelParticipantCreatorTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "AdminRights" ,
SchemaName : "admin_rights" ,
},
{
Name : "Rank" ,
SchemaName : "rank" ,
Null : !c .Flags .Has (0 ),
},
}
return typ
}
func (c *ChannelParticipantCreator ) SetFlags () {
if !(c .Rank == "" ) {
c .Flags .Set (0 )
}
}
func (c *ChannelParticipantCreator ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantCreator#2fe601d3 as nil" )
}
b .PutID (ChannelParticipantCreatorTypeID )
return c .EncodeBare (b )
}
func (c *ChannelParticipantCreator ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantCreator#2fe601d3 as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantCreator#2fe601d3: field flags: %w" , err )
}
b .PutLong (c .UserID )
if err := c .AdminRights .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantCreator#2fe601d3: field admin_rights: %w" , err )
}
if c .Flags .Has (0 ) {
b .PutString (c .Rank )
}
return nil
}
func (c *ChannelParticipantCreator ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantCreator#2fe601d3 to nil" )
}
if err := b .ConsumeID (ChannelParticipantCreatorTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantCreator#2fe601d3: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelParticipantCreator ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantCreator#2fe601d3 to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantCreator#2fe601d3: field flags: %w" , err )
}
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantCreator#2fe601d3: field user_id: %w" , err )
}
c .UserID = value
}
{
if err := c .AdminRights .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantCreator#2fe601d3: field admin_rights: %w" , err )
}
}
if c .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantCreator#2fe601d3: field rank: %w" , err )
}
c .Rank = value
}
return nil
}
func (c *ChannelParticipantCreator ) GetUserID () (value int64 ) {
if c == nil {
return
}
return c .UserID
}
func (c *ChannelParticipantCreator ) GetAdminRights () (value ChatAdminRights ) {
if c == nil {
return
}
return c .AdminRights
}
func (c *ChannelParticipantCreator ) SetRank (value string ) {
c .Flags .Set (0 )
c .Rank = value
}
func (c *ChannelParticipantCreator ) GetRank () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (0 ) {
return value , false
}
return c .Rank , true
}
type ChannelParticipantAdmin struct {
Flags bin .Fields
CanEdit bool
Self bool
UserID int64
InviterID int64
PromotedBy int64
Date int
AdminRights ChatAdminRights
Rank string
}
const ChannelParticipantAdminTypeID = 0x34c3bb53
func (c ChannelParticipantAdmin ) construct () ChannelParticipantClass { return &c }
var (
_ bin .Encoder = &ChannelParticipantAdmin {}
_ bin .Decoder = &ChannelParticipantAdmin {}
_ bin .BareEncoder = &ChannelParticipantAdmin {}
_ bin .BareDecoder = &ChannelParticipantAdmin {}
_ ChannelParticipantClass = &ChannelParticipantAdmin {}
)
func (c *ChannelParticipantAdmin ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .CanEdit == false ) {
return false
}
if !(c .Self == false ) {
return false
}
if !(c .UserID == 0 ) {
return false
}
if !(c .InviterID == 0 ) {
return false
}
if !(c .PromotedBy == 0 ) {
return false
}
if !(c .Date == 0 ) {
return false
}
if !(c .AdminRights .Zero ()) {
return false
}
if !(c .Rank == "" ) {
return false
}
return true
}
func (c *ChannelParticipantAdmin ) String () string {
if c == nil {
return "ChannelParticipantAdmin(nil)"
}
type Alias ChannelParticipantAdmin
return fmt .Sprintf ("ChannelParticipantAdmin%+v" , Alias (*c ))
}
func (c *ChannelParticipantAdmin ) FillFrom (from interface {
GetCanEdit () (value bool )
GetSelf () (value bool )
GetUserID () (value int64 )
GetInviterID () (value int64 , ok bool )
GetPromotedBy () (value int64 )
GetDate () (value int )
GetAdminRights () (value ChatAdminRights )
GetRank () (value string , ok bool )
}) {
c .CanEdit = from .GetCanEdit ()
c .Self = from .GetSelf ()
c .UserID = from .GetUserID ()
if val , ok := from .GetInviterID (); ok {
c .InviterID = val
}
c .PromotedBy = from .GetPromotedBy ()
c .Date = from .GetDate ()
c .AdminRights = from .GetAdminRights ()
if val , ok := from .GetRank (); ok {
c .Rank = val
}
}
func (*ChannelParticipantAdmin ) TypeID () uint32 {
return ChannelParticipantAdminTypeID
}
func (*ChannelParticipantAdmin ) TypeName () string {
return "channelParticipantAdmin"
}
func (c *ChannelParticipantAdmin ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelParticipantAdmin" ,
ID : ChannelParticipantAdminTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "CanEdit" ,
SchemaName : "can_edit" ,
Null : !c .Flags .Has (0 ),
},
{
Name : "Self" ,
SchemaName : "self" ,
Null : !c .Flags .Has (1 ),
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "InviterID" ,
SchemaName : "inviter_id" ,
Null : !c .Flags .Has (1 ),
},
{
Name : "PromotedBy" ,
SchemaName : "promoted_by" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminRights" ,
SchemaName : "admin_rights" ,
},
{
Name : "Rank" ,
SchemaName : "rank" ,
Null : !c .Flags .Has (2 ),
},
}
return typ
}
func (c *ChannelParticipantAdmin ) SetFlags () {
if !(c .CanEdit == false ) {
c .Flags .Set (0 )
}
if !(c .Self == false ) {
c .Flags .Set (1 )
}
if !(c .InviterID == 0 ) {
c .Flags .Set (1 )
}
if !(c .Rank == "" ) {
c .Flags .Set (2 )
}
}
func (c *ChannelParticipantAdmin ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantAdmin#34c3bb53 as nil" )
}
b .PutID (ChannelParticipantAdminTypeID )
return c .EncodeBare (b )
}
func (c *ChannelParticipantAdmin ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantAdmin#34c3bb53 as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantAdmin#34c3bb53: field flags: %w" , err )
}
b .PutLong (c .UserID )
if c .Flags .Has (1 ) {
b .PutLong (c .InviterID )
}
b .PutLong (c .PromotedBy )
b .PutInt (c .Date )
if err := c .AdminRights .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantAdmin#34c3bb53: field admin_rights: %w" , err )
}
if c .Flags .Has (2 ) {
b .PutString (c .Rank )
}
return nil
}
func (c *ChannelParticipantAdmin ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantAdmin#34c3bb53 to nil" )
}
if err := b .ConsumeID (ChannelParticipantAdminTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelParticipantAdmin ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantAdmin#34c3bb53 to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field flags: %w" , err )
}
}
c .CanEdit = c .Flags .Has (0 )
c .Self = c .Flags .Has (1 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field user_id: %w" , err )
}
c .UserID = value
}
if c .Flags .Has (1 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field inviter_id: %w" , err )
}
c .InviterID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field promoted_by: %w" , err )
}
c .PromotedBy = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field date: %w" , err )
}
c .Date = value
}
{
if err := c .AdminRights .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field admin_rights: %w" , err )
}
}
if c .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantAdmin#34c3bb53: field rank: %w" , err )
}
c .Rank = value
}
return nil
}
func (c *ChannelParticipantAdmin ) SetCanEdit (value bool ) {
if value {
c .Flags .Set (0 )
c .CanEdit = true
} else {
c .Flags .Unset (0 )
c .CanEdit = false
}
}
func (c *ChannelParticipantAdmin ) GetCanEdit () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (0 )
}
func (c *ChannelParticipantAdmin ) SetSelf (value bool ) {
if value {
c .Flags .Set (1 )
c .Self = true
} else {
c .Flags .Unset (1 )
c .Self = false
}
}
func (c *ChannelParticipantAdmin ) GetSelf () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (1 )
}
func (c *ChannelParticipantAdmin ) GetUserID () (value int64 ) {
if c == nil {
return
}
return c .UserID
}
func (c *ChannelParticipantAdmin ) SetInviterID (value int64 ) {
c .Flags .Set (1 )
c .InviterID = value
}
func (c *ChannelParticipantAdmin ) GetInviterID () (value int64 , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (1 ) {
return value , false
}
return c .InviterID , true
}
func (c *ChannelParticipantAdmin ) GetPromotedBy () (value int64 ) {
if c == nil {
return
}
return c .PromotedBy
}
func (c *ChannelParticipantAdmin ) GetDate () (value int ) {
if c == nil {
return
}
return c .Date
}
func (c *ChannelParticipantAdmin ) GetAdminRights () (value ChatAdminRights ) {
if c == nil {
return
}
return c .AdminRights
}
func (c *ChannelParticipantAdmin ) SetRank (value string ) {
c .Flags .Set (2 )
c .Rank = value
}
func (c *ChannelParticipantAdmin ) GetRank () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (2 ) {
return value , false
}
return c .Rank , true
}
type ChannelParticipantBanned struct {
Flags bin .Fields
Left bool
Peer PeerClass
KickedBy int64
Date int
BannedRights ChatBannedRights
}
const ChannelParticipantBannedTypeID = 0x6df8014e
func (c ChannelParticipantBanned ) construct () ChannelParticipantClass { return &c }
var (
_ bin .Encoder = &ChannelParticipantBanned {}
_ bin .Decoder = &ChannelParticipantBanned {}
_ bin .BareEncoder = &ChannelParticipantBanned {}
_ bin .BareDecoder = &ChannelParticipantBanned {}
_ ChannelParticipantClass = &ChannelParticipantBanned {}
)
func (c *ChannelParticipantBanned ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .Left == false ) {
return false
}
if !(c .Peer == nil ) {
return false
}
if !(c .KickedBy == 0 ) {
return false
}
if !(c .Date == 0 ) {
return false
}
if !(c .BannedRights .Zero ()) {
return false
}
return true
}
func (c *ChannelParticipantBanned ) String () string {
if c == nil {
return "ChannelParticipantBanned(nil)"
}
type Alias ChannelParticipantBanned
return fmt .Sprintf ("ChannelParticipantBanned%+v" , Alias (*c ))
}
func (c *ChannelParticipantBanned ) FillFrom (from interface {
GetLeft () (value bool )
GetPeer () (value PeerClass )
GetKickedBy () (value int64 )
GetDate () (value int )
GetBannedRights () (value ChatBannedRights )
}) {
c .Left = from .GetLeft ()
c .Peer = from .GetPeer ()
c .KickedBy = from .GetKickedBy ()
c .Date = from .GetDate ()
c .BannedRights = from .GetBannedRights ()
}
func (*ChannelParticipantBanned ) TypeID () uint32 {
return ChannelParticipantBannedTypeID
}
func (*ChannelParticipantBanned ) TypeName () string {
return "channelParticipantBanned"
}
func (c *ChannelParticipantBanned ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelParticipantBanned" ,
ID : ChannelParticipantBannedTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Left" ,
SchemaName : "left" ,
Null : !c .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "KickedBy" ,
SchemaName : "kicked_by" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "BannedRights" ,
SchemaName : "banned_rights" ,
},
}
return typ
}
func (c *ChannelParticipantBanned ) SetFlags () {
if !(c .Left == false ) {
c .Flags .Set (0 )
}
}
func (c *ChannelParticipantBanned ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantBanned#6df8014e as nil" )
}
b .PutID (ChannelParticipantBannedTypeID )
return c .EncodeBare (b )
}
func (c *ChannelParticipantBanned ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantBanned#6df8014e as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantBanned#6df8014e: field flags: %w" , err )
}
if c .Peer == nil {
return fmt .Errorf ("unable to encode channelParticipantBanned#6df8014e: field peer is nil" )
}
if err := c .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantBanned#6df8014e: field peer: %w" , err )
}
b .PutLong (c .KickedBy )
b .PutInt (c .Date )
if err := c .BannedRights .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantBanned#6df8014e: field banned_rights: %w" , err )
}
return nil
}
func (c *ChannelParticipantBanned ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantBanned#6df8014e to nil" )
}
if err := b .ConsumeID (ChannelParticipantBannedTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantBanned#6df8014e: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelParticipantBanned ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantBanned#6df8014e to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantBanned#6df8014e: field flags: %w" , err )
}
}
c .Left = c .Flags .Has (0 )
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantBanned#6df8014e: field peer: %w" , err )
}
c .Peer = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantBanned#6df8014e: field kicked_by: %w" , err )
}
c .KickedBy = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantBanned#6df8014e: field date: %w" , err )
}
c .Date = value
}
{
if err := c .BannedRights .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantBanned#6df8014e: field banned_rights: %w" , err )
}
}
return nil
}
func (c *ChannelParticipantBanned ) SetLeft (value bool ) {
if value {
c .Flags .Set (0 )
c .Left = true
} else {
c .Flags .Unset (0 )
c .Left = false
}
}
func (c *ChannelParticipantBanned ) GetLeft () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (0 )
}
func (c *ChannelParticipantBanned ) GetPeer () (value PeerClass ) {
if c == nil {
return
}
return c .Peer
}
func (c *ChannelParticipantBanned ) GetKickedBy () (value int64 ) {
if c == nil {
return
}
return c .KickedBy
}
func (c *ChannelParticipantBanned ) GetDate () (value int ) {
if c == nil {
return
}
return c .Date
}
func (c *ChannelParticipantBanned ) GetBannedRights () (value ChatBannedRights ) {
if c == nil {
return
}
return c .BannedRights
}
type ChannelParticipantLeft struct {
Peer PeerClass
}
const ChannelParticipantLeftTypeID = 0x1b03f006
func (c ChannelParticipantLeft ) construct () ChannelParticipantClass { return &c }
var (
_ bin .Encoder = &ChannelParticipantLeft {}
_ bin .Decoder = &ChannelParticipantLeft {}
_ bin .BareEncoder = &ChannelParticipantLeft {}
_ bin .BareDecoder = &ChannelParticipantLeft {}
_ ChannelParticipantClass = &ChannelParticipantLeft {}
)
func (c *ChannelParticipantLeft ) Zero () bool {
if c == nil {
return true
}
if !(c .Peer == nil ) {
return false
}
return true
}
func (c *ChannelParticipantLeft ) String () string {
if c == nil {
return "ChannelParticipantLeft(nil)"
}
type Alias ChannelParticipantLeft
return fmt .Sprintf ("ChannelParticipantLeft%+v" , Alias (*c ))
}
func (c *ChannelParticipantLeft ) FillFrom (from interface {
GetPeer () (value PeerClass )
}) {
c .Peer = from .GetPeer ()
}
func (*ChannelParticipantLeft ) TypeID () uint32 {
return ChannelParticipantLeftTypeID
}
func (*ChannelParticipantLeft ) TypeName () string {
return "channelParticipantLeft"
}
func (c *ChannelParticipantLeft ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelParticipantLeft" ,
ID : ChannelParticipantLeftTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
}
return typ
}
func (c *ChannelParticipantLeft ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantLeft#1b03f006 as nil" )
}
b .PutID (ChannelParticipantLeftTypeID )
return c .EncodeBare (b )
}
func (c *ChannelParticipantLeft ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelParticipantLeft#1b03f006 as nil" )
}
if c .Peer == nil {
return fmt .Errorf ("unable to encode channelParticipantLeft#1b03f006: field peer is nil" )
}
if err := c .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelParticipantLeft#1b03f006: field peer: %w" , err )
}
return nil
}
func (c *ChannelParticipantLeft ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantLeft#1b03f006 to nil" )
}
if err := b .ConsumeID (ChannelParticipantLeftTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelParticipantLeft#1b03f006: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelParticipantLeft ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelParticipantLeft#1b03f006 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode channelParticipantLeft#1b03f006: field peer: %w" , err )
}
c .Peer = value
}
return nil
}
func (c *ChannelParticipantLeft ) GetPeer () (value PeerClass ) {
if c == nil {
return
}
return c .Peer
}
const ChannelParticipantClassName = "ChannelParticipant"
type ChannelParticipantClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () ChannelParticipantClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeChannelParticipant (buf *bin .Buffer ) (ChannelParticipantClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case ChannelParticipantTypeID :
v := ChannelParticipant {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , err )
}
return &v , nil
case ChannelParticipantSelfTypeID :
v := ChannelParticipantSelf {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , err )
}
return &v , nil
case ChannelParticipantCreatorTypeID :
v := ChannelParticipantCreator {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , err )
}
return &v , nil
case ChannelParticipantAdminTypeID :
v := ChannelParticipantAdmin {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , err )
}
return &v , nil
case ChannelParticipantBannedTypeID :
v := ChannelParticipantBanned {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , err )
}
return &v , nil
case ChannelParticipantLeftTypeID :
v := ChannelParticipantLeft {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode ChannelParticipantClass: %w" , bin .NewUnexpectedID (id ))
}
}
type ChannelParticipantBox struct {
ChannelParticipant ChannelParticipantClass
}
func (b *ChannelParticipantBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode ChannelParticipantBox to nil" )
}
v , err := DecodeChannelParticipant (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .ChannelParticipant = v
return nil
}
func (b *ChannelParticipantBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .ChannelParticipant == nil {
return fmt .Errorf ("unable to encode ChannelParticipantClass as nil" )
}
return b .ChannelParticipant .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .