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 MessagesHideAllChatJoinRequestsRequest struct {
Flags bin .Fields
Approved bool
Peer InputPeerClass
Link string
}
const MessagesHideAllChatJoinRequestsRequestTypeID = 0xe085f4ea
var (
_ bin .Encoder = &MessagesHideAllChatJoinRequestsRequest {}
_ bin .Decoder = &MessagesHideAllChatJoinRequestsRequest {}
_ bin .BareEncoder = &MessagesHideAllChatJoinRequestsRequest {}
_ bin .BareDecoder = &MessagesHideAllChatJoinRequestsRequest {}
)
func (h *MessagesHideAllChatJoinRequestsRequest ) 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 .Link == "" ) {
return false
}
return true
}
func (h *MessagesHideAllChatJoinRequestsRequest ) String () string {
if h == nil {
return "MessagesHideAllChatJoinRequestsRequest(nil)"
}
type Alias MessagesHideAllChatJoinRequestsRequest
return fmt .Sprintf ("MessagesHideAllChatJoinRequestsRequest%+v" , Alias (*h ))
}
func (h *MessagesHideAllChatJoinRequestsRequest ) FillFrom (from interface {
GetApproved () (value bool )
GetPeer () (value InputPeerClass )
GetLink () (value string , ok bool )
}) {
h .Approved = from .GetApproved ()
h .Peer = from .GetPeer ()
if val , ok := from .GetLink (); ok {
h .Link = val
}
}
func (*MessagesHideAllChatJoinRequestsRequest ) TypeID () uint32 {
return MessagesHideAllChatJoinRequestsRequestTypeID
}
func (*MessagesHideAllChatJoinRequestsRequest ) TypeName () string {
return "messages.hideAllChatJoinRequests"
}
func (h *MessagesHideAllChatJoinRequestsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.hideAllChatJoinRequests" ,
ID : MessagesHideAllChatJoinRequestsRequestTypeID ,
}
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 : "Link" ,
SchemaName : "link" ,
Null : !h .Flags .Has (1 ),
},
}
return typ
}
func (h *MessagesHideAllChatJoinRequestsRequest ) SetFlags () {
if !(h .Approved == false ) {
h .Flags .Set (0 )
}
if !(h .Link == "" ) {
h .Flags .Set (1 )
}
}
func (h *MessagesHideAllChatJoinRequestsRequest ) Encode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode messages.hideAllChatJoinRequests#e085f4ea as nil" )
}
b .PutID (MessagesHideAllChatJoinRequestsRequestTypeID )
return h .EncodeBare (b )
}
func (h *MessagesHideAllChatJoinRequestsRequest ) EncodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode messages.hideAllChatJoinRequests#e085f4ea as nil" )
}
h .SetFlags ()
if err := h .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.hideAllChatJoinRequests#e085f4ea: field flags: %w" , err )
}
if h .Peer == nil {
return fmt .Errorf ("unable to encode messages.hideAllChatJoinRequests#e085f4ea: field peer is nil" )
}
if err := h .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.hideAllChatJoinRequests#e085f4ea: field peer: %w" , err )
}
if h .Flags .Has (1 ) {
b .PutString (h .Link )
}
return nil
}
func (h *MessagesHideAllChatJoinRequestsRequest ) Decode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode messages.hideAllChatJoinRequests#e085f4ea to nil" )
}
if err := b .ConsumeID (MessagesHideAllChatJoinRequestsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.hideAllChatJoinRequests#e085f4ea: %w" , err )
}
return h .DecodeBare (b )
}
func (h *MessagesHideAllChatJoinRequestsRequest ) DecodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode messages.hideAllChatJoinRequests#e085f4ea to nil" )
}
{
if err := h .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.hideAllChatJoinRequests#e085f4ea: field flags: %w" , err )
}
}
h .Approved = h .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.hideAllChatJoinRequests#e085f4ea: field peer: %w" , err )
}
h .Peer = value
}
if h .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.hideAllChatJoinRequests#e085f4ea: field link: %w" , err )
}
h .Link = value
}
return nil
}
func (h *MessagesHideAllChatJoinRequestsRequest ) SetApproved (value bool ) {
if value {
h .Flags .Set (0 )
h .Approved = true
} else {
h .Flags .Unset (0 )
h .Approved = false
}
}
func (h *MessagesHideAllChatJoinRequestsRequest ) GetApproved () (value bool ) {
if h == nil {
return
}
return h .Flags .Has (0 )
}
func (h *MessagesHideAllChatJoinRequestsRequest ) GetPeer () (value InputPeerClass ) {
if h == nil {
return
}
return h .Peer
}
func (h *MessagesHideAllChatJoinRequestsRequest ) SetLink (value string ) {
h .Flags .Set (1 )
h .Link = value
}
func (h *MessagesHideAllChatJoinRequestsRequest ) GetLink () (value string , ok bool ) {
if h == nil {
return
}
if !h .Flags .Has (1 ) {
return value , false
}
return h .Link , true
}
func (c *Client ) MessagesHideAllChatJoinRequests (ctx context .Context , request *MessagesHideAllChatJoinRequestsRequest ) (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 .