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 StatsGetMegagroupStatsRequest struct {
Flags bin .Fields
Dark bool
Channel InputChannelClass
}
const StatsGetMegagroupStatsRequestTypeID = 0xdcdf8607
var (
_ bin .Encoder = &StatsGetMegagroupStatsRequest {}
_ bin .Decoder = &StatsGetMegagroupStatsRequest {}
_ bin .BareEncoder = &StatsGetMegagroupStatsRequest {}
_ bin .BareDecoder = &StatsGetMegagroupStatsRequest {}
)
func (g *StatsGetMegagroupStatsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Dark == false ) {
return false
}
if !(g .Channel == nil ) {
return false
}
return true
}
func (g *StatsGetMegagroupStatsRequest ) String () string {
if g == nil {
return "StatsGetMegagroupStatsRequest(nil)"
}
type Alias StatsGetMegagroupStatsRequest
return fmt .Sprintf ("StatsGetMegagroupStatsRequest%+v" , Alias (*g ))
}
func (g *StatsGetMegagroupStatsRequest ) FillFrom (from interface {
GetDark () (value bool )
GetChannel () (value InputChannelClass )
}) {
g .Dark = from .GetDark ()
g .Channel = from .GetChannel ()
}
func (*StatsGetMegagroupStatsRequest ) TypeID () uint32 {
return StatsGetMegagroupStatsRequestTypeID
}
func (*StatsGetMegagroupStatsRequest ) TypeName () string {
return "stats.getMegagroupStats"
}
func (g *StatsGetMegagroupStatsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stats.getMegagroupStats" ,
ID : StatsGetMegagroupStatsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Dark" ,
SchemaName : "dark" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Channel" ,
SchemaName : "channel" ,
},
}
return typ
}
func (g *StatsGetMegagroupStatsRequest ) SetFlags () {
if !(g .Dark == false ) {
g .Flags .Set (0 )
}
}
func (g *StatsGetMegagroupStatsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stats.getMegagroupStats#dcdf8607 as nil" )
}
b .PutID (StatsGetMegagroupStatsRequestTypeID )
return g .EncodeBare (b )
}
func (g *StatsGetMegagroupStatsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stats.getMegagroupStats#dcdf8607 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.getMegagroupStats#dcdf8607: field flags: %w" , err )
}
if g .Channel == nil {
return fmt .Errorf ("unable to encode stats.getMegagroupStats#dcdf8607: field channel is nil" )
}
if err := g .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.getMegagroupStats#dcdf8607: field channel: %w" , err )
}
return nil
}
func (g *StatsGetMegagroupStatsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stats.getMegagroupStats#dcdf8607 to nil" )
}
if err := b .ConsumeID (StatsGetMegagroupStatsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stats.getMegagroupStats#dcdf8607: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StatsGetMegagroupStatsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stats.getMegagroupStats#dcdf8607 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stats.getMegagroupStats#dcdf8607: field flags: %w" , err )
}
}
g .Dark = g .Flags .Has (0 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode stats.getMegagroupStats#dcdf8607: field channel: %w" , err )
}
g .Channel = value
}
return nil
}
func (g *StatsGetMegagroupStatsRequest ) SetDark (value bool ) {
if value {
g .Flags .Set (0 )
g .Dark = true
} else {
g .Flags .Unset (0 )
g .Dark = false
}
}
func (g *StatsGetMegagroupStatsRequest ) GetDark () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *StatsGetMegagroupStatsRequest ) GetChannel () (value InputChannelClass ) {
if g == nil {
return
}
return g .Channel
}
func (g *StatsGetMegagroupStatsRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return g .Channel .AsNotEmpty ()
}
func (c *Client ) StatsGetMegagroupStats (ctx context .Context , request *StatsGetMegagroupStatsRequest ) (*StatsMegagroupStats , error ) {
var result StatsMegagroupStats
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .