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 PaymentsGetStarsTransactionsByIDRequest struct {
Flags bin .Fields
Ton bool
Peer InputPeerClass
ID []InputStarsTransaction
}
const PaymentsGetStarsTransactionsByIDRequestTypeID = 0x2dca16b8
var (
_ bin .Encoder = &PaymentsGetStarsTransactionsByIDRequest {}
_ bin .Decoder = &PaymentsGetStarsTransactionsByIDRequest {}
_ bin .BareEncoder = &PaymentsGetStarsTransactionsByIDRequest {}
_ bin .BareDecoder = &PaymentsGetStarsTransactionsByIDRequest {}
)
func (g *PaymentsGetStarsTransactionsByIDRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Ton == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .ID == nil ) {
return false
}
return true
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) String () string {
if g == nil {
return "PaymentsGetStarsTransactionsByIDRequest(nil)"
}
type Alias PaymentsGetStarsTransactionsByIDRequest
return fmt .Sprintf ("PaymentsGetStarsTransactionsByIDRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) FillFrom (from interface {
GetTon () (value bool )
GetPeer () (value InputPeerClass )
GetID () (value []InputStarsTransaction )
}) {
g .Ton = from .GetTon ()
g .Peer = from .GetPeer ()
g .ID = from .GetID ()
}
func (*PaymentsGetStarsTransactionsByIDRequest ) TypeID () uint32 {
return PaymentsGetStarsTransactionsByIDRequestTypeID
}
func (*PaymentsGetStarsTransactionsByIDRequest ) TypeName () string {
return "payments.getStarsTransactionsByID"
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getStarsTransactionsByID" ,
ID : PaymentsGetStarsTransactionsByIDRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Ton" ,
SchemaName : "ton" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) SetFlags () {
if !(g .Ton == false ) {
g .Flags .Set (0 )
}
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarsTransactionsByID#2dca16b8 as nil" )
}
b .PutID (PaymentsGetStarsTransactionsByIDRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarsTransactionsByID#2dca16b8 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsTransactionsByID#2dca16b8: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getStarsTransactionsByID#2dca16b8: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsTransactionsByID#2dca16b8: field peer: %w" , err )
}
b .PutVectorHeader (len (g .ID ))
for idx , v := range g .ID {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsTransactionsByID#2dca16b8: field id element with index %d: %w" , idx , err )
}
}
return nil
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarsTransactionsByID#2dca16b8 to nil" )
}
if err := b .ConsumeID (PaymentsGetStarsTransactionsByIDRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsTransactionsByID#2dca16b8: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarsTransactionsByID#2dca16b8 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsTransactionsByID#2dca16b8: field flags: %w" , err )
}
}
g .Ton = g .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsTransactionsByID#2dca16b8: field peer: %w" , err )
}
g .Peer = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsTransactionsByID#2dca16b8: field id: %w" , err )
}
if headerLen > 0 {
g .ID = make ([]InputStarsTransaction , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value InputStarsTransaction
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsTransactionsByID#2dca16b8: field id: %w" , err )
}
g .ID = append (g .ID , value )
}
}
return nil
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) SetTon (value bool ) {
if value {
g .Flags .Set (0 )
g .Ton = true
} else {
g .Flags .Unset (0 )
g .Ton = false
}
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) GetTon () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetStarsTransactionsByIDRequest ) GetID () (value []InputStarsTransaction ) {
if g == nil {
return
}
return g .ID
}
func (c *Client ) PaymentsGetStarsTransactionsByID (ctx context .Context , request *PaymentsGetStarsTransactionsByIDRequest ) (*PaymentsStarsStatus , error ) {
var result PaymentsStarsStatus
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 .