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