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