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 WalletGetTransactionsByIDsRequest struct {
ID []string
}
const WalletGetTransactionsByIDsRequestTypeID = 0x811ceab6
var (
_ bin .Encoder = &WalletGetTransactionsByIDsRequest {}
_ bin .Decoder = &WalletGetTransactionsByIDsRequest {}
_ bin .BareEncoder = &WalletGetTransactionsByIDsRequest {}
_ bin .BareDecoder = &WalletGetTransactionsByIDsRequest {}
)
func (g *WalletGetTransactionsByIDsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .ID == nil ) {
return false
}
return true
}
func (g *WalletGetTransactionsByIDsRequest ) String () string {
if g == nil {
return "WalletGetTransactionsByIDsRequest(nil)"
}
type Alias WalletGetTransactionsByIDsRequest
return fmt .Sprintf ("WalletGetTransactionsByIDsRequest%+v" , Alias (*g ))
}
func (g *WalletGetTransactionsByIDsRequest ) FillFrom (from interface {
GetID () (value []string )
}) {
g .ID = from .GetID ()
}
func (*WalletGetTransactionsByIDsRequest ) TypeID () uint32 {
return WalletGetTransactionsByIDsRequestTypeID
}
func (*WalletGetTransactionsByIDsRequest ) TypeName () string {
return "wallet.getTransactionsByIDs"
}
func (g *WalletGetTransactionsByIDsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.getTransactionsByIDs" ,
ID : WalletGetTransactionsByIDsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (g *WalletGetTransactionsByIDsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode wallet.getTransactionsByIDs#811ceab6 as nil" )
}
b .PutID (WalletGetTransactionsByIDsRequestTypeID )
return g .EncodeBare (b )
}
func (g *WalletGetTransactionsByIDsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode wallet.getTransactionsByIDs#811ceab6 as nil" )
}
b .PutVectorHeader (len (g .ID ))
for _ , v := range g .ID {
b .PutString (v )
}
return nil
}
func (g *WalletGetTransactionsByIDsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode wallet.getTransactionsByIDs#811ceab6 to nil" )
}
if err := b .ConsumeID (WalletGetTransactionsByIDsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactionsByIDs#811ceab6: %w" , err )
}
return g .DecodeBare (b )
}
func (g *WalletGetTransactionsByIDsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode wallet.getTransactionsByIDs#811ceab6 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactionsByIDs#811ceab6: field id: %w" , err )
}
if headerLen > 0 {
g .ID = make ([]string , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.getTransactionsByIDs#811ceab6: field id: %w" , err )
}
g .ID = append (g .ID , value )
}
}
return nil
}
func (g *WalletGetTransactionsByIDsRequest ) GetID () (value []string ) {
if g == nil {
return
}
return g .ID
}
func (c *Client ) WalletGetTransactionsByIDs (ctx context .Context , id []string ) (*WalletTransactions , error ) {
var result WalletTransactions
request := &WalletGetTransactionsByIDsRequest {
ID : id ,
}
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 .