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