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