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 StarsSubscriptionPricing struct {
Period int
Amount int64
}
const StarsSubscriptionPricingTypeID = 0x5416d58
var (
_ bin .Encoder = &StarsSubscriptionPricing {}
_ bin .Decoder = &StarsSubscriptionPricing {}
_ bin .BareEncoder = &StarsSubscriptionPricing {}
_ bin .BareDecoder = &StarsSubscriptionPricing {}
)
func (s *StarsSubscriptionPricing ) Zero () bool {
if s == nil {
return true
}
if !(s .Period == 0 ) {
return false
}
if !(s .Amount == 0 ) {
return false
}
return true
}
func (s *StarsSubscriptionPricing ) String () string {
if s == nil {
return "StarsSubscriptionPricing(nil)"
}
type Alias StarsSubscriptionPricing
return fmt .Sprintf ("StarsSubscriptionPricing%+v" , Alias (*s ))
}
func (s *StarsSubscriptionPricing ) FillFrom (from interface {
GetPeriod () (value int )
GetAmount () (value int64 )
}) {
s .Period = from .GetPeriod ()
s .Amount = from .GetAmount ()
}
func (*StarsSubscriptionPricing ) TypeID () uint32 {
return StarsSubscriptionPricingTypeID
}
func (*StarsSubscriptionPricing ) TypeName () string {
return "starsSubscriptionPricing"
}
func (s *StarsSubscriptionPricing ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starsSubscriptionPricing" ,
ID : StarsSubscriptionPricingTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Period" ,
SchemaName : "period" ,
},
{
Name : "Amount" ,
SchemaName : "amount" ,
},
}
return typ
}
func (s *StarsSubscriptionPricing ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starsSubscriptionPricing#5416d58 as nil" )
}
b .PutID (StarsSubscriptionPricingTypeID )
return s .EncodeBare (b )
}
func (s *StarsSubscriptionPricing ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starsSubscriptionPricing#5416d58 as nil" )
}
b .PutInt (s .Period )
b .PutLong (s .Amount )
return nil
}
func (s *StarsSubscriptionPricing ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starsSubscriptionPricing#5416d58 to nil" )
}
if err := b .ConsumeID (StarsSubscriptionPricingTypeID ); err != nil {
return fmt .Errorf ("unable to decode starsSubscriptionPricing#5416d58: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarsSubscriptionPricing ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starsSubscriptionPricing#5416d58 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starsSubscriptionPricing#5416d58: field period: %w" , err )
}
s .Period = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode starsSubscriptionPricing#5416d58: field amount: %w" , err )
}
s .Amount = value
}
return nil
}
func (s *StarsSubscriptionPricing ) GetPeriod () (value int ) {
if s == nil {
return
}
return s .Period
}
func (s *StarsSubscriptionPricing ) GetAmount () (value int64 ) {
if s == nil {
return
}
return s .Amount
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .