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 FragmentGetCollectibleInfoRequest struct {
Collectible InputCollectibleClass
}
const FragmentGetCollectibleInfoRequestTypeID = 0xbe1e85ba
var (
_ bin .Encoder = &FragmentGetCollectibleInfoRequest {}
_ bin .Decoder = &FragmentGetCollectibleInfoRequest {}
_ bin .BareEncoder = &FragmentGetCollectibleInfoRequest {}
_ bin .BareDecoder = &FragmentGetCollectibleInfoRequest {}
)
func (g *FragmentGetCollectibleInfoRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Collectible == nil ) {
return false
}
return true
}
func (g *FragmentGetCollectibleInfoRequest ) String () string {
if g == nil {
return "FragmentGetCollectibleInfoRequest(nil)"
}
type Alias FragmentGetCollectibleInfoRequest
return fmt .Sprintf ("FragmentGetCollectibleInfoRequest%+v" , Alias (*g ))
}
func (g *FragmentGetCollectibleInfoRequest ) FillFrom (from interface {
GetCollectible () (value InputCollectibleClass )
}) {
g .Collectible = from .GetCollectible ()
}
func (*FragmentGetCollectibleInfoRequest ) TypeID () uint32 {
return FragmentGetCollectibleInfoRequestTypeID
}
func (*FragmentGetCollectibleInfoRequest ) TypeName () string {
return "fragment.getCollectibleInfo"
}
func (g *FragmentGetCollectibleInfoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "fragment.getCollectibleInfo" ,
ID : FragmentGetCollectibleInfoRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Collectible" ,
SchemaName : "collectible" ,
},
}
return typ
}
func (g *FragmentGetCollectibleInfoRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode fragment.getCollectibleInfo#be1e85ba as nil" )
}
b .PutID (FragmentGetCollectibleInfoRequestTypeID )
return g .EncodeBare (b )
}
func (g *FragmentGetCollectibleInfoRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode fragment.getCollectibleInfo#be1e85ba as nil" )
}
if g .Collectible == nil {
return fmt .Errorf ("unable to encode fragment.getCollectibleInfo#be1e85ba: field collectible is nil" )
}
if err := g .Collectible .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode fragment.getCollectibleInfo#be1e85ba: field collectible: %w" , err )
}
return nil
}
func (g *FragmentGetCollectibleInfoRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode fragment.getCollectibleInfo#be1e85ba to nil" )
}
if err := b .ConsumeID (FragmentGetCollectibleInfoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode fragment.getCollectibleInfo#be1e85ba: %w" , err )
}
return g .DecodeBare (b )
}
func (g *FragmentGetCollectibleInfoRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode fragment.getCollectibleInfo#be1e85ba to nil" )
}
{
value , err := DecodeInputCollectible (b )
if err != nil {
return fmt .Errorf ("unable to decode fragment.getCollectibleInfo#be1e85ba: field collectible: %w" , err )
}
g .Collectible = value
}
return nil
}
func (g *FragmentGetCollectibleInfoRequest ) GetCollectible () (value InputCollectibleClass ) {
if g == nil {
return
}
return g .Collectible
}
func (c *Client ) FragmentGetCollectibleInfo (ctx context .Context , collectible InputCollectibleClass ) (*FragmentCollectibleInfo , error ) {
var result FragmentCollectibleInfo
request := &FragmentGetCollectibleInfoRequest {
Collectible : collectible ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .