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 MessagesEditChatDefaultBannedRightsRequest struct {
Peer InputPeerClass
BannedRights ChatBannedRights
}
const MessagesEditChatDefaultBannedRightsRequestTypeID = 0xa5866b41
var (
_ bin .Encoder = &MessagesEditChatDefaultBannedRightsRequest {}
_ bin .Decoder = &MessagesEditChatDefaultBannedRightsRequest {}
_ bin .BareEncoder = &MessagesEditChatDefaultBannedRightsRequest {}
_ bin .BareDecoder = &MessagesEditChatDefaultBannedRightsRequest {}
)
func (e *MessagesEditChatDefaultBannedRightsRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Peer == nil ) {
return false
}
if !(e .BannedRights .Zero ()) {
return false
}
return true
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) String () string {
if e == nil {
return "MessagesEditChatDefaultBannedRightsRequest(nil)"
}
type Alias MessagesEditChatDefaultBannedRightsRequest
return fmt .Sprintf ("MessagesEditChatDefaultBannedRightsRequest%+v" , Alias (*e ))
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetBannedRights () (value ChatBannedRights )
}) {
e .Peer = from .GetPeer ()
e .BannedRights = from .GetBannedRights ()
}
func (*MessagesEditChatDefaultBannedRightsRequest ) TypeID () uint32 {
return MessagesEditChatDefaultBannedRightsRequestTypeID
}
func (*MessagesEditChatDefaultBannedRightsRequest ) TypeName () string {
return "messages.editChatDefaultBannedRights"
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.editChatDefaultBannedRights" ,
ID : MessagesEditChatDefaultBannedRightsRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "BannedRights" ,
SchemaName : "banned_rights" ,
},
}
return typ
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatDefaultBannedRights#a5866b41 as nil" )
}
b .PutID (MessagesEditChatDefaultBannedRightsRequestTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatDefaultBannedRights#a5866b41 as nil" )
}
if e .Peer == nil {
return fmt .Errorf ("unable to encode messages.editChatDefaultBannedRights#a5866b41: field peer is nil" )
}
if err := e .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.editChatDefaultBannedRights#a5866b41: field peer: %w" , err )
}
if err := e .BannedRights .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.editChatDefaultBannedRights#a5866b41: field banned_rights: %w" , err )
}
return nil
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatDefaultBannedRights#a5866b41 to nil" )
}
if err := b .ConsumeID (MessagesEditChatDefaultBannedRightsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.editChatDefaultBannedRights#a5866b41: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatDefaultBannedRights#a5866b41 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatDefaultBannedRights#a5866b41: field peer: %w" , err )
}
e .Peer = value
}
{
if err := e .BannedRights .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.editChatDefaultBannedRights#a5866b41: field banned_rights: %w" , err )
}
}
return nil
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) GetPeer () (value InputPeerClass ) {
if e == nil {
return
}
return e .Peer
}
func (e *MessagesEditChatDefaultBannedRightsRequest ) GetBannedRights () (value ChatBannedRights ) {
if e == nil {
return
}
return e .BannedRights
}
func (c *Client ) MessagesEditChatDefaultBannedRights (ctx context .Context , request *MessagesEditChatDefaultBannedRightsRequest ) (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 .