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 PaymentsExportInvoiceRequest struct {
InvoiceMedia InputMediaClass
}
const PaymentsExportInvoiceRequestTypeID = 0xf91b065
var (
_ bin .Encoder = &PaymentsExportInvoiceRequest {}
_ bin .Decoder = &PaymentsExportInvoiceRequest {}
_ bin .BareEncoder = &PaymentsExportInvoiceRequest {}
_ bin .BareDecoder = &PaymentsExportInvoiceRequest {}
)
func (e *PaymentsExportInvoiceRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .InvoiceMedia == nil ) {
return false
}
return true
}
func (e *PaymentsExportInvoiceRequest ) String () string {
if e == nil {
return "PaymentsExportInvoiceRequest(nil)"
}
type Alias PaymentsExportInvoiceRequest
return fmt .Sprintf ("PaymentsExportInvoiceRequest%+v" , Alias (*e ))
}
func (e *PaymentsExportInvoiceRequest ) FillFrom (from interface {
GetInvoiceMedia () (value InputMediaClass )
}) {
e .InvoiceMedia = from .GetInvoiceMedia ()
}
func (*PaymentsExportInvoiceRequest ) TypeID () uint32 {
return PaymentsExportInvoiceRequestTypeID
}
func (*PaymentsExportInvoiceRequest ) TypeName () string {
return "payments.exportInvoice"
}
func (e *PaymentsExportInvoiceRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.exportInvoice" ,
ID : PaymentsExportInvoiceRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "InvoiceMedia" ,
SchemaName : "invoice_media" ,
},
}
return typ
}
func (e *PaymentsExportInvoiceRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode payments.exportInvoice#f91b065 as nil" )
}
b .PutID (PaymentsExportInvoiceRequestTypeID )
return e .EncodeBare (b )
}
func (e *PaymentsExportInvoiceRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode payments.exportInvoice#f91b065 as nil" )
}
if e .InvoiceMedia == nil {
return fmt .Errorf ("unable to encode payments.exportInvoice#f91b065: field invoice_media is nil" )
}
if err := e .InvoiceMedia .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.exportInvoice#f91b065: field invoice_media: %w" , err )
}
return nil
}
func (e *PaymentsExportInvoiceRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode payments.exportInvoice#f91b065 to nil" )
}
if err := b .ConsumeID (PaymentsExportInvoiceRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.exportInvoice#f91b065: %w" , err )
}
return e .DecodeBare (b )
}
func (e *PaymentsExportInvoiceRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode payments.exportInvoice#f91b065 to nil" )
}
{
value , err := DecodeInputMedia (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.exportInvoice#f91b065: field invoice_media: %w" , err )
}
e .InvoiceMedia = value
}
return nil
}
func (e *PaymentsExportInvoiceRequest ) GetInvoiceMedia () (value InputMediaClass ) {
if e == nil {
return
}
return e .InvoiceMedia
}
func (c *Client ) PaymentsExportInvoice (ctx context .Context , invoicemedia InputMediaClass ) (*PaymentsExportedInvoice , error ) {
var result PaymentsExportedInvoice
request := &PaymentsExportInvoiceRequest {
InvoiceMedia : invoicemedia ,
}
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 .