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