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 InlineBotWebView struct {
Text string
URL string
}
const InlineBotWebViewTypeID = 0xb57295d5
var (
_ bin .Encoder = &InlineBotWebView {}
_ bin .Decoder = &InlineBotWebView {}
_ bin .BareEncoder = &InlineBotWebView {}
_ bin .BareDecoder = &InlineBotWebView {}
)
func (i *InlineBotWebView ) Zero () bool {
if i == nil {
return true
}
if !(i .Text == "" ) {
return false
}
if !(i .URL == "" ) {
return false
}
return true
}
func (i *InlineBotWebView ) String () string {
if i == nil {
return "InlineBotWebView(nil)"
}
type Alias InlineBotWebView
return fmt .Sprintf ("InlineBotWebView%+v" , Alias (*i ))
}
func (i *InlineBotWebView ) FillFrom (from interface {
GetText () (value string )
GetURL () (value string )
}) {
i .Text = from .GetText ()
i .URL = from .GetURL ()
}
func (*InlineBotWebView ) TypeID () uint32 {
return InlineBotWebViewTypeID
}
func (*InlineBotWebView ) TypeName () string {
return "inlineBotWebView"
}
func (i *InlineBotWebView ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inlineBotWebView" ,
ID : InlineBotWebViewTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (i *InlineBotWebView ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inlineBotWebView#b57295d5 as nil" )
}
b .PutID (InlineBotWebViewTypeID )
return i .EncodeBare (b )
}
func (i *InlineBotWebView ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inlineBotWebView#b57295d5 as nil" )
}
b .PutString (i .Text )
b .PutString (i .URL )
return nil
}
func (i *InlineBotWebView ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inlineBotWebView#b57295d5 to nil" )
}
if err := b .ConsumeID (InlineBotWebViewTypeID ); err != nil {
return fmt .Errorf ("unable to decode inlineBotWebView#b57295d5: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InlineBotWebView ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inlineBotWebView#b57295d5 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inlineBotWebView#b57295d5: field text: %w" , err )
}
i .Text = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inlineBotWebView#b57295d5: field url: %w" , err )
}
i .URL = value
}
return nil
}
func (i *InlineBotWebView ) GetText () (value string ) {
if i == nil {
return
}
return i .Text
}
func (i *InlineBotWebView ) GetURL () (value string ) {
if i == nil {
return
}
return i .URL
}
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 .