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