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