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 PhoneToggleGroupCallStartSubscriptionRequest struct {
Call InputGroupCall
Subscribed bool
}
const PhoneToggleGroupCallStartSubscriptionRequestTypeID = 0x219c34e6
var (
_ bin .Encoder = &PhoneToggleGroupCallStartSubscriptionRequest {}
_ bin .Decoder = &PhoneToggleGroupCallStartSubscriptionRequest {}
_ bin .BareEncoder = &PhoneToggleGroupCallStartSubscriptionRequest {}
_ bin .BareDecoder = &PhoneToggleGroupCallStartSubscriptionRequest {}
)
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Call .Zero ()) {
return false
}
if !(t .Subscribed == false ) {
return false
}
return true
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) String () string {
if t == nil {
return "PhoneToggleGroupCallStartSubscriptionRequest(nil)"
}
type Alias PhoneToggleGroupCallStartSubscriptionRequest
return fmt .Sprintf ("PhoneToggleGroupCallStartSubscriptionRequest%+v" , Alias (*t ))
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) FillFrom (from interface {
GetCall () (value InputGroupCall )
GetSubscribed () (value bool )
}) {
t .Call = from .GetCall ()
t .Subscribed = from .GetSubscribed ()
}
func (*PhoneToggleGroupCallStartSubscriptionRequest ) TypeID () uint32 {
return PhoneToggleGroupCallStartSubscriptionRequestTypeID
}
func (*PhoneToggleGroupCallStartSubscriptionRequest ) TypeName () string {
return "phone.toggleGroupCallStartSubscription"
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.toggleGroupCallStartSubscription" ,
ID : PhoneToggleGroupCallStartSubscriptionRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Call" ,
SchemaName : "call" ,
},
{
Name : "Subscribed" ,
SchemaName : "subscribed" ,
},
}
return typ
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode phone.toggleGroupCallStartSubscription#219c34e6 as nil" )
}
b .PutID (PhoneToggleGroupCallStartSubscriptionRequestTypeID )
return t .EncodeBare (b )
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode phone.toggleGroupCallStartSubscription#219c34e6 as nil" )
}
if err := t .Call .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.toggleGroupCallStartSubscription#219c34e6: field call: %w" , err )
}
b .PutBool (t .Subscribed )
return nil
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode phone.toggleGroupCallStartSubscription#219c34e6 to nil" )
}
if err := b .ConsumeID (PhoneToggleGroupCallStartSubscriptionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallStartSubscription#219c34e6: %w" , err )
}
return t .DecodeBare (b )
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode phone.toggleGroupCallStartSubscription#219c34e6 to nil" )
}
{
if err := t .Call .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallStartSubscription#219c34e6: field call: %w" , err )
}
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode phone.toggleGroupCallStartSubscription#219c34e6: field subscribed: %w" , err )
}
t .Subscribed = value
}
return nil
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) GetCall () (value InputGroupCall ) {
if t == nil {
return
}
return t .Call
}
func (t *PhoneToggleGroupCallStartSubscriptionRequest ) GetSubscribed () (value bool ) {
if t == nil {
return
}
return t .Subscribed
}
func (c *Client ) PhoneToggleGroupCallStartSubscription (ctx context .Context , request *PhoneToggleGroupCallStartSubscriptionRequest ) (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 .