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 PhoneCreateGroupCallRequest struct {
Flags bin .Fields
RtmpStream bool
Peer InputPeerClass
RandomID int
Title string
ScheduleDate int
}
const PhoneCreateGroupCallRequestTypeID = 0x48cdc6d8
var (
_ bin .Encoder = &PhoneCreateGroupCallRequest {}
_ bin .Decoder = &PhoneCreateGroupCallRequest {}
_ bin .BareEncoder = &PhoneCreateGroupCallRequest {}
_ bin .BareDecoder = &PhoneCreateGroupCallRequest {}
)
func (c *PhoneCreateGroupCallRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .RtmpStream == false ) {
return false
}
if !(c .Peer == nil ) {
return false
}
if !(c .RandomID == 0 ) {
return false
}
if !(c .Title == "" ) {
return false
}
if !(c .ScheduleDate == 0 ) {
return false
}
return true
}
func (c *PhoneCreateGroupCallRequest ) String () string {
if c == nil {
return "PhoneCreateGroupCallRequest(nil)"
}
type Alias PhoneCreateGroupCallRequest
return fmt .Sprintf ("PhoneCreateGroupCallRequest%+v" , Alias (*c ))
}
func (c *PhoneCreateGroupCallRequest ) FillFrom (from interface {
GetRtmpStream () (value bool )
GetPeer () (value InputPeerClass )
GetRandomID () (value int )
GetTitle () (value string , ok bool )
GetScheduleDate () (value int , ok bool )
}) {
c .RtmpStream = from .GetRtmpStream ()
c .Peer = from .GetPeer ()
c .RandomID = from .GetRandomID ()
if val , ok := from .GetTitle (); ok {
c .Title = val
}
if val , ok := from .GetScheduleDate (); ok {
c .ScheduleDate = val
}
}
func (*PhoneCreateGroupCallRequest ) TypeID () uint32 {
return PhoneCreateGroupCallRequestTypeID
}
func (*PhoneCreateGroupCallRequest ) TypeName () string {
return "phone.createGroupCall"
}
func (c *PhoneCreateGroupCallRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.createGroupCall" ,
ID : PhoneCreateGroupCallRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "RtmpStream" ,
SchemaName : "rtmp_stream" ,
Null : !c .Flags .Has (2 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "RandomID" ,
SchemaName : "random_id" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
Null : !c .Flags .Has (0 ),
},
{
Name : "ScheduleDate" ,
SchemaName : "schedule_date" ,
Null : !c .Flags .Has (1 ),
},
}
return typ
}
func (c *PhoneCreateGroupCallRequest ) SetFlags () {
if !(c .RtmpStream == false ) {
c .Flags .Set (2 )
}
if !(c .Title == "" ) {
c .Flags .Set (0 )
}
if !(c .ScheduleDate == 0 ) {
c .Flags .Set (1 )
}
}
func (c *PhoneCreateGroupCallRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode phone.createGroupCall#48cdc6d8 as nil" )
}
b .PutID (PhoneCreateGroupCallRequestTypeID )
return c .EncodeBare (b )
}
func (c *PhoneCreateGroupCallRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode phone.createGroupCall#48cdc6d8 as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.createGroupCall#48cdc6d8: field flags: %w" , err )
}
if c .Peer == nil {
return fmt .Errorf ("unable to encode phone.createGroupCall#48cdc6d8: field peer is nil" )
}
if err := c .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.createGroupCall#48cdc6d8: field peer: %w" , err )
}
b .PutInt (c .RandomID )
if c .Flags .Has (0 ) {
b .PutString (c .Title )
}
if c .Flags .Has (1 ) {
b .PutInt (c .ScheduleDate )
}
return nil
}
func (c *PhoneCreateGroupCallRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode phone.createGroupCall#48cdc6d8 to nil" )
}
if err := b .ConsumeID (PhoneCreateGroupCallRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.createGroupCall#48cdc6d8: %w" , err )
}
return c .DecodeBare (b )
}
func (c *PhoneCreateGroupCallRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode phone.createGroupCall#48cdc6d8 to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.createGroupCall#48cdc6d8: field flags: %w" , err )
}
}
c .RtmpStream = c .Flags .Has (2 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.createGroupCall#48cdc6d8: field peer: %w" , err )
}
c .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phone.createGroupCall#48cdc6d8: field random_id: %w" , err )
}
c .RandomID = value
}
if c .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode phone.createGroupCall#48cdc6d8: field title: %w" , err )
}
c .Title = value
}
if c .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phone.createGroupCall#48cdc6d8: field schedule_date: %w" , err )
}
c .ScheduleDate = value
}
return nil
}
func (c *PhoneCreateGroupCallRequest ) SetRtmpStream (value bool ) {
if value {
c .Flags .Set (2 )
c .RtmpStream = true
} else {
c .Flags .Unset (2 )
c .RtmpStream = false
}
}
func (c *PhoneCreateGroupCallRequest ) GetRtmpStream () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (2 )
}
func (c *PhoneCreateGroupCallRequest ) GetPeer () (value InputPeerClass ) {
if c == nil {
return
}
return c .Peer
}
func (c *PhoneCreateGroupCallRequest ) GetRandomID () (value int ) {
if c == nil {
return
}
return c .RandomID
}
func (c *PhoneCreateGroupCallRequest ) SetTitle (value string ) {
c .Flags .Set (0 )
c .Title = value
}
func (c *PhoneCreateGroupCallRequest ) GetTitle () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (0 ) {
return value , false
}
return c .Title , true
}
func (c *PhoneCreateGroupCallRequest ) SetScheduleDate (value int ) {
c .Flags .Set (1 )
c .ScheduleDate = value
}
func (c *PhoneCreateGroupCallRequest ) GetScheduleDate () (value int , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (1 ) {
return value , false
}
return c .ScheduleDate , true
}
func (c *Client ) PhoneCreateGroupCall (ctx context .Context , request *PhoneCreateGroupCallRequest ) (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 .