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 PhoneGetGroupParticipantsRequest struct {
Call InputGroupCall
IDs []InputPeerClass
Sources []int
Offset string
Limit int
}
const PhoneGetGroupParticipantsRequestTypeID = 0xc558d8ab
var (
_ bin .Encoder = &PhoneGetGroupParticipantsRequest {}
_ bin .Decoder = &PhoneGetGroupParticipantsRequest {}
_ bin .BareEncoder = &PhoneGetGroupParticipantsRequest {}
_ bin .BareDecoder = &PhoneGetGroupParticipantsRequest {}
)
func (g *PhoneGetGroupParticipantsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Call .Zero ()) {
return false
}
if !(g .IDs == nil ) {
return false
}
if !(g .Sources == nil ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *PhoneGetGroupParticipantsRequest ) String () string {
if g == nil {
return "PhoneGetGroupParticipantsRequest(nil)"
}
type Alias PhoneGetGroupParticipantsRequest
return fmt .Sprintf ("PhoneGetGroupParticipantsRequest%+v" , Alias (*g ))
}
func (g *PhoneGetGroupParticipantsRequest ) FillFrom (from interface {
GetCall () (value InputGroupCall )
GetIDs () (value []InputPeerClass )
GetSources () (value []int )
GetOffset () (value string )
GetLimit () (value int )
}) {
g .Call = from .GetCall ()
g .IDs = from .GetIDs ()
g .Sources = from .GetSources ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*PhoneGetGroupParticipantsRequest ) TypeID () uint32 {
return PhoneGetGroupParticipantsRequestTypeID
}
func (*PhoneGetGroupParticipantsRequest ) TypeName () string {
return "phone.getGroupParticipants"
}
func (g *PhoneGetGroupParticipantsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.getGroupParticipants" ,
ID : PhoneGetGroupParticipantsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Call" ,
SchemaName : "call" ,
},
{
Name : "IDs" ,
SchemaName : "ids" ,
},
{
Name : "Sources" ,
SchemaName : "sources" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *PhoneGetGroupParticipantsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode phone.getGroupParticipants#c558d8ab as nil" )
}
b .PutID (PhoneGetGroupParticipantsRequestTypeID )
return g .EncodeBare (b )
}
func (g *PhoneGetGroupParticipantsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode phone.getGroupParticipants#c558d8ab as nil" )
}
if err := g .Call .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.getGroupParticipants#c558d8ab: field call: %w" , err )
}
b .PutVectorHeader (len (g .IDs ))
for idx , v := range g .IDs {
if v == nil {
return fmt .Errorf ("unable to encode phone.getGroupParticipants#c558d8ab: field ids element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.getGroupParticipants#c558d8ab: field ids element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (g .Sources ))
for _ , v := range g .Sources {
b .PutInt (v )
}
b .PutString (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *PhoneGetGroupParticipantsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode phone.getGroupParticipants#c558d8ab to nil" )
}
if err := b .ConsumeID (PhoneGetGroupParticipantsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PhoneGetGroupParticipantsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode phone.getGroupParticipants#c558d8ab to nil" )
}
{
if err := g .Call .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field call: %w" , err )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field ids: %w" , err )
}
if headerLen > 0 {
g .IDs = make ([]InputPeerClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field ids: %w" , err )
}
g .IDs = append (g .IDs , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field sources: %w" , err )
}
if headerLen > 0 {
g .Sources = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field sources: %w" , err )
}
g .Sources = append (g .Sources , value )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phone.getGroupParticipants#c558d8ab: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *PhoneGetGroupParticipantsRequest ) GetCall () (value InputGroupCall ) {
if g == nil {
return
}
return g .Call
}
func (g *PhoneGetGroupParticipantsRequest ) GetIDs () (value []InputPeerClass ) {
if g == nil {
return
}
return g .IDs
}
func (g *PhoneGetGroupParticipantsRequest ) GetSources () (value []int ) {
if g == nil {
return
}
return g .Sources
}
func (g *PhoneGetGroupParticipantsRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *PhoneGetGroupParticipantsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *PhoneGetGroupParticipantsRequest ) MapIDs () (value InputPeerClassArray ) {
return InputPeerClassArray (g .IDs )
}
func (c *Client ) PhoneGetGroupParticipants (ctx context .Context , request *PhoneGetGroupParticipantsRequest ) (*PhoneGroupParticipants , error ) {
var result PhoneGroupParticipants
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .