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 AuthLoggedOut struct {
Flags bin .Fields
FutureAuthToken []byte
}
const AuthLoggedOutTypeID = 0xc3a2835f
var (
_ bin .Encoder = &AuthLoggedOut {}
_ bin .Decoder = &AuthLoggedOut {}
_ bin .BareEncoder = &AuthLoggedOut {}
_ bin .BareDecoder = &AuthLoggedOut {}
)
func (l *AuthLoggedOut ) Zero () bool {
if l == nil {
return true
}
if !(l .Flags .Zero ()) {
return false
}
if !(l .FutureAuthToken == nil ) {
return false
}
return true
}
func (l *AuthLoggedOut ) String () string {
if l == nil {
return "AuthLoggedOut(nil)"
}
type Alias AuthLoggedOut
return fmt .Sprintf ("AuthLoggedOut%+v" , Alias (*l ))
}
func (l *AuthLoggedOut ) FillFrom (from interface {
GetFutureAuthToken () (value []byte , ok bool )
}) {
if val , ok := from .GetFutureAuthToken (); ok {
l .FutureAuthToken = val
}
}
func (*AuthLoggedOut ) TypeID () uint32 {
return AuthLoggedOutTypeID
}
func (*AuthLoggedOut ) TypeName () string {
return "auth.loggedOut"
}
func (l *AuthLoggedOut ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.loggedOut" ,
ID : AuthLoggedOutTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FutureAuthToken" ,
SchemaName : "future_auth_token" ,
Null : !l .Flags .Has (0 ),
},
}
return typ
}
func (l *AuthLoggedOut ) SetFlags () {
if !(l .FutureAuthToken == nil ) {
l .Flags .Set (0 )
}
}
func (l *AuthLoggedOut ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode auth.loggedOut#c3a2835f as nil" )
}
b .PutID (AuthLoggedOutTypeID )
return l .EncodeBare (b )
}
func (l *AuthLoggedOut ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode auth.loggedOut#c3a2835f as nil" )
}
l .SetFlags ()
if err := l .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode auth.loggedOut#c3a2835f: field flags: %w" , err )
}
if l .Flags .Has (0 ) {
b .PutBytes (l .FutureAuthToken )
}
return nil
}
func (l *AuthLoggedOut ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode auth.loggedOut#c3a2835f to nil" )
}
if err := b .ConsumeID (AuthLoggedOutTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.loggedOut#c3a2835f: %w" , err )
}
return l .DecodeBare (b )
}
func (l *AuthLoggedOut ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode auth.loggedOut#c3a2835f to nil" )
}
{
if err := l .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode auth.loggedOut#c3a2835f: field flags: %w" , err )
}
}
if l .Flags .Has (0 ) {
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode auth.loggedOut#c3a2835f: field future_auth_token: %w" , err )
}
l .FutureAuthToken = value
}
return nil
}
func (l *AuthLoggedOut ) SetFutureAuthToken (value []byte ) {
l .Flags .Set (0 )
l .FutureAuthToken = value
}
func (l *AuthLoggedOut ) GetFutureAuthToken () (value []byte , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (0 ) {
return value , false
}
return l .FutureAuthToken , true
}
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 .