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 MessagesGetWebPageRequest struct {
URL string
Hash int
}
const MessagesGetWebPageRequestTypeID = 0x8d9692a3
var (
_ bin .Encoder = &MessagesGetWebPageRequest {}
_ bin .Decoder = &MessagesGetWebPageRequest {}
_ bin .BareEncoder = &MessagesGetWebPageRequest {}
_ bin .BareDecoder = &MessagesGetWebPageRequest {}
)
func (g *MessagesGetWebPageRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .URL == "" ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *MessagesGetWebPageRequest ) String () string {
if g == nil {
return "MessagesGetWebPageRequest(nil)"
}
type Alias MessagesGetWebPageRequest
return fmt .Sprintf ("MessagesGetWebPageRequest%+v" , Alias (*g ))
}
func (g *MessagesGetWebPageRequest ) FillFrom (from interface {
GetURL () (value string )
GetHash () (value int )
}) {
g .URL = from .GetURL ()
g .Hash = from .GetHash ()
}
func (*MessagesGetWebPageRequest ) TypeID () uint32 {
return MessagesGetWebPageRequestTypeID
}
func (*MessagesGetWebPageRequest ) TypeName () string {
return "messages.getWebPage"
}
func (g *MessagesGetWebPageRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getWebPage" ,
ID : MessagesGetWebPageRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *MessagesGetWebPageRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getWebPage#8d9692a3 as nil" )
}
b .PutID (MessagesGetWebPageRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetWebPageRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getWebPage#8d9692a3 as nil" )
}
b .PutString (g .URL )
b .PutInt (g .Hash )
return nil
}
func (g *MessagesGetWebPageRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getWebPage#8d9692a3 to nil" )
}
if err := b .ConsumeID (MessagesGetWebPageRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getWebPage#8d9692a3: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetWebPageRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getWebPage#8d9692a3 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getWebPage#8d9692a3: field url: %w" , err )
}
g .URL = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getWebPage#8d9692a3: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *MessagesGetWebPageRequest ) GetURL () (value string ) {
if g == nil {
return
}
return g .URL
}
func (g *MessagesGetWebPageRequest ) GetHash () (value int ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) MessagesGetWebPage (ctx context .Context , request *MessagesGetWebPageRequest ) (*MessagesWebPage , error ) {
var result MessagesWebPage
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .