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 InputUserEmpty struct {
}
const InputUserEmptyTypeID = 0xb98886cf
func (i InputUserEmpty ) construct () InputUserClass { return &i }
var (
_ bin .Encoder = &InputUserEmpty {}
_ bin .Decoder = &InputUserEmpty {}
_ bin .BareEncoder = &InputUserEmpty {}
_ bin .BareDecoder = &InputUserEmpty {}
_ InputUserClass = &InputUserEmpty {}
)
func (i *InputUserEmpty ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputUserEmpty ) String () string {
if i == nil {
return "InputUserEmpty(nil)"
}
type Alias InputUserEmpty
return fmt .Sprintf ("InputUserEmpty%+v" , Alias (*i ))
}
func (*InputUserEmpty ) TypeID () uint32 {
return InputUserEmptyTypeID
}
func (*InputUserEmpty ) TypeName () string {
return "inputUserEmpty"
}
func (i *InputUserEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputUserEmpty" ,
ID : InputUserEmptyTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputUserEmpty ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUserEmpty#b98886cf as nil" )
}
b .PutID (InputUserEmptyTypeID )
return i .EncodeBare (b )
}
func (i *InputUserEmpty ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUserEmpty#b98886cf as nil" )
}
return nil
}
func (i *InputUserEmpty ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUserEmpty#b98886cf to nil" )
}
if err := b .ConsumeID (InputUserEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputUserEmpty#b98886cf: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputUserEmpty ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUserEmpty#b98886cf to nil" )
}
return nil
}
type InputUserSelf struct {
}
const InputUserSelfTypeID = 0xf7c1b13f
func (i InputUserSelf ) construct () InputUserClass { return &i }
var (
_ bin .Encoder = &InputUserSelf {}
_ bin .Decoder = &InputUserSelf {}
_ bin .BareEncoder = &InputUserSelf {}
_ bin .BareDecoder = &InputUserSelf {}
_ InputUserClass = &InputUserSelf {}
)
func (i *InputUserSelf ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputUserSelf ) String () string {
if i == nil {
return "InputUserSelf(nil)"
}
type Alias InputUserSelf
return fmt .Sprintf ("InputUserSelf%+v" , Alias (*i ))
}
func (*InputUserSelf ) TypeID () uint32 {
return InputUserSelfTypeID
}
func (*InputUserSelf ) TypeName () string {
return "inputUserSelf"
}
func (i *InputUserSelf ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputUserSelf" ,
ID : InputUserSelfTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputUserSelf ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUserSelf#f7c1b13f as nil" )
}
b .PutID (InputUserSelfTypeID )
return i .EncodeBare (b )
}
func (i *InputUserSelf ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUserSelf#f7c1b13f as nil" )
}
return nil
}
func (i *InputUserSelf ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUserSelf#f7c1b13f to nil" )
}
if err := b .ConsumeID (InputUserSelfTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputUserSelf#f7c1b13f: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputUserSelf ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUserSelf#f7c1b13f to nil" )
}
return nil
}
type InputUser struct {
UserID int64
AccessHash int64
}
const InputUserTypeID = 0xf21158c6
func (i InputUser ) construct () InputUserClass { return &i }
var (
_ bin .Encoder = &InputUser {}
_ bin .Decoder = &InputUser {}
_ bin .BareEncoder = &InputUser {}
_ bin .BareDecoder = &InputUser {}
_ InputUserClass = &InputUser {}
)
func (i *InputUser ) Zero () bool {
if i == nil {
return true
}
if !(i .UserID == 0 ) {
return false
}
if !(i .AccessHash == 0 ) {
return false
}
return true
}
func (i *InputUser ) String () string {
if i == nil {
return "InputUser(nil)"
}
type Alias InputUser
return fmt .Sprintf ("InputUser%+v" , Alias (*i ))
}
func (i *InputUser ) FillFrom (from interface {
GetUserID () (value int64 )
GetAccessHash () (value int64 )
}) {
i .UserID = from .GetUserID ()
i .AccessHash = from .GetAccessHash ()
}
func (*InputUser ) TypeID () uint32 {
return InputUserTypeID
}
func (*InputUser ) TypeName () string {
return "inputUser"
}
func (i *InputUser ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputUser" ,
ID : InputUserTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
}
return typ
}
func (i *InputUser ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUser#f21158c6 as nil" )
}
b .PutID (InputUserTypeID )
return i .EncodeBare (b )
}
func (i *InputUser ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUser#f21158c6 as nil" )
}
b .PutLong (i .UserID )
b .PutLong (i .AccessHash )
return nil
}
func (i *InputUser ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUser#f21158c6 to nil" )
}
if err := b .ConsumeID (InputUserTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputUser#f21158c6: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputUser ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUser#f21158c6 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputUser#f21158c6: field user_id: %w" , err )
}
i .UserID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputUser#f21158c6: field access_hash: %w" , err )
}
i .AccessHash = value
}
return nil
}
func (i *InputUser ) GetUserID () (value int64 ) {
if i == nil {
return
}
return i .UserID
}
func (i *InputUser ) GetAccessHash () (value int64 ) {
if i == nil {
return
}
return i .AccessHash
}
type InputUserFromMessage struct {
Peer InputPeerClass
MsgID int
UserID int64
}
const InputUserFromMessageTypeID = 0x1da448e2
func (i InputUserFromMessage ) construct () InputUserClass { return &i }
var (
_ bin .Encoder = &InputUserFromMessage {}
_ bin .Decoder = &InputUserFromMessage {}
_ bin .BareEncoder = &InputUserFromMessage {}
_ bin .BareDecoder = &InputUserFromMessage {}
_ InputUserClass = &InputUserFromMessage {}
)
func (i *InputUserFromMessage ) Zero () bool {
if i == nil {
return true
}
if !(i .Peer == nil ) {
return false
}
if !(i .MsgID == 0 ) {
return false
}
if !(i .UserID == 0 ) {
return false
}
return true
}
func (i *InputUserFromMessage ) String () string {
if i == nil {
return "InputUserFromMessage(nil)"
}
type Alias InputUserFromMessage
return fmt .Sprintf ("InputUserFromMessage%+v" , Alias (*i ))
}
func (i *InputUserFromMessage ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetMsgID () (value int )
GetUserID () (value int64 )
}) {
i .Peer = from .GetPeer ()
i .MsgID = from .GetMsgID ()
i .UserID = from .GetUserID ()
}
func (*InputUserFromMessage ) TypeID () uint32 {
return InputUserFromMessageTypeID
}
func (*InputUserFromMessage ) TypeName () string {
return "inputUserFromMessage"
}
func (i *InputUserFromMessage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputUserFromMessage" ,
ID : InputUserFromMessageTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (i *InputUserFromMessage ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUserFromMessage#1da448e2 as nil" )
}
b .PutID (InputUserFromMessageTypeID )
return i .EncodeBare (b )
}
func (i *InputUserFromMessage ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputUserFromMessage#1da448e2 as nil" )
}
if i .Peer == nil {
return fmt .Errorf ("unable to encode inputUserFromMessage#1da448e2: field peer is nil" )
}
if err := i .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputUserFromMessage#1da448e2: field peer: %w" , err )
}
b .PutInt (i .MsgID )
b .PutLong (i .UserID )
return nil
}
func (i *InputUserFromMessage ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUserFromMessage#1da448e2 to nil" )
}
if err := b .ConsumeID (InputUserFromMessageTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputUserFromMessage#1da448e2: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputUserFromMessage ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputUserFromMessage#1da448e2 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode inputUserFromMessage#1da448e2: field peer: %w" , err )
}
i .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputUserFromMessage#1da448e2: field msg_id: %w" , err )
}
i .MsgID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputUserFromMessage#1da448e2: field user_id: %w" , err )
}
i .UserID = value
}
return nil
}
func (i *InputUserFromMessage ) GetPeer () (value InputPeerClass ) {
if i == nil {
return
}
return i .Peer
}
func (i *InputUserFromMessage ) GetMsgID () (value int ) {
if i == nil {
return
}
return i .MsgID
}
func (i *InputUserFromMessage ) GetUserID () (value int64 ) {
if i == nil {
return
}
return i .UserID
}
const InputUserClassName = "InputUser"
type InputUserClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputUserClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputUser (buf *bin .Buffer ) (InputUserClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputUserEmptyTypeID :
v := InputUserEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputUserClass: %w" , err )
}
return &v , nil
case InputUserSelfTypeID :
v := InputUserSelf {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputUserClass: %w" , err )
}
return &v , nil
case InputUserTypeID :
v := InputUser {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputUserClass: %w" , err )
}
return &v , nil
case InputUserFromMessageTypeID :
v := InputUserFromMessage {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputUserClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputUserClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputUserBox struct {
InputUser InputUserClass
}
func (b *InputUserBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputUserBox to nil" )
}
v , err := DecodeInputUser (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputUser = v
return nil
}
func (b *InputUserBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputUser == nil {
return fmt .Errorf ("unable to encode InputUserClass as nil" )
}
return b .InputUser .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 .