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 PaymentsGetStarGiftUpgradeAttributesRequest struct {
GiftID int64
}
const PaymentsGetStarGiftUpgradeAttributesRequestTypeID = 0x6d038b58
var (
_ bin .Encoder = &PaymentsGetStarGiftUpgradeAttributesRequest {}
_ bin .Decoder = &PaymentsGetStarGiftUpgradeAttributesRequest {}
_ bin .BareEncoder = &PaymentsGetStarGiftUpgradeAttributesRequest {}
_ bin .BareDecoder = &PaymentsGetStarGiftUpgradeAttributesRequest {}
)
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .GiftID == 0 ) {
return false
}
return true
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) String () string {
if g == nil {
return "PaymentsGetStarGiftUpgradeAttributesRequest(nil)"
}
type Alias PaymentsGetStarGiftUpgradeAttributesRequest
return fmt .Sprintf ("PaymentsGetStarGiftUpgradeAttributesRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) FillFrom (from interface {
GetGiftID () (value int64 )
}) {
g .GiftID = from .GetGiftID ()
}
func (*PaymentsGetStarGiftUpgradeAttributesRequest ) TypeID () uint32 {
return PaymentsGetStarGiftUpgradeAttributesRequestTypeID
}
func (*PaymentsGetStarGiftUpgradeAttributesRequest ) TypeName () string {
return "payments.getStarGiftUpgradeAttributes"
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getStarGiftUpgradeAttributes" ,
ID : PaymentsGetStarGiftUpgradeAttributesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "GiftID" ,
SchemaName : "gift_id" ,
},
}
return typ
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil" )
}
b .PutID (PaymentsGetStarGiftUpgradeAttributesRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil" )
}
b .PutLong (g .GiftID )
return nil
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil" )
}
if err := b .ConsumeID (PaymentsGetStarGiftUpgradeAttributesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: field gift_id: %w" , err )
}
g .GiftID = value
}
return nil
}
func (g *PaymentsGetStarGiftUpgradeAttributesRequest ) GetGiftID () (value int64 ) {
if g == nil {
return
}
return g .GiftID
}
func (c *Client ) PaymentsGetStarGiftUpgradeAttributes (ctx context .Context , giftid int64 ) (*PaymentsStarGiftUpgradeAttributes , error ) {
var result PaymentsStarGiftUpgradeAttributes
request := &PaymentsGetStarGiftUpgradeAttributesRequest {
GiftID : giftid ,
}
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 .