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 ChannelsGetParticipantsRequest struct {
Channel InputChannelClass
Filter ChannelParticipantsFilterClass
Offset int
Limit int
Hash int64
}
const ChannelsGetParticipantsRequestTypeID = 0x77ced9d0
var (
_ bin .Encoder = &ChannelsGetParticipantsRequest {}
_ bin .Decoder = &ChannelsGetParticipantsRequest {}
_ bin .BareEncoder = &ChannelsGetParticipantsRequest {}
_ bin .BareDecoder = &ChannelsGetParticipantsRequest {}
)
func (g *ChannelsGetParticipantsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Channel == nil ) {
return false
}
if !(g .Filter == nil ) {
return false
}
if !(g .Offset == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *ChannelsGetParticipantsRequest ) String () string {
if g == nil {
return "ChannelsGetParticipantsRequest(nil)"
}
type Alias ChannelsGetParticipantsRequest
return fmt .Sprintf ("ChannelsGetParticipantsRequest%+v" , Alias (*g ))
}
func (g *ChannelsGetParticipantsRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetFilter () (value ChannelParticipantsFilterClass )
GetOffset () (value int )
GetLimit () (value int )
GetHash () (value int64 )
}) {
g .Channel = from .GetChannel ()
g .Filter = from .GetFilter ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
g .Hash = from .GetHash ()
}
func (*ChannelsGetParticipantsRequest ) TypeID () uint32 {
return ChannelsGetParticipantsRequestTypeID
}
func (*ChannelsGetParticipantsRequest ) TypeName () string {
return "channels.getParticipants"
}
func (g *ChannelsGetParticipantsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.getParticipants" ,
ID : ChannelsGetParticipantsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Filter" ,
SchemaName : "filter" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *ChannelsGetParticipantsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getParticipants#77ced9d0 as nil" )
}
b .PutID (ChannelsGetParticipantsRequestTypeID )
return g .EncodeBare (b )
}
func (g *ChannelsGetParticipantsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getParticipants#77ced9d0 as nil" )
}
if g .Channel == nil {
return fmt .Errorf ("unable to encode channels.getParticipants#77ced9d0: field channel is nil" )
}
if err := g .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getParticipants#77ced9d0: field channel: %w" , err )
}
if g .Filter == nil {
return fmt .Errorf ("unable to encode channels.getParticipants#77ced9d0: field filter is nil" )
}
if err := g .Filter .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getParticipants#77ced9d0: field filter: %w" , err )
}
b .PutInt (g .Offset )
b .PutInt (g .Limit )
b .PutLong (g .Hash )
return nil
}
func (g *ChannelsGetParticipantsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getParticipants#77ced9d0 to nil" )
}
if err := b .ConsumeID (ChannelsGetParticipantsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.getParticipants#77ced9d0: %w" , err )
}
return g .DecodeBare (b )
}
func (g *ChannelsGetParticipantsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getParticipants#77ced9d0 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.getParticipants#77ced9d0: field channel: %w" , err )
}
g .Channel = value
}
{
value , err := DecodeChannelParticipantsFilter (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.getParticipants#77ced9d0: field filter: %w" , err )
}
g .Filter = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getParticipants#77ced9d0: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getParticipants#77ced9d0: field limit: %w" , err )
}
g .Limit = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getParticipants#77ced9d0: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *ChannelsGetParticipantsRequest ) GetChannel () (value InputChannelClass ) {
if g == nil {
return
}
return g .Channel
}
func (g *ChannelsGetParticipantsRequest ) GetFilter () (value ChannelParticipantsFilterClass ) {
if g == nil {
return
}
return g .Filter
}
func (g *ChannelsGetParticipantsRequest ) GetOffset () (value int ) {
if g == nil {
return
}
return g .Offset
}
func (g *ChannelsGetParticipantsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *ChannelsGetParticipantsRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
func (g *ChannelsGetParticipantsRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return g .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsGetParticipants (ctx context .Context , request *ChannelsGetParticipantsRequest ) (ChannelsChannelParticipantsClass , error ) {
var result ChannelsChannelParticipantsBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .ChannelParticipants , 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 .