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 DestroySessionOk struct {
SessionID int64
}
const DestroySessionOkTypeID = 0xe22045fc
func (d DestroySessionOk ) construct () DestroySessionResClass { return &d }
var (
_ bin .Encoder = &DestroySessionOk {}
_ bin .Decoder = &DestroySessionOk {}
_ bin .BareEncoder = &DestroySessionOk {}
_ bin .BareDecoder = &DestroySessionOk {}
_ DestroySessionResClass = &DestroySessionOk {}
)
func (d *DestroySessionOk ) Zero () bool {
if d == nil {
return true
}
if !(d .SessionID == 0 ) {
return false
}
return true
}
func (d *DestroySessionOk ) String () string {
if d == nil {
return "DestroySessionOk(nil)"
}
type Alias DestroySessionOk
return fmt .Sprintf ("DestroySessionOk%+v" , Alias (*d ))
}
func (*DestroySessionOk ) TypeID () uint32 {
return DestroySessionOkTypeID
}
func (*DestroySessionOk ) TypeName () string {
return "destroy_session_ok"
}
func (d *DestroySessionOk ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "destroy_session_ok" ,
ID : DestroySessionOkTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SessionID" ,
SchemaName : "session_id" ,
},
}
return typ
}
func (d *DestroySessionOk ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode destroy_session_ok#e22045fc as nil" )
}
b .PutID (DestroySessionOkTypeID )
return d .EncodeBare (b )
}
func (d *DestroySessionOk ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode destroy_session_ok#e22045fc as nil" )
}
b .PutLong (d .SessionID )
return nil
}
func (d *DestroySessionOk ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode destroy_session_ok#e22045fc to nil" )
}
if err := b .ConsumeID (DestroySessionOkTypeID ); err != nil {
return fmt .Errorf ("unable to decode destroy_session_ok#e22045fc: %w" , err )
}
return d .DecodeBare (b )
}
func (d *DestroySessionOk ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode destroy_session_ok#e22045fc to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode destroy_session_ok#e22045fc: field session_id: %w" , err )
}
d .SessionID = value
}
return nil
}
func (d *DestroySessionOk ) GetSessionID () (value int64 ) {
if d == nil {
return
}
return d .SessionID
}
type DestroySessionNone struct {
SessionID int64
}
const DestroySessionNoneTypeID = 0x62d350c9
func (d DestroySessionNone ) construct () DestroySessionResClass { return &d }
var (
_ bin .Encoder = &DestroySessionNone {}
_ bin .Decoder = &DestroySessionNone {}
_ bin .BareEncoder = &DestroySessionNone {}
_ bin .BareDecoder = &DestroySessionNone {}
_ DestroySessionResClass = &DestroySessionNone {}
)
func (d *DestroySessionNone ) Zero () bool {
if d == nil {
return true
}
if !(d .SessionID == 0 ) {
return false
}
return true
}
func (d *DestroySessionNone ) String () string {
if d == nil {
return "DestroySessionNone(nil)"
}
type Alias DestroySessionNone
return fmt .Sprintf ("DestroySessionNone%+v" , Alias (*d ))
}
func (*DestroySessionNone ) TypeID () uint32 {
return DestroySessionNoneTypeID
}
func (*DestroySessionNone ) TypeName () string {
return "destroy_session_none"
}
func (d *DestroySessionNone ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "destroy_session_none" ,
ID : DestroySessionNoneTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SessionID" ,
SchemaName : "session_id" ,
},
}
return typ
}
func (d *DestroySessionNone ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode destroy_session_none#62d350c9 as nil" )
}
b .PutID (DestroySessionNoneTypeID )
return d .EncodeBare (b )
}
func (d *DestroySessionNone ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode destroy_session_none#62d350c9 as nil" )
}
b .PutLong (d .SessionID )
return nil
}
func (d *DestroySessionNone ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode destroy_session_none#62d350c9 to nil" )
}
if err := b .ConsumeID (DestroySessionNoneTypeID ); err != nil {
return fmt .Errorf ("unable to decode destroy_session_none#62d350c9: %w" , err )
}
return d .DecodeBare (b )
}
func (d *DestroySessionNone ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode destroy_session_none#62d350c9 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode destroy_session_none#62d350c9: field session_id: %w" , err )
}
d .SessionID = value
}
return nil
}
func (d *DestroySessionNone ) GetSessionID () (value int64 ) {
if d == nil {
return
}
return d .SessionID
}
const DestroySessionResClassName = "DestroySessionRes"
type DestroySessionResClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () DestroySessionResClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetSessionID () (value int64 )
}
func DecodeDestroySessionRes (buf *bin .Buffer ) (DestroySessionResClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case DestroySessionOkTypeID :
v := DestroySessionOk {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode DestroySessionResClass: %w" , err )
}
return &v , nil
case DestroySessionNoneTypeID :
v := DestroySessionNone {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode DestroySessionResClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode DestroySessionResClass: %w" , bin .NewUnexpectedID (id ))
}
}
type DestroySessionResBox struct {
DestroySessionRes DestroySessionResClass
}
func (b *DestroySessionResBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode DestroySessionResBox to nil" )
}
v , err := DecodeDestroySessionRes (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .DestroySessionRes = v
return nil
}
func (b *DestroySessionResBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .DestroySessionRes == nil {
return fmt .Errorf ("unable to encode DestroySessionResClass as nil" )
}
return b .DestroySessionRes .Encode (buf )
}
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 .