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