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 PaymentsConvertStarGiftRequest struct {
Stargift InputSavedStarGiftClass
}
const PaymentsConvertStarGiftRequestTypeID = 0x74bf076b
var (
_ bin .Encoder = &PaymentsConvertStarGiftRequest {}
_ bin .Decoder = &PaymentsConvertStarGiftRequest {}
_ bin .BareEncoder = &PaymentsConvertStarGiftRequest {}
_ bin .BareDecoder = &PaymentsConvertStarGiftRequest {}
)
func (c *PaymentsConvertStarGiftRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Stargift == nil ) {
return false
}
return true
}
func (c *PaymentsConvertStarGiftRequest ) String () string {
if c == nil {
return "PaymentsConvertStarGiftRequest(nil)"
}
type Alias PaymentsConvertStarGiftRequest
return fmt .Sprintf ("PaymentsConvertStarGiftRequest%+v" , Alias (*c ))
}
func (c *PaymentsConvertStarGiftRequest ) FillFrom (from interface {
GetStargift () (value InputSavedStarGiftClass )
}) {
c .Stargift = from .GetStargift ()
}
func (*PaymentsConvertStarGiftRequest ) TypeID () uint32 {
return PaymentsConvertStarGiftRequestTypeID
}
func (*PaymentsConvertStarGiftRequest ) TypeName () string {
return "payments.convertStarGift"
}
func (c *PaymentsConvertStarGiftRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.convertStarGift" ,
ID : PaymentsConvertStarGiftRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stargift" ,
SchemaName : "stargift" ,
},
}
return typ
}
func (c *PaymentsConvertStarGiftRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode payments.convertStarGift#74bf076b as nil" )
}
b .PutID (PaymentsConvertStarGiftRequestTypeID )
return c .EncodeBare (b )
}
func (c *PaymentsConvertStarGiftRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode payments.convertStarGift#74bf076b as nil" )
}
if c .Stargift == nil {
return fmt .Errorf ("unable to encode payments.convertStarGift#74bf076b: field stargift is nil" )
}
if err := c .Stargift .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.convertStarGift#74bf076b: field stargift: %w" , err )
}
return nil
}
func (c *PaymentsConvertStarGiftRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode payments.convertStarGift#74bf076b to nil" )
}
if err := b .ConsumeID (PaymentsConvertStarGiftRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.convertStarGift#74bf076b: %w" , err )
}
return c .DecodeBare (b )
}
func (c *PaymentsConvertStarGiftRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode payments.convertStarGift#74bf076b to nil" )
}
{
value , err := DecodeInputSavedStarGift (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.convertStarGift#74bf076b: field stargift: %w" , err )
}
c .Stargift = value
}
return nil
}
func (c *PaymentsConvertStarGiftRequest ) GetStargift () (value InputSavedStarGiftClass ) {
if c == nil {
return
}
return c .Stargift
}
func (c *Client ) PaymentsConvertStarGift (ctx context .Context , stargift InputSavedStarGiftClass ) (bool , error ) {
var result BoolBox
request := &PaymentsConvertStarGiftRequest {
Stargift : stargift ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .