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