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 WebViewResultURL struct {
Flags bin .Fields
Fullsize bool
Fullscreen bool
SameOrigin bool
QueryID int64
URL string
}
const WebViewResultURLTypeID = 0x4d22ff98
var (
_ bin .Encoder = &WebViewResultURL {}
_ bin .Decoder = &WebViewResultURL {}
_ bin .BareEncoder = &WebViewResultURL {}
_ bin .BareDecoder = &WebViewResultURL {}
)
func (w *WebViewResultURL ) Zero () bool {
if w == nil {
return true
}
if !(w .Flags .Zero ()) {
return false
}
if !(w .Fullsize == false ) {
return false
}
if !(w .Fullscreen == false ) {
return false
}
if !(w .SameOrigin == false ) {
return false
}
if !(w .QueryID == 0 ) {
return false
}
if !(w .URL == "" ) {
return false
}
return true
}
func (w *WebViewResultURL ) String () string {
if w == nil {
return "WebViewResultURL(nil)"
}
type Alias WebViewResultURL
return fmt .Sprintf ("WebViewResultURL%+v" , Alias (*w ))
}
func (w *WebViewResultURL ) FillFrom (from interface {
GetFullsize () (value bool )
GetFullscreen () (value bool )
GetSameOrigin () (value bool )
GetQueryID () (value int64 , ok bool )
GetURL () (value string )
}) {
w .Fullsize = from .GetFullsize ()
w .Fullscreen = from .GetFullscreen ()
w .SameOrigin = from .GetSameOrigin ()
if val , ok := from .GetQueryID (); ok {
w .QueryID = val
}
w .URL = from .GetURL ()
}
func (*WebViewResultURL ) TypeID () uint32 {
return WebViewResultURLTypeID
}
func (*WebViewResultURL ) TypeName () string {
return "webViewResultUrl"
}
func (w *WebViewResultURL ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webViewResultUrl" ,
ID : WebViewResultURLTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Fullsize" ,
SchemaName : "fullsize" ,
Null : !w .Flags .Has (1 ),
},
{
Name : "Fullscreen" ,
SchemaName : "fullscreen" ,
Null : !w .Flags .Has (2 ),
},
{
Name : "SameOrigin" ,
SchemaName : "same_origin" ,
Null : !w .Flags .Has (3 ),
},
{
Name : "QueryID" ,
SchemaName : "query_id" ,
Null : !w .Flags .Has (0 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (w *WebViewResultURL ) SetFlags () {
if !(w .Fullsize == false ) {
w .Flags .Set (1 )
}
if !(w .Fullscreen == false ) {
w .Flags .Set (2 )
}
if !(w .SameOrigin == false ) {
w .Flags .Set (3 )
}
if !(w .QueryID == 0 ) {
w .Flags .Set (0 )
}
}
func (w *WebViewResultURL ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webViewResultUrl#4d22ff98 as nil" )
}
b .PutID (WebViewResultURLTypeID )
return w .EncodeBare (b )
}
func (w *WebViewResultURL ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webViewResultUrl#4d22ff98 as nil" )
}
w .SetFlags ()
if err := w .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webViewResultUrl#4d22ff98: field flags: %w" , err )
}
if w .Flags .Has (0 ) {
b .PutLong (w .QueryID )
}
b .PutString (w .URL )
return nil
}
func (w *WebViewResultURL ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webViewResultUrl#4d22ff98 to nil" )
}
if err := b .ConsumeID (WebViewResultURLTypeID ); err != nil {
return fmt .Errorf ("unable to decode webViewResultUrl#4d22ff98: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebViewResultURL ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webViewResultUrl#4d22ff98 to nil" )
}
{
if err := w .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webViewResultUrl#4d22ff98: field flags: %w" , err )
}
}
w .Fullsize = w .Flags .Has (1 )
w .Fullscreen = w .Flags .Has (2 )
w .SameOrigin = w .Flags .Has (3 )
if w .Flags .Has (0 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode webViewResultUrl#4d22ff98: field query_id: %w" , err )
}
w .QueryID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode webViewResultUrl#4d22ff98: field url: %w" , err )
}
w .URL = value
}
return nil
}
func (w *WebViewResultURL ) SetFullsize (value bool ) {
if value {
w .Flags .Set (1 )
w .Fullsize = true
} else {
w .Flags .Unset (1 )
w .Fullsize = false
}
}
func (w *WebViewResultURL ) GetFullsize () (value bool ) {
if w == nil {
return
}
return w .Flags .Has (1 )
}
func (w *WebViewResultURL ) SetFullscreen (value bool ) {
if value {
w .Flags .Set (2 )
w .Fullscreen = true
} else {
w .Flags .Unset (2 )
w .Fullscreen = false
}
}
func (w *WebViewResultURL ) GetFullscreen () (value bool ) {
if w == nil {
return
}
return w .Flags .Has (2 )
}
func (w *WebViewResultURL ) SetSameOrigin (value bool ) {
if value {
w .Flags .Set (3 )
w .SameOrigin = true
} else {
w .Flags .Unset (3 )
w .SameOrigin = false
}
}
func (w *WebViewResultURL ) GetSameOrigin () (value bool ) {
if w == nil {
return
}
return w .Flags .Has (3 )
}
func (w *WebViewResultURL ) SetQueryID (value int64 ) {
w .Flags .Set (0 )
w .QueryID = value
}
func (w *WebViewResultURL ) GetQueryID () (value int64 , ok bool ) {
if w == nil {
return
}
if !w .Flags .Has (0 ) {
return value , false
}
return w .QueryID , true
}
func (w *WebViewResultURL ) GetURL () (value string ) {
if w == nil {
return
}
return w .URL
}
The pages are generated with Golds v0.8.4 . (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 .