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 AccountGetUniqueGiftChatThemesRequest struct {
Offset string
Limit int
Hash int64
}
const AccountGetUniqueGiftChatThemesRequestTypeID = 0xe42ce9c9
var (
_ bin .Encoder = &AccountGetUniqueGiftChatThemesRequest {}
_ bin .Decoder = &AccountGetUniqueGiftChatThemesRequest {}
_ bin .BareEncoder = &AccountGetUniqueGiftChatThemesRequest {}
_ bin .BareDecoder = &AccountGetUniqueGiftChatThemesRequest {}
)
func (g *AccountGetUniqueGiftChatThemesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *AccountGetUniqueGiftChatThemesRequest ) String () string {
if g == nil {
return "AccountGetUniqueGiftChatThemesRequest(nil)"
}
type Alias AccountGetUniqueGiftChatThemesRequest
return fmt .Sprintf ("AccountGetUniqueGiftChatThemesRequest%+v" , Alias (*g ))
}
func (g *AccountGetUniqueGiftChatThemesRequest ) FillFrom (from interface {
GetOffset () (value string )
GetLimit () (value int )
GetHash () (value int64 )
}) {
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
g .Hash = from .GetHash ()
}
func (*AccountGetUniqueGiftChatThemesRequest ) TypeID () uint32 {
return AccountGetUniqueGiftChatThemesRequestTypeID
}
func (*AccountGetUniqueGiftChatThemesRequest ) TypeName () string {
return "account.getUniqueGiftChatThemes"
}
func (g *AccountGetUniqueGiftChatThemesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getUniqueGiftChatThemes" ,
ID : AccountGetUniqueGiftChatThemesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *AccountGetUniqueGiftChatThemesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getUniqueGiftChatThemes#e42ce9c9 as nil" )
}
b .PutID (AccountGetUniqueGiftChatThemesRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetUniqueGiftChatThemesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getUniqueGiftChatThemes#e42ce9c9 as nil" )
}
b .PutString (g .Offset )
b .PutInt (g .Limit )
b .PutLong (g .Hash )
return nil
}
func (g *AccountGetUniqueGiftChatThemesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getUniqueGiftChatThemes#e42ce9c9 to nil" )
}
if err := b .ConsumeID (AccountGetUniqueGiftChatThemesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getUniqueGiftChatThemes#e42ce9c9: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetUniqueGiftChatThemesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getUniqueGiftChatThemes#e42ce9c9 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.getUniqueGiftChatThemes#e42ce9c9: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode account.getUniqueGiftChatThemes#e42ce9c9: field limit: %w" , err )
}
g .Limit = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.getUniqueGiftChatThemes#e42ce9c9: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *AccountGetUniqueGiftChatThemesRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *AccountGetUniqueGiftChatThemesRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *AccountGetUniqueGiftChatThemesRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) AccountGetUniqueGiftChatThemes (ctx context .Context , request *AccountGetUniqueGiftChatThemesRequest ) (AccountChatThemesClass , error ) {
var result AccountChatThemesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .ChatThemes , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .