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 AccountInstallWallPaperRequest struct {
Wallpaper InputWallPaperClass
Settings WallPaperSettings
}
const AccountInstallWallPaperRequestTypeID = 0xfeed5769
var (
_ bin .Encoder = &AccountInstallWallPaperRequest {}
_ bin .Decoder = &AccountInstallWallPaperRequest {}
_ bin .BareEncoder = &AccountInstallWallPaperRequest {}
_ bin .BareDecoder = &AccountInstallWallPaperRequest {}
)
func (i *AccountInstallWallPaperRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Wallpaper == nil ) {
return false
}
if !(i .Settings .Zero ()) {
return false
}
return true
}
func (i *AccountInstallWallPaperRequest ) String () string {
if i == nil {
return "AccountInstallWallPaperRequest(nil)"
}
type Alias AccountInstallWallPaperRequest
return fmt .Sprintf ("AccountInstallWallPaperRequest%+v" , Alias (*i ))
}
func (i *AccountInstallWallPaperRequest ) FillFrom (from interface {
GetWallpaper () (value InputWallPaperClass )
GetSettings () (value WallPaperSettings )
}) {
i .Wallpaper = from .GetWallpaper ()
i .Settings = from .GetSettings ()
}
func (*AccountInstallWallPaperRequest ) TypeID () uint32 {
return AccountInstallWallPaperRequestTypeID
}
func (*AccountInstallWallPaperRequest ) TypeName () string {
return "account.installWallPaper"
}
func (i *AccountInstallWallPaperRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.installWallPaper" ,
ID : AccountInstallWallPaperRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Wallpaper" ,
SchemaName : "wallpaper" ,
},
{
Name : "Settings" ,
SchemaName : "settings" ,
},
}
return typ
}
func (i *AccountInstallWallPaperRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode account.installWallPaper#feed5769 as nil" )
}
b .PutID (AccountInstallWallPaperRequestTypeID )
return i .EncodeBare (b )
}
func (i *AccountInstallWallPaperRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode account.installWallPaper#feed5769 as nil" )
}
if i .Wallpaper == nil {
return fmt .Errorf ("unable to encode account.installWallPaper#feed5769: field wallpaper is nil" )
}
if err := i .Wallpaper .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.installWallPaper#feed5769: field wallpaper: %w" , err )
}
if err := i .Settings .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.installWallPaper#feed5769: field settings: %w" , err )
}
return nil
}
func (i *AccountInstallWallPaperRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode account.installWallPaper#feed5769 to nil" )
}
if err := b .ConsumeID (AccountInstallWallPaperRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.installWallPaper#feed5769: %w" , err )
}
return i .DecodeBare (b )
}
func (i *AccountInstallWallPaperRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode account.installWallPaper#feed5769 to nil" )
}
{
value , err := DecodeInputWallPaper (b )
if err != nil {
return fmt .Errorf ("unable to decode account.installWallPaper#feed5769: field wallpaper: %w" , err )
}
i .Wallpaper = value
}
{
if err := i .Settings .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.installWallPaper#feed5769: field settings: %w" , err )
}
}
return nil
}
func (i *AccountInstallWallPaperRequest ) GetWallpaper () (value InputWallPaperClass ) {
if i == nil {
return
}
return i .Wallpaper
}
func (i *AccountInstallWallPaperRequest ) GetSettings () (value WallPaperSettings ) {
if i == nil {
return
}
return i .Settings
}
func (c *Client ) AccountInstallWallPaper (ctx context .Context , request *AccountInstallWallPaperRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .