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 PhoneGroupCallStreamChannels struct {
Channels []GroupCallStreamChannel
}
const PhoneGroupCallStreamChannelsTypeID = 0xd0e482b2
var (
_ bin .Encoder = &PhoneGroupCallStreamChannels {}
_ bin .Decoder = &PhoneGroupCallStreamChannels {}
_ bin .BareEncoder = &PhoneGroupCallStreamChannels {}
_ bin .BareDecoder = &PhoneGroupCallStreamChannels {}
)
func (g *PhoneGroupCallStreamChannels ) Zero () bool {
if g == nil {
return true
}
if !(g .Channels == nil ) {
return false
}
return true
}
func (g *PhoneGroupCallStreamChannels ) String () string {
if g == nil {
return "PhoneGroupCallStreamChannels(nil)"
}
type Alias PhoneGroupCallStreamChannels
return fmt .Sprintf ("PhoneGroupCallStreamChannels%+v" , Alias (*g ))
}
func (g *PhoneGroupCallStreamChannels ) FillFrom (from interface {
GetChannels () (value []GroupCallStreamChannel )
}) {
g .Channels = from .GetChannels ()
}
func (*PhoneGroupCallStreamChannels ) TypeID () uint32 {
return PhoneGroupCallStreamChannelsTypeID
}
func (*PhoneGroupCallStreamChannels ) TypeName () string {
return "phone.groupCallStreamChannels"
}
func (g *PhoneGroupCallStreamChannels ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.groupCallStreamChannels" ,
ID : PhoneGroupCallStreamChannelsTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channels" ,
SchemaName : "channels" ,
},
}
return typ
}
func (g *PhoneGroupCallStreamChannels ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode phone.groupCallStreamChannels#d0e482b2 as nil" )
}
b .PutID (PhoneGroupCallStreamChannelsTypeID )
return g .EncodeBare (b )
}
func (g *PhoneGroupCallStreamChannels ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode phone.groupCallStreamChannels#d0e482b2 as nil" )
}
b .PutVectorHeader (len (g .Channels ))
for idx , v := range g .Channels {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.groupCallStreamChannels#d0e482b2: field channels element with index %d: %w" , idx , err )
}
}
return nil
}
func (g *PhoneGroupCallStreamChannels ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode phone.groupCallStreamChannels#d0e482b2 to nil" )
}
if err := b .ConsumeID (PhoneGroupCallStreamChannelsTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.groupCallStreamChannels#d0e482b2: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PhoneGroupCallStreamChannels ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode phone.groupCallStreamChannels#d0e482b2 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode phone.groupCallStreamChannels#d0e482b2: field channels: %w" , err )
}
if headerLen > 0 {
g .Channels = make ([]GroupCallStreamChannel , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value GroupCallStreamChannel
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.groupCallStreamChannels#d0e482b2: field channels: %w" , err )
}
g .Channels = append (g .Channels , value )
}
}
return nil
}
func (g *PhoneGroupCallStreamChannels ) GetChannels () (value []GroupCallStreamChannel ) {
if g == nil {
return
}
return g .Channels
}
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 .