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 InputStarGiftAuction struct {
GiftID int64
}
const InputStarGiftAuctionTypeID = 0x2e16c98
func (i InputStarGiftAuction ) construct () InputStarGiftAuctionClass { return &i }
var (
_ bin .Encoder = &InputStarGiftAuction {}
_ bin .Decoder = &InputStarGiftAuction {}
_ bin .BareEncoder = &InputStarGiftAuction {}
_ bin .BareDecoder = &InputStarGiftAuction {}
_ InputStarGiftAuctionClass = &InputStarGiftAuction {}
)
func (i *InputStarGiftAuction ) Zero () bool {
if i == nil {
return true
}
if !(i .GiftID == 0 ) {
return false
}
return true
}
func (i *InputStarGiftAuction ) String () string {
if i == nil {
return "InputStarGiftAuction(nil)"
}
type Alias InputStarGiftAuction
return fmt .Sprintf ("InputStarGiftAuction%+v" , Alias (*i ))
}
func (i *InputStarGiftAuction ) FillFrom (from interface {
GetGiftID () (value int64 )
}) {
i .GiftID = from .GetGiftID ()
}
func (*InputStarGiftAuction ) TypeID () uint32 {
return InputStarGiftAuctionTypeID
}
func (*InputStarGiftAuction ) TypeName () string {
return "inputStarGiftAuction"
}
func (i *InputStarGiftAuction ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputStarGiftAuction" ,
ID : InputStarGiftAuctionTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "GiftID" ,
SchemaName : "gift_id" ,
},
}
return typ
}
func (i *InputStarGiftAuction ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStarGiftAuction#2e16c98 as nil" )
}
b .PutID (InputStarGiftAuctionTypeID )
return i .EncodeBare (b )
}
func (i *InputStarGiftAuction ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStarGiftAuction#2e16c98 as nil" )
}
b .PutLong (i .GiftID )
return nil
}
func (i *InputStarGiftAuction ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStarGiftAuction#2e16c98 to nil" )
}
if err := b .ConsumeID (InputStarGiftAuctionTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputStarGiftAuction#2e16c98: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputStarGiftAuction ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStarGiftAuction#2e16c98 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputStarGiftAuction#2e16c98: field gift_id: %w" , err )
}
i .GiftID = value
}
return nil
}
func (i *InputStarGiftAuction ) GetGiftID () (value int64 ) {
if i == nil {
return
}
return i .GiftID
}
type InputStarGiftAuctionSlug struct {
Slug string
}
const InputStarGiftAuctionSlugTypeID = 0x7ab58308
func (i InputStarGiftAuctionSlug ) construct () InputStarGiftAuctionClass { return &i }
var (
_ bin .Encoder = &InputStarGiftAuctionSlug {}
_ bin .Decoder = &InputStarGiftAuctionSlug {}
_ bin .BareEncoder = &InputStarGiftAuctionSlug {}
_ bin .BareDecoder = &InputStarGiftAuctionSlug {}
_ InputStarGiftAuctionClass = &InputStarGiftAuctionSlug {}
)
func (i *InputStarGiftAuctionSlug ) Zero () bool {
if i == nil {
return true
}
if !(i .Slug == "" ) {
return false
}
return true
}
func (i *InputStarGiftAuctionSlug ) String () string {
if i == nil {
return "InputStarGiftAuctionSlug(nil)"
}
type Alias InputStarGiftAuctionSlug
return fmt .Sprintf ("InputStarGiftAuctionSlug%+v" , Alias (*i ))
}
func (i *InputStarGiftAuctionSlug ) FillFrom (from interface {
GetSlug () (value string )
}) {
i .Slug = from .GetSlug ()
}
func (*InputStarGiftAuctionSlug ) TypeID () uint32 {
return InputStarGiftAuctionSlugTypeID
}
func (*InputStarGiftAuctionSlug ) TypeName () string {
return "inputStarGiftAuctionSlug"
}
func (i *InputStarGiftAuctionSlug ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputStarGiftAuctionSlug" ,
ID : InputStarGiftAuctionSlugTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (i *InputStarGiftAuctionSlug ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStarGiftAuctionSlug#7ab58308 as nil" )
}
b .PutID (InputStarGiftAuctionSlugTypeID )
return i .EncodeBare (b )
}
func (i *InputStarGiftAuctionSlug ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStarGiftAuctionSlug#7ab58308 as nil" )
}
b .PutString (i .Slug )
return nil
}
func (i *InputStarGiftAuctionSlug ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStarGiftAuctionSlug#7ab58308 to nil" )
}
if err := b .ConsumeID (InputStarGiftAuctionSlugTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputStarGiftAuctionSlug#7ab58308: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputStarGiftAuctionSlug ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStarGiftAuctionSlug#7ab58308 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputStarGiftAuctionSlug#7ab58308: field slug: %w" , err )
}
i .Slug = value
}
return nil
}
func (i *InputStarGiftAuctionSlug ) GetSlug () (value string ) {
if i == nil {
return
}
return i .Slug
}
const InputStarGiftAuctionClassName = "InputStarGiftAuction"
type InputStarGiftAuctionClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputStarGiftAuctionClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputStarGiftAuction (buf *bin .Buffer ) (InputStarGiftAuctionClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputStarGiftAuctionTypeID :
v := InputStarGiftAuction {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputStarGiftAuctionClass: %w" , err )
}
return &v , nil
case InputStarGiftAuctionSlugTypeID :
v := InputStarGiftAuctionSlug {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputStarGiftAuctionClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputStarGiftAuctionClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputStarGiftAuctionBox struct {
InputStarGiftAuction InputStarGiftAuctionClass
}
func (b *InputStarGiftAuctionBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputStarGiftAuctionBox to nil" )
}
v , err := DecodeInputStarGiftAuction (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputStarGiftAuction = v
return nil
}
func (b *InputStarGiftAuctionBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputStarGiftAuction == nil {
return fmt .Errorf ("unable to encode InputStarGiftAuctionClass as nil" )
}
return b .InputStarGiftAuction .Encode (buf )
}
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 .