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