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 GroupCallParticipant struct {
Flags bin .Fields
Muted bool
Left bool
CanSelfUnmute bool
JustJoined bool
Versioned bool
Min bool
MutedByYou bool
VolumeByAdmin bool
Self bool
VideoJoined bool
Peer PeerClass
Date int
ActiveDate int
Source int
Volume int
About string
RaiseHandRating int64
Video GroupCallParticipantVideo
Presentation GroupCallParticipantVideo
}
const GroupCallParticipantTypeID = 0xeba636fe
var (
_ bin .Encoder = &GroupCallParticipant {}
_ bin .Decoder = &GroupCallParticipant {}
_ bin .BareEncoder = &GroupCallParticipant {}
_ bin .BareDecoder = &GroupCallParticipant {}
)
func (g *GroupCallParticipant ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Muted == false ) {
return false
}
if !(g .Left == false ) {
return false
}
if !(g .CanSelfUnmute == false ) {
return false
}
if !(g .JustJoined == false ) {
return false
}
if !(g .Versioned == false ) {
return false
}
if !(g .Min == false ) {
return false
}
if !(g .MutedByYou == false ) {
return false
}
if !(g .VolumeByAdmin == false ) {
return false
}
if !(g .Self == false ) {
return false
}
if !(g .VideoJoined == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .Date == 0 ) {
return false
}
if !(g .ActiveDate == 0 ) {
return false
}
if !(g .Source == 0 ) {
return false
}
if !(g .Volume == 0 ) {
return false
}
if !(g .About == "" ) {
return false
}
if !(g .RaiseHandRating == 0 ) {
return false
}
if !(g .Video .Zero ()) {
return false
}
if !(g .Presentation .Zero ()) {
return false
}
return true
}
func (g *GroupCallParticipant ) String () string {
if g == nil {
return "GroupCallParticipant(nil)"
}
type Alias GroupCallParticipant
return fmt .Sprintf ("GroupCallParticipant%+v" , Alias (*g ))
}
func (g *GroupCallParticipant ) FillFrom (from interface {
GetMuted () (value bool )
GetLeft () (value bool )
GetCanSelfUnmute () (value bool )
GetJustJoined () (value bool )
GetVersioned () (value bool )
GetMin () (value bool )
GetMutedByYou () (value bool )
GetVolumeByAdmin () (value bool )
GetSelf () (value bool )
GetVideoJoined () (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 )
GetVideo () (value GroupCallParticipantVideo , ok bool )
GetPresentation () (value GroupCallParticipantVideo , ok bool )
}) {
g .Muted = from .GetMuted ()
g .Left = from .GetLeft ()
g .CanSelfUnmute = from .GetCanSelfUnmute ()
g .JustJoined = from .GetJustJoined ()
g .Versioned = from .GetVersioned ()
g .Min = from .GetMin ()
g .MutedByYou = from .GetMutedByYou ()
g .VolumeByAdmin = from .GetVolumeByAdmin ()
g .Self = from .GetSelf ()
g .VideoJoined = from .GetVideoJoined ()
g .Peer = from .GetPeer ()
g .Date = from .GetDate ()
if val , ok := from .GetActiveDate (); ok {
g .ActiveDate = val
}
g .Source = from .GetSource ()
if val , ok := from .GetVolume (); ok {
g .Volume = val
}
if val , ok := from .GetAbout (); ok {
g .About = val
}
if val , ok := from .GetRaiseHandRating (); ok {
g .RaiseHandRating = val
}
if val , ok := from .GetVideo (); ok {
g .Video = val
}
if val , ok := from .GetPresentation (); ok {
g .Presentation = val
}
}
func (*GroupCallParticipant ) TypeID () uint32 {
return GroupCallParticipantTypeID
}
func (*GroupCallParticipant ) TypeName () string {
return "groupCallParticipant"
}
func (g *GroupCallParticipant ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "groupCallParticipant" ,
ID : GroupCallParticipantTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Muted" ,
SchemaName : "muted" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Left" ,
SchemaName : "left" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "CanSelfUnmute" ,
SchemaName : "can_self_unmute" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "JustJoined" ,
SchemaName : "just_joined" ,
Null : !g .Flags .Has (4 ),
},
{
Name : "Versioned" ,
SchemaName : "versioned" ,
Null : !g .Flags .Has (5 ),
},
{
Name : "Min" ,
SchemaName : "min" ,
Null : !g .Flags .Has (8 ),
},
{
Name : "MutedByYou" ,
SchemaName : "muted_by_you" ,
Null : !g .Flags .Has (9 ),
},
{
Name : "VolumeByAdmin" ,
SchemaName : "volume_by_admin" ,
Null : !g .Flags .Has (10 ),
},
{
Name : "Self" ,
SchemaName : "self" ,
Null : !g .Flags .Has (12 ),
},
{
Name : "VideoJoined" ,
SchemaName : "video_joined" ,
Null : !g .Flags .Has (15 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "ActiveDate" ,
SchemaName : "active_date" ,
Null : !g .Flags .Has (3 ),
},
{
Name : "Source" ,
SchemaName : "source" ,
},
{
Name : "Volume" ,
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 ),
},
{
Name : "Video" ,
SchemaName : "video" ,
Null : !g .Flags .Has (6 ),
},
{
Name : "Presentation" ,
SchemaName : "presentation" ,
Null : !g .Flags .Has (14 ),
},
}
return typ
}
func (g *GroupCallParticipant ) SetFlags () {
if !(g .Muted == false ) {
g .Flags .Set (0 )
}
if !(g .Left == false ) {
g .Flags .Set (1 )
}
if !(g .CanSelfUnmute == false ) {
g .Flags .Set (2 )
}
if !(g .JustJoined == false ) {
g .Flags .Set (4 )
}
if !(g .Versioned == false ) {
g .Flags .Set (5 )
}
if !(g .Min == false ) {
g .Flags .Set (8 )
}
if !(g .MutedByYou == false ) {
g .Flags .Set (9 )
}
if !(g .VolumeByAdmin == false ) {
g .Flags .Set (10 )
}
if !(g .Self == false ) {
g .Flags .Set (12 )
}
if !(g .VideoJoined == false ) {
g .Flags .Set (15 )
}
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 !(g .Video .Zero ()) {
g .Flags .Set (6 )
}
if !(g .Presentation .Zero ()) {
g .Flags .Set (14 )
}
}
func (g *GroupCallParticipant ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallParticipant#eba636fe as nil" )
}
b .PutID (GroupCallParticipantTypeID )
return g .EncodeBare (b )
}
func (g *GroupCallParticipant ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallParticipant#eba636fe as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallParticipant#eba636fe: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode groupCallParticipant#eba636fe: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallParticipant#eba636fe: field peer: %w" , err )
}
b .PutInt (g .Date )
if g .Flags .Has (3 ) {
b .PutInt (g .ActiveDate )
}
b .PutInt (g .Source )
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 )
}
if g .Flags .Has (6 ) {
if err := g .Video .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallParticipant#eba636fe: field video: %w" , err )
}
}
if g .Flags .Has (14 ) {
if err := g .Presentation .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallParticipant#eba636fe: field presentation: %w" , err )
}
}
return nil
}
func (g *GroupCallParticipant ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallParticipant#eba636fe to nil" )
}
if err := b .ConsumeID (GroupCallParticipantTypeID ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: %w" , err )
}
return g .DecodeBare (b )
}
func (g *GroupCallParticipant ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallParticipant#eba636fe to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: field flags: %w" , err )
}
}
g .Muted = g .Flags .Has (0 )
g .Left = g .Flags .Has (1 )
g .CanSelfUnmute = g .Flags .Has (2 )
g .JustJoined = g .Flags .Has (4 )
g .Versioned = g .Flags .Has (5 )
g .Min = g .Flags .Has (8 )
g .MutedByYou = g .Flags .Has (9 )
g .VolumeByAdmin = g .Flags .Has (10 )
g .Self = g .Flags .Has (12 )
g .VideoJoined = g .Flags .Has (15 )
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: 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#eba636fe: field active_date: %w" , err )
}
g .ActiveDate = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: 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#eba636fe: 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#eba636fe: 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#eba636fe: field raise_hand_rating: %w" , err )
}
g .RaiseHandRating = value
}
if g .Flags .Has (6 ) {
if err := g .Video .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: field video: %w" , err )
}
}
if g .Flags .Has (14 ) {
if err := g .Presentation .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipant#eba636fe: field presentation: %w" , err )
}
}
return nil
}
func (g *GroupCallParticipant ) SetMuted (value bool ) {
if value {
g .Flags .Set (0 )
g .Muted = true
} else {
g .Flags .Unset (0 )
g .Muted = false
}
}
func (g *GroupCallParticipant ) GetMuted () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *GroupCallParticipant ) SetLeft (value bool ) {
if value {
g .Flags .Set (1 )
g .Left = true
} else {
g .Flags .Unset (1 )
g .Left = false
}
}
func (g *GroupCallParticipant ) GetLeft () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (g *GroupCallParticipant ) SetCanSelfUnmute (value bool ) {
if value {
g .Flags .Set (2 )
g .CanSelfUnmute = true
} else {
g .Flags .Unset (2 )
g .CanSelfUnmute = false
}
}
func (g *GroupCallParticipant ) GetCanSelfUnmute () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (2 )
}
func (g *GroupCallParticipant ) SetJustJoined (value bool ) {
if value {
g .Flags .Set (4 )
g .JustJoined = true
} else {
g .Flags .Unset (4 )
g .JustJoined = false
}
}
func (g *GroupCallParticipant ) GetJustJoined () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (4 )
}
func (g *GroupCallParticipant ) SetVersioned (value bool ) {
if value {
g .Flags .Set (5 )
g .Versioned = true
} else {
g .Flags .Unset (5 )
g .Versioned = false
}
}
func (g *GroupCallParticipant ) GetVersioned () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (5 )
}
func (g *GroupCallParticipant ) SetMin (value bool ) {
if value {
g .Flags .Set (8 )
g .Min = true
} else {
g .Flags .Unset (8 )
g .Min = false
}
}
func (g *GroupCallParticipant ) GetMin () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (8 )
}
func (g *GroupCallParticipant ) SetMutedByYou (value bool ) {
if value {
g .Flags .Set (9 )
g .MutedByYou = true
} else {
g .Flags .Unset (9 )
g .MutedByYou = false
}
}
func (g *GroupCallParticipant ) GetMutedByYou () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (9 )
}
func (g *GroupCallParticipant ) SetVolumeByAdmin (value bool ) {
if value {
g .Flags .Set (10 )
g .VolumeByAdmin = true
} else {
g .Flags .Unset (10 )
g .VolumeByAdmin = false
}
}
func (g *GroupCallParticipant ) GetVolumeByAdmin () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (10 )
}
func (g *GroupCallParticipant ) SetSelf (value bool ) {
if value {
g .Flags .Set (12 )
g .Self = true
} else {
g .Flags .Unset (12 )
g .Self = false
}
}
func (g *GroupCallParticipant ) GetSelf () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (12 )
}
func (g *GroupCallParticipant ) SetVideoJoined (value bool ) {
if value {
g .Flags .Set (15 )
g .VideoJoined = true
} else {
g .Flags .Unset (15 )
g .VideoJoined = false
}
}
func (g *GroupCallParticipant ) GetVideoJoined () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (15 )
}
func (g *GroupCallParticipant ) GetPeer () (value PeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *GroupCallParticipant ) GetDate () (value int ) {
if g == nil {
return
}
return g .Date
}
func (g *GroupCallParticipant ) SetActiveDate (value int ) {
g .Flags .Set (3 )
g .ActiveDate = value
}
func (g *GroupCallParticipant ) GetActiveDate () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (3 ) {
return value , false
}
return g .ActiveDate , true
}
func (g *GroupCallParticipant ) GetSource () (value int ) {
if g == nil {
return
}
return g .Source
}
func (g *GroupCallParticipant ) SetVolume (value int ) {
g .Flags .Set (7 )
g .Volume = value
}
func (g *GroupCallParticipant ) GetVolume () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (7 ) {
return value , false
}
return g .Volume , true
}
func (g *GroupCallParticipant ) SetAbout (value string ) {
g .Flags .Set (11 )
g .About = value
}
func (g *GroupCallParticipant ) GetAbout () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (11 ) {
return value , false
}
return g .About , true
}
func (g *GroupCallParticipant ) SetRaiseHandRating (value int64 ) {
g .Flags .Set (13 )
g .RaiseHandRating = value
}
func (g *GroupCallParticipant ) GetRaiseHandRating () (value int64 , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (13 ) {
return value , false
}
return g .RaiseHandRating , true
}
func (g *GroupCallParticipant ) SetVideo (value GroupCallParticipantVideo ) {
g .Flags .Set (6 )
g .Video = value
}
func (g *GroupCallParticipant ) GetVideo () (value GroupCallParticipantVideo , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (6 ) {
return value , false
}
return g .Video , true
}
func (g *GroupCallParticipant ) SetPresentation (value GroupCallParticipantVideo ) {
g .Flags .Set (14 )
g .Presentation = value
}
func (g *GroupCallParticipant ) GetPresentation () (value GroupCallParticipantVideo , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (14 ) {
return value , false
}
return g .Presentation , true
}
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 .