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 PaymentsDisplayStarGiftRequest struct {
Flags bin .Fields
Peer InputPeerClass
Slug string
}
const PaymentsDisplayStarGiftRequestTypeID = 0x4aa5f0fe
var (
_ bin .Encoder = &PaymentsDisplayStarGiftRequest {}
_ bin .Decoder = &PaymentsDisplayStarGiftRequest {}
_ bin .BareEncoder = &PaymentsDisplayStarGiftRequest {}
_ bin .BareDecoder = &PaymentsDisplayStarGiftRequest {}
)
func (d *PaymentsDisplayStarGiftRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .Flags .Zero ()) {
return false
}
if !(d .Peer == nil ) {
return false
}
if !(d .Slug == "" ) {
return false
}
return true
}
func (d *PaymentsDisplayStarGiftRequest ) String () string {
if d == nil {
return "PaymentsDisplayStarGiftRequest(nil)"
}
type Alias PaymentsDisplayStarGiftRequest
return fmt .Sprintf ("PaymentsDisplayStarGiftRequest%+v" , Alias (*d ))
}
func (d *PaymentsDisplayStarGiftRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass , ok bool )
GetSlug () (value string )
}) {
if val , ok := from .GetPeer (); ok {
d .Peer = val
}
d .Slug = from .GetSlug ()
}
func (*PaymentsDisplayStarGiftRequest ) TypeID () uint32 {
return PaymentsDisplayStarGiftRequestTypeID
}
func (*PaymentsDisplayStarGiftRequest ) TypeName () string {
return "payments.displayStarGift"
}
func (d *PaymentsDisplayStarGiftRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.displayStarGift" ,
ID : PaymentsDisplayStarGiftRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
Null : !d .Flags .Has (0 ),
},
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (d *PaymentsDisplayStarGiftRequest ) SetFlags () {
if !(d .Peer == nil ) {
d .Flags .Set (0 )
}
}
func (d *PaymentsDisplayStarGiftRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode payments.displayStarGift#4aa5f0fe as nil" )
}
b .PutID (PaymentsDisplayStarGiftRequestTypeID )
return d .EncodeBare (b )
}
func (d *PaymentsDisplayStarGiftRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode payments.displayStarGift#4aa5f0fe as nil" )
}
d .SetFlags ()
if err := d .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.displayStarGift#4aa5f0fe: field flags: %w" , err )
}
if d .Flags .Has (0 ) {
if d .Peer == nil {
return fmt .Errorf ("unable to encode payments.displayStarGift#4aa5f0fe: field peer is nil" )
}
if err := d .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.displayStarGift#4aa5f0fe: field peer: %w" , err )
}
}
b .PutString (d .Slug )
return nil
}
func (d *PaymentsDisplayStarGiftRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode payments.displayStarGift#4aa5f0fe to nil" )
}
if err := b .ConsumeID (PaymentsDisplayStarGiftRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.displayStarGift#4aa5f0fe: %w" , err )
}
return d .DecodeBare (b )
}
func (d *PaymentsDisplayStarGiftRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode payments.displayStarGift#4aa5f0fe to nil" )
}
{
if err := d .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.displayStarGift#4aa5f0fe: field flags: %w" , err )
}
}
if d .Flags .Has (0 ) {
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.displayStarGift#4aa5f0fe: field peer: %w" , err )
}
d .Peer = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.displayStarGift#4aa5f0fe: field slug: %w" , err )
}
d .Slug = value
}
return nil
}
func (d *PaymentsDisplayStarGiftRequest ) SetPeer (value InputPeerClass ) {
d .Flags .Set (0 )
d .Peer = value
}
func (d *PaymentsDisplayStarGiftRequest ) GetPeer () (value InputPeerClass , ok bool ) {
if d == nil {
return
}
if !d .Flags .Has (0 ) {
return value , false
}
return d .Peer , true
}
func (d *PaymentsDisplayStarGiftRequest ) GetSlug () (value string ) {
if d == nil {
return
}
return d .Slug
}
func (c *Client ) PaymentsDisplayStarGift (ctx context .Context , request *PaymentsDisplayStarGiftRequest ) (bool , error ) {
var result BoolBox
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 .