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 PaymentFormMethod struct {
URL string
Title string
}
const PaymentFormMethodTypeID = 0x88f8f21b
var (
_ bin .Encoder = &PaymentFormMethod {}
_ bin .Decoder = &PaymentFormMethod {}
_ bin .BareEncoder = &PaymentFormMethod {}
_ bin .BareDecoder = &PaymentFormMethod {}
)
func (p *PaymentFormMethod ) Zero () bool {
if p == nil {
return true
}
if !(p .URL == "" ) {
return false
}
if !(p .Title == "" ) {
return false
}
return true
}
func (p *PaymentFormMethod ) String () string {
if p == nil {
return "PaymentFormMethod(nil)"
}
type Alias PaymentFormMethod
return fmt .Sprintf ("PaymentFormMethod%+v" , Alias (*p ))
}
func (p *PaymentFormMethod ) FillFrom (from interface {
GetURL () (value string )
GetTitle () (value string )
}) {
p .URL = from .GetURL ()
p .Title = from .GetTitle ()
}
func (*PaymentFormMethod ) TypeID () uint32 {
return PaymentFormMethodTypeID
}
func (*PaymentFormMethod ) TypeName () string {
return "paymentFormMethod"
}
func (p *PaymentFormMethod ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "paymentFormMethod" ,
ID : PaymentFormMethodTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
},
}
return typ
}
func (p *PaymentFormMethod ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode paymentFormMethod#88f8f21b as nil" )
}
b .PutID (PaymentFormMethodTypeID )
return p .EncodeBare (b )
}
func (p *PaymentFormMethod ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode paymentFormMethod#88f8f21b as nil" )
}
b .PutString (p .URL )
b .PutString (p .Title )
return nil
}
func (p *PaymentFormMethod ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode paymentFormMethod#88f8f21b to nil" )
}
if err := b .ConsumeID (PaymentFormMethodTypeID ); err != nil {
return fmt .Errorf ("unable to decode paymentFormMethod#88f8f21b: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PaymentFormMethod ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode paymentFormMethod#88f8f21b to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode paymentFormMethod#88f8f21b: field url: %w" , err )
}
p .URL = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode paymentFormMethod#88f8f21b: field title: %w" , err )
}
p .Title = value
}
return nil
}
func (p *PaymentFormMethod ) GetURL () (value string ) {
if p == nil {
return
}
return p .URL
}
func (p *PaymentFormMethod ) GetTitle () (value string ) {
if p == nil {
return
}
return p .Title
}
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 .