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 PhoneConfirmCallRequest struct {
Peer InputPhoneCall
GA []byte
KeyFingerprint int64
Protocol PhoneCallProtocol
}
const PhoneConfirmCallRequestTypeID = 0x2efe1722
var (
_ bin .Encoder = &PhoneConfirmCallRequest {}
_ bin .Decoder = &PhoneConfirmCallRequest {}
_ bin .BareEncoder = &PhoneConfirmCallRequest {}
_ bin .BareDecoder = &PhoneConfirmCallRequest {}
)
func (c *PhoneConfirmCallRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Peer .Zero ()) {
return false
}
if !(c .GA == nil ) {
return false
}
if !(c .KeyFingerprint == 0 ) {
return false
}
if !(c .Protocol .Zero ()) {
return false
}
return true
}
func (c *PhoneConfirmCallRequest ) String () string {
if c == nil {
return "PhoneConfirmCallRequest(nil)"
}
type Alias PhoneConfirmCallRequest
return fmt .Sprintf ("PhoneConfirmCallRequest%+v" , Alias (*c ))
}
func (c *PhoneConfirmCallRequest ) FillFrom (from interface {
GetPeer () (value InputPhoneCall )
GetGA () (value []byte )
GetKeyFingerprint () (value int64 )
GetProtocol () (value PhoneCallProtocol )
}) {
c .Peer = from .GetPeer ()
c .GA = from .GetGA ()
c .KeyFingerprint = from .GetKeyFingerprint ()
c .Protocol = from .GetProtocol ()
}
func (*PhoneConfirmCallRequest ) TypeID () uint32 {
return PhoneConfirmCallRequestTypeID
}
func (*PhoneConfirmCallRequest ) TypeName () string {
return "phone.confirmCall"
}
func (c *PhoneConfirmCallRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.confirmCall" ,
ID : PhoneConfirmCallRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "GA" ,
SchemaName : "g_a" ,
},
{
Name : "KeyFingerprint" ,
SchemaName : "key_fingerprint" ,
},
{
Name : "Protocol" ,
SchemaName : "protocol" ,
},
}
return typ
}
func (c *PhoneConfirmCallRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode phone.confirmCall#2efe1722 as nil" )
}
b .PutID (PhoneConfirmCallRequestTypeID )
return c .EncodeBare (b )
}
func (c *PhoneConfirmCallRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode phone.confirmCall#2efe1722 as nil" )
}
if err := c .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.confirmCall#2efe1722: field peer: %w" , err )
}
b .PutBytes (c .GA )
b .PutLong (c .KeyFingerprint )
if err := c .Protocol .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.confirmCall#2efe1722: field protocol: %w" , err )
}
return nil
}
func (c *PhoneConfirmCallRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode phone.confirmCall#2efe1722 to nil" )
}
if err := b .ConsumeID (PhoneConfirmCallRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.confirmCall#2efe1722: %w" , err )
}
return c .DecodeBare (b )
}
func (c *PhoneConfirmCallRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode phone.confirmCall#2efe1722 to nil" )
}
{
if err := c .Peer .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.confirmCall#2efe1722: field peer: %w" , err )
}
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode phone.confirmCall#2efe1722: field g_a: %w" , err )
}
c .GA = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phone.confirmCall#2efe1722: field key_fingerprint: %w" , err )
}
c .KeyFingerprint = value
}
{
if err := c .Protocol .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.confirmCall#2efe1722: field protocol: %w" , err )
}
}
return nil
}
func (c *PhoneConfirmCallRequest ) GetPeer () (value InputPhoneCall ) {
if c == nil {
return
}
return c .Peer
}
func (c *PhoneConfirmCallRequest ) GetGA () (value []byte ) {
if c == nil {
return
}
return c .GA
}
func (c *PhoneConfirmCallRequest ) GetKeyFingerprint () (value int64 ) {
if c == nil {
return
}
return c .KeyFingerprint
}
func (c *PhoneConfirmCallRequest ) GetProtocol () (value PhoneCallProtocol ) {
if c == nil {
return
}
return c .Protocol
}
func (c *Client ) PhoneConfirmCall (ctx context .Context , request *PhoneConfirmCallRequest ) (*PhonePhoneCall , error ) {
var result PhonePhoneCall
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .