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 WalletGetTransactionsRequest struct {
Flags bin .Fields
Inbound bool
Outbound bool
Offset string
Limit int
}
const WalletGetTransactionsRequestTypeID = 0xa8830a83
var (
_ bin .Encoder = &WalletGetTransactionsRequest {}
_ bin .Decoder = &WalletGetTransactionsRequest {}
_ bin .BareEncoder = &WalletGetTransactionsRequest {}
_ bin .BareDecoder = &WalletGetTransactionsRequest {}
)
func (g *WalletGetTransactionsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Inbound == false ) {
return false
}
if !(g .Outbound == false ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *WalletGetTransactionsRequest ) String () string {
if g == nil {
return "WalletGetTransactionsRequest(nil)"
}
type Alias WalletGetTransactionsRequest
return fmt .Sprintf ("WalletGetTransactionsRequest%+v" , Alias (*g ))
}
func (g *WalletGetTransactionsRequest ) FillFrom (from interface {
GetInbound () (value bool )
GetOutbound () (value bool )
GetOffset () (value string )
GetLimit () (value int )
}) {
g .Inbound = from .GetInbound ()
g .Outbound = from .GetOutbound ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*WalletGetTransactionsRequest ) TypeID () uint32 {
return WalletGetTransactionsRequestTypeID
}
func (*WalletGetTransactionsRequest ) TypeName () string {
return "wallet.getTransactions"
}
func (g *WalletGetTransactionsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.getTransactions" ,
ID : WalletGetTransactionsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Inbound" ,
SchemaName : "inbound" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Outbound" ,
SchemaName : "outbound" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *WalletGetTransactionsRequest ) SetFlags () {
if !(g .Inbound == false ) {
g .Flags .Set (0 )
}
if !(g .Outbound == false ) {
g .Flags .Set (1 )
}
}
func (g *WalletGetTransactionsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode wallet.getTransactions#a8830a83 as nil" )
}
b .PutID (WalletGetTransactionsRequestTypeID )
return g .EncodeBare (b )
}
func (g *WalletGetTransactionsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode wallet.getTransactions#a8830a83 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.getTransactions#a8830a83: field flags: %w" , err )
}
b .PutString (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *WalletGetTransactionsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode wallet.getTransactions#a8830a83 to nil" )
}
if err := b .ConsumeID (WalletGetTransactionsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactions#a8830a83: %w" , err )
}
return g .DecodeBare (b )
}
func (g *WalletGetTransactionsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode wallet.getTransactions#a8830a83 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactions#a8830a83: field flags: %w" , err )
}
}
g .Inbound = g .Flags .Has (0 )
g .Outbound = g .Flags .Has (1 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactions#a8830a83: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactions#a8830a83: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *WalletGetTransactionsRequest ) SetInbound (value bool ) {
if value {
g .Flags .Set (0 )
g .Inbound = true
} else {
g .Flags .Unset (0 )
g .Inbound = false
}
}
func (g *WalletGetTransactionsRequest ) GetInbound () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *WalletGetTransactionsRequest ) SetOutbound (value bool ) {
if value {
g .Flags .Set (1 )
g .Outbound = true
} else {
g .Flags .Unset (1 )
g .Outbound = false
}
}
func (g *WalletGetTransactionsRequest ) GetOutbound () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (g *WalletGetTransactionsRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *WalletGetTransactionsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) WalletGetTransactions (ctx context .Context , request *WalletGetTransactionsRequest ) (*WalletTransactions , error ) {
var result WalletTransactions
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .