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 PhoneJoinGroupCallRequest struct {
Flags bin .Fields
Muted bool
VideoStopped bool
Call InputGroupCall
JoinAs InputPeerClass
InviteHash string
Params DataJSON
}
const PhoneJoinGroupCallRequestTypeID = 0xb132ff7b
var (
_ bin .Encoder = &PhoneJoinGroupCallRequest {}
_ bin .Decoder = &PhoneJoinGroupCallRequest {}
_ bin .BareEncoder = &PhoneJoinGroupCallRequest {}
_ bin .BareDecoder = &PhoneJoinGroupCallRequest {}
)
func (j *PhoneJoinGroupCallRequest ) Zero () bool {
if j == nil {
return true
}
if !(j .Flags .Zero ()) {
return false
}
if !(j .Muted == false ) {
return false
}
if !(j .VideoStopped == false ) {
return false
}
if !(j .Call .Zero ()) {
return false
}
if !(j .JoinAs == nil ) {
return false
}
if !(j .InviteHash == "" ) {
return false
}
if !(j .Params .Zero ()) {
return false
}
return true
}
func (j *PhoneJoinGroupCallRequest ) String () string {
if j == nil {
return "PhoneJoinGroupCallRequest(nil)"
}
type Alias PhoneJoinGroupCallRequest
return fmt .Sprintf ("PhoneJoinGroupCallRequest%+v" , Alias (*j ))
}
func (j *PhoneJoinGroupCallRequest ) FillFrom (from interface {
GetMuted () (value bool )
GetVideoStopped () (value bool )
GetCall () (value InputGroupCall )
GetJoinAs () (value InputPeerClass )
GetInviteHash () (value string , ok bool )
GetParams () (value DataJSON )
}) {
j .Muted = from .GetMuted ()
j .VideoStopped = from .GetVideoStopped ()
j .Call = from .GetCall ()
j .JoinAs = from .GetJoinAs ()
if val , ok := from .GetInviteHash (); ok {
j .InviteHash = val
}
j .Params = from .GetParams ()
}
func (*PhoneJoinGroupCallRequest ) TypeID () uint32 {
return PhoneJoinGroupCallRequestTypeID
}
func (*PhoneJoinGroupCallRequest ) TypeName () string {
return "phone.joinGroupCall"
}
func (j *PhoneJoinGroupCallRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.joinGroupCall" ,
ID : PhoneJoinGroupCallRequestTypeID ,
}
if j == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Muted" ,
SchemaName : "muted" ,
Null : !j .Flags .Has (0 ),
},
{
Name : "VideoStopped" ,
SchemaName : "video_stopped" ,
Null : !j .Flags .Has (2 ),
},
{
Name : "Call" ,
SchemaName : "call" ,
},
{
Name : "JoinAs" ,
SchemaName : "join_as" ,
},
{
Name : "InviteHash" ,
SchemaName : "invite_hash" ,
Null : !j .Flags .Has (1 ),
},
{
Name : "Params" ,
SchemaName : "params" ,
},
}
return typ
}
func (j *PhoneJoinGroupCallRequest ) SetFlags () {
if !(j .Muted == false ) {
j .Flags .Set (0 )
}
if !(j .VideoStopped == false ) {
j .Flags .Set (2 )
}
if !(j .InviteHash == "" ) {
j .Flags .Set (1 )
}
}
func (j *PhoneJoinGroupCallRequest ) Encode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode phone.joinGroupCall#b132ff7b as nil" )
}
b .PutID (PhoneJoinGroupCallRequestTypeID )
return j .EncodeBare (b )
}
func (j *PhoneJoinGroupCallRequest ) EncodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode phone.joinGroupCall#b132ff7b as nil" )
}
j .SetFlags ()
if err := j .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.joinGroupCall#b132ff7b: field flags: %w" , err )
}
if err := j .Call .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.joinGroupCall#b132ff7b: field call: %w" , err )
}
if j .JoinAs == nil {
return fmt .Errorf ("unable to encode phone.joinGroupCall#b132ff7b: field join_as is nil" )
}
if err := j .JoinAs .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.joinGroupCall#b132ff7b: field join_as: %w" , err )
}
if j .Flags .Has (1 ) {
b .PutString (j .InviteHash )
}
if err := j .Params .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.joinGroupCall#b132ff7b: field params: %w" , err )
}
return nil
}
func (j *PhoneJoinGroupCallRequest ) Decode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode phone.joinGroupCall#b132ff7b to nil" )
}
if err := b .ConsumeID (PhoneJoinGroupCallRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.joinGroupCall#b132ff7b: %w" , err )
}
return j .DecodeBare (b )
}
func (j *PhoneJoinGroupCallRequest ) DecodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode phone.joinGroupCall#b132ff7b to nil" )
}
{
if err := j .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.joinGroupCall#b132ff7b: field flags: %w" , err )
}
}
j .Muted = j .Flags .Has (0 )
j .VideoStopped = j .Flags .Has (2 )
{
if err := j .Call .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.joinGroupCall#b132ff7b: field call: %w" , err )
}
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.joinGroupCall#b132ff7b: field join_as: %w" , err )
}
j .JoinAs = value
}
if j .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode phone.joinGroupCall#b132ff7b: field invite_hash: %w" , err )
}
j .InviteHash = value
}
{
if err := j .Params .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.joinGroupCall#b132ff7b: field params: %w" , err )
}
}
return nil
}
func (j *PhoneJoinGroupCallRequest ) SetMuted (value bool ) {
if value {
j .Flags .Set (0 )
j .Muted = true
} else {
j .Flags .Unset (0 )
j .Muted = false
}
}
func (j *PhoneJoinGroupCallRequest ) GetMuted () (value bool ) {
if j == nil {
return
}
return j .Flags .Has (0 )
}
func (j *PhoneJoinGroupCallRequest ) SetVideoStopped (value bool ) {
if value {
j .Flags .Set (2 )
j .VideoStopped = true
} else {
j .Flags .Unset (2 )
j .VideoStopped = false
}
}
func (j *PhoneJoinGroupCallRequest ) GetVideoStopped () (value bool ) {
if j == nil {
return
}
return j .Flags .Has (2 )
}
func (j *PhoneJoinGroupCallRequest ) GetCall () (value InputGroupCall ) {
if j == nil {
return
}
return j .Call
}
func (j *PhoneJoinGroupCallRequest ) GetJoinAs () (value InputPeerClass ) {
if j == nil {
return
}
return j .JoinAs
}
func (j *PhoneJoinGroupCallRequest ) SetInviteHash (value string ) {
j .Flags .Set (1 )
j .InviteHash = value
}
func (j *PhoneJoinGroupCallRequest ) GetInviteHash () (value string , ok bool ) {
if j == nil {
return
}
if !j .Flags .Has (1 ) {
return value , false
}
return j .InviteHash , true
}
func (j *PhoneJoinGroupCallRequest ) GetParams () (value DataJSON ) {
if j == nil {
return
}
return j .Params
}
func (c *Client ) PhoneJoinGroupCall (ctx context .Context , request *PhoneJoinGroupCallRequest ) (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 .