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 ToncenterStreamingURL struct {
URL string
Expires int
}
const ToncenterStreamingURLTypeID = 0x19887601
var (
_ bin .Encoder = &ToncenterStreamingURL {}
_ bin .Decoder = &ToncenterStreamingURL {}
_ bin .BareEncoder = &ToncenterStreamingURL {}
_ bin .BareDecoder = &ToncenterStreamingURL {}
)
func (s *ToncenterStreamingURL ) Zero () bool {
if s == nil {
return true
}
if !(s .URL == "" ) {
return false
}
if !(s .Expires == 0 ) {
return false
}
return true
}
func (s *ToncenterStreamingURL ) String () string {
if s == nil {
return "ToncenterStreamingURL(nil)"
}
type Alias ToncenterStreamingURL
return fmt .Sprintf ("ToncenterStreamingURL%+v" , Alias (*s ))
}
func (s *ToncenterStreamingURL ) FillFrom (from interface {
GetURL () (value string )
GetExpires () (value int )
}) {
s .URL = from .GetURL ()
s .Expires = from .GetExpires ()
}
func (*ToncenterStreamingURL ) TypeID () uint32 {
return ToncenterStreamingURLTypeID
}
func (*ToncenterStreamingURL ) TypeName () string {
return "toncenter.streamingUrl"
}
func (s *ToncenterStreamingURL ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "toncenter.streamingUrl" ,
ID : ToncenterStreamingURLTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Expires" ,
SchemaName : "expires" ,
},
}
return typ
}
func (s *ToncenterStreamingURL ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode toncenter.streamingUrl#19887601 as nil" )
}
b .PutID (ToncenterStreamingURLTypeID )
return s .EncodeBare (b )
}
func (s *ToncenterStreamingURL ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode toncenter.streamingUrl#19887601 as nil" )
}
b .PutString (s .URL )
b .PutInt (s .Expires )
return nil
}
func (s *ToncenterStreamingURL ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode toncenter.streamingUrl#19887601 to nil" )
}
if err := b .ConsumeID (ToncenterStreamingURLTypeID ); err != nil {
return fmt .Errorf ("unable to decode toncenter.streamingUrl#19887601: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ToncenterStreamingURL ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode toncenter.streamingUrl#19887601 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode toncenter.streamingUrl#19887601: field url: %w" , err )
}
s .URL = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode toncenter.streamingUrl#19887601: field expires: %w" , err )
}
s .Expires = value
}
return nil
}
func (s *ToncenterStreamingURL ) GetURL () (value string ) {
if s == nil {
return
}
return s .URL
}
func (s *ToncenterStreamingURL ) GetExpires () (value int ) {
if s == nil {
return
}
return s .Expires
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .