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 InputSavedStarGiftUser struct {
MsgID int
}
const InputSavedStarGiftUserTypeID = 0x69279795
func (i InputSavedStarGiftUser ) construct () InputSavedStarGiftClass { return &i }
var (
_ bin .Encoder = &InputSavedStarGiftUser {}
_ bin .Decoder = &InputSavedStarGiftUser {}
_ bin .BareEncoder = &InputSavedStarGiftUser {}
_ bin .BareDecoder = &InputSavedStarGiftUser {}
_ InputSavedStarGiftClass = &InputSavedStarGiftUser {}
)
func (i *InputSavedStarGiftUser ) Zero () bool {
if i == nil {
return true
}
if !(i .MsgID == 0 ) {
return false
}
return true
}
func (i *InputSavedStarGiftUser ) String () string {
if i == nil {
return "InputSavedStarGiftUser(nil)"
}
type Alias InputSavedStarGiftUser
return fmt .Sprintf ("InputSavedStarGiftUser%+v" , Alias (*i ))
}
func (i *InputSavedStarGiftUser ) FillFrom (from interface {
GetMsgID () (value int )
}) {
i .MsgID = from .GetMsgID ()
}
func (*InputSavedStarGiftUser ) TypeID () uint32 {
return InputSavedStarGiftUserTypeID
}
func (*InputSavedStarGiftUser ) TypeName () string {
return "inputSavedStarGiftUser"
}
func (i *InputSavedStarGiftUser ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputSavedStarGiftUser" ,
ID : InputSavedStarGiftUserTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (i *InputSavedStarGiftUser ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputSavedStarGiftUser#69279795 as nil" )
}
b .PutID (InputSavedStarGiftUserTypeID )
return i .EncodeBare (b )
}
func (i *InputSavedStarGiftUser ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputSavedStarGiftUser#69279795 as nil" )
}
b .PutInt (i .MsgID )
return nil
}
func (i *InputSavedStarGiftUser ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputSavedStarGiftUser#69279795 to nil" )
}
if err := b .ConsumeID (InputSavedStarGiftUserTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftUser#69279795: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputSavedStarGiftUser ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputSavedStarGiftUser#69279795 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftUser#69279795: field msg_id: %w" , err )
}
i .MsgID = value
}
return nil
}
func (i *InputSavedStarGiftUser ) GetMsgID () (value int ) {
if i == nil {
return
}
return i .MsgID
}
type InputSavedStarGiftChat struct {
Peer InputPeerClass
SavedID int64
}
const InputSavedStarGiftChatTypeID = 0xf101aa7f
func (i InputSavedStarGiftChat ) construct () InputSavedStarGiftClass { return &i }
var (
_ bin .Encoder = &InputSavedStarGiftChat {}
_ bin .Decoder = &InputSavedStarGiftChat {}
_ bin .BareEncoder = &InputSavedStarGiftChat {}
_ bin .BareDecoder = &InputSavedStarGiftChat {}
_ InputSavedStarGiftClass = &InputSavedStarGiftChat {}
)
func (i *InputSavedStarGiftChat ) Zero () bool {
if i == nil {
return true
}
if !(i .Peer == nil ) {
return false
}
if !(i .SavedID == 0 ) {
return false
}
return true
}
func (i *InputSavedStarGiftChat ) String () string {
if i == nil {
return "InputSavedStarGiftChat(nil)"
}
type Alias InputSavedStarGiftChat
return fmt .Sprintf ("InputSavedStarGiftChat%+v" , Alias (*i ))
}
func (i *InputSavedStarGiftChat ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetSavedID () (value int64 )
}) {
i .Peer = from .GetPeer ()
i .SavedID = from .GetSavedID ()
}
func (*InputSavedStarGiftChat ) TypeID () uint32 {
return InputSavedStarGiftChatTypeID
}
func (*InputSavedStarGiftChat ) TypeName () string {
return "inputSavedStarGiftChat"
}
func (i *InputSavedStarGiftChat ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputSavedStarGiftChat" ,
ID : InputSavedStarGiftChatTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "SavedID" ,
SchemaName : "saved_id" ,
},
}
return typ
}
func (i *InputSavedStarGiftChat ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputSavedStarGiftChat#f101aa7f as nil" )
}
b .PutID (InputSavedStarGiftChatTypeID )
return i .EncodeBare (b )
}
func (i *InputSavedStarGiftChat ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputSavedStarGiftChat#f101aa7f as nil" )
}
if i .Peer == nil {
return fmt .Errorf ("unable to encode inputSavedStarGiftChat#f101aa7f: field peer is nil" )
}
if err := i .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputSavedStarGiftChat#f101aa7f: field peer: %w" , err )
}
b .PutLong (i .SavedID )
return nil
}
func (i *InputSavedStarGiftChat ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputSavedStarGiftChat#f101aa7f to nil" )
}
if err := b .ConsumeID (InputSavedStarGiftChatTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftChat#f101aa7f: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputSavedStarGiftChat ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputSavedStarGiftChat#f101aa7f to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftChat#f101aa7f: field peer: %w" , err )
}
i .Peer = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftChat#f101aa7f: field saved_id: %w" , err )
}
i .SavedID = value
}
return nil
}
func (i *InputSavedStarGiftChat ) GetPeer () (value InputPeerClass ) {
if i == nil {
return
}
return i .Peer
}
func (i *InputSavedStarGiftChat ) GetSavedID () (value int64 ) {
if i == nil {
return
}
return i .SavedID
}
type InputSavedStarGiftSlug struct {
Slug string
}
const InputSavedStarGiftSlugTypeID = 0x2085c238
func (i InputSavedStarGiftSlug ) construct () InputSavedStarGiftClass { return &i }
var (
_ bin .Encoder = &InputSavedStarGiftSlug {}
_ bin .Decoder = &InputSavedStarGiftSlug {}
_ bin .BareEncoder = &InputSavedStarGiftSlug {}
_ bin .BareDecoder = &InputSavedStarGiftSlug {}
_ InputSavedStarGiftClass = &InputSavedStarGiftSlug {}
)
func (i *InputSavedStarGiftSlug ) Zero () bool {
if i == nil {
return true
}
if !(i .Slug == "" ) {
return false
}
return true
}
func (i *InputSavedStarGiftSlug ) String () string {
if i == nil {
return "InputSavedStarGiftSlug(nil)"
}
type Alias InputSavedStarGiftSlug
return fmt .Sprintf ("InputSavedStarGiftSlug%+v" , Alias (*i ))
}
func (i *InputSavedStarGiftSlug ) FillFrom (from interface {
GetSlug () (value string )
}) {
i .Slug = from .GetSlug ()
}
func (*InputSavedStarGiftSlug ) TypeID () uint32 {
return InputSavedStarGiftSlugTypeID
}
func (*InputSavedStarGiftSlug ) TypeName () string {
return "inputSavedStarGiftSlug"
}
func (i *InputSavedStarGiftSlug ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputSavedStarGiftSlug" ,
ID : InputSavedStarGiftSlugTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (i *InputSavedStarGiftSlug ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputSavedStarGiftSlug#2085c238 as nil" )
}
b .PutID (InputSavedStarGiftSlugTypeID )
return i .EncodeBare (b )
}
func (i *InputSavedStarGiftSlug ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputSavedStarGiftSlug#2085c238 as nil" )
}
b .PutString (i .Slug )
return nil
}
func (i *InputSavedStarGiftSlug ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputSavedStarGiftSlug#2085c238 to nil" )
}
if err := b .ConsumeID (InputSavedStarGiftSlugTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftSlug#2085c238: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputSavedStarGiftSlug ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputSavedStarGiftSlug#2085c238 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputSavedStarGiftSlug#2085c238: field slug: %w" , err )
}
i .Slug = value
}
return nil
}
func (i *InputSavedStarGiftSlug ) GetSlug () (value string ) {
if i == nil {
return
}
return i .Slug
}
const InputSavedStarGiftClassName = "InputSavedStarGift"
type InputSavedStarGiftClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputSavedStarGiftClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputSavedStarGift (buf *bin .Buffer ) (InputSavedStarGiftClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputSavedStarGiftUserTypeID :
v := InputSavedStarGiftUser {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputSavedStarGiftClass: %w" , err )
}
return &v , nil
case InputSavedStarGiftChatTypeID :
v := InputSavedStarGiftChat {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputSavedStarGiftClass: %w" , err )
}
return &v , nil
case InputSavedStarGiftSlugTypeID :
v := InputSavedStarGiftSlug {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputSavedStarGiftClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputSavedStarGiftClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputSavedStarGiftBox struct {
InputSavedStarGift InputSavedStarGiftClass
}
func (b *InputSavedStarGiftBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputSavedStarGiftBox to nil" )
}
v , err := DecodeInputSavedStarGift (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputSavedStarGift = v
return nil
}
func (b *InputSavedStarGiftBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputSavedStarGift == nil {
return fmt .Errorf ("unable to encode InputSavedStarGiftClass as nil" )
}
return b .InputSavedStarGift .Encode (buf )
}
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 .