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 PhoneCheckGroupCallRequest struct {
Call InputGroupCall
Sources []int
}
const PhoneCheckGroupCallRequestTypeID = 0xb59cf977
var (
_ bin .Encoder = &PhoneCheckGroupCallRequest {}
_ bin .Decoder = &PhoneCheckGroupCallRequest {}
_ bin .BareEncoder = &PhoneCheckGroupCallRequest {}
_ bin .BareDecoder = &PhoneCheckGroupCallRequest {}
)
func (c *PhoneCheckGroupCallRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Call .Zero ()) {
return false
}
if !(c .Sources == nil ) {
return false
}
return true
}
func (c *PhoneCheckGroupCallRequest ) String () string {
if c == nil {
return "PhoneCheckGroupCallRequest(nil)"
}
type Alias PhoneCheckGroupCallRequest
return fmt .Sprintf ("PhoneCheckGroupCallRequest%+v" , Alias (*c ))
}
func (c *PhoneCheckGroupCallRequest ) FillFrom (from interface {
GetCall () (value InputGroupCall )
GetSources () (value []int )
}) {
c .Call = from .GetCall ()
c .Sources = from .GetSources ()
}
func (*PhoneCheckGroupCallRequest ) TypeID () uint32 {
return PhoneCheckGroupCallRequestTypeID
}
func (*PhoneCheckGroupCallRequest ) TypeName () string {
return "phone.checkGroupCall"
}
func (c *PhoneCheckGroupCallRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.checkGroupCall" ,
ID : PhoneCheckGroupCallRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Call" ,
SchemaName : "call" ,
},
{
Name : "Sources" ,
SchemaName : "sources" ,
},
}
return typ
}
func (c *PhoneCheckGroupCallRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode phone.checkGroupCall#b59cf977 as nil" )
}
b .PutID (PhoneCheckGroupCallRequestTypeID )
return c .EncodeBare (b )
}
func (c *PhoneCheckGroupCallRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode phone.checkGroupCall#b59cf977 as nil" )
}
if err := c .Call .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.checkGroupCall#b59cf977: field call: %w" , err )
}
b .PutVectorHeader (len (c .Sources ))
for _ , v := range c .Sources {
b .PutInt (v )
}
return nil
}
func (c *PhoneCheckGroupCallRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode phone.checkGroupCall#b59cf977 to nil" )
}
if err := b .ConsumeID (PhoneCheckGroupCallRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.checkGroupCall#b59cf977: %w" , err )
}
return c .DecodeBare (b )
}
func (c *PhoneCheckGroupCallRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode phone.checkGroupCall#b59cf977 to nil" )
}
{
if err := c .Call .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.checkGroupCall#b59cf977: field call: %w" , err )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode phone.checkGroupCall#b59cf977: field sources: %w" , err )
}
if headerLen > 0 {
c .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.checkGroupCall#b59cf977: field sources: %w" , err )
}
c .Sources = append (c .Sources , value )
}
}
return nil
}
func (c *PhoneCheckGroupCallRequest ) GetCall () (value InputGroupCall ) {
if c == nil {
return
}
return c .Call
}
func (c *PhoneCheckGroupCallRequest ) GetSources () (value []int ) {
if c == nil {
return
}
return c .Sources
}
func (c *Client ) PhoneCheckGroupCall (ctx context .Context , request *PhoneCheckGroupCallRequest ) ([]int , error ) {
var result IntVector
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []int (result .Elems ), 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 .