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