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 GroupCallParticipantVideo struct {
Flags bin .Fields
Paused bool
Endpoint string
SourceGroups []GroupCallParticipantVideoSourceGroup
AudioSource int
}
const GroupCallParticipantVideoTypeID = 0x67753ac8
var (
_ bin .Encoder = &GroupCallParticipantVideo {}
_ bin .Decoder = &GroupCallParticipantVideo {}
_ bin .BareEncoder = &GroupCallParticipantVideo {}
_ bin .BareDecoder = &GroupCallParticipantVideo {}
)
func (g *GroupCallParticipantVideo ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Paused == false ) {
return false
}
if !(g .Endpoint == "" ) {
return false
}
if !(g .SourceGroups == nil ) {
return false
}
if !(g .AudioSource == 0 ) {
return false
}
return true
}
func (g *GroupCallParticipantVideo ) String () string {
if g == nil {
return "GroupCallParticipantVideo(nil)"
}
type Alias GroupCallParticipantVideo
return fmt .Sprintf ("GroupCallParticipantVideo%+v" , Alias (*g ))
}
func (g *GroupCallParticipantVideo ) FillFrom (from interface {
GetPaused () (value bool )
GetEndpoint () (value string )
GetSourceGroups () (value []GroupCallParticipantVideoSourceGroup )
GetAudioSource () (value int , ok bool )
}) {
g .Paused = from .GetPaused ()
g .Endpoint = from .GetEndpoint ()
g .SourceGroups = from .GetSourceGroups ()
if val , ok := from .GetAudioSource (); ok {
g .AudioSource = val
}
}
func (*GroupCallParticipantVideo ) TypeID () uint32 {
return GroupCallParticipantVideoTypeID
}
func (*GroupCallParticipantVideo ) TypeName () string {
return "groupCallParticipantVideo"
}
func (g *GroupCallParticipantVideo ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "groupCallParticipantVideo" ,
ID : GroupCallParticipantVideoTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Paused" ,
SchemaName : "paused" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Endpoint" ,
SchemaName : "endpoint" ,
},
{
Name : "SourceGroups" ,
SchemaName : "source_groups" ,
},
{
Name : "AudioSource" ,
SchemaName : "audio_source" ,
Null : !g .Flags .Has (1 ),
},
}
return typ
}
func (g *GroupCallParticipantVideo ) SetFlags () {
if !(g .Paused == false ) {
g .Flags .Set (0 )
}
if !(g .AudioSource == 0 ) {
g .Flags .Set (1 )
}
}
func (g *GroupCallParticipantVideo ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallParticipantVideo#67753ac8 as nil" )
}
b .PutID (GroupCallParticipantVideoTypeID )
return g .EncodeBare (b )
}
func (g *GroupCallParticipantVideo ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallParticipantVideo#67753ac8 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallParticipantVideo#67753ac8: field flags: %w" , err )
}
b .PutString (g .Endpoint )
b .PutVectorHeader (len (g .SourceGroups ))
for idx , v := range g .SourceGroups {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallParticipantVideo#67753ac8: field source_groups element with index %d: %w" , idx , err )
}
}
if g .Flags .Has (1 ) {
b .PutInt (g .AudioSource )
}
return nil
}
func (g *GroupCallParticipantVideo ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallParticipantVideo#67753ac8 to nil" )
}
if err := b .ConsumeID (GroupCallParticipantVideoTypeID ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideo#67753ac8: %w" , err )
}
return g .DecodeBare (b )
}
func (g *GroupCallParticipantVideo ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallParticipantVideo#67753ac8 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideo#67753ac8: field flags: %w" , err )
}
}
g .Paused = g .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideo#67753ac8: field endpoint: %w" , err )
}
g .Endpoint = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideo#67753ac8: field source_groups: %w" , err )
}
if headerLen > 0 {
g .SourceGroups = make ([]GroupCallParticipantVideoSourceGroup , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value GroupCallParticipantVideoSourceGroup
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideo#67753ac8: field source_groups: %w" , err )
}
g .SourceGroups = append (g .SourceGroups , value )
}
}
if g .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideo#67753ac8: field audio_source: %w" , err )
}
g .AudioSource = value
}
return nil
}
func (g *GroupCallParticipantVideo ) SetPaused (value bool ) {
if value {
g .Flags .Set (0 )
g .Paused = true
} else {
g .Flags .Unset (0 )
g .Paused = false
}
}
func (g *GroupCallParticipantVideo ) GetPaused () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *GroupCallParticipantVideo ) GetEndpoint () (value string ) {
if g == nil {
return
}
return g .Endpoint
}
func (g *GroupCallParticipantVideo ) GetSourceGroups () (value []GroupCallParticipantVideoSourceGroup ) {
if g == nil {
return
}
return g .SourceGroups
}
func (g *GroupCallParticipantVideo ) SetAudioSource (value int ) {
g .Flags .Set (1 )
g .AudioSource = value
}
func (g *GroupCallParticipantVideo ) GetAudioSource () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (1 ) {
return value , false
}
return g .AudioSource , 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 .