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