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 InputStarsTransaction struct {
Flags bin .Fields
Refund bool
ID string
}
const InputStarsTransactionTypeID = 0x206ae6d1
var (
_ bin .Encoder = &InputStarsTransaction {}
_ bin .Decoder = &InputStarsTransaction {}
_ bin .BareEncoder = &InputStarsTransaction {}
_ bin .BareDecoder = &InputStarsTransaction {}
)
func (i *InputStarsTransaction ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Refund == false ) {
return false
}
if !(i .ID == "" ) {
return false
}
return true
}
func (i *InputStarsTransaction ) String () string {
if i == nil {
return "InputStarsTransaction(nil)"
}
type Alias InputStarsTransaction
return fmt .Sprintf ("InputStarsTransaction%+v" , Alias (*i ))
}
func (i *InputStarsTransaction ) FillFrom (from interface {
GetRefund () (value bool )
GetID () (value string )
}) {
i .Refund = from .GetRefund ()
i .ID = from .GetID ()
}
func (*InputStarsTransaction ) TypeID () uint32 {
return InputStarsTransactionTypeID
}
func (*InputStarsTransaction ) TypeName () string {
return "inputStarsTransaction"
}
func (i *InputStarsTransaction ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputStarsTransaction" ,
ID : InputStarsTransactionTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Refund" ,
SchemaName : "refund" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (i *InputStarsTransaction ) SetFlags () {
if !(i .Refund == false ) {
i .Flags .Set (0 )
}
}
func (i *InputStarsTransaction ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStarsTransaction#206ae6d1 as nil" )
}
b .PutID (InputStarsTransactionTypeID )
return i .EncodeBare (b )
}
func (i *InputStarsTransaction ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStarsTransaction#206ae6d1 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputStarsTransaction#206ae6d1: field flags: %w" , err )
}
b .PutString (i .ID )
return nil
}
func (i *InputStarsTransaction ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStarsTransaction#206ae6d1 to nil" )
}
if err := b .ConsumeID (InputStarsTransactionTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputStarsTransaction#206ae6d1: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputStarsTransaction ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStarsTransaction#206ae6d1 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputStarsTransaction#206ae6d1: field flags: %w" , err )
}
}
i .Refund = i .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputStarsTransaction#206ae6d1: field id: %w" , err )
}
i .ID = value
}
return nil
}
func (i *InputStarsTransaction ) SetRefund (value bool ) {
if value {
i .Flags .Set (0 )
i .Refund = true
} else {
i .Flags .Unset (0 )
i .Refund = false
}
}
func (i *InputStarsTransaction ) GetRefund () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (0 )
}
func (i *InputStarsTransaction ) GetID () (value string ) {
if i == nil {
return
}
return i .ID
}
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 .