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