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 AccountGetThemeRequest struct {
Format string
Theme InputThemeClass
}
const AccountGetThemeRequestTypeID = 0x3a5869ec
var (
_ bin .Encoder = &AccountGetThemeRequest {}
_ bin .Decoder = &AccountGetThemeRequest {}
_ bin .BareEncoder = &AccountGetThemeRequest {}
_ bin .BareDecoder = &AccountGetThemeRequest {}
)
func (g *AccountGetThemeRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Format == "" ) {
return false
}
if !(g .Theme == nil ) {
return false
}
return true
}
func (g *AccountGetThemeRequest ) String () string {
if g == nil {
return "AccountGetThemeRequest(nil)"
}
type Alias AccountGetThemeRequest
return fmt .Sprintf ("AccountGetThemeRequest%+v" , Alias (*g ))
}
func (g *AccountGetThemeRequest ) FillFrom (from interface {
GetFormat () (value string )
GetTheme () (value InputThemeClass )
}) {
g .Format = from .GetFormat ()
g .Theme = from .GetTheme ()
}
func (*AccountGetThemeRequest ) TypeID () uint32 {
return AccountGetThemeRequestTypeID
}
func (*AccountGetThemeRequest ) TypeName () string {
return "account.getTheme"
}
func (g *AccountGetThemeRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getTheme" ,
ID : AccountGetThemeRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Format" ,
SchemaName : "format" ,
},
{
Name : "Theme" ,
SchemaName : "theme" ,
},
}
return typ
}
func (g *AccountGetThemeRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getTheme#3a5869ec as nil" )
}
b .PutID (AccountGetThemeRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetThemeRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getTheme#3a5869ec as nil" )
}
b .PutString (g .Format )
if g .Theme == nil {
return fmt .Errorf ("unable to encode account.getTheme#3a5869ec: field theme is nil" )
}
if err := g .Theme .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.getTheme#3a5869ec: field theme: %w" , err )
}
return nil
}
func (g *AccountGetThemeRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getTheme#3a5869ec to nil" )
}
if err := b .ConsumeID (AccountGetThemeRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getTheme#3a5869ec: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetThemeRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getTheme#3a5869ec to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.getTheme#3a5869ec: field format: %w" , err )
}
g .Format = value
}
{
value , err := DecodeInputTheme (b )
if err != nil {
return fmt .Errorf ("unable to decode account.getTheme#3a5869ec: field theme: %w" , err )
}
g .Theme = value
}
return nil
}
func (g *AccountGetThemeRequest ) GetFormat () (value string ) {
if g == nil {
return
}
return g .Format
}
func (g *AccountGetThemeRequest ) GetTheme () (value InputThemeClass ) {
if g == nil {
return
}
return g .Theme
}
func (c *Client ) AccountGetTheme (ctx context .Context , request *AccountGetThemeRequest ) (*Theme , error ) {
var result Theme
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .