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 MessagesHideChatJoinRequestRequest struct {
Flags bin .Fields
Approved bool
Peer InputPeerClass
UserID InputUserClass
}
const MessagesHideChatJoinRequestRequestTypeID = 0x7fe7e815
var (
_ bin .Encoder = &MessagesHideChatJoinRequestRequest {}
_ bin .Decoder = &MessagesHideChatJoinRequestRequest {}
_ bin .BareEncoder = &MessagesHideChatJoinRequestRequest {}
_ bin .BareDecoder = &MessagesHideChatJoinRequestRequest {}
)
func (h *MessagesHideChatJoinRequestRequest ) Zero () bool {
if h == nil {
return true
}
if !(h .Flags .Zero ()) {
return false
}
if !(h .Approved == false ) {
return false
}
if !(h .Peer == nil ) {
return false
}
if !(h .UserID == nil ) {
return false
}
return true
}
func (h *MessagesHideChatJoinRequestRequest ) String () string {
if h == nil {
return "MessagesHideChatJoinRequestRequest(nil)"
}
type Alias MessagesHideChatJoinRequestRequest
return fmt .Sprintf ("MessagesHideChatJoinRequestRequest%+v" , Alias (*h ))
}
func (h *MessagesHideChatJoinRequestRequest ) FillFrom (from interface {
GetApproved () (value bool )
GetPeer () (value InputPeerClass )
GetUserID () (value InputUserClass )
}) {
h .Approved = from .GetApproved ()
h .Peer = from .GetPeer ()
h .UserID = from .GetUserID ()
}
func (*MessagesHideChatJoinRequestRequest ) TypeID () uint32 {
return MessagesHideChatJoinRequestRequestTypeID
}
func (*MessagesHideChatJoinRequestRequest ) TypeName () string {
return "messages.hideChatJoinRequest"
}
func (h *MessagesHideChatJoinRequestRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.hideChatJoinRequest" ,
ID : MessagesHideChatJoinRequestRequestTypeID ,
}
if h == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Approved" ,
SchemaName : "approved" ,
Null : !h .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (h *MessagesHideChatJoinRequestRequest ) SetFlags () {
if !(h .Approved == false ) {
h .Flags .Set (0 )
}
}
func (h *MessagesHideChatJoinRequestRequest ) Encode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode messages.hideChatJoinRequest#7fe7e815 as nil" )
}
b .PutID (MessagesHideChatJoinRequestRequestTypeID )
return h .EncodeBare (b )
}
func (h *MessagesHideChatJoinRequestRequest ) EncodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode messages.hideChatJoinRequest#7fe7e815 as nil" )
}
h .SetFlags ()
if err := h .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.hideChatJoinRequest#7fe7e815: field flags: %w" , err )
}
if h .Peer == nil {
return fmt .Errorf ("unable to encode messages.hideChatJoinRequest#7fe7e815: field peer is nil" )
}
if err := h .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.hideChatJoinRequest#7fe7e815: field peer: %w" , err )
}
if h .UserID == nil {
return fmt .Errorf ("unable to encode messages.hideChatJoinRequest#7fe7e815: field user_id is nil" )
}
if err := h .UserID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.hideChatJoinRequest#7fe7e815: field user_id: %w" , err )
}
return nil
}
func (h *MessagesHideChatJoinRequestRequest ) Decode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode messages.hideChatJoinRequest#7fe7e815 to nil" )
}
if err := b .ConsumeID (MessagesHideChatJoinRequestRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.hideChatJoinRequest#7fe7e815: %w" , err )
}
return h .DecodeBare (b )
}
func (h *MessagesHideChatJoinRequestRequest ) DecodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode messages.hideChatJoinRequest#7fe7e815 to nil" )
}
{
if err := h .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.hideChatJoinRequest#7fe7e815: field flags: %w" , err )
}
}
h .Approved = h .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.hideChatJoinRequest#7fe7e815: field peer: %w" , err )
}
h .Peer = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.hideChatJoinRequest#7fe7e815: field user_id: %w" , err )
}
h .UserID = value
}
return nil
}
func (h *MessagesHideChatJoinRequestRequest ) SetApproved (value bool ) {
if value {
h .Flags .Set (0 )
h .Approved = true
} else {
h .Flags .Unset (0 )
h .Approved = false
}
}
func (h *MessagesHideChatJoinRequestRequest ) GetApproved () (value bool ) {
if h == nil {
return
}
return h .Flags .Has (0 )
}
func (h *MessagesHideChatJoinRequestRequest ) GetPeer () (value InputPeerClass ) {
if h == nil {
return
}
return h .Peer
}
func (h *MessagesHideChatJoinRequestRequest ) GetUserID () (value InputUserClass ) {
if h == nil {
return
}
return h .UserID
}
func (c *Client ) MessagesHideChatJoinRequest (ctx context .Context , request *MessagesHideChatJoinRequestRequest ) (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 .