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 FoundStory struct {
Peer PeerClass
Story StoryItemClass
}
const FoundStoryTypeID = 0xe87acbc0
var (
_ bin .Encoder = &FoundStory {}
_ bin .Decoder = &FoundStory {}
_ bin .BareEncoder = &FoundStory {}
_ bin .BareDecoder = &FoundStory {}
)
func (f *FoundStory ) Zero () bool {
if f == nil {
return true
}
if !(f .Peer == nil ) {
return false
}
if !(f .Story == nil ) {
return false
}
return true
}
func (f *FoundStory ) String () string {
if f == nil {
return "FoundStory(nil)"
}
type Alias FoundStory
return fmt .Sprintf ("FoundStory%+v" , Alias (*f ))
}
func (f *FoundStory ) FillFrom (from interface {
GetPeer () (value PeerClass )
GetStory () (value StoryItemClass )
}) {
f .Peer = from .GetPeer ()
f .Story = from .GetStory ()
}
func (*FoundStory ) TypeID () uint32 {
return FoundStoryTypeID
}
func (*FoundStory ) TypeName () string {
return "foundStory"
}
func (f *FoundStory ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "foundStory" ,
ID : FoundStoryTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Story" ,
SchemaName : "story" ,
},
}
return typ
}
func (f *FoundStory ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode foundStory#e87acbc0 as nil" )
}
b .PutID (FoundStoryTypeID )
return f .EncodeBare (b )
}
func (f *FoundStory ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode foundStory#e87acbc0 as nil" )
}
if f .Peer == nil {
return fmt .Errorf ("unable to encode foundStory#e87acbc0: field peer is nil" )
}
if err := f .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode foundStory#e87acbc0: field peer: %w" , err )
}
if f .Story == nil {
return fmt .Errorf ("unable to encode foundStory#e87acbc0: field story is nil" )
}
if err := f .Story .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode foundStory#e87acbc0: field story: %w" , err )
}
return nil
}
func (f *FoundStory ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode foundStory#e87acbc0 to nil" )
}
if err := b .ConsumeID (FoundStoryTypeID ); err != nil {
return fmt .Errorf ("unable to decode foundStory#e87acbc0: %w" , err )
}
return f .DecodeBare (b )
}
func (f *FoundStory ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode foundStory#e87acbc0 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode foundStory#e87acbc0: field peer: %w" , err )
}
f .Peer = value
}
{
value , err := DecodeStoryItem (b )
if err != nil {
return fmt .Errorf ("unable to decode foundStory#e87acbc0: field story: %w" , err )
}
f .Story = value
}
return nil
}
func (f *FoundStory ) GetPeer () (value PeerClass ) {
if f == nil {
return
}
return f .Peer
}
func (f *FoundStory ) GetStory () (value StoryItemClass ) {
if f == nil {
return
}
return f .Story
}
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 .