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 PhoneInviteToGroupCallRequest struct {
Call InputGroupCall
Users []InputUserClass
}
const PhoneInviteToGroupCallRequestTypeID = 0x7b393160
var (
_ bin .Encoder = &PhoneInviteToGroupCallRequest {}
_ bin .Decoder = &PhoneInviteToGroupCallRequest {}
_ bin .BareEncoder = &PhoneInviteToGroupCallRequest {}
_ bin .BareDecoder = &PhoneInviteToGroupCallRequest {}
)
func (i *PhoneInviteToGroupCallRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Call .Zero ()) {
return false
}
if !(i .Users == nil ) {
return false
}
return true
}
func (i *PhoneInviteToGroupCallRequest ) String () string {
if i == nil {
return "PhoneInviteToGroupCallRequest(nil)"
}
type Alias PhoneInviteToGroupCallRequest
return fmt .Sprintf ("PhoneInviteToGroupCallRequest%+v" , Alias (*i ))
}
func (i *PhoneInviteToGroupCallRequest ) FillFrom (from interface {
GetCall () (value InputGroupCall )
GetUsers () (value []InputUserClass )
}) {
i .Call = from .GetCall ()
i .Users = from .GetUsers ()
}
func (*PhoneInviteToGroupCallRequest ) TypeID () uint32 {
return PhoneInviteToGroupCallRequestTypeID
}
func (*PhoneInviteToGroupCallRequest ) TypeName () string {
return "phone.inviteToGroupCall"
}
func (i *PhoneInviteToGroupCallRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.inviteToGroupCall" ,
ID : PhoneInviteToGroupCallRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Call" ,
SchemaName : "call" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
}
return typ
}
func (i *PhoneInviteToGroupCallRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode phone.inviteToGroupCall#7b393160 as nil" )
}
b .PutID (PhoneInviteToGroupCallRequestTypeID )
return i .EncodeBare (b )
}
func (i *PhoneInviteToGroupCallRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode phone.inviteToGroupCall#7b393160 as nil" )
}
if err := i .Call .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.inviteToGroupCall#7b393160: field call: %w" , err )
}
b .PutVectorHeader (len (i .Users ))
for idx , v := range i .Users {
if v == nil {
return fmt .Errorf ("unable to encode phone.inviteToGroupCall#7b393160: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.inviteToGroupCall#7b393160: field users element with index %d: %w" , idx , err )
}
}
return nil
}
func (i *PhoneInviteToGroupCallRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode phone.inviteToGroupCall#7b393160 to nil" )
}
if err := b .ConsumeID (PhoneInviteToGroupCallRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.inviteToGroupCall#7b393160: %w" , err )
}
return i .DecodeBare (b )
}
func (i *PhoneInviteToGroupCallRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode phone.inviteToGroupCall#7b393160 to nil" )
}
{
if err := i .Call .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.inviteToGroupCall#7b393160: field call: %w" , err )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode phone.inviteToGroupCall#7b393160: field users: %w" , err )
}
if headerLen > 0 {
i .Users = make ([]InputUserClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.inviteToGroupCall#7b393160: field users: %w" , err )
}
i .Users = append (i .Users , value )
}
}
return nil
}
func (i *PhoneInviteToGroupCallRequest ) GetCall () (value InputGroupCall ) {
if i == nil {
return
}
return i .Call
}
func (i *PhoneInviteToGroupCallRequest ) GetUsers () (value []InputUserClass ) {
if i == nil {
return
}
return i .Users
}
func (i *PhoneInviteToGroupCallRequest ) MapUsers () (value InputUserClassArray ) {
return InputUserClassArray (i .Users )
}
func (c *Client ) PhoneInviteToGroupCall (ctx context .Context , request *PhoneInviteToGroupCallRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .