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 ChannelsReorderPinnedForumTopicsRequest struct {
Flags bin .Fields
Force bool
Channel InputChannelClass
Order []int
}
const ChannelsReorderPinnedForumTopicsRequestTypeID = 0x2950a18f
var (
_ bin .Encoder = &ChannelsReorderPinnedForumTopicsRequest {}
_ bin .Decoder = &ChannelsReorderPinnedForumTopicsRequest {}
_ bin .BareEncoder = &ChannelsReorderPinnedForumTopicsRequest {}
_ bin .BareDecoder = &ChannelsReorderPinnedForumTopicsRequest {}
)
func (r *ChannelsReorderPinnedForumTopicsRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Flags .Zero ()) {
return false
}
if !(r .Force == false ) {
return false
}
if !(r .Channel == nil ) {
return false
}
if !(r .Order == nil ) {
return false
}
return true
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) String () string {
if r == nil {
return "ChannelsReorderPinnedForumTopicsRequest(nil)"
}
type Alias ChannelsReorderPinnedForumTopicsRequest
return fmt .Sprintf ("ChannelsReorderPinnedForumTopicsRequest%+v" , Alias (*r ))
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) FillFrom (from interface {
GetForce () (value bool )
GetChannel () (value InputChannelClass )
GetOrder () (value []int )
}) {
r .Force = from .GetForce ()
r .Channel = from .GetChannel ()
r .Order = from .GetOrder ()
}
func (*ChannelsReorderPinnedForumTopicsRequest ) TypeID () uint32 {
return ChannelsReorderPinnedForumTopicsRequestTypeID
}
func (*ChannelsReorderPinnedForumTopicsRequest ) TypeName () string {
return "channels.reorderPinnedForumTopics"
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.reorderPinnedForumTopics" ,
ID : ChannelsReorderPinnedForumTopicsRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Force" ,
SchemaName : "force" ,
Null : !r .Flags .Has (0 ),
},
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Order" ,
SchemaName : "order" ,
},
}
return typ
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) SetFlags () {
if !(r .Force == false ) {
r .Flags .Set (0 )
}
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode channels.reorderPinnedForumTopics#2950a18f as nil" )
}
b .PutID (ChannelsReorderPinnedForumTopicsRequestTypeID )
return r .EncodeBare (b )
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode channels.reorderPinnedForumTopics#2950a18f as nil" )
}
r .SetFlags ()
if err := r .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.reorderPinnedForumTopics#2950a18f: field flags: %w" , err )
}
if r .Channel == nil {
return fmt .Errorf ("unable to encode channels.reorderPinnedForumTopics#2950a18f: field channel is nil" )
}
if err := r .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.reorderPinnedForumTopics#2950a18f: field channel: %w" , err )
}
b .PutVectorHeader (len (r .Order ))
for _ , v := range r .Order {
b .PutInt (v )
}
return nil
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode channels.reorderPinnedForumTopics#2950a18f to nil" )
}
if err := b .ConsumeID (ChannelsReorderPinnedForumTopicsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.reorderPinnedForumTopics#2950a18f: %w" , err )
}
return r .DecodeBare (b )
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode channels.reorderPinnedForumTopics#2950a18f to nil" )
}
{
if err := r .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.reorderPinnedForumTopics#2950a18f: field flags: %w" , err )
}
}
r .Force = r .Flags .Has (0 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.reorderPinnedForumTopics#2950a18f: field channel: %w" , err )
}
r .Channel = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode channels.reorderPinnedForumTopics#2950a18f: field order: %w" , err )
}
if headerLen > 0 {
r .Order = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.reorderPinnedForumTopics#2950a18f: field order: %w" , err )
}
r .Order = append (r .Order , value )
}
}
return nil
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) SetForce (value bool ) {
if value {
r .Flags .Set (0 )
r .Force = true
} else {
r .Flags .Unset (0 )
r .Force = false
}
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) GetForce () (value bool ) {
if r == nil {
return
}
return r .Flags .Has (0 )
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) GetChannel () (value InputChannelClass ) {
if r == nil {
return
}
return r .Channel
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) GetOrder () (value []int ) {
if r == nil {
return
}
return r .Order
}
func (r *ChannelsReorderPinnedForumTopicsRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return r .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsReorderPinnedForumTopics (ctx context .Context , request *ChannelsReorderPinnedForumTopicsRequest ) (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 .