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 ChatlistsLeaveChatlistRequest struct {
Chatlist InputChatlistDialogFilter
Peers []InputPeerClass
}
const ChatlistsLeaveChatlistRequestTypeID = 0x74fae13a
var (
_ bin .Encoder = &ChatlistsLeaveChatlistRequest {}
_ bin .Decoder = &ChatlistsLeaveChatlistRequest {}
_ bin .BareEncoder = &ChatlistsLeaveChatlistRequest {}
_ bin .BareDecoder = &ChatlistsLeaveChatlistRequest {}
)
func (l *ChatlistsLeaveChatlistRequest ) Zero () bool {
if l == nil {
return true
}
if !(l .Chatlist .Zero ()) {
return false
}
if !(l .Peers == nil ) {
return false
}
return true
}
func (l *ChatlistsLeaveChatlistRequest ) String () string {
if l == nil {
return "ChatlistsLeaveChatlistRequest(nil)"
}
type Alias ChatlistsLeaveChatlistRequest
return fmt .Sprintf ("ChatlistsLeaveChatlistRequest%+v" , Alias (*l ))
}
func (l *ChatlistsLeaveChatlistRequest ) FillFrom (from interface {
GetChatlist () (value InputChatlistDialogFilter )
GetPeers () (value []InputPeerClass )
}) {
l .Chatlist = from .GetChatlist ()
l .Peers = from .GetPeers ()
}
func (*ChatlistsLeaveChatlistRequest ) TypeID () uint32 {
return ChatlistsLeaveChatlistRequestTypeID
}
func (*ChatlistsLeaveChatlistRequest ) TypeName () string {
return "chatlists.leaveChatlist"
}
func (l *ChatlistsLeaveChatlistRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "chatlists.leaveChatlist" ,
ID : ChatlistsLeaveChatlistRequestTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Chatlist" ,
SchemaName : "chatlist" ,
},
{
Name : "Peers" ,
SchemaName : "peers" ,
},
}
return typ
}
func (l *ChatlistsLeaveChatlistRequest ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode chatlists.leaveChatlist#74fae13a as nil" )
}
b .PutID (ChatlistsLeaveChatlistRequestTypeID )
return l .EncodeBare (b )
}
func (l *ChatlistsLeaveChatlistRequest ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode chatlists.leaveChatlist#74fae13a as nil" )
}
if err := l .Chatlist .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode chatlists.leaveChatlist#74fae13a: field chatlist: %w" , err )
}
b .PutVectorHeader (len (l .Peers ))
for idx , v := range l .Peers {
if v == nil {
return fmt .Errorf ("unable to encode chatlists.leaveChatlist#74fae13a: field peers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode chatlists.leaveChatlist#74fae13a: field peers element with index %d: %w" , idx , err )
}
}
return nil
}
func (l *ChatlistsLeaveChatlistRequest ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode chatlists.leaveChatlist#74fae13a to nil" )
}
if err := b .ConsumeID (ChatlistsLeaveChatlistRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode chatlists.leaveChatlist#74fae13a: %w" , err )
}
return l .DecodeBare (b )
}
func (l *ChatlistsLeaveChatlistRequest ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode chatlists.leaveChatlist#74fae13a to nil" )
}
{
if err := l .Chatlist .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode chatlists.leaveChatlist#74fae13a: field chatlist: %w" , err )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode chatlists.leaveChatlist#74fae13a: field peers: %w" , err )
}
if headerLen > 0 {
l .Peers = make ([]InputPeerClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode chatlists.leaveChatlist#74fae13a: field peers: %w" , err )
}
l .Peers = append (l .Peers , value )
}
}
return nil
}
func (l *ChatlistsLeaveChatlistRequest ) GetChatlist () (value InputChatlistDialogFilter ) {
if l == nil {
return
}
return l .Chatlist
}
func (l *ChatlistsLeaveChatlistRequest ) GetPeers () (value []InputPeerClass ) {
if l == nil {
return
}
return l .Peers
}
func (l *ChatlistsLeaveChatlistRequest ) MapPeers () (value InputPeerClassArray ) {
return InputPeerClassArray (l .Peers )
}
func (c *Client ) ChatlistsLeaveChatlist (ctx context .Context , request *ChatlistsLeaveChatlistRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , nil
}
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 .