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 ChannelsToggleForumRequest struct {
Channel InputChannelClass
Enabled bool
}
const ChannelsToggleForumRequestTypeID = 0xa4298b29
var (
_ bin .Encoder = &ChannelsToggleForumRequest {}
_ bin .Decoder = &ChannelsToggleForumRequest {}
_ bin .BareEncoder = &ChannelsToggleForumRequest {}
_ bin .BareDecoder = &ChannelsToggleForumRequest {}
)
func (t *ChannelsToggleForumRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Channel == nil ) {
return false
}
if !(t .Enabled == false ) {
return false
}
return true
}
func (t *ChannelsToggleForumRequest ) String () string {
if t == nil {
return "ChannelsToggleForumRequest(nil)"
}
type Alias ChannelsToggleForumRequest
return fmt .Sprintf ("ChannelsToggleForumRequest%+v" , Alias (*t ))
}
func (t *ChannelsToggleForumRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetEnabled () (value bool )
}) {
t .Channel = from .GetChannel ()
t .Enabled = from .GetEnabled ()
}
func (*ChannelsToggleForumRequest ) TypeID () uint32 {
return ChannelsToggleForumRequestTypeID
}
func (*ChannelsToggleForumRequest ) TypeName () string {
return "channels.toggleForum"
}
func (t *ChannelsToggleForumRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.toggleForum" ,
ID : ChannelsToggleForumRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Enabled" ,
SchemaName : "enabled" ,
},
}
return typ
}
func (t *ChannelsToggleForumRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode channels.toggleForum#a4298b29 as nil" )
}
b .PutID (ChannelsToggleForumRequestTypeID )
return t .EncodeBare (b )
}
func (t *ChannelsToggleForumRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode channels.toggleForum#a4298b29 as nil" )
}
if t .Channel == nil {
return fmt .Errorf ("unable to encode channels.toggleForum#a4298b29: field channel is nil" )
}
if err := t .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.toggleForum#a4298b29: field channel: %w" , err )
}
b .PutBool (t .Enabled )
return nil
}
func (t *ChannelsToggleForumRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode channels.toggleForum#a4298b29 to nil" )
}
if err := b .ConsumeID (ChannelsToggleForumRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.toggleForum#a4298b29: %w" , err )
}
return t .DecodeBare (b )
}
func (t *ChannelsToggleForumRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode channels.toggleForum#a4298b29 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.toggleForum#a4298b29: field channel: %w" , err )
}
t .Channel = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode channels.toggleForum#a4298b29: field enabled: %w" , err )
}
t .Enabled = value
}
return nil
}
func (t *ChannelsToggleForumRequest ) GetChannel () (value InputChannelClass ) {
if t == nil {
return
}
return t .Channel
}
func (t *ChannelsToggleForumRequest ) GetEnabled () (value bool ) {
if t == nil {
return
}
return t .Enabled
}
func (t *ChannelsToggleForumRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return t .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsToggleForum (ctx context .Context , request *ChannelsToggleForumRequest ) (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 .