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 ChannelsGetAdminedPublicChannelsRequest struct {
Flags bin .Fields
ByLocation bool
CheckLimit bool
}
const ChannelsGetAdminedPublicChannelsRequestTypeID = 0xf8b036af
var (
_ bin .Encoder = &ChannelsGetAdminedPublicChannelsRequest {}
_ bin .Decoder = &ChannelsGetAdminedPublicChannelsRequest {}
_ bin .BareEncoder = &ChannelsGetAdminedPublicChannelsRequest {}
_ bin .BareDecoder = &ChannelsGetAdminedPublicChannelsRequest {}
)
func (g *ChannelsGetAdminedPublicChannelsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .ByLocation == false ) {
return false
}
if !(g .CheckLimit == false ) {
return false
}
return true
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) String () string {
if g == nil {
return "ChannelsGetAdminedPublicChannelsRequest(nil)"
}
type Alias ChannelsGetAdminedPublicChannelsRequest
return fmt .Sprintf ("ChannelsGetAdminedPublicChannelsRequest%+v" , Alias (*g ))
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) FillFrom (from interface {
GetByLocation () (value bool )
GetCheckLimit () (value bool )
}) {
g .ByLocation = from .GetByLocation ()
g .CheckLimit = from .GetCheckLimit ()
}
func (*ChannelsGetAdminedPublicChannelsRequest ) TypeID () uint32 {
return ChannelsGetAdminedPublicChannelsRequestTypeID
}
func (*ChannelsGetAdminedPublicChannelsRequest ) TypeName () string {
return "channels.getAdminedPublicChannels"
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.getAdminedPublicChannels" ,
ID : ChannelsGetAdminedPublicChannelsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ByLocation" ,
SchemaName : "by_location" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "CheckLimit" ,
SchemaName : "check_limit" ,
Null : !g .Flags .Has (1 ),
},
}
return typ
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) SetFlags () {
if !(g .ByLocation == false ) {
g .Flags .Set (0 )
}
if !(g .CheckLimit == false ) {
g .Flags .Set (1 )
}
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getAdminedPublicChannels#f8b036af as nil" )
}
b .PutID (ChannelsGetAdminedPublicChannelsRequestTypeID )
return g .EncodeBare (b )
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getAdminedPublicChannels#f8b036af as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getAdminedPublicChannels#f8b036af: field flags: %w" , err )
}
return nil
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getAdminedPublicChannels#f8b036af to nil" )
}
if err := b .ConsumeID (ChannelsGetAdminedPublicChannelsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.getAdminedPublicChannels#f8b036af: %w" , err )
}
return g .DecodeBare (b )
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getAdminedPublicChannels#f8b036af to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.getAdminedPublicChannels#f8b036af: field flags: %w" , err )
}
}
g .ByLocation = g .Flags .Has (0 )
g .CheckLimit = g .Flags .Has (1 )
return nil
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) SetByLocation (value bool ) {
if value {
g .Flags .Set (0 )
g .ByLocation = true
} else {
g .Flags .Unset (0 )
g .ByLocation = false
}
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) GetByLocation () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) SetCheckLimit (value bool ) {
if value {
g .Flags .Set (1 )
g .CheckLimit = true
} else {
g .Flags .Unset (1 )
g .CheckLimit = false
}
}
func (g *ChannelsGetAdminedPublicChannelsRequest ) GetCheckLimit () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (c *Client ) ChannelsGetAdminedPublicChannels (ctx context .Context , request *ChannelsGetAdminedPublicChannelsRequest ) (MessagesChatsClass , error ) {
var result MessagesChatsBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Chats , 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 .