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 ChannelsEditForumTopicRequest struct {
Flags bin .Fields
Channel InputChannelClass
TopicID int
Title string
IconEmojiID int64
Closed bool
Hidden bool
}
const ChannelsEditForumTopicRequestTypeID = 0xf4dfa185
var (
_ bin .Encoder = &ChannelsEditForumTopicRequest {}
_ bin .Decoder = &ChannelsEditForumTopicRequest {}
_ bin .BareEncoder = &ChannelsEditForumTopicRequest {}
_ bin .BareDecoder = &ChannelsEditForumTopicRequest {}
)
func (e *ChannelsEditForumTopicRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Flags .Zero ()) {
return false
}
if !(e .Channel == nil ) {
return false
}
if !(e .TopicID == 0 ) {
return false
}
if !(e .Title == "" ) {
return false
}
if !(e .IconEmojiID == 0 ) {
return false
}
if !(e .Closed == false ) {
return false
}
if !(e .Hidden == false ) {
return false
}
return true
}
func (e *ChannelsEditForumTopicRequest ) String () string {
if e == nil {
return "ChannelsEditForumTopicRequest(nil)"
}
type Alias ChannelsEditForumTopicRequest
return fmt .Sprintf ("ChannelsEditForumTopicRequest%+v" , Alias (*e ))
}
func (e *ChannelsEditForumTopicRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetTopicID () (value int )
GetTitle () (value string , ok bool )
GetIconEmojiID () (value int64 , ok bool )
GetClosed () (value bool , ok bool )
GetHidden () (value bool , ok bool )
}) {
e .Channel = from .GetChannel ()
e .TopicID = from .GetTopicID ()
if val , ok := from .GetTitle (); ok {
e .Title = val
}
if val , ok := from .GetIconEmojiID (); ok {
e .IconEmojiID = val
}
if val , ok := from .GetClosed (); ok {
e .Closed = val
}
if val , ok := from .GetHidden (); ok {
e .Hidden = val
}
}
func (*ChannelsEditForumTopicRequest ) TypeID () uint32 {
return ChannelsEditForumTopicRequestTypeID
}
func (*ChannelsEditForumTopicRequest ) TypeName () string {
return "channels.editForumTopic"
}
func (e *ChannelsEditForumTopicRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.editForumTopic" ,
ID : ChannelsEditForumTopicRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "TopicID" ,
SchemaName : "topic_id" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
Null : !e .Flags .Has (0 ),
},
{
Name : "IconEmojiID" ,
SchemaName : "icon_emoji_id" ,
Null : !e .Flags .Has (1 ),
},
{
Name : "Closed" ,
SchemaName : "closed" ,
Null : !e .Flags .Has (2 ),
},
{
Name : "Hidden" ,
SchemaName : "hidden" ,
Null : !e .Flags .Has (3 ),
},
}
return typ
}
func (e *ChannelsEditForumTopicRequest ) SetFlags () {
if !(e .Title == "" ) {
e .Flags .Set (0 )
}
if !(e .IconEmojiID == 0 ) {
e .Flags .Set (1 )
}
if !(e .Closed == false ) {
e .Flags .Set (2 )
}
if !(e .Hidden == false ) {
e .Flags .Set (3 )
}
}
func (e *ChannelsEditForumTopicRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editForumTopic#f4dfa185 as nil" )
}
b .PutID (ChannelsEditForumTopicRequestTypeID )
return e .EncodeBare (b )
}
func (e *ChannelsEditForumTopicRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editForumTopic#f4dfa185 as nil" )
}
e .SetFlags ()
if err := e .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editForumTopic#f4dfa185: field flags: %w" , err )
}
if e .Channel == nil {
return fmt .Errorf ("unable to encode channels.editForumTopic#f4dfa185: field channel is nil" )
}
if err := e .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editForumTopic#f4dfa185: field channel: %w" , err )
}
b .PutInt (e .TopicID )
if e .Flags .Has (0 ) {
b .PutString (e .Title )
}
if e .Flags .Has (1 ) {
b .PutLong (e .IconEmojiID )
}
if e .Flags .Has (2 ) {
b .PutBool (e .Closed )
}
if e .Flags .Has (3 ) {
b .PutBool (e .Hidden )
}
return nil
}
func (e *ChannelsEditForumTopicRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editForumTopic#f4dfa185 to nil" )
}
if err := b .ConsumeID (ChannelsEditForumTopicRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ChannelsEditForumTopicRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editForumTopic#f4dfa185 to nil" )
}
{
if err := e .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field flags: %w" , err )
}
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field channel: %w" , err )
}
e .Channel = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field topic_id: %w" , err )
}
e .TopicID = value
}
if e .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field title: %w" , err )
}
e .Title = value
}
if e .Flags .Has (1 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field icon_emoji_id: %w" , err )
}
e .IconEmojiID = value
}
if e .Flags .Has (2 ) {
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field closed: %w" , err )
}
e .Closed = value
}
if e .Flags .Has (3 ) {
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editForumTopic#f4dfa185: field hidden: %w" , err )
}
e .Hidden = value
}
return nil
}
func (e *ChannelsEditForumTopicRequest ) GetChannel () (value InputChannelClass ) {
if e == nil {
return
}
return e .Channel
}
func (e *ChannelsEditForumTopicRequest ) GetTopicID () (value int ) {
if e == nil {
return
}
return e .TopicID
}
func (e *ChannelsEditForumTopicRequest ) SetTitle (value string ) {
e .Flags .Set (0 )
e .Title = value
}
func (e *ChannelsEditForumTopicRequest ) GetTitle () (value string , ok bool ) {
if e == nil {
return
}
if !e .Flags .Has (0 ) {
return value , false
}
return e .Title , true
}
func (e *ChannelsEditForumTopicRequest ) SetIconEmojiID (value int64 ) {
e .Flags .Set (1 )
e .IconEmojiID = value
}
func (e *ChannelsEditForumTopicRequest ) GetIconEmojiID () (value int64 , ok bool ) {
if e == nil {
return
}
if !e .Flags .Has (1 ) {
return value , false
}
return e .IconEmojiID , true
}
func (e *ChannelsEditForumTopicRequest ) SetClosed (value bool ) {
e .Flags .Set (2 )
e .Closed = value
}
func (e *ChannelsEditForumTopicRequest ) GetClosed () (value bool , ok bool ) {
if e == nil {
return
}
if !e .Flags .Has (2 ) {
return value , false
}
return e .Closed , true
}
func (e *ChannelsEditForumTopicRequest ) SetHidden (value bool ) {
e .Flags .Set (3 )
e .Hidden = value
}
func (e *ChannelsEditForumTopicRequest ) GetHidden () (value bool , ok bool ) {
if e == nil {
return
}
if !e .Flags .Has (3 ) {
return value , false
}
return e .Hidden , true
}
func (e *ChannelsEditForumTopicRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return e .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsEditForumTopic (ctx context .Context , request *ChannelsEditForumTopicRequest ) (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 .