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 WalletNftAttribute struct {
TraitType string
Value string
}
const WalletNftAttributeTypeID = 0x4c1ef10e
var (
_ bin .Encoder = &WalletNftAttribute {}
_ bin .Decoder = &WalletNftAttribute {}
_ bin .BareEncoder = &WalletNftAttribute {}
_ bin .BareDecoder = &WalletNftAttribute {}
)
func (n *WalletNftAttribute ) Zero () bool {
if n == nil {
return true
}
if !(n .TraitType == "" ) {
return false
}
if !(n .Value == "" ) {
return false
}
return true
}
func (n *WalletNftAttribute ) String () string {
if n == nil {
return "WalletNftAttribute(nil)"
}
type Alias WalletNftAttribute
return fmt .Sprintf ("WalletNftAttribute%+v" , Alias (*n ))
}
func (n *WalletNftAttribute ) FillFrom (from interface {
GetTraitType () (value string )
GetValue () (value string )
}) {
n .TraitType = from .GetTraitType ()
n .Value = from .GetValue ()
}
func (*WalletNftAttribute ) TypeID () uint32 {
return WalletNftAttributeTypeID
}
func (*WalletNftAttribute ) TypeName () string {
return "wallet.nftAttribute"
}
func (n *WalletNftAttribute ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.nftAttribute" ,
ID : WalletNftAttributeTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "TraitType" ,
SchemaName : "trait_type" ,
},
{
Name : "Value" ,
SchemaName : "value" ,
},
}
return typ
}
func (n *WalletNftAttribute ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode wallet.nftAttribute#4c1ef10e as nil" )
}
b .PutID (WalletNftAttributeTypeID )
return n .EncodeBare (b )
}
func (n *WalletNftAttribute ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode wallet.nftAttribute#4c1ef10e as nil" )
}
b .PutString (n .TraitType )
b .PutString (n .Value )
return nil
}
func (n *WalletNftAttribute ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode wallet.nftAttribute#4c1ef10e to nil" )
}
if err := b .ConsumeID (WalletNftAttributeTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.nftAttribute#4c1ef10e: %w" , err )
}
return n .DecodeBare (b )
}
func (n *WalletNftAttribute ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode wallet.nftAttribute#4c1ef10e to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.nftAttribute#4c1ef10e: field trait_type: %w" , err )
}
n .TraitType = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.nftAttribute#4c1ef10e: field value: %w" , err )
}
n .Value = value
}
return nil
}
func (n *WalletNftAttribute ) GetTraitType () (value string ) {
if n == nil {
return
}
return n .TraitType
}
func (n *WalletNftAttribute ) GetValue () (value string ) {
if n == nil {
return
}
return n .Value
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .