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 NewSessionCreated struct {
FirstMsgID int64
UniqueID int64
ServerSalt int64
}
const NewSessionCreatedTypeID = 0x9ec20908
var (
_ bin .Encoder = &NewSessionCreated {}
_ bin .Decoder = &NewSessionCreated {}
_ bin .BareEncoder = &NewSessionCreated {}
_ bin .BareDecoder = &NewSessionCreated {}
)
func (n *NewSessionCreated ) Zero () bool {
if n == nil {
return true
}
if !(n .FirstMsgID == 0 ) {
return false
}
if !(n .UniqueID == 0 ) {
return false
}
if !(n .ServerSalt == 0 ) {
return false
}
return true
}
func (n *NewSessionCreated ) String () string {
if n == nil {
return "NewSessionCreated(nil)"
}
type Alias NewSessionCreated
return fmt .Sprintf ("NewSessionCreated%+v" , Alias (*n ))
}
func (*NewSessionCreated ) TypeID () uint32 {
return NewSessionCreatedTypeID
}
func (*NewSessionCreated ) TypeName () string {
return "new_session_created"
}
func (n *NewSessionCreated ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "new_session_created" ,
ID : NewSessionCreatedTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FirstMsgID" ,
SchemaName : "first_msg_id" ,
},
{
Name : "UniqueID" ,
SchemaName : "unique_id" ,
},
{
Name : "ServerSalt" ,
SchemaName : "server_salt" ,
},
}
return typ
}
func (n *NewSessionCreated ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode new_session_created#9ec20908 as nil" )
}
b .PutID (NewSessionCreatedTypeID )
return n .EncodeBare (b )
}
func (n *NewSessionCreated ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode new_session_created#9ec20908 as nil" )
}
b .PutLong (n .FirstMsgID )
b .PutLong (n .UniqueID )
b .PutLong (n .ServerSalt )
return nil
}
func (n *NewSessionCreated ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode new_session_created#9ec20908 to nil" )
}
if err := b .ConsumeID (NewSessionCreatedTypeID ); err != nil {
return fmt .Errorf ("unable to decode new_session_created#9ec20908: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NewSessionCreated ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode new_session_created#9ec20908 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode new_session_created#9ec20908: field first_msg_id: %w" , err )
}
n .FirstMsgID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode new_session_created#9ec20908: field unique_id: %w" , err )
}
n .UniqueID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode new_session_created#9ec20908: field server_salt: %w" , err )
}
n .ServerSalt = value
}
return nil
}
func (n *NewSessionCreated ) GetFirstMsgID () (value int64 ) {
if n == nil {
return
}
return n .FirstMsgID
}
func (n *NewSessionCreated ) GetUniqueID () (value int64 ) {
if n == nil {
return
}
return n .UniqueID
}
func (n *NewSessionCreated ) GetServerSalt () (value int64 ) {
if n == nil {
return
}
return n .ServerSalt
}
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 .