package mt
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 FutureSalts struct {
ReqMsgID int64
Now int
Salts []FutureSalt
}
const FutureSaltsTypeID = 0xae500895
var (
_ bin .Encoder = &FutureSalts {}
_ bin .Decoder = &FutureSalts {}
_ bin .BareEncoder = &FutureSalts {}
_ bin .BareDecoder = &FutureSalts {}
)
func (f *FutureSalts ) Zero () bool {
if f == nil {
return true
}
if !(f .ReqMsgID == 0 ) {
return false
}
if !(f .Now == 0 ) {
return false
}
if !(f .Salts == nil ) {
return false
}
return true
}
func (f *FutureSalts ) String () string {
if f == nil {
return "FutureSalts(nil)"
}
type Alias FutureSalts
return fmt .Sprintf ("FutureSalts%+v" , Alias (*f ))
}
func (*FutureSalts ) TypeID () uint32 {
return FutureSaltsTypeID
}
func (*FutureSalts ) TypeName () string {
return "future_salts"
}
func (f *FutureSalts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "future_salts" ,
ID : FutureSaltsTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ReqMsgID" ,
SchemaName : "req_msg_id" ,
},
{
Name : "Now" ,
SchemaName : "now" ,
},
{
Name : "Salts" ,
SchemaName : "salts" ,
},
}
return typ
}
func (f *FutureSalts ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode future_salts#ae500895 as nil" )
}
b .PutID (FutureSaltsTypeID )
return f .EncodeBare (b )
}
func (f *FutureSalts ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode future_salts#ae500895 as nil" )
}
b .PutLong (f .ReqMsgID )
b .PutInt (f .Now )
b .PutInt (len (f .Salts ))
for idx , v := range f .Salts {
if err := v .EncodeBare (b ); err != nil {
return fmt .Errorf ("unable to encode bare future_salts#ae500895: field salts element with index %d: %w" , idx , err )
}
}
return nil
}
func (f *FutureSalts ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode future_salts#ae500895 to nil" )
}
if err := b .ConsumeID (FutureSaltsTypeID ); err != nil {
return fmt .Errorf ("unable to decode future_salts#ae500895: %w" , err )
}
return f .DecodeBare (b )
}
func (f *FutureSalts ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode future_salts#ae500895 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode future_salts#ae500895: field req_msg_id: %w" , err )
}
f .ReqMsgID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode future_salts#ae500895: field now: %w" , err )
}
f .Now = value
}
{
headerLen , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode future_salts#ae500895: field salts: %w" , err )
}
if headerLen > 0 {
f .Salts = make ([]FutureSalt , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value FutureSalt
if err := value .DecodeBare (b ); err != nil {
return fmt .Errorf ("unable to decode bare future_salts#ae500895: field salts: %w" , err )
}
f .Salts = append (f .Salts , value )
}
}
return nil
}
func (f *FutureSalts ) GetReqMsgID () (value int64 ) {
if f == nil {
return
}
return f .ReqMsgID
}
func (f *FutureSalts ) GetNow () (value int ) {
if f == nil {
return
}
return f .Now
}
func (f *FutureSalts ) GetSalts () (value []FutureSalt ) {
if f == nil {
return
}
return f .Salts
}
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 .