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 CommunitiesToggleAllPeerLinkRequestApprovalRequest struct {
Flags bin .Fields
Reject bool
Community InputChannelClass
}
const CommunitiesToggleAllPeerLinkRequestApprovalRequestTypeID = 0xbfe3dd3d
var (
_ bin .Encoder = &CommunitiesToggleAllPeerLinkRequestApprovalRequest {}
_ bin .Decoder = &CommunitiesToggleAllPeerLinkRequestApprovalRequest {}
_ bin .BareEncoder = &CommunitiesToggleAllPeerLinkRequestApprovalRequest {}
_ bin .BareDecoder = &CommunitiesToggleAllPeerLinkRequestApprovalRequest {}
)
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Flags .Zero ()) {
return false
}
if !(t .Reject == false ) {
return false
}
if !(t .Community == nil ) {
return false
}
return true
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) String () string {
if t == nil {
return "CommunitiesToggleAllPeerLinkRequestApprovalRequest(nil)"
}
type Alias CommunitiesToggleAllPeerLinkRequestApprovalRequest
return fmt .Sprintf ("CommunitiesToggleAllPeerLinkRequestApprovalRequest%+v" , Alias (*t ))
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) FillFrom (from interface {
GetReject () (value bool )
GetCommunity () (value InputChannelClass )
}) {
t .Reject = from .GetReject ()
t .Community = from .GetCommunity ()
}
func (*CommunitiesToggleAllPeerLinkRequestApprovalRequest ) TypeID () uint32 {
return CommunitiesToggleAllPeerLinkRequestApprovalRequestTypeID
}
func (*CommunitiesToggleAllPeerLinkRequestApprovalRequest ) TypeName () string {
return "communities.toggleAllPeerLinkRequestApproval"
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "communities.toggleAllPeerLinkRequestApproval" ,
ID : CommunitiesToggleAllPeerLinkRequestApprovalRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Reject" ,
SchemaName : "reject" ,
Null : !t .Flags .Has (0 ),
},
{
Name : "Community" ,
SchemaName : "community" ,
},
}
return typ
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) SetFlags () {
if !(t .Reject == false ) {
t .Flags .Set (0 )
}
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d as nil" )
}
b .PutID (CommunitiesToggleAllPeerLinkRequestApprovalRequestTypeID )
return t .EncodeBare (b )
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d as nil" )
}
t .SetFlags ()
if err := t .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d: field flags: %w" , err )
}
if t .Community == nil {
return fmt .Errorf ("unable to encode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d: field community is nil" )
}
if err := t .Community .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d: field community: %w" , err )
}
return nil
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d to nil" )
}
if err := b .ConsumeID (CommunitiesToggleAllPeerLinkRequestApprovalRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d: %w" , err )
}
return t .DecodeBare (b )
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d to nil" )
}
{
if err := t .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d: field flags: %w" , err )
}
}
t .Reject = t .Flags .Has (0 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode communities.toggleAllPeerLinkRequestApproval#bfe3dd3d: field community: %w" , err )
}
t .Community = value
}
return nil
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) SetReject (value bool ) {
if value {
t .Flags .Set (0 )
t .Reject = true
} else {
t .Flags .Unset (0 )
t .Reject = false
}
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) GetReject () (value bool ) {
if t == nil {
return
}
return t .Flags .Has (0 )
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) GetCommunity () (value InputChannelClass ) {
if t == nil {
return
}
return t .Community
}
func (t *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) GetCommunityAsNotEmpty () (NotEmptyInputChannel , bool ) {
return t .Community .AsNotEmpty ()
}
func (c *Client ) CommunitiesToggleAllPeerLinkRequestApproval (ctx context .Context , request *CommunitiesToggleAllPeerLinkRequestApprovalRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .