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 PaymentsGetPaymentReceiptRequest struct {
Peer InputPeerClass
MsgID int
}
const PaymentsGetPaymentReceiptRequestTypeID = 0x2478d1cc
var (
_ bin .Encoder = &PaymentsGetPaymentReceiptRequest {}
_ bin .Decoder = &PaymentsGetPaymentReceiptRequest {}
_ bin .BareEncoder = &PaymentsGetPaymentReceiptRequest {}
_ bin .BareDecoder = &PaymentsGetPaymentReceiptRequest {}
)
func (g *PaymentsGetPaymentReceiptRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Peer == nil ) {
return false
}
if !(g .MsgID == 0 ) {
return false
}
return true
}
func (g *PaymentsGetPaymentReceiptRequest ) String () string {
if g == nil {
return "PaymentsGetPaymentReceiptRequest(nil)"
}
type Alias PaymentsGetPaymentReceiptRequest
return fmt .Sprintf ("PaymentsGetPaymentReceiptRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetPaymentReceiptRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetMsgID () (value int )
}) {
g .Peer = from .GetPeer ()
g .MsgID = from .GetMsgID ()
}
func (*PaymentsGetPaymentReceiptRequest ) TypeID () uint32 {
return PaymentsGetPaymentReceiptRequestTypeID
}
func (*PaymentsGetPaymentReceiptRequest ) TypeName () string {
return "payments.getPaymentReceipt"
}
func (g *PaymentsGetPaymentReceiptRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getPaymentReceipt" ,
ID : PaymentsGetPaymentReceiptRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (g *PaymentsGetPaymentReceiptRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getPaymentReceipt#2478d1cc as nil" )
}
b .PutID (PaymentsGetPaymentReceiptRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetPaymentReceiptRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getPaymentReceipt#2478d1cc as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getPaymentReceipt#2478d1cc: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getPaymentReceipt#2478d1cc: field peer: %w" , err )
}
b .PutInt (g .MsgID )
return nil
}
func (g *PaymentsGetPaymentReceiptRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getPaymentReceipt#2478d1cc to nil" )
}
if err := b .ConsumeID (PaymentsGetPaymentReceiptRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentReceipt#2478d1cc: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetPaymentReceiptRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getPaymentReceipt#2478d1cc to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentReceipt#2478d1cc: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentReceipt#2478d1cc: field msg_id: %w" , err )
}
g .MsgID = value
}
return nil
}
func (g *PaymentsGetPaymentReceiptRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetPaymentReceiptRequest ) GetMsgID () (value int ) {
if g == nil {
return
}
return g .MsgID
}
func (c *Client ) PaymentsGetPaymentReceipt (ctx context .Context , request *PaymentsGetPaymentReceiptRequest ) (*PaymentsPaymentReceipt , error ) {
var result PaymentsPaymentReceipt
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.6.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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .