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 ExportedMessageLink struct {
Link string
HTML string
}
const ExportedMessageLinkTypeID = 0x5dab1af4
var (
_ bin .Encoder = &ExportedMessageLink {}
_ bin .Decoder = &ExportedMessageLink {}
_ bin .BareEncoder = &ExportedMessageLink {}
_ bin .BareDecoder = &ExportedMessageLink {}
)
func (e *ExportedMessageLink ) Zero () bool {
if e == nil {
return true
}
if !(e .Link == "" ) {
return false
}
if !(e .HTML == "" ) {
return false
}
return true
}
func (e *ExportedMessageLink ) String () string {
if e == nil {
return "ExportedMessageLink(nil)"
}
type Alias ExportedMessageLink
return fmt .Sprintf ("ExportedMessageLink%+v" , Alias (*e ))
}
func (e *ExportedMessageLink ) FillFrom (from interface {
GetLink () (value string )
GetHTML () (value string )
}) {
e .Link = from .GetLink ()
e .HTML = from .GetHTML ()
}
func (*ExportedMessageLink ) TypeID () uint32 {
return ExportedMessageLinkTypeID
}
func (*ExportedMessageLink ) TypeName () string {
return "exportedMessageLink"
}
func (e *ExportedMessageLink ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "exportedMessageLink" ,
ID : ExportedMessageLinkTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Link" ,
SchemaName : "link" ,
},
{
Name : "HTML" ,
SchemaName : "html" ,
},
}
return typ
}
func (e *ExportedMessageLink ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode exportedMessageLink#5dab1af4 as nil" )
}
b .PutID (ExportedMessageLinkTypeID )
return e .EncodeBare (b )
}
func (e *ExportedMessageLink ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode exportedMessageLink#5dab1af4 as nil" )
}
b .PutString (e .Link )
b .PutString (e .HTML )
return nil
}
func (e *ExportedMessageLink ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode exportedMessageLink#5dab1af4 to nil" )
}
if err := b .ConsumeID (ExportedMessageLinkTypeID ); err != nil {
return fmt .Errorf ("unable to decode exportedMessageLink#5dab1af4: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ExportedMessageLink ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode exportedMessageLink#5dab1af4 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode exportedMessageLink#5dab1af4: field link: %w" , err )
}
e .Link = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode exportedMessageLink#5dab1af4: field html: %w" , err )
}
e .HTML = value
}
return nil
}
func (e *ExportedMessageLink ) GetLink () (value string ) {
if e == nil {
return
}
return e .Link
}
func (e *ExportedMessageLink ) GetHTML () (value string ) {
if e == nil {
return
}
return e .HTML
}
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 .