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 MessagesMigrateChatRequest struct {
ChatID int64
}
const MessagesMigrateChatRequestTypeID = 0xa2875319
var (
_ bin .Encoder = &MessagesMigrateChatRequest {}
_ bin .Decoder = &MessagesMigrateChatRequest {}
_ bin .BareEncoder = &MessagesMigrateChatRequest {}
_ bin .BareDecoder = &MessagesMigrateChatRequest {}
)
func (m *MessagesMigrateChatRequest ) Zero () bool {
if m == nil {
return true
}
if !(m .ChatID == 0 ) {
return false
}
return true
}
func (m *MessagesMigrateChatRequest ) String () string {
if m == nil {
return "MessagesMigrateChatRequest(nil)"
}
type Alias MessagesMigrateChatRequest
return fmt .Sprintf ("MessagesMigrateChatRequest%+v" , Alias (*m ))
}
func (m *MessagesMigrateChatRequest ) FillFrom (from interface {
GetChatID () (value int64 )
}) {
m .ChatID = from .GetChatID ()
}
func (*MessagesMigrateChatRequest ) TypeID () uint32 {
return MessagesMigrateChatRequestTypeID
}
func (*MessagesMigrateChatRequest ) TypeName () string {
return "messages.migrateChat"
}
func (m *MessagesMigrateChatRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.migrateChat" ,
ID : MessagesMigrateChatRequestTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ChatID" ,
SchemaName : "chat_id" ,
},
}
return typ
}
func (m *MessagesMigrateChatRequest ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messages.migrateChat#a2875319 as nil" )
}
b .PutID (MessagesMigrateChatRequestTypeID )
return m .EncodeBare (b )
}
func (m *MessagesMigrateChatRequest ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messages.migrateChat#a2875319 as nil" )
}
b .PutLong (m .ChatID )
return nil
}
func (m *MessagesMigrateChatRequest ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messages.migrateChat#a2875319 to nil" )
}
if err := b .ConsumeID (MessagesMigrateChatRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.migrateChat#a2875319: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessagesMigrateChatRequest ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messages.migrateChat#a2875319 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.migrateChat#a2875319: field chat_id: %w" , err )
}
m .ChatID = value
}
return nil
}
func (m *MessagesMigrateChatRequest ) GetChatID () (value int64 ) {
if m == nil {
return
}
return m .ChatID
}
func (c *Client ) MessagesMigrateChat (ctx context .Context , chatid int64 ) (UpdatesClass , error ) {
var result UpdatesBox
request := &MessagesMigrateChatRequest {
ChatID : chatid ,
}
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 .