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 AccountGetMultiWallPapersRequest struct {
Wallpapers []InputWallPaperClass
}
const AccountGetMultiWallPapersRequestTypeID = 0x65ad71dc
var (
_ bin .Encoder = &AccountGetMultiWallPapersRequest {}
_ bin .Decoder = &AccountGetMultiWallPapersRequest {}
_ bin .BareEncoder = &AccountGetMultiWallPapersRequest {}
_ bin .BareDecoder = &AccountGetMultiWallPapersRequest {}
)
func (g *AccountGetMultiWallPapersRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Wallpapers == nil ) {
return false
}
return true
}
func (g *AccountGetMultiWallPapersRequest ) String () string {
if g == nil {
return "AccountGetMultiWallPapersRequest(nil)"
}
type Alias AccountGetMultiWallPapersRequest
return fmt .Sprintf ("AccountGetMultiWallPapersRequest%+v" , Alias (*g ))
}
func (g *AccountGetMultiWallPapersRequest ) FillFrom (from interface {
GetWallpapers () (value []InputWallPaperClass )
}) {
g .Wallpapers = from .GetWallpapers ()
}
func (*AccountGetMultiWallPapersRequest ) TypeID () uint32 {
return AccountGetMultiWallPapersRequestTypeID
}
func (*AccountGetMultiWallPapersRequest ) TypeName () string {
return "account.getMultiWallPapers"
}
func (g *AccountGetMultiWallPapersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getMultiWallPapers" ,
ID : AccountGetMultiWallPapersRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Wallpapers" ,
SchemaName : "wallpapers" ,
},
}
return typ
}
func (g *AccountGetMultiWallPapersRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getMultiWallPapers#65ad71dc as nil" )
}
b .PutID (AccountGetMultiWallPapersRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetMultiWallPapersRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getMultiWallPapers#65ad71dc as nil" )
}
b .PutVectorHeader (len (g .Wallpapers ))
for idx , v := range g .Wallpapers {
if v == nil {
return fmt .Errorf ("unable to encode account.getMultiWallPapers#65ad71dc: field wallpapers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.getMultiWallPapers#65ad71dc: field wallpapers element with index %d: %w" , idx , err )
}
}
return nil
}
func (g *AccountGetMultiWallPapersRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getMultiWallPapers#65ad71dc to nil" )
}
if err := b .ConsumeID (AccountGetMultiWallPapersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getMultiWallPapers#65ad71dc: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetMultiWallPapersRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getMultiWallPapers#65ad71dc to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode account.getMultiWallPapers#65ad71dc: field wallpapers: %w" , err )
}
if headerLen > 0 {
g .Wallpapers = make ([]InputWallPaperClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputWallPaper (b )
if err != nil {
return fmt .Errorf ("unable to decode account.getMultiWallPapers#65ad71dc: field wallpapers: %w" , err )
}
g .Wallpapers = append (g .Wallpapers , value )
}
}
return nil
}
func (g *AccountGetMultiWallPapersRequest ) GetWallpapers () (value []InputWallPaperClass ) {
if g == nil {
return
}
return g .Wallpapers
}
func (g *AccountGetMultiWallPapersRequest ) MapWallpapers () (value InputWallPaperClassArray ) {
return InputWallPaperClassArray (g .Wallpapers )
}
func (c *Client ) AccountGetMultiWallPapers (ctx context .Context , wallpapers []InputWallPaperClass ) ([]WallPaperClass , error ) {
var result WallPaperClassVector
request := &AccountGetMultiWallPapersRequest {
Wallpapers : wallpapers ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []WallPaperClass (result .Elems ), 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 .