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 PhoneToggleGroupCallSettingsRequest struct {
Flags bin .Fields
ResetInviteHash bool
Call InputGroupCall
JoinMuted bool
}
const PhoneToggleGroupCallSettingsRequestTypeID = 0x74bbb43d
var (
_ bin .Encoder = &PhoneToggleGroupCallSettingsRequest {}
_ bin .Decoder = &PhoneToggleGroupCallSettingsRequest {}
_ bin .BareEncoder = &PhoneToggleGroupCallSettingsRequest {}
_ bin .BareDecoder = &PhoneToggleGroupCallSettingsRequest {}
)
func (t *PhoneToggleGroupCallSettingsRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Flags .Zero ()) {
return false
}
if !(t .ResetInviteHash == false ) {
return false
}
if !(t .Call .Zero ()) {
return false
}
if !(t .JoinMuted == false ) {
return false
}
return true
}
func (t *PhoneToggleGroupCallSettingsRequest ) String () string {
if t == nil {
return "PhoneToggleGroupCallSettingsRequest(nil)"
}
type Alias PhoneToggleGroupCallSettingsRequest
return fmt .Sprintf ("PhoneToggleGroupCallSettingsRequest%+v" , Alias (*t ))
}
func (t *PhoneToggleGroupCallSettingsRequest ) FillFrom (from interface {
GetResetInviteHash () (value bool )
GetCall () (value InputGroupCall )
GetJoinMuted () (value bool , ok bool )
}) {
t .ResetInviteHash = from .GetResetInviteHash ()
t .Call = from .GetCall ()
if val , ok := from .GetJoinMuted (); ok {
t .JoinMuted = val
}
}
func (*PhoneToggleGroupCallSettingsRequest ) TypeID () uint32 {
return PhoneToggleGroupCallSettingsRequestTypeID
}
func (*PhoneToggleGroupCallSettingsRequest ) TypeName () string {
return "phone.toggleGroupCallSettings"
}
func (t *PhoneToggleGroupCallSettingsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.toggleGroupCallSettings" ,
ID : PhoneToggleGroupCallSettingsRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ResetInviteHash" ,
SchemaName : "reset_invite_hash" ,
Null : !t .Flags .Has (1 ),
},
{
Name : "Call" ,
SchemaName : "call" ,
},
{
Name : "JoinMuted" ,
SchemaName : "join_muted" ,
Null : !t .Flags .Has (0 ),
},
}
return typ
}
func (t *PhoneToggleGroupCallSettingsRequest ) SetFlags () {
if !(t .ResetInviteHash == false ) {
t .Flags .Set (1 )
}
if !(t .JoinMuted == false ) {
t .Flags .Set (0 )
}
}
func (t *PhoneToggleGroupCallSettingsRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode phone.toggleGroupCallSettings#74bbb43d as nil" )
}
b .PutID (PhoneToggleGroupCallSettingsRequestTypeID )
return t .EncodeBare (b )
}
func (t *PhoneToggleGroupCallSettingsRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode phone.toggleGroupCallSettings#74bbb43d as nil" )
}
t .SetFlags ()
if err := t .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.toggleGroupCallSettings#74bbb43d: field flags: %w" , err )
}
if err := t .Call .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.toggleGroupCallSettings#74bbb43d: field call: %w" , err )
}
if t .Flags .Has (0 ) {
b .PutBool (t .JoinMuted )
}
return nil
}
func (t *PhoneToggleGroupCallSettingsRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode phone.toggleGroupCallSettings#74bbb43d to nil" )
}
if err := b .ConsumeID (PhoneToggleGroupCallSettingsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallSettings#74bbb43d: %w" , err )
}
return t .DecodeBare (b )
}
func (t *PhoneToggleGroupCallSettingsRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode phone.toggleGroupCallSettings#74bbb43d to nil" )
}
{
if err := t .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallSettings#74bbb43d: field flags: %w" , err )
}
}
t .ResetInviteHash = t .Flags .Has (1 )
{
if err := t .Call .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallSettings#74bbb43d: field call: %w" , err )
}
}
if t .Flags .Has (0 ) {
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallSettings#74bbb43d: field join_muted: %w" , err )
}
t .JoinMuted = value
}
return nil
}
func (t *PhoneToggleGroupCallSettingsRequest ) SetResetInviteHash (value bool ) {
if value {
t .Flags .Set (1 )
t .ResetInviteHash = true
} else {
t .Flags .Unset (1 )
t .ResetInviteHash = false
}
}
func (t *PhoneToggleGroupCallSettingsRequest ) GetResetInviteHash () (value bool ) {
if t == nil {
return
}
return t .Flags .Has (1 )
}
func (t *PhoneToggleGroupCallSettingsRequest ) GetCall () (value InputGroupCall ) {
if t == nil {
return
}
return t .Call
}
func (t *PhoneToggleGroupCallSettingsRequest ) SetJoinMuted (value bool ) {
t .Flags .Set (0 )
t .JoinMuted = value
}
func (t *PhoneToggleGroupCallSettingsRequest ) GetJoinMuted () (value bool , ok bool ) {
if t == nil {
return
}
if !t .Flags .Has (0 ) {
return value , false
}
return t .JoinMuted , true
}
func (c *Client ) PhoneToggleGroupCallSettings (ctx context .Context , request *PhoneToggleGroupCallSettingsRequest ) (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 .