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