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 ChannelsSetMainProfileTabRequest struct {
Channel InputChannelClass
Tab ProfileTabClass
}
const ChannelsSetMainProfileTabRequestTypeID = 0x3583fcb1
var (
_ bin .Encoder = &ChannelsSetMainProfileTabRequest {}
_ bin .Decoder = &ChannelsSetMainProfileTabRequest {}
_ bin .BareEncoder = &ChannelsSetMainProfileTabRequest {}
_ bin .BareDecoder = &ChannelsSetMainProfileTabRequest {}
)
func (s *ChannelsSetMainProfileTabRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Channel == nil ) {
return false
}
if !(s .Tab == nil ) {
return false
}
return true
}
func (s *ChannelsSetMainProfileTabRequest ) String () string {
if s == nil {
return "ChannelsSetMainProfileTabRequest(nil)"
}
type Alias ChannelsSetMainProfileTabRequest
return fmt .Sprintf ("ChannelsSetMainProfileTabRequest%+v" , Alias (*s ))
}
func (s *ChannelsSetMainProfileTabRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetTab () (value ProfileTabClass )
}) {
s .Channel = from .GetChannel ()
s .Tab = from .GetTab ()
}
func (*ChannelsSetMainProfileTabRequest ) TypeID () uint32 {
return ChannelsSetMainProfileTabRequestTypeID
}
func (*ChannelsSetMainProfileTabRequest ) TypeName () string {
return "channels.setMainProfileTab"
}
func (s *ChannelsSetMainProfileTabRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.setMainProfileTab" ,
ID : ChannelsSetMainProfileTabRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Tab" ,
SchemaName : "tab" ,
},
}
return typ
}
func (s *ChannelsSetMainProfileTabRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setMainProfileTab#3583fcb1 as nil" )
}
b .PutID (ChannelsSetMainProfileTabRequestTypeID )
return s .EncodeBare (b )
}
func (s *ChannelsSetMainProfileTabRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setMainProfileTab#3583fcb1 as nil" )
}
if s .Channel == nil {
return fmt .Errorf ("unable to encode channels.setMainProfileTab#3583fcb1: field channel is nil" )
}
if err := s .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setMainProfileTab#3583fcb1: field channel: %w" , err )
}
if s .Tab == nil {
return fmt .Errorf ("unable to encode channels.setMainProfileTab#3583fcb1: field tab is nil" )
}
if err := s .Tab .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setMainProfileTab#3583fcb1: field tab: %w" , err )
}
return nil
}
func (s *ChannelsSetMainProfileTabRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setMainProfileTab#3583fcb1 to nil" )
}
if err := b .ConsumeID (ChannelsSetMainProfileTabRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.setMainProfileTab#3583fcb1: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ChannelsSetMainProfileTabRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setMainProfileTab#3583fcb1 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setMainProfileTab#3583fcb1: field channel: %w" , err )
}
s .Channel = value
}
{
value , err := DecodeProfileTab (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setMainProfileTab#3583fcb1: field tab: %w" , err )
}
s .Tab = value
}
return nil
}
func (s *ChannelsSetMainProfileTabRequest ) GetChannel () (value InputChannelClass ) {
if s == nil {
return
}
return s .Channel
}
func (s *ChannelsSetMainProfileTabRequest ) GetTab () (value ProfileTabClass ) {
if s == nil {
return
}
return s .Tab
}
func (s *ChannelsSetMainProfileTabRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return s .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsSetMainProfileTab (ctx context .Context , request *ChannelsSetMainProfileTabRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .