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 PhoneAcceptCallRequest struct {
Peer InputPhoneCall
GB []byte
Protocol PhoneCallProtocol
}
const PhoneAcceptCallRequestTypeID = 0x3bd2b4a0
var (
_ bin .Encoder = &PhoneAcceptCallRequest {}
_ bin .Decoder = &PhoneAcceptCallRequest {}
_ bin .BareEncoder = &PhoneAcceptCallRequest {}
_ bin .BareDecoder = &PhoneAcceptCallRequest {}
)
func (a *PhoneAcceptCallRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .Peer .Zero ()) {
return false
}
if !(a .GB == nil ) {
return false
}
if !(a .Protocol .Zero ()) {
return false
}
return true
}
func (a *PhoneAcceptCallRequest ) String () string {
if a == nil {
return "PhoneAcceptCallRequest(nil)"
}
type Alias PhoneAcceptCallRequest
return fmt .Sprintf ("PhoneAcceptCallRequest%+v" , Alias (*a ))
}
func (a *PhoneAcceptCallRequest ) FillFrom (from interface {
GetPeer () (value InputPhoneCall )
GetGB () (value []byte )
GetProtocol () (value PhoneCallProtocol )
}) {
a .Peer = from .GetPeer ()
a .GB = from .GetGB ()
a .Protocol = from .GetProtocol ()
}
func (*PhoneAcceptCallRequest ) TypeID () uint32 {
return PhoneAcceptCallRequestTypeID
}
func (*PhoneAcceptCallRequest ) TypeName () string {
return "phone.acceptCall"
}
func (a *PhoneAcceptCallRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.acceptCall" ,
ID : PhoneAcceptCallRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "GB" ,
SchemaName : "g_b" ,
},
{
Name : "Protocol" ,
SchemaName : "protocol" ,
},
}
return typ
}
func (a *PhoneAcceptCallRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode phone.acceptCall#3bd2b4a0 as nil" )
}
b .PutID (PhoneAcceptCallRequestTypeID )
return a .EncodeBare (b )
}
func (a *PhoneAcceptCallRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode phone.acceptCall#3bd2b4a0 as nil" )
}
if err := a .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.acceptCall#3bd2b4a0: field peer: %w" , err )
}
b .PutBytes (a .GB )
if err := a .Protocol .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.acceptCall#3bd2b4a0: field protocol: %w" , err )
}
return nil
}
func (a *PhoneAcceptCallRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode phone.acceptCall#3bd2b4a0 to nil" )
}
if err := b .ConsumeID (PhoneAcceptCallRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.acceptCall#3bd2b4a0: %w" , err )
}
return a .DecodeBare (b )
}
func (a *PhoneAcceptCallRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode phone.acceptCall#3bd2b4a0 to nil" )
}
{
if err := a .Peer .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.acceptCall#3bd2b4a0: field peer: %w" , err )
}
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode phone.acceptCall#3bd2b4a0: field g_b: %w" , err )
}
a .GB = value
}
{
if err := a .Protocol .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.acceptCall#3bd2b4a0: field protocol: %w" , err )
}
}
return nil
}
func (a *PhoneAcceptCallRequest ) GetPeer () (value InputPhoneCall ) {
if a == nil {
return
}
return a .Peer
}
func (a *PhoneAcceptCallRequest ) GetGB () (value []byte ) {
if a == nil {
return
}
return a .GB
}
func (a *PhoneAcceptCallRequest ) GetProtocol () (value PhoneCallProtocol ) {
if a == nil {
return
}
return a .Protocol
}
func (c *Client ) PhoneAcceptCall (ctx context .Context , request *PhoneAcceptCallRequest ) (*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 .