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