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 GroupCallDonor struct {
Flags bin .Fields
Top bool
My bool
PeerID PeerClass
Stars int64
}
const GroupCallDonorTypeID = 0xee430c85
var (
_ bin .Encoder = &GroupCallDonor {}
_ bin .Decoder = &GroupCallDonor {}
_ bin .BareEncoder = &GroupCallDonor {}
_ bin .BareDecoder = &GroupCallDonor {}
)
func (g *GroupCallDonor ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Top == false ) {
return false
}
if !(g .My == false ) {
return false
}
if !(g .PeerID == nil ) {
return false
}
if !(g .Stars == 0 ) {
return false
}
return true
}
func (g *GroupCallDonor ) String () string {
if g == nil {
return "GroupCallDonor(nil)"
}
type Alias GroupCallDonor
return fmt .Sprintf ("GroupCallDonor%+v" , Alias (*g ))
}
func (g *GroupCallDonor ) FillFrom (from interface {
GetTop () (value bool )
GetMy () (value bool )
GetPeerID () (value PeerClass , ok bool )
GetStars () (value int64 )
}) {
g .Top = from .GetTop ()
g .My = from .GetMy ()
if val , ok := from .GetPeerID (); ok {
g .PeerID = val
}
g .Stars = from .GetStars ()
}
func (*GroupCallDonor ) TypeID () uint32 {
return GroupCallDonorTypeID
}
func (*GroupCallDonor ) TypeName () string {
return "groupCallDonor"
}
func (g *GroupCallDonor ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "groupCallDonor" ,
ID : GroupCallDonorTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Top" ,
SchemaName : "top" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "My" ,
SchemaName : "my" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "PeerID" ,
SchemaName : "peer_id" ,
Null : !g .Flags .Has (3 ),
},
{
Name : "Stars" ,
SchemaName : "stars" ,
},
}
return typ
}
func (g *GroupCallDonor ) SetFlags () {
if !(g .Top == false ) {
g .Flags .Set (0 )
}
if !(g .My == false ) {
g .Flags .Set (1 )
}
if !(g .PeerID == nil ) {
g .Flags .Set (3 )
}
}
func (g *GroupCallDonor ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallDonor#ee430c85 as nil" )
}
b .PutID (GroupCallDonorTypeID )
return g .EncodeBare (b )
}
func (g *GroupCallDonor ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode groupCallDonor#ee430c85 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallDonor#ee430c85: field flags: %w" , err )
}
if g .Flags .Has (3 ) {
if g .PeerID == nil {
return fmt .Errorf ("unable to encode groupCallDonor#ee430c85: field peer_id is nil" )
}
if err := g .PeerID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode groupCallDonor#ee430c85: field peer_id: %w" , err )
}
}
b .PutLong (g .Stars )
return nil
}
func (g *GroupCallDonor ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallDonor#ee430c85 to nil" )
}
if err := b .ConsumeID (GroupCallDonorTypeID ); err != nil {
return fmt .Errorf ("unable to decode groupCallDonor#ee430c85: %w" , err )
}
return g .DecodeBare (b )
}
func (g *GroupCallDonor ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode groupCallDonor#ee430c85 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode groupCallDonor#ee430c85: field flags: %w" , err )
}
}
g .Top = g .Flags .Has (0 )
g .My = g .Flags .Has (1 )
if g .Flags .Has (3 ) {
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode groupCallDonor#ee430c85: field peer_id: %w" , err )
}
g .PeerID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode groupCallDonor#ee430c85: field stars: %w" , err )
}
g .Stars = value
}
return nil
}
func (g *GroupCallDonor ) SetTop (value bool ) {
if value {
g .Flags .Set (0 )
g .Top = true
} else {
g .Flags .Unset (0 )
g .Top = false
}
}
func (g *GroupCallDonor ) GetTop () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *GroupCallDonor ) SetMy (value bool ) {
if value {
g .Flags .Set (1 )
g .My = true
} else {
g .Flags .Unset (1 )
g .My = false
}
}
func (g *GroupCallDonor ) GetMy () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (g *GroupCallDonor ) SetPeerID (value PeerClass ) {
g .Flags .Set (3 )
g .PeerID = value
}
func (g *GroupCallDonor ) GetPeerID () (value PeerClass , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (3 ) {
return value , false
}
return g .PeerID , true
}
func (g *GroupCallDonor ) GetStars () (value int64 ) {
if g == nil {
return
}
return g .Stars
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .