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 PhoneSaveDefaultGroupCallJoinAsRequest struct {
Peer InputPeerClass
JoinAs InputPeerClass
}
const PhoneSaveDefaultGroupCallJoinAsRequestTypeID = 0x575e1f8c
var (
_ bin .Encoder = &PhoneSaveDefaultGroupCallJoinAsRequest {}
_ bin .Decoder = &PhoneSaveDefaultGroupCallJoinAsRequest {}
_ bin .BareEncoder = &PhoneSaveDefaultGroupCallJoinAsRequest {}
_ bin .BareDecoder = &PhoneSaveDefaultGroupCallJoinAsRequest {}
)
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer == nil ) {
return false
}
if !(s .JoinAs == nil ) {
return false
}
return true
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) String () string {
if s == nil {
return "PhoneSaveDefaultGroupCallJoinAsRequest(nil)"
}
type Alias PhoneSaveDefaultGroupCallJoinAsRequest
return fmt .Sprintf ("PhoneSaveDefaultGroupCallJoinAsRequest%+v" , Alias (*s ))
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetJoinAs () (value InputPeerClass )
}) {
s .Peer = from .GetPeer ()
s .JoinAs = from .GetJoinAs ()
}
func (*PhoneSaveDefaultGroupCallJoinAsRequest ) TypeID () uint32 {
return PhoneSaveDefaultGroupCallJoinAsRequestTypeID
}
func (*PhoneSaveDefaultGroupCallJoinAsRequest ) TypeName () string {
return "phone.saveDefaultGroupCallJoinAs"
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.saveDefaultGroupCallJoinAs" ,
ID : PhoneSaveDefaultGroupCallJoinAsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "JoinAs" ,
SchemaName : "join_as" ,
},
}
return typ
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode phone.saveDefaultGroupCallJoinAs#575e1f8c as nil" )
}
b .PutID (PhoneSaveDefaultGroupCallJoinAsRequestTypeID )
return s .EncodeBare (b )
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode phone.saveDefaultGroupCallJoinAs#575e1f8c as nil" )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode phone.saveDefaultGroupCallJoinAs#575e1f8c: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.saveDefaultGroupCallJoinAs#575e1f8c: field peer: %w" , err )
}
if s .JoinAs == nil {
return fmt .Errorf ("unable to encode phone.saveDefaultGroupCallJoinAs#575e1f8c: field join_as is nil" )
}
if err := s .JoinAs .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.saveDefaultGroupCallJoinAs#575e1f8c: field join_as: %w" , err )
}
return nil
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode phone.saveDefaultGroupCallJoinAs#575e1f8c to nil" )
}
if err := b .ConsumeID (PhoneSaveDefaultGroupCallJoinAsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.saveDefaultGroupCallJoinAs#575e1f8c: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode phone.saveDefaultGroupCallJoinAs#575e1f8c to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.saveDefaultGroupCallJoinAs#575e1f8c: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.saveDefaultGroupCallJoinAs#575e1f8c: field join_as: %w" , err )
}
s .JoinAs = value
}
return nil
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *PhoneSaveDefaultGroupCallJoinAsRequest ) GetJoinAs () (value InputPeerClass ) {
if s == nil {
return
}
return s .JoinAs
}
func (c *Client ) PhoneSaveDefaultGroupCallJoinAs (ctx context .Context , request *PhoneSaveDefaultGroupCallJoinAsRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .