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 PaymentsGetStarGiftAuctionStateRequest struct {
Auction InputStarGiftAuctionClass
Version int
}
const PaymentsGetStarGiftAuctionStateRequestTypeID = 0x5c9ff4d6
var (
_ bin .Encoder = &PaymentsGetStarGiftAuctionStateRequest {}
_ bin .Decoder = &PaymentsGetStarGiftAuctionStateRequest {}
_ bin .BareEncoder = &PaymentsGetStarGiftAuctionStateRequest {}
_ bin .BareDecoder = &PaymentsGetStarGiftAuctionStateRequest {}
)
func (g *PaymentsGetStarGiftAuctionStateRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Auction == nil ) {
return false
}
if !(g .Version == 0 ) {
return false
}
return true
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) String () string {
if g == nil {
return "PaymentsGetStarGiftAuctionStateRequest(nil)"
}
type Alias PaymentsGetStarGiftAuctionStateRequest
return fmt .Sprintf ("PaymentsGetStarGiftAuctionStateRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) FillFrom (from interface {
GetAuction () (value InputStarGiftAuctionClass )
GetVersion () (value int )
}) {
g .Auction = from .GetAuction ()
g .Version = from .GetVersion ()
}
func (*PaymentsGetStarGiftAuctionStateRequest ) TypeID () uint32 {
return PaymentsGetStarGiftAuctionStateRequestTypeID
}
func (*PaymentsGetStarGiftAuctionStateRequest ) TypeName () string {
return "payments.getStarGiftAuctionState"
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getStarGiftAuctionState" ,
ID : PaymentsGetStarGiftAuctionStateRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Auction" ,
SchemaName : "auction" ,
},
{
Name : "Version" ,
SchemaName : "version" ,
},
}
return typ
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarGiftAuctionState#5c9ff4d6 as nil" )
}
b .PutID (PaymentsGetStarGiftAuctionStateRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarGiftAuctionState#5c9ff4d6 as nil" )
}
if g .Auction == nil {
return fmt .Errorf ("unable to encode payments.getStarGiftAuctionState#5c9ff4d6: field auction is nil" )
}
if err := g .Auction .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarGiftAuctionState#5c9ff4d6: field auction: %w" , err )
}
b .PutInt (g .Version )
return nil
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarGiftAuctionState#5c9ff4d6 to nil" )
}
if err := b .ConsumeID (PaymentsGetStarGiftAuctionStateRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftAuctionState#5c9ff4d6: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarGiftAuctionState#5c9ff4d6 to nil" )
}
{
value , err := DecodeInputStarGiftAuction (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftAuctionState#5c9ff4d6: field auction: %w" , err )
}
g .Auction = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftAuctionState#5c9ff4d6: field version: %w" , err )
}
g .Version = value
}
return nil
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) GetAuction () (value InputStarGiftAuctionClass ) {
if g == nil {
return
}
return g .Auction
}
func (g *PaymentsGetStarGiftAuctionStateRequest ) GetVersion () (value int ) {
if g == nil {
return
}
return g .Version
}
func (c *Client ) PaymentsGetStarGiftAuctionState (ctx context .Context , request *PaymentsGetStarGiftAuctionStateRequest ) (*PaymentsStarGiftAuctionState , error ) {
var result PaymentsStarGiftAuctionState
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .