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 CommunitiesToggleCommunityCollapsedInDialogsRequest struct {
Flags bin .Fields
Collapsed bool
Community InputChannelClass
}
const CommunitiesToggleCommunityCollapsedInDialogsRequestTypeID = 0xd766e3ea
var (
_ bin .Encoder = &CommunitiesToggleCommunityCollapsedInDialogsRequest {}
_ bin .Decoder = &CommunitiesToggleCommunityCollapsedInDialogsRequest {}
_ bin .BareEncoder = &CommunitiesToggleCommunityCollapsedInDialogsRequest {}
_ bin .BareDecoder = &CommunitiesToggleCommunityCollapsedInDialogsRequest {}
)
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Flags .Zero ()) {
return false
}
if !(t .Collapsed == false ) {
return false
}
if !(t .Community == nil ) {
return false
}
return true
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) String () string {
if t == nil {
return "CommunitiesToggleCommunityCollapsedInDialogsRequest(nil)"
}
type Alias CommunitiesToggleCommunityCollapsedInDialogsRequest
return fmt .Sprintf ("CommunitiesToggleCommunityCollapsedInDialogsRequest%+v" , Alias (*t ))
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) FillFrom (from interface {
GetCollapsed () (value bool )
GetCommunity () (value InputChannelClass )
}) {
t .Collapsed = from .GetCollapsed ()
t .Community = from .GetCommunity ()
}
func (*CommunitiesToggleCommunityCollapsedInDialogsRequest ) TypeID () uint32 {
return CommunitiesToggleCommunityCollapsedInDialogsRequestTypeID
}
func (*CommunitiesToggleCommunityCollapsedInDialogsRequest ) TypeName () string {
return "communities.toggleCommunityCollapsedInDialogs"
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "communities.toggleCommunityCollapsedInDialogs" ,
ID : CommunitiesToggleCommunityCollapsedInDialogsRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Collapsed" ,
SchemaName : "collapsed" ,
Null : !t .Flags .Has (0 ),
},
{
Name : "Community" ,
SchemaName : "community" ,
},
}
return typ
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) SetFlags () {
if !(t .Collapsed == false ) {
t .Flags .Set (0 )
}
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode communities.toggleCommunityCollapsedInDialogs#d766e3ea as nil" )
}
b .PutID (CommunitiesToggleCommunityCollapsedInDialogsRequestTypeID )
return t .EncodeBare (b )
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode communities.toggleCommunityCollapsedInDialogs#d766e3ea as nil" )
}
t .SetFlags ()
if err := t .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode communities.toggleCommunityCollapsedInDialogs#d766e3ea: field flags: %w" , err )
}
if t .Community == nil {
return fmt .Errorf ("unable to encode communities.toggleCommunityCollapsedInDialogs#d766e3ea: field community is nil" )
}
if err := t .Community .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode communities.toggleCommunityCollapsedInDialogs#d766e3ea: field community: %w" , err )
}
return nil
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode communities.toggleCommunityCollapsedInDialogs#d766e3ea to nil" )
}
if err := b .ConsumeID (CommunitiesToggleCommunityCollapsedInDialogsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode communities.toggleCommunityCollapsedInDialogs#d766e3ea: %w" , err )
}
return t .DecodeBare (b )
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode communities.toggleCommunityCollapsedInDialogs#d766e3ea to nil" )
}
{
if err := t .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode communities.toggleCommunityCollapsedInDialogs#d766e3ea: field flags: %w" , err )
}
}
t .Collapsed = t .Flags .Has (0 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode communities.toggleCommunityCollapsedInDialogs#d766e3ea: field community: %w" , err )
}
t .Community = value
}
return nil
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) SetCollapsed (value bool ) {
if value {
t .Flags .Set (0 )
t .Collapsed = true
} else {
t .Flags .Unset (0 )
t .Collapsed = false
}
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) GetCollapsed () (value bool ) {
if t == nil {
return
}
return t .Flags .Has (0 )
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) GetCommunity () (value InputChannelClass ) {
if t == nil {
return
}
return t .Community
}
func (t *CommunitiesToggleCommunityCollapsedInDialogsRequest ) GetCommunityAsNotEmpty () (NotEmptyInputChannel , bool ) {
return t .Community .AsNotEmpty ()
}
func (c *Client ) CommunitiesToggleCommunityCollapsedInDialogs (ctx context .Context , request *CommunitiesToggleCommunityCollapsedInDialogsRequest ) (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.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .