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 UpdatesState struct {
Pts int
Qts int
Date int
Seq int
UnreadCount int
}
const UpdatesStateTypeID = 0xa56c2a3e
var (
_ bin .Encoder = &UpdatesState {}
_ bin .Decoder = &UpdatesState {}
_ bin .BareEncoder = &UpdatesState {}
_ bin .BareDecoder = &UpdatesState {}
)
func (s *UpdatesState ) Zero () bool {
if s == nil {
return true
}
if !(s .Pts == 0 ) {
return false
}
if !(s .Qts == 0 ) {
return false
}
if !(s .Date == 0 ) {
return false
}
if !(s .Seq == 0 ) {
return false
}
if !(s .UnreadCount == 0 ) {
return false
}
return true
}
func (s *UpdatesState ) String () string {
if s == nil {
return "UpdatesState(nil)"
}
type Alias UpdatesState
return fmt .Sprintf ("UpdatesState%+v" , Alias (*s ))
}
func (s *UpdatesState ) FillFrom (from interface {
GetPts () (value int )
GetQts () (value int )
GetDate () (value int )
GetSeq () (value int )
GetUnreadCount () (value int )
}) {
s .Pts = from .GetPts ()
s .Qts = from .GetQts ()
s .Date = from .GetDate ()
s .Seq = from .GetSeq ()
s .UnreadCount = from .GetUnreadCount ()
}
func (*UpdatesState ) TypeID () uint32 {
return UpdatesStateTypeID
}
func (*UpdatesState ) TypeName () string {
return "updates.state"
}
func (s *UpdatesState ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "updates.state" ,
ID : UpdatesStateTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pts" ,
SchemaName : "pts" ,
},
{
Name : "Qts" ,
SchemaName : "qts" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "Seq" ,
SchemaName : "seq" ,
},
{
Name : "UnreadCount" ,
SchemaName : "unread_count" ,
},
}
return typ
}
func (s *UpdatesState ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode updates.state#a56c2a3e as nil" )
}
b .PutID (UpdatesStateTypeID )
return s .EncodeBare (b )
}
func (s *UpdatesState ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode updates.state#a56c2a3e as nil" )
}
b .PutInt (s .Pts )
b .PutInt (s .Qts )
b .PutInt (s .Date )
b .PutInt (s .Seq )
b .PutInt (s .UnreadCount )
return nil
}
func (s *UpdatesState ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode updates.state#a56c2a3e to nil" )
}
if err := b .ConsumeID (UpdatesStateTypeID ); err != nil {
return fmt .Errorf ("unable to decode updates.state#a56c2a3e: %w" , err )
}
return s .DecodeBare (b )
}
func (s *UpdatesState ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode updates.state#a56c2a3e to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.state#a56c2a3e: field pts: %w" , err )
}
s .Pts = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.state#a56c2a3e: field qts: %w" , err )
}
s .Qts = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.state#a56c2a3e: field date: %w" , err )
}
s .Date = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.state#a56c2a3e: field seq: %w" , err )
}
s .Seq = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.state#a56c2a3e: field unread_count: %w" , err )
}
s .UnreadCount = value
}
return nil
}
func (s *UpdatesState ) GetPts () (value int ) {
if s == nil {
return
}
return s .Pts
}
func (s *UpdatesState ) GetQts () (value int ) {
if s == nil {
return
}
return s .Qts
}
func (s *UpdatesState ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *UpdatesState ) GetSeq () (value int ) {
if s == nil {
return
}
return s .Seq
}
func (s *UpdatesState ) GetUnreadCount () (value int ) {
if s == nil {
return
}
return s .UnreadCount
}
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 .