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 ChannelsDeleteParticipantHistoryRequest struct {
Channel InputChannelClass
Participant InputPeerClass
}
const ChannelsDeleteParticipantHistoryRequestTypeID = 0x367544db
var (
_ bin .Encoder = &ChannelsDeleteParticipantHistoryRequest {}
_ bin .Decoder = &ChannelsDeleteParticipantHistoryRequest {}
_ bin .BareEncoder = &ChannelsDeleteParticipantHistoryRequest {}
_ bin .BareDecoder = &ChannelsDeleteParticipantHistoryRequest {}
)
func (d *ChannelsDeleteParticipantHistoryRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .Channel == nil ) {
return false
}
if !(d .Participant == nil ) {
return false
}
return true
}
func (d *ChannelsDeleteParticipantHistoryRequest ) String () string {
if d == nil {
return "ChannelsDeleteParticipantHistoryRequest(nil)"
}
type Alias ChannelsDeleteParticipantHistoryRequest
return fmt .Sprintf ("ChannelsDeleteParticipantHistoryRequest%+v" , Alias (*d ))
}
func (d *ChannelsDeleteParticipantHistoryRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetParticipant () (value InputPeerClass )
}) {
d .Channel = from .GetChannel ()
d .Participant = from .GetParticipant ()
}
func (*ChannelsDeleteParticipantHistoryRequest ) TypeID () uint32 {
return ChannelsDeleteParticipantHistoryRequestTypeID
}
func (*ChannelsDeleteParticipantHistoryRequest ) TypeName () string {
return "channels.deleteParticipantHistory"
}
func (d *ChannelsDeleteParticipantHistoryRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.deleteParticipantHistory" ,
ID : ChannelsDeleteParticipantHistoryRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Participant" ,
SchemaName : "participant" ,
},
}
return typ
}
func (d *ChannelsDeleteParticipantHistoryRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode channels.deleteParticipantHistory#367544db as nil" )
}
b .PutID (ChannelsDeleteParticipantHistoryRequestTypeID )
return d .EncodeBare (b )
}
func (d *ChannelsDeleteParticipantHistoryRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode channels.deleteParticipantHistory#367544db as nil" )
}
if d .Channel == nil {
return fmt .Errorf ("unable to encode channels.deleteParticipantHistory#367544db: field channel is nil" )
}
if err := d .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.deleteParticipantHistory#367544db: field channel: %w" , err )
}
if d .Participant == nil {
return fmt .Errorf ("unable to encode channels.deleteParticipantHistory#367544db: field participant is nil" )
}
if err := d .Participant .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.deleteParticipantHistory#367544db: field participant: %w" , err )
}
return nil
}
func (d *ChannelsDeleteParticipantHistoryRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode channels.deleteParticipantHistory#367544db to nil" )
}
if err := b .ConsumeID (ChannelsDeleteParticipantHistoryRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.deleteParticipantHistory#367544db: %w" , err )
}
return d .DecodeBare (b )
}
func (d *ChannelsDeleteParticipantHistoryRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode channels.deleteParticipantHistory#367544db to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.deleteParticipantHistory#367544db: field channel: %w" , err )
}
d .Channel = value
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.deleteParticipantHistory#367544db: field participant: %w" , err )
}
d .Participant = value
}
return nil
}
func (d *ChannelsDeleteParticipantHistoryRequest ) GetChannel () (value InputChannelClass ) {
if d == nil {
return
}
return d .Channel
}
func (d *ChannelsDeleteParticipantHistoryRequest ) GetParticipant () (value InputPeerClass ) {
if d == nil {
return
}
return d .Participant
}
func (d *ChannelsDeleteParticipantHistoryRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return d .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsDeleteParticipantHistory (ctx context .Context , request *ChannelsDeleteParticipantHistoryRequest ) (*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 .