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 GroupCallDiscarded struct {
ID int64
AccessHash int64
Duration int
}
const GroupCallDiscardedTypeID = 0x7780bcb4
func (g GroupCallDiscarded ) construct () GroupCallClass { return &g }
var (
_ bin .Encoder = &GroupCallDiscarded {}
_ bin .Decoder = &GroupCallDiscarded {}
_ bin .BareEncoder = &GroupCallDiscarded {}
_ bin .BareDecoder = &GroupCallDiscarded {}
_ GroupCallClass = &GroupCallDiscarded {}
)
func (g *GroupCallDiscarded ) Zero () bool {
if g == nil {
return true
}
if !(g .ID == 0 ) {
return false
}
if !(g .AccessHash == 0 ) {
return false
}
if !(g .Duration == 0 ) {
return false
}
return true
}
func (g *GroupCallDiscarded ) String () string {
if g == nil {
return "GroupCallDiscarded(nil)"
}
type Alias GroupCallDiscarded
return fmt .Sprintf ("GroupCallDiscarded%+v" , Alias (*g ))
}
func (g *GroupCallDiscarded ) FillFrom (from interface {
GetID () (value int64 )
GetAccessHash () (value int64 )
GetDuration () (value int )
}) {
g .ID = from .GetID ()
g .AccessHash = from .GetAccessHash ()
g .Duration = from .GetDuration ()
}
func (*GroupCallDiscarded ) TypeID () uint32 {
return GroupCallDiscardedTypeID
}
func (*GroupCallDiscarded ) TypeName () string {
return "groupCallDiscarded"
}
func (g *GroupCallDiscarded ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "groupCallDiscarded" ,
ID : GroupCallDiscardedTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Duration" ,
SchemaName : "duration" ,
},
}
return typ
}
func (g *GroupCallDiscarded ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallDiscarded#7780bcb4 as nil" )
}
b .PutID (GroupCallDiscardedTypeID )
return g .EncodeBare (b )
}
func (g *GroupCallDiscarded ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallDiscarded#7780bcb4 as nil" )
}
b .PutLong (g .ID )
b .PutLong (g .AccessHash )
b .PutInt (g .Duration )
return nil
}
func (g *GroupCallDiscarded ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallDiscarded#7780bcb4 to nil" )
}
if err := b .ConsumeID (GroupCallDiscardedTypeID ); err != nil {
return fmt .Errorf ("unable to decode groupCallDiscarded#7780bcb4: %w" , err )
}
return g .DecodeBare (b )
}
func (g *GroupCallDiscarded ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallDiscarded#7780bcb4 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallDiscarded#7780bcb4: field id: %w" , err )
}
g .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallDiscarded#7780bcb4: field access_hash: %w" , err )
}
g .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallDiscarded#7780bcb4: field duration: %w" , err )
}
g .Duration = value
}
return nil
}
func (g *GroupCallDiscarded ) GetID () (value int64 ) {
if g == nil {
return
}
return g .ID
}
func (g *GroupCallDiscarded ) GetAccessHash () (value int64 ) {
if g == nil {
return
}
return g .AccessHash
}
func (g *GroupCallDiscarded ) GetDuration () (value int ) {
if g == nil {
return
}
return g .Duration
}
type GroupCall struct {
Flags bin .Fields
JoinMuted bool
CanChangeJoinMuted bool
JoinDateAsc bool
ScheduleStartSubscribed bool
CanStartVideo bool
RecordVideoActive bool
RtmpStream bool
ListenersHidden bool
ID int64
AccessHash int64
ParticipantsCount int
Title string
StreamDCID int
RecordStartDate int
ScheduleDate int
UnmutedVideoCount int
UnmutedVideoLimit int
Version int
}
const GroupCallTypeID = 0xd597650c
func (g GroupCall ) construct () GroupCallClass { return &g }
var (
_ bin .Encoder = &GroupCall {}
_ bin .Decoder = &GroupCall {}
_ bin .BareEncoder = &GroupCall {}
_ bin .BareDecoder = &GroupCall {}
_ GroupCallClass = &GroupCall {}
)
func (g *GroupCall ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .JoinMuted == false ) {
return false
}
if !(g .CanChangeJoinMuted == false ) {
return false
}
if !(g .JoinDateAsc == false ) {
return false
}
if !(g .ScheduleStartSubscribed == false ) {
return false
}
if !(g .CanStartVideo == false ) {
return false
}
if !(g .RecordVideoActive == false ) {
return false
}
if !(g .RtmpStream == false ) {
return false
}
if !(g .ListenersHidden == false ) {
return false
}
if !(g .ID == 0 ) {
return false
}
if !(g .AccessHash == 0 ) {
return false
}
if !(g .ParticipantsCount == 0 ) {
return false
}
if !(g .Title == "" ) {
return false
}
if !(g .StreamDCID == 0 ) {
return false
}
if !(g .RecordStartDate == 0 ) {
return false
}
if !(g .ScheduleDate == 0 ) {
return false
}
if !(g .UnmutedVideoCount == 0 ) {
return false
}
if !(g .UnmutedVideoLimit == 0 ) {
return false
}
if !(g .Version == 0 ) {
return false
}
return true
}
func (g *GroupCall ) String () string {
if g == nil {
return "GroupCall(nil)"
}
type Alias GroupCall
return fmt .Sprintf ("GroupCall%+v" , Alias (*g ))
}
func (g *GroupCall ) FillFrom (from interface {
GetJoinMuted () (value bool )
GetCanChangeJoinMuted () (value bool )
GetJoinDateAsc () (value bool )
GetScheduleStartSubscribed () (value bool )
GetCanStartVideo () (value bool )
GetRecordVideoActive () (value bool )
GetRtmpStream () (value bool )
GetListenersHidden () (value bool )
GetID () (value int64 )
GetAccessHash () (value int64 )
GetParticipantsCount () (value int )
GetTitle () (value string , ok bool )
GetStreamDCID () (value int , ok bool )
GetRecordStartDate () (value int , ok bool )
GetScheduleDate () (value int , ok bool )
GetUnmutedVideoCount () (value int , ok bool )
GetUnmutedVideoLimit () (value int )
GetVersion () (value int )
}) {
g .JoinMuted = from .GetJoinMuted ()
g .CanChangeJoinMuted = from .GetCanChangeJoinMuted ()
g .JoinDateAsc = from .GetJoinDateAsc ()
g .ScheduleStartSubscribed = from .GetScheduleStartSubscribed ()
g .CanStartVideo = from .GetCanStartVideo ()
g .RecordVideoActive = from .GetRecordVideoActive ()
g .RtmpStream = from .GetRtmpStream ()
g .ListenersHidden = from .GetListenersHidden ()
g .ID = from .GetID ()
g .AccessHash = from .GetAccessHash ()
g .ParticipantsCount = from .GetParticipantsCount ()
if val , ok := from .GetTitle (); ok {
g .Title = val
}
if val , ok := from .GetStreamDCID (); ok {
g .StreamDCID = val
}
if val , ok := from .GetRecordStartDate (); ok {
g .RecordStartDate = val
}
if val , ok := from .GetScheduleDate (); ok {
g .ScheduleDate = val
}
if val , ok := from .GetUnmutedVideoCount (); ok {
g .UnmutedVideoCount = val
}
g .UnmutedVideoLimit = from .GetUnmutedVideoLimit ()
g .Version = from .GetVersion ()
}
func (*GroupCall ) TypeID () uint32 {
return GroupCallTypeID
}
func (*GroupCall ) TypeName () string {
return "groupCall"
}
func (g *GroupCall ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "groupCall" ,
ID : GroupCallTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "JoinMuted" ,
SchemaName : "join_muted" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "CanChangeJoinMuted" ,
SchemaName : "can_change_join_muted" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "JoinDateAsc" ,
SchemaName : "join_date_asc" ,
Null : !g .Flags .Has (6 ),
},
{
Name : "ScheduleStartSubscribed" ,
SchemaName : "schedule_start_subscribed" ,
Null : !g .Flags .Has (8 ),
},
{
Name : "CanStartVideo" ,
SchemaName : "can_start_video" ,
Null : !g .Flags .Has (9 ),
},
{
Name : "RecordVideoActive" ,
SchemaName : "record_video_active" ,
Null : !g .Flags .Has (11 ),
},
{
Name : "RtmpStream" ,
SchemaName : "rtmp_stream" ,
Null : !g .Flags .Has (12 ),
},
{
Name : "ListenersHidden" ,
SchemaName : "listeners_hidden" ,
Null : !g .Flags .Has (13 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "ParticipantsCount" ,
SchemaName : "participants_count" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
Null : !g .Flags .Has (3 ),
},
{
Name : "StreamDCID" ,
SchemaName : "stream_dc_id" ,
Null : !g .Flags .Has (4 ),
},
{
Name : "RecordStartDate" ,
SchemaName : "record_start_date" ,
Null : !g .Flags .Has (5 ),
},
{
Name : "ScheduleDate" ,
SchemaName : "schedule_date" ,
Null : !g .Flags .Has (7 ),
},
{
Name : "UnmutedVideoCount" ,
SchemaName : "unmuted_video_count" ,
Null : !g .Flags .Has (10 ),
},
{
Name : "UnmutedVideoLimit" ,
SchemaName : "unmuted_video_limit" ,
},
{
Name : "Version" ,
SchemaName : "version" ,
},
}
return typ
}
func (g *GroupCall ) SetFlags () {
if !(g .JoinMuted == false ) {
g .Flags .Set (1 )
}
if !(g .CanChangeJoinMuted == false ) {
g .Flags .Set (2 )
}
if !(g .JoinDateAsc == false ) {
g .Flags .Set (6 )
}
if !(g .ScheduleStartSubscribed == false ) {
g .Flags .Set (8 )
}
if !(g .CanStartVideo == false ) {
g .Flags .Set (9 )
}
if !(g .RecordVideoActive == false ) {
g .Flags .Set (11 )
}
if !(g .RtmpStream == false ) {
g .Flags .Set (12 )
}
if !(g .ListenersHidden == false ) {
g .Flags .Set (13 )
}
if !(g .Title == "" ) {
g .Flags .Set (3 )
}
if !(g .StreamDCID == 0 ) {
g .Flags .Set (4 )
}
if !(g .RecordStartDate == 0 ) {
g .Flags .Set (5 )
}
if !(g .ScheduleDate == 0 ) {
g .Flags .Set (7 )
}
if !(g .UnmutedVideoCount == 0 ) {
g .Flags .Set (10 )
}
}
func (g *GroupCall ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCall#d597650c as nil" )
}
b .PutID (GroupCallTypeID )
return g .EncodeBare (b )
}
func (g *GroupCall ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCall#d597650c as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCall#d597650c: field flags: %w" , err )
}
b .PutLong (g .ID )
b .PutLong (g .AccessHash )
b .PutInt (g .ParticipantsCount )
if g .Flags .Has (3 ) {
b .PutString (g .Title )
}
if g .Flags .Has (4 ) {
b .PutInt (g .StreamDCID )
}
if g .Flags .Has (5 ) {
b .PutInt (g .RecordStartDate )
}
if g .Flags .Has (7 ) {
b .PutInt (g .ScheduleDate )
}
if g .Flags .Has (10 ) {
b .PutInt (g .UnmutedVideoCount )
}
b .PutInt (g .UnmutedVideoLimit )
b .PutInt (g .Version )
return nil
}
func (g *GroupCall ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCall#d597650c to nil" )
}
if err := b .ConsumeID (GroupCallTypeID ); err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: %w" , err )
}
return g .DecodeBare (b )
}
func (g *GroupCall ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCall#d597650c to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field flags: %w" , err )
}
}
g .JoinMuted = g .Flags .Has (1 )
g .CanChangeJoinMuted = g .Flags .Has (2 )
g .JoinDateAsc = g .Flags .Has (6 )
g .ScheduleStartSubscribed = g .Flags .Has (8 )
g .CanStartVideo = g .Flags .Has (9 )
g .RecordVideoActive = g .Flags .Has (11 )
g .RtmpStream = g .Flags .Has (12 )
g .ListenersHidden = g .Flags .Has (13 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field id: %w" , err )
}
g .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field access_hash: %w" , err )
}
g .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field participants_count: %w" , err )
}
g .ParticipantsCount = value
}
if g .Flags .Has (3 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field title: %w" , err )
}
g .Title = value
}
if g .Flags .Has (4 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field stream_dc_id: %w" , err )
}
g .StreamDCID = value
}
if g .Flags .Has (5 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field record_start_date: %w" , err )
}
g .RecordStartDate = value
}
if g .Flags .Has (7 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field schedule_date: %w" , err )
}
g .ScheduleDate = value
}
if g .Flags .Has (10 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field unmuted_video_count: %w" , err )
}
g .UnmutedVideoCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field unmuted_video_limit: %w" , err )
}
g .UnmutedVideoLimit = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode groupCall#d597650c: field version: %w" , err )
}
g .Version = value
}
return nil
}
func (g *GroupCall ) SetJoinMuted (value bool ) {
if value {
g .Flags .Set (1 )
g .JoinMuted = true
} else {
g .Flags .Unset (1 )
g .JoinMuted = false
}
}
func (g *GroupCall ) GetJoinMuted () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (g *GroupCall ) SetCanChangeJoinMuted (value bool ) {
if value {
g .Flags .Set (2 )
g .CanChangeJoinMuted = true
} else {
g .Flags .Unset (2 )
g .CanChangeJoinMuted = false
}
}
func (g *GroupCall ) GetCanChangeJoinMuted () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (2 )
}
func (g *GroupCall ) SetJoinDateAsc (value bool ) {
if value {
g .Flags .Set (6 )
g .JoinDateAsc = true
} else {
g .Flags .Unset (6 )
g .JoinDateAsc = false
}
}
func (g *GroupCall ) GetJoinDateAsc () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (6 )
}
func (g *GroupCall ) SetScheduleStartSubscribed (value bool ) {
if value {
g .Flags .Set (8 )
g .ScheduleStartSubscribed = true
} else {
g .Flags .Unset (8 )
g .ScheduleStartSubscribed = false
}
}
func (g *GroupCall ) GetScheduleStartSubscribed () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (8 )
}
func (g *GroupCall ) SetCanStartVideo (value bool ) {
if value {
g .Flags .Set (9 )
g .CanStartVideo = true
} else {
g .Flags .Unset (9 )
g .CanStartVideo = false
}
}
func (g *GroupCall ) GetCanStartVideo () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (9 )
}
func (g *GroupCall ) SetRecordVideoActive (value bool ) {
if value {
g .Flags .Set (11 )
g .RecordVideoActive = true
} else {
g .Flags .Unset (11 )
g .RecordVideoActive = false
}
}
func (g *GroupCall ) GetRecordVideoActive () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (11 )
}
func (g *GroupCall ) SetRtmpStream (value bool ) {
if value {
g .Flags .Set (12 )
g .RtmpStream = true
} else {
g .Flags .Unset (12 )
g .RtmpStream = false
}
}
func (g *GroupCall ) GetRtmpStream () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (12 )
}
func (g *GroupCall ) SetListenersHidden (value bool ) {
if value {
g .Flags .Set (13 )
g .ListenersHidden = true
} else {
g .Flags .Unset (13 )
g .ListenersHidden = false
}
}
func (g *GroupCall ) GetListenersHidden () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (13 )
}
func (g *GroupCall ) GetID () (value int64 ) {
if g == nil {
return
}
return g .ID
}
func (g *GroupCall ) GetAccessHash () (value int64 ) {
if g == nil {
return
}
return g .AccessHash
}
func (g *GroupCall ) GetParticipantsCount () (value int ) {
if g == nil {
return
}
return g .ParticipantsCount
}
func (g *GroupCall ) SetTitle (value string ) {
g .Flags .Set (3 )
g .Title = value
}
func (g *GroupCall ) GetTitle () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (3 ) {
return value , false
}
return g .Title , true
}
func (g *GroupCall ) SetStreamDCID (value int ) {
g .Flags .Set (4 )
g .StreamDCID = value
}
func (g *GroupCall ) GetStreamDCID () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (4 ) {
return value , false
}
return g .StreamDCID , true
}
func (g *GroupCall ) SetRecordStartDate (value int ) {
g .Flags .Set (5 )
g .RecordStartDate = value
}
func (g *GroupCall ) GetRecordStartDate () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (5 ) {
return value , false
}
return g .RecordStartDate , true
}
func (g *GroupCall ) SetScheduleDate (value int ) {
g .Flags .Set (7 )
g .ScheduleDate = value
}
func (g *GroupCall ) GetScheduleDate () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (7 ) {
return value , false
}
return g .ScheduleDate , true
}
func (g *GroupCall ) SetUnmutedVideoCount (value int ) {
g .Flags .Set (10 )
g .UnmutedVideoCount = value
}
func (g *GroupCall ) GetUnmutedVideoCount () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (10 ) {
return value , false
}
return g .UnmutedVideoCount , true
}
func (g *GroupCall ) GetUnmutedVideoLimit () (value int ) {
if g == nil {
return
}
return g .UnmutedVideoLimit
}
func (g *GroupCall ) GetVersion () (value int ) {
if g == nil {
return
}
return g .Version
}
const GroupCallClassName = "GroupCall"
type GroupCallClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () GroupCallClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value int64 )
GetAccessHash () (value int64 )
}
func (g *GroupCall ) AsInput () *InputGroupCall {
value := new (InputGroupCall )
value .ID = g .GetID ()
value .AccessHash = g .GetAccessHash ()
return value
}
func DecodeGroupCall (buf *bin .Buffer ) (GroupCallClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case GroupCallDiscardedTypeID :
v := GroupCallDiscarded {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode GroupCallClass: %w" , err )
}
return &v , nil
case GroupCallTypeID :
v := GroupCall {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode GroupCallClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode GroupCallClass: %w" , bin .NewUnexpectedID (id ))
}
}
type GroupCallBox struct {
GroupCall GroupCallClass
}
func (b *GroupCallBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode GroupCallBox to nil" )
}
v , err := DecodeGroupCall (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .GroupCall = v
return nil
}
func (b *GroupCallBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .GroupCall == nil {
return fmt .Errorf ("unable to encode GroupCallClass as nil" )
}
return b .GroupCall .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 .