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 GroupCallParticipantVideoSourceGroup struct {
Semantics string
Sources []int
}
const GroupCallParticipantVideoSourceGroupTypeID = 0xdcb118b7
var (
_ bin .Encoder = &GroupCallParticipantVideoSourceGroup {}
_ bin .Decoder = &GroupCallParticipantVideoSourceGroup {}
_ bin .BareEncoder = &GroupCallParticipantVideoSourceGroup {}
_ bin .BareDecoder = &GroupCallParticipantVideoSourceGroup {}
)
func (g *GroupCallParticipantVideoSourceGroup ) Zero () bool {
if g == nil {
return true
}
if !(g .Semantics == "" ) {
return false
}
if !(g .Sources == nil ) {
return false
}
return true
}
func (g *GroupCallParticipantVideoSourceGroup ) String () string {
if g == nil {
return "GroupCallParticipantVideoSourceGroup(nil)"
}
type Alias GroupCallParticipantVideoSourceGroup
return fmt .Sprintf ("GroupCallParticipantVideoSourceGroup%+v" , Alias (*g ))
}
func (g *GroupCallParticipantVideoSourceGroup ) FillFrom (from interface {
GetSemantics () (value string )
GetSources () (value []int )
}) {
g .Semantics = from .GetSemantics ()
g .Sources = from .GetSources ()
}
func (*GroupCallParticipantVideoSourceGroup ) TypeID () uint32 {
return GroupCallParticipantVideoSourceGroupTypeID
}
func (*GroupCallParticipantVideoSourceGroup ) TypeName () string {
return "groupCallParticipantVideoSourceGroup"
}
func (g *GroupCallParticipantVideoSourceGroup ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "groupCallParticipantVideoSourceGroup" ,
ID : GroupCallParticipantVideoSourceGroupTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Semantics" ,
SchemaName : "semantics" ,
},
{
Name : "Sources" ,
SchemaName : "sources" ,
},
}
return typ
}
func (g *GroupCallParticipantVideoSourceGroup ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallParticipantVideoSourceGroup#dcb118b7 as nil" )
}
b .PutID (GroupCallParticipantVideoSourceGroupTypeID )
return g .EncodeBare (b )
}
func (g *GroupCallParticipantVideoSourceGroup ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallParticipantVideoSourceGroup#dcb118b7 as nil" )
}
b .PutString (g .Semantics )
b .PutVectorHeader (len (g .Sources ))
for _ , v := range g .Sources {
b .PutInt (v )
}
return nil
}
func (g *GroupCallParticipantVideoSourceGroup ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallParticipantVideoSourceGroup#dcb118b7 to nil" )
}
if err := b .ConsumeID (GroupCallParticipantVideoSourceGroupTypeID ); err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: %w" , err )
}
return g .DecodeBare (b )
}
func (g *GroupCallParticipantVideoSourceGroup ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallParticipantVideoSourceGroup#dcb118b7 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: field semantics: %w" , err )
}
g .Semantics = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: field sources: %w" , err )
}
if headerLen > 0 {
g .Sources = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallParticipantVideoSourceGroup#dcb118b7: field sources: %w" , err )
}
g .Sources = append (g .Sources , value )
}
}
return nil
}
func (g *GroupCallParticipantVideoSourceGroup ) GetSemantics () (value string ) {
if g == nil {
return
}
return g .Semantics
}
func (g *GroupCallParticipantVideoSourceGroup ) GetSources () (value []int ) {
if g == nil {
return
}
return g .Sources
}
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 .