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 ChannelsDeleteTopicHistoryRequest struct {
Channel InputChannelClass
TopMsgID int
}
const ChannelsDeleteTopicHistoryRequestTypeID = 0x34435f2d
var (
_ bin .Encoder = &ChannelsDeleteTopicHistoryRequest {}
_ bin .Decoder = &ChannelsDeleteTopicHistoryRequest {}
_ bin .BareEncoder = &ChannelsDeleteTopicHistoryRequest {}
_ bin .BareDecoder = &ChannelsDeleteTopicHistoryRequest {}
)
func (d *ChannelsDeleteTopicHistoryRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .Channel == nil ) {
return false
}
if !(d .TopMsgID == 0 ) {
return false
}
return true
}
func (d *ChannelsDeleteTopicHistoryRequest ) String () string {
if d == nil {
return "ChannelsDeleteTopicHistoryRequest(nil)"
}
type Alias ChannelsDeleteTopicHistoryRequest
return fmt .Sprintf ("ChannelsDeleteTopicHistoryRequest%+v" , Alias (*d ))
}
func (d *ChannelsDeleteTopicHistoryRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetTopMsgID () (value int )
}) {
d .Channel = from .GetChannel ()
d .TopMsgID = from .GetTopMsgID ()
}
func (*ChannelsDeleteTopicHistoryRequest ) TypeID () uint32 {
return ChannelsDeleteTopicHistoryRequestTypeID
}
func (*ChannelsDeleteTopicHistoryRequest ) TypeName () string {
return "channels.deleteTopicHistory"
}
func (d *ChannelsDeleteTopicHistoryRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.deleteTopicHistory" ,
ID : ChannelsDeleteTopicHistoryRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "TopMsgID" ,
SchemaName : "top_msg_id" ,
},
}
return typ
}
func (d *ChannelsDeleteTopicHistoryRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode channels.deleteTopicHistory#34435f2d as nil" )
}
b .PutID (ChannelsDeleteTopicHistoryRequestTypeID )
return d .EncodeBare (b )
}
func (d *ChannelsDeleteTopicHistoryRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode channels.deleteTopicHistory#34435f2d as nil" )
}
if d .Channel == nil {
return fmt .Errorf ("unable to encode channels.deleteTopicHistory#34435f2d: field channel is nil" )
}
if err := d .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.deleteTopicHistory#34435f2d: field channel: %w" , err )
}
b .PutInt (d .TopMsgID )
return nil
}
func (d *ChannelsDeleteTopicHistoryRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode channels.deleteTopicHistory#34435f2d to nil" )
}
if err := b .ConsumeID (ChannelsDeleteTopicHistoryRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.deleteTopicHistory#34435f2d: %w" , err )
}
return d .DecodeBare (b )
}
func (d *ChannelsDeleteTopicHistoryRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode channels.deleteTopicHistory#34435f2d to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.deleteTopicHistory#34435f2d: field channel: %w" , err )
}
d .Channel = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.deleteTopicHistory#34435f2d: field top_msg_id: %w" , err )
}
d .TopMsgID = value
}
return nil
}
func (d *ChannelsDeleteTopicHistoryRequest ) GetChannel () (value InputChannelClass ) {
if d == nil {
return
}
return d .Channel
}
func (d *ChannelsDeleteTopicHistoryRequest ) GetTopMsgID () (value int ) {
if d == nil {
return
}
return d .TopMsgID
}
func (d *ChannelsDeleteTopicHistoryRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return d .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsDeleteTopicHistory (ctx context .Context , request *ChannelsDeleteTopicHistoryRequest ) (*MessagesAffectedHistory , error ) {
var result MessagesAffectedHistory
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .