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 FolderPeer struct {
Peer PeerClass
FolderID int
}
const FolderPeerTypeID = 0xe9baa668
var (
_ bin .Encoder = &FolderPeer {}
_ bin .Decoder = &FolderPeer {}
_ bin .BareEncoder = &FolderPeer {}
_ bin .BareDecoder = &FolderPeer {}
)
func (f *FolderPeer ) Zero () bool {
if f == nil {
return true
}
if !(f .Peer == nil ) {
return false
}
if !(f .FolderID == 0 ) {
return false
}
return true
}
func (f *FolderPeer ) String () string {
if f == nil {
return "FolderPeer(nil)"
}
type Alias FolderPeer
return fmt .Sprintf ("FolderPeer%+v" , Alias (*f ))
}
func (f *FolderPeer ) FillFrom (from interface {
GetPeer () (value PeerClass )
GetFolderID () (value int )
}) {
f .Peer = from .GetPeer ()
f .FolderID = from .GetFolderID ()
}
func (*FolderPeer ) TypeID () uint32 {
return FolderPeerTypeID
}
func (*FolderPeer ) TypeName () string {
return "folderPeer"
}
func (f *FolderPeer ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "folderPeer" ,
ID : FolderPeerTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "FolderID" ,
SchemaName : "folder_id" ,
},
}
return typ
}
func (f *FolderPeer ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode folderPeer#e9baa668 as nil" )
}
b .PutID (FolderPeerTypeID )
return f .EncodeBare (b )
}
func (f *FolderPeer ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode folderPeer#e9baa668 as nil" )
}
if f .Peer == nil {
return fmt .Errorf ("unable to encode folderPeer#e9baa668: field peer is nil" )
}
if err := f .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode folderPeer#e9baa668: field peer: %w" , err )
}
b .PutInt (f .FolderID )
return nil
}
func (f *FolderPeer ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode folderPeer#e9baa668 to nil" )
}
if err := b .ConsumeID (FolderPeerTypeID ); err != nil {
return fmt .Errorf ("unable to decode folderPeer#e9baa668: %w" , err )
}
return f .DecodeBare (b )
}
func (f *FolderPeer ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode folderPeer#e9baa668 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode folderPeer#e9baa668: field peer: %w" , err )
}
f .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode folderPeer#e9baa668: field folder_id: %w" , err )
}
f .FolderID = value
}
return nil
}
func (f *FolderPeer ) GetPeer () (value PeerClass ) {
if f == nil {
return
}
return f .Peer
}
func (f *FolderPeer ) GetFolderID () (value int ) {
if f == nil {
return
}
return f .FolderID
}
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 .