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 FutureSalt struct {
ValidSince int
ValidUntil int
Salt int64
}
const FutureSaltTypeID = 0x949d9dc
var (
_ bin .Encoder = &FutureSalt {}
_ bin .Decoder = &FutureSalt {}
_ bin .BareEncoder = &FutureSalt {}
_ bin .BareDecoder = &FutureSalt {}
)
func (f *FutureSalt ) Zero () bool {
if f == nil {
return true
}
if !(f .ValidSince == 0 ) {
return false
}
if !(f .ValidUntil == 0 ) {
return false
}
if !(f .Salt == 0 ) {
return false
}
return true
}
func (f *FutureSalt ) String () string {
if f == nil {
return "FutureSalt(nil)"
}
type Alias FutureSalt
return fmt .Sprintf ("FutureSalt%+v" , Alias (*f ))
}
func (*FutureSalt ) TypeID () uint32 {
return FutureSaltTypeID
}
func (*FutureSalt ) TypeName () string {
return "future_salt"
}
func (f *FutureSalt ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "future_salt" ,
ID : FutureSaltTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ValidSince" ,
SchemaName : "valid_since" ,
},
{
Name : "ValidUntil" ,
SchemaName : "valid_until" ,
},
{
Name : "Salt" ,
SchemaName : "salt" ,
},
}
return typ
}
func (f *FutureSalt ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode future_salt#949d9dc as nil" )
}
b .PutID (FutureSaltTypeID )
return f .EncodeBare (b )
}
func (f *FutureSalt ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode future_salt#949d9dc as nil" )
}
b .PutInt (f .ValidSince )
b .PutInt (f .ValidUntil )
b .PutLong (f .Salt )
return nil
}
func (f *FutureSalt ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode future_salt#949d9dc to nil" )
}
if err := b .ConsumeID (FutureSaltTypeID ); err != nil {
return fmt .Errorf ("unable to decode future_salt#949d9dc: %w" , err )
}
return f .DecodeBare (b )
}
func (f *FutureSalt ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode future_salt#949d9dc to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode future_salt#949d9dc: field valid_since: %w" , err )
}
f .ValidSince = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode future_salt#949d9dc: field valid_until: %w" , err )
}
f .ValidUntil = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode future_salt#949d9dc: field salt: %w" , err )
}
f .Salt = value
}
return nil
}
func (f *FutureSalt ) GetValidSince () (value int ) {
if f == nil {
return
}
return f .ValidSince
}
func (f *FutureSalt ) GetValidUntil () (value int ) {
if f == nil {
return
}
return f .ValidUntil
}
func (f *FutureSalt ) GetSalt () (value int64 ) {
if f == nil {
return
}
return f .Salt
}
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 .