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 MessagesAffectedFoundMessages struct {
Pts int
PtsCount int
Offset int
Messages []int
}
const MessagesAffectedFoundMessagesTypeID = 0xef8d3e6c
var (
_ bin .Encoder = &MessagesAffectedFoundMessages {}
_ bin .Decoder = &MessagesAffectedFoundMessages {}
_ bin .BareEncoder = &MessagesAffectedFoundMessages {}
_ bin .BareDecoder = &MessagesAffectedFoundMessages {}
)
func (a *MessagesAffectedFoundMessages ) Zero () bool {
if a == nil {
return true
}
if !(a .Pts == 0 ) {
return false
}
if !(a .PtsCount == 0 ) {
return false
}
if !(a .Offset == 0 ) {
return false
}
if !(a .Messages == nil ) {
return false
}
return true
}
func (a *MessagesAffectedFoundMessages ) String () string {
if a == nil {
return "MessagesAffectedFoundMessages(nil)"
}
type Alias MessagesAffectedFoundMessages
return fmt .Sprintf ("MessagesAffectedFoundMessages%+v" , Alias (*a ))
}
func (a *MessagesAffectedFoundMessages ) FillFrom (from interface {
GetPts () (value int )
GetPtsCount () (value int )
GetOffset () (value int )
GetMessages () (value []int )
}) {
a .Pts = from .GetPts ()
a .PtsCount = from .GetPtsCount ()
a .Offset = from .GetOffset ()
a .Messages = from .GetMessages ()
}
func (*MessagesAffectedFoundMessages ) TypeID () uint32 {
return MessagesAffectedFoundMessagesTypeID
}
func (*MessagesAffectedFoundMessages ) TypeName () string {
return "messages.affectedFoundMessages"
}
func (a *MessagesAffectedFoundMessages ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.affectedFoundMessages" ,
ID : MessagesAffectedFoundMessagesTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pts" ,
SchemaName : "pts" ,
},
{
Name : "PtsCount" ,
SchemaName : "pts_count" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Messages" ,
SchemaName : "messages" ,
},
}
return typ
}
func (a *MessagesAffectedFoundMessages ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.affectedFoundMessages#ef8d3e6c as nil" )
}
b .PutID (MessagesAffectedFoundMessagesTypeID )
return a .EncodeBare (b )
}
func (a *MessagesAffectedFoundMessages ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.affectedFoundMessages#ef8d3e6c as nil" )
}
b .PutInt (a .Pts )
b .PutInt (a .PtsCount )
b .PutInt (a .Offset )
b .PutVectorHeader (len (a .Messages ))
for _ , v := range a .Messages {
b .PutInt (v )
}
return nil
}
func (a *MessagesAffectedFoundMessages ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.affectedFoundMessages#ef8d3e6c to nil" )
}
if err := b .ConsumeID (MessagesAffectedFoundMessagesTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.affectedFoundMessages#ef8d3e6c: %w" , err )
}
return a .DecodeBare (b )
}
func (a *MessagesAffectedFoundMessages ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.affectedFoundMessages#ef8d3e6c to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedFoundMessages#ef8d3e6c: field pts: %w" , err )
}
a .Pts = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedFoundMessages#ef8d3e6c: field pts_count: %w" , err )
}
a .PtsCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedFoundMessages#ef8d3e6c: field offset: %w" , err )
}
a .Offset = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedFoundMessages#ef8d3e6c: field messages: %w" , err )
}
if headerLen > 0 {
a .Messages = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedFoundMessages#ef8d3e6c: field messages: %w" , err )
}
a .Messages = append (a .Messages , value )
}
}
return nil
}
func (a *MessagesAffectedFoundMessages ) GetPts () (value int ) {
if a == nil {
return
}
return a .Pts
}
func (a *MessagesAffectedFoundMessages ) GetPtsCount () (value int ) {
if a == nil {
return
}
return a .PtsCount
}
func (a *MessagesAffectedFoundMessages ) GetOffset () (value int ) {
if a == nil {
return
}
return a .Offset
}
func (a *MessagesAffectedFoundMessages ) GetMessages () (value []int ) {
if a == nil {
return
}
return a .Messages
}
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 .