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 WebDomainException struct {
Flags bin .Fields
Domain string
URL string
Title string
Favicon int64
}
const WebDomainExceptionTypeID = 0x933ca597
var (
_ bin .Encoder = &WebDomainException {}
_ bin .Decoder = &WebDomainException {}
_ bin .BareEncoder = &WebDomainException {}
_ bin .BareDecoder = &WebDomainException {}
)
func (w *WebDomainException ) Zero () bool {
if w == nil {
return true
}
if !(w .Flags .Zero ()) {
return false
}
if !(w .Domain == "" ) {
return false
}
if !(w .URL == "" ) {
return false
}
if !(w .Title == "" ) {
return false
}
if !(w .Favicon == 0 ) {
return false
}
return true
}
func (w *WebDomainException ) String () string {
if w == nil {
return "WebDomainException(nil)"
}
type Alias WebDomainException
return fmt .Sprintf ("WebDomainException%+v" , Alias (*w ))
}
func (w *WebDomainException ) FillFrom (from interface {
GetDomain () (value string )
GetURL () (value string )
GetTitle () (value string )
GetFavicon () (value int64 , ok bool )
}) {
w .Domain = from .GetDomain ()
w .URL = from .GetURL ()
w .Title = from .GetTitle ()
if val , ok := from .GetFavicon (); ok {
w .Favicon = val
}
}
func (*WebDomainException ) TypeID () uint32 {
return WebDomainExceptionTypeID
}
func (*WebDomainException ) TypeName () string {
return "webDomainException"
}
func (w *WebDomainException ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webDomainException" ,
ID : WebDomainExceptionTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Domain" ,
SchemaName : "domain" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Favicon" ,
SchemaName : "favicon" ,
Null : !w .Flags .Has (0 ),
},
}
return typ
}
func (w *WebDomainException ) SetFlags () {
if !(w .Favicon == 0 ) {
w .Flags .Set (0 )
}
}
func (w *WebDomainException ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webDomainException#933ca597 as nil" )
}
b .PutID (WebDomainExceptionTypeID )
return w .EncodeBare (b )
}
func (w *WebDomainException ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webDomainException#933ca597 as nil" )
}
w .SetFlags ()
if err := w .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webDomainException#933ca597: field flags: %w" , err )
}
b .PutString (w .Domain )
b .PutString (w .URL )
b .PutString (w .Title )
if w .Flags .Has (0 ) {
b .PutLong (w .Favicon )
}
return nil
}
func (w *WebDomainException ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webDomainException#933ca597 to nil" )
}
if err := b .ConsumeID (WebDomainExceptionTypeID ); err != nil {
return fmt .Errorf ("unable to decode webDomainException#933ca597: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebDomainException ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webDomainException#933ca597 to nil" )
}
{
if err := w .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webDomainException#933ca597: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode webDomainException#933ca597: field domain: %w" , err )
}
w .Domain = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode webDomainException#933ca597: field url: %w" , err )
}
w .URL = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode webDomainException#933ca597: field title: %w" , err )
}
w .Title = value
}
if w .Flags .Has (0 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode webDomainException#933ca597: field favicon: %w" , err )
}
w .Favicon = value
}
return nil
}
func (w *WebDomainException ) GetDomain () (value string ) {
if w == nil {
return
}
return w .Domain
}
func (w *WebDomainException ) GetURL () (value string ) {
if w == nil {
return
}
return w .URL
}
func (w *WebDomainException ) GetTitle () (value string ) {
if w == nil {
return
}
return w .Title
}
func (w *WebDomainException ) SetFavicon (value int64 ) {
w .Flags .Set (0 )
w .Favicon = value
}
func (w *WebDomainException ) GetFavicon () (value int64 , ok bool ) {
if w == nil {
return
}
if !w .Flags .Has (0 ) {
return value , false
}
return w .Favicon , true
}
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 .