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 MessagesAffectedHistory struct {
Pts int
PtsCount int
Offset int
}
const MessagesAffectedHistoryTypeID = 0xb45c69d1
var (
_ bin .Encoder = &MessagesAffectedHistory {}
_ bin .Decoder = &MessagesAffectedHistory {}
_ bin .BareEncoder = &MessagesAffectedHistory {}
_ bin .BareDecoder = &MessagesAffectedHistory {}
)
func (a *MessagesAffectedHistory ) 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
}
return true
}
func (a *MessagesAffectedHistory ) String () string {
if a == nil {
return "MessagesAffectedHistory(nil)"
}
type Alias MessagesAffectedHistory
return fmt .Sprintf ("MessagesAffectedHistory%+v" , Alias (*a ))
}
func (a *MessagesAffectedHistory ) FillFrom (from interface {
GetPts () (value int )
GetPtsCount () (value int )
GetOffset () (value int )
}) {
a .Pts = from .GetPts ()
a .PtsCount = from .GetPtsCount ()
a .Offset = from .GetOffset ()
}
func (*MessagesAffectedHistory ) TypeID () uint32 {
return MessagesAffectedHistoryTypeID
}
func (*MessagesAffectedHistory ) TypeName () string {
return "messages.affectedHistory"
}
func (a *MessagesAffectedHistory ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.affectedHistory" ,
ID : MessagesAffectedHistoryTypeID ,
}
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" ,
},
}
return typ
}
func (a *MessagesAffectedHistory ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.affectedHistory#b45c69d1 as nil" )
}
b .PutID (MessagesAffectedHistoryTypeID )
return a .EncodeBare (b )
}
func (a *MessagesAffectedHistory ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.affectedHistory#b45c69d1 as nil" )
}
b .PutInt (a .Pts )
b .PutInt (a .PtsCount )
b .PutInt (a .Offset )
return nil
}
func (a *MessagesAffectedHistory ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.affectedHistory#b45c69d1 to nil" )
}
if err := b .ConsumeID (MessagesAffectedHistoryTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.affectedHistory#b45c69d1: %w" , err )
}
return a .DecodeBare (b )
}
func (a *MessagesAffectedHistory ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.affectedHistory#b45c69d1 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedHistory#b45c69d1: field pts: %w" , err )
}
a .Pts = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedHistory#b45c69d1: field pts_count: %w" , err )
}
a .PtsCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.affectedHistory#b45c69d1: field offset: %w" , err )
}
a .Offset = value
}
return nil
}
func (a *MessagesAffectedHistory ) GetPts () (value int ) {
if a == nil {
return
}
return a .Pts
}
func (a *MessagesAffectedHistory ) GetPtsCount () (value int ) {
if a == nil {
return
}
return a .PtsCount
}
func (a *MessagesAffectedHistory ) GetOffset () (value int ) {
if a == nil {
return
}
return a .Offset
}
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 .