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 AccountGetThemesRequest struct {
Format string
Hash int64
}
const AccountGetThemesRequestTypeID = 0x7206e458
var (
_ bin .Encoder = &AccountGetThemesRequest {}
_ bin .Decoder = &AccountGetThemesRequest {}
_ bin .BareEncoder = &AccountGetThemesRequest {}
_ bin .BareDecoder = &AccountGetThemesRequest {}
)
func (g *AccountGetThemesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Format == "" ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *AccountGetThemesRequest ) String () string {
if g == nil {
return "AccountGetThemesRequest(nil)"
}
type Alias AccountGetThemesRequest
return fmt .Sprintf ("AccountGetThemesRequest%+v" , Alias (*g ))
}
func (g *AccountGetThemesRequest ) FillFrom (from interface {
GetFormat () (value string )
GetHash () (value int64 )
}) {
g .Format = from .GetFormat ()
g .Hash = from .GetHash ()
}
func (*AccountGetThemesRequest ) TypeID () uint32 {
return AccountGetThemesRequestTypeID
}
func (*AccountGetThemesRequest ) TypeName () string {
return "account.getThemes"
}
func (g *AccountGetThemesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getThemes" ,
ID : AccountGetThemesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Format" ,
SchemaName : "format" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *AccountGetThemesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getThemes#7206e458 as nil" )
}
b .PutID (AccountGetThemesRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetThemesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getThemes#7206e458 as nil" )
}
b .PutString (g .Format )
b .PutLong (g .Hash )
return nil
}
func (g *AccountGetThemesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getThemes#7206e458 to nil" )
}
if err := b .ConsumeID (AccountGetThemesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getThemes#7206e458: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetThemesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getThemes#7206e458 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.getThemes#7206e458: field format: %w" , err )
}
g .Format = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.getThemes#7206e458: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *AccountGetThemesRequest ) GetFormat () (value string ) {
if g == nil {
return
}
return g .Format
}
func (g *AccountGetThemesRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) AccountGetThemes (ctx context .Context , request *AccountGetThemesRequest ) (AccountThemesClass , error ) {
var result AccountThemesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Themes , 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 .