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 InputDialogPeer struct {
Peer InputPeerClass
}
const InputDialogPeerTypeID = 0xfcaafeb7
func (i InputDialogPeer ) construct () InputDialogPeerClass { return &i }
var (
_ bin .Encoder = &InputDialogPeer {}
_ bin .Decoder = &InputDialogPeer {}
_ bin .BareEncoder = &InputDialogPeer {}
_ bin .BareDecoder = &InputDialogPeer {}
_ InputDialogPeerClass = &InputDialogPeer {}
)
func (i *InputDialogPeer ) Zero () bool {
if i == nil {
return true
}
if !(i .Peer == nil ) {
return false
}
return true
}
func (i *InputDialogPeer ) String () string {
if i == nil {
return "InputDialogPeer(nil)"
}
type Alias InputDialogPeer
return fmt .Sprintf ("InputDialogPeer%+v" , Alias (*i ))
}
func (i *InputDialogPeer ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
}) {
i .Peer = from .GetPeer ()
}
func (*InputDialogPeer ) TypeID () uint32 {
return InputDialogPeerTypeID
}
func (*InputDialogPeer ) TypeName () string {
return "inputDialogPeer"
}
func (i *InputDialogPeer ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputDialogPeer" ,
ID : InputDialogPeerTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
}
return typ
}
func (i *InputDialogPeer ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputDialogPeer#fcaafeb7 as nil" )
}
b .PutID (InputDialogPeerTypeID )
return i .EncodeBare (b )
}
func (i *InputDialogPeer ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputDialogPeer#fcaafeb7 as nil" )
}
if i .Peer == nil {
return fmt .Errorf ("unable to encode inputDialogPeer#fcaafeb7: field peer is nil" )
}
if err := i .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputDialogPeer#fcaafeb7: field peer: %w" , err )
}
return nil
}
func (i *InputDialogPeer ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputDialogPeer#fcaafeb7 to nil" )
}
if err := b .ConsumeID (InputDialogPeerTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputDialogPeer#fcaafeb7: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputDialogPeer ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputDialogPeer#fcaafeb7 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode inputDialogPeer#fcaafeb7: field peer: %w" , err )
}
i .Peer = value
}
return nil
}
func (i *InputDialogPeer ) GetPeer () (value InputPeerClass ) {
if i == nil {
return
}
return i .Peer
}
type InputDialogPeerFolder struct {
FolderID int
}
const InputDialogPeerFolderTypeID = 0x64600527
func (i InputDialogPeerFolder ) construct () InputDialogPeerClass { return &i }
var (
_ bin .Encoder = &InputDialogPeerFolder {}
_ bin .Decoder = &InputDialogPeerFolder {}
_ bin .BareEncoder = &InputDialogPeerFolder {}
_ bin .BareDecoder = &InputDialogPeerFolder {}
_ InputDialogPeerClass = &InputDialogPeerFolder {}
)
func (i *InputDialogPeerFolder ) Zero () bool {
if i == nil {
return true
}
if !(i .FolderID == 0 ) {
return false
}
return true
}
func (i *InputDialogPeerFolder ) String () string {
if i == nil {
return "InputDialogPeerFolder(nil)"
}
type Alias InputDialogPeerFolder
return fmt .Sprintf ("InputDialogPeerFolder%+v" , Alias (*i ))
}
func (i *InputDialogPeerFolder ) FillFrom (from interface {
GetFolderID () (value int )
}) {
i .FolderID = from .GetFolderID ()
}
func (*InputDialogPeerFolder ) TypeID () uint32 {
return InputDialogPeerFolderTypeID
}
func (*InputDialogPeerFolder ) TypeName () string {
return "inputDialogPeerFolder"
}
func (i *InputDialogPeerFolder ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputDialogPeerFolder" ,
ID : InputDialogPeerFolderTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FolderID" ,
SchemaName : "folder_id" ,
},
}
return typ
}
func (i *InputDialogPeerFolder ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputDialogPeerFolder#64600527 as nil" )
}
b .PutID (InputDialogPeerFolderTypeID )
return i .EncodeBare (b )
}
func (i *InputDialogPeerFolder ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputDialogPeerFolder#64600527 as nil" )
}
b .PutInt (i .FolderID )
return nil
}
func (i *InputDialogPeerFolder ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputDialogPeerFolder#64600527 to nil" )
}
if err := b .ConsumeID (InputDialogPeerFolderTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputDialogPeerFolder#64600527: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputDialogPeerFolder ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputDialogPeerFolder#64600527 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputDialogPeerFolder#64600527: field folder_id: %w" , err )
}
i .FolderID = value
}
return nil
}
func (i *InputDialogPeerFolder ) GetFolderID () (value int ) {
if i == nil {
return
}
return i .FolderID
}
const InputDialogPeerClassName = "InputDialogPeer"
type InputDialogPeerClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputDialogPeerClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputDialogPeer (buf *bin .Buffer ) (InputDialogPeerClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputDialogPeerTypeID :
v := InputDialogPeer {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputDialogPeerClass: %w" , err )
}
return &v , nil
case InputDialogPeerFolderTypeID :
v := InputDialogPeerFolder {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputDialogPeerClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputDialogPeerClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputDialogPeerBox struct {
InputDialogPeer InputDialogPeerClass
}
func (b *InputDialogPeerBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputDialogPeerBox to nil" )
}
v , err := DecodeInputDialogPeer (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputDialogPeer = v
return nil
}
func (b *InputDialogPeerBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputDialogPeer == nil {
return fmt .Errorf ("unable to encode InputDialogPeerClass as nil" )
}
return b .InputDialogPeer .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 .