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 StatsGetMessagePublicForwardsRequest struct {
Channel InputChannelClass
MsgID int
Offset string
Limit int
}
const StatsGetMessagePublicForwardsRequestTypeID = 0x5f150144
var (
_ bin .Encoder = &StatsGetMessagePublicForwardsRequest {}
_ bin .Decoder = &StatsGetMessagePublicForwardsRequest {}
_ bin .BareEncoder = &StatsGetMessagePublicForwardsRequest {}
_ bin .BareDecoder = &StatsGetMessagePublicForwardsRequest {}
)
func (g *StatsGetMessagePublicForwardsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Channel == nil ) {
return false
}
if !(g .MsgID == 0 ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *StatsGetMessagePublicForwardsRequest ) String () string {
if g == nil {
return "StatsGetMessagePublicForwardsRequest(nil)"
}
type Alias StatsGetMessagePublicForwardsRequest
return fmt .Sprintf ("StatsGetMessagePublicForwardsRequest%+v" , Alias (*g ))
}
func (g *StatsGetMessagePublicForwardsRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetMsgID () (value int )
GetOffset () (value string )
GetLimit () (value int )
}) {
g .Channel = from .GetChannel ()
g .MsgID = from .GetMsgID ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*StatsGetMessagePublicForwardsRequest ) TypeID () uint32 {
return StatsGetMessagePublicForwardsRequestTypeID
}
func (*StatsGetMessagePublicForwardsRequest ) TypeName () string {
return "stats.getMessagePublicForwards"
}
func (g *StatsGetMessagePublicForwardsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stats.getMessagePublicForwards" ,
ID : StatsGetMessagePublicForwardsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *StatsGetMessagePublicForwardsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stats.getMessagePublicForwards#5f150144 as nil" )
}
b .PutID (StatsGetMessagePublicForwardsRequestTypeID )
return g .EncodeBare (b )
}
func (g *StatsGetMessagePublicForwardsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stats.getMessagePublicForwards#5f150144 as nil" )
}
if g .Channel == nil {
return fmt .Errorf ("unable to encode stats.getMessagePublicForwards#5f150144: field channel is nil" )
}
if err := g .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.getMessagePublicForwards#5f150144: field channel: %w" , err )
}
b .PutInt (g .MsgID )
b .PutString (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *StatsGetMessagePublicForwardsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stats.getMessagePublicForwards#5f150144 to nil" )
}
if err := b .ConsumeID (StatsGetMessagePublicForwardsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stats.getMessagePublicForwards#5f150144: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StatsGetMessagePublicForwardsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stats.getMessagePublicForwards#5f150144 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode stats.getMessagePublicForwards#5f150144: field channel: %w" , err )
}
g .Channel = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stats.getMessagePublicForwards#5f150144: field msg_id: %w" , err )
}
g .MsgID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode stats.getMessagePublicForwards#5f150144: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stats.getMessagePublicForwards#5f150144: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *StatsGetMessagePublicForwardsRequest ) GetChannel () (value InputChannelClass ) {
if g == nil {
return
}
return g .Channel
}
func (g *StatsGetMessagePublicForwardsRequest ) GetMsgID () (value int ) {
if g == nil {
return
}
return g .MsgID
}
func (g *StatsGetMessagePublicForwardsRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *StatsGetMessagePublicForwardsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *StatsGetMessagePublicForwardsRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return g .Channel .AsNotEmpty ()
}
func (c *Client ) StatsGetMessagePublicForwards (ctx context .Context , request *StatsGetMessagePublicForwardsRequest ) (*StatsPublicForwards , error ) {
var result StatsPublicForwards
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 .