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 MessagesDeleteChatUserRequest struct {
Flags bin .Fields
RevokeHistory bool
ChatID int64
UserID InputUserClass
}
const MessagesDeleteChatUserRequestTypeID = 0xa2185cab
var (
_ bin .Encoder = &MessagesDeleteChatUserRequest {}
_ bin .Decoder = &MessagesDeleteChatUserRequest {}
_ bin .BareEncoder = &MessagesDeleteChatUserRequest {}
_ bin .BareDecoder = &MessagesDeleteChatUserRequest {}
)
func (d *MessagesDeleteChatUserRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .Flags .Zero ()) {
return false
}
if !(d .RevokeHistory == false ) {
return false
}
if !(d .ChatID == 0 ) {
return false
}
if !(d .UserID == nil ) {
return false
}
return true
}
func (d *MessagesDeleteChatUserRequest ) String () string {
if d == nil {
return "MessagesDeleteChatUserRequest(nil)"
}
type Alias MessagesDeleteChatUserRequest
return fmt .Sprintf ("MessagesDeleteChatUserRequest%+v" , Alias (*d ))
}
func (d *MessagesDeleteChatUserRequest ) FillFrom (from interface {
GetRevokeHistory () (value bool )
GetChatID () (value int64 )
GetUserID () (value InputUserClass )
}) {
d .RevokeHistory = from .GetRevokeHistory ()
d .ChatID = from .GetChatID ()
d .UserID = from .GetUserID ()
}
func (*MessagesDeleteChatUserRequest ) TypeID () uint32 {
return MessagesDeleteChatUserRequestTypeID
}
func (*MessagesDeleteChatUserRequest ) TypeName () string {
return "messages.deleteChatUser"
}
func (d *MessagesDeleteChatUserRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.deleteChatUser" ,
ID : MessagesDeleteChatUserRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "RevokeHistory" ,
SchemaName : "revoke_history" ,
Null : !d .Flags .Has (0 ),
},
{
Name : "ChatID" ,
SchemaName : "chat_id" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (d *MessagesDeleteChatUserRequest ) SetFlags () {
if !(d .RevokeHistory == false ) {
d .Flags .Set (0 )
}
}
func (d *MessagesDeleteChatUserRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode messages.deleteChatUser#a2185cab as nil" )
}
b .PutID (MessagesDeleteChatUserRequestTypeID )
return d .EncodeBare (b )
}
func (d *MessagesDeleteChatUserRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode messages.deleteChatUser#a2185cab as nil" )
}
d .SetFlags ()
if err := d .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.deleteChatUser#a2185cab: field flags: %w" , err )
}
b .PutLong (d .ChatID )
if d .UserID == nil {
return fmt .Errorf ("unable to encode messages.deleteChatUser#a2185cab: field user_id is nil" )
}
if err := d .UserID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.deleteChatUser#a2185cab: field user_id: %w" , err )
}
return nil
}
func (d *MessagesDeleteChatUserRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode messages.deleteChatUser#a2185cab to nil" )
}
if err := b .ConsumeID (MessagesDeleteChatUserRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.deleteChatUser#a2185cab: %w" , err )
}
return d .DecodeBare (b )
}
func (d *MessagesDeleteChatUserRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode messages.deleteChatUser#a2185cab to nil" )
}
{
if err := d .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.deleteChatUser#a2185cab: field flags: %w" , err )
}
}
d .RevokeHistory = d .Flags .Has (0 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.deleteChatUser#a2185cab: field chat_id: %w" , err )
}
d .ChatID = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.deleteChatUser#a2185cab: field user_id: %w" , err )
}
d .UserID = value
}
return nil
}
func (d *MessagesDeleteChatUserRequest ) SetRevokeHistory (value bool ) {
if value {
d .Flags .Set (0 )
d .RevokeHistory = true
} else {
d .Flags .Unset (0 )
d .RevokeHistory = false
}
}
func (d *MessagesDeleteChatUserRequest ) GetRevokeHistory () (value bool ) {
if d == nil {
return
}
return d .Flags .Has (0 )
}
func (d *MessagesDeleteChatUserRequest ) GetChatID () (value int64 ) {
if d == nil {
return
}
return d .ChatID
}
func (d *MessagesDeleteChatUserRequest ) GetUserID () (value InputUserClass ) {
if d == nil {
return
}
return d .UserID
}
func (c *Client ) MessagesDeleteChatUser (ctx context .Context , request *MessagesDeleteChatUserRequest ) (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 .