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 BotsGetPreviewInfoRequest struct {
Bot InputUserClass
LangCode string
}
const BotsGetPreviewInfoRequestTypeID = 0x423ab3ad
var (
_ bin .Encoder = &BotsGetPreviewInfoRequest {}
_ bin .Decoder = &BotsGetPreviewInfoRequest {}
_ bin .BareEncoder = &BotsGetPreviewInfoRequest {}
_ bin .BareDecoder = &BotsGetPreviewInfoRequest {}
)
func (g *BotsGetPreviewInfoRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Bot == nil ) {
return false
}
if !(g .LangCode == "" ) {
return false
}
return true
}
func (g *BotsGetPreviewInfoRequest ) String () string {
if g == nil {
return "BotsGetPreviewInfoRequest(nil)"
}
type Alias BotsGetPreviewInfoRequest
return fmt .Sprintf ("BotsGetPreviewInfoRequest%+v" , Alias (*g ))
}
func (g *BotsGetPreviewInfoRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
GetLangCode () (value string )
}) {
g .Bot = from .GetBot ()
g .LangCode = from .GetLangCode ()
}
func (*BotsGetPreviewInfoRequest ) TypeID () uint32 {
return BotsGetPreviewInfoRequestTypeID
}
func (*BotsGetPreviewInfoRequest ) TypeName () string {
return "bots.getPreviewInfo"
}
func (g *BotsGetPreviewInfoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.getPreviewInfo" ,
ID : BotsGetPreviewInfoRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
}
return typ
}
func (g *BotsGetPreviewInfoRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode bots.getPreviewInfo#423ab3ad as nil" )
}
b .PutID (BotsGetPreviewInfoRequestTypeID )
return g .EncodeBare (b )
}
func (g *BotsGetPreviewInfoRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode bots.getPreviewInfo#423ab3ad as nil" )
}
if g .Bot == nil {
return fmt .Errorf ("unable to encode bots.getPreviewInfo#423ab3ad: field bot is nil" )
}
if err := g .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.getPreviewInfo#423ab3ad: field bot: %w" , err )
}
b .PutString (g .LangCode )
return nil
}
func (g *BotsGetPreviewInfoRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode bots.getPreviewInfo#423ab3ad to nil" )
}
if err := b .ConsumeID (BotsGetPreviewInfoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.getPreviewInfo#423ab3ad: %w" , err )
}
return g .DecodeBare (b )
}
func (g *BotsGetPreviewInfoRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode bots.getPreviewInfo#423ab3ad to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.getPreviewInfo#423ab3ad: field bot: %w" , err )
}
g .Bot = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.getPreviewInfo#423ab3ad: field lang_code: %w" , err )
}
g .LangCode = value
}
return nil
}
func (g *BotsGetPreviewInfoRequest ) GetBot () (value InputUserClass ) {
if g == nil {
return
}
return g .Bot
}
func (g *BotsGetPreviewInfoRequest ) GetLangCode () (value string ) {
if g == nil {
return
}
return g .LangCode
}
func (c *Client ) BotsGetPreviewInfo (ctx context .Context , request *BotsGetPreviewInfoRequest ) (*BotsPreviewInfo , error ) {
var result BotsPreviewInfo
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .