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 PublicForwardMessage struct {
Message MessageClass
}
const PublicForwardMessageTypeID = 0x1f2bf4a
func (p PublicForwardMessage ) construct () PublicForwardClass { return &p }
var (
_ bin .Encoder = &PublicForwardMessage {}
_ bin .Decoder = &PublicForwardMessage {}
_ bin .BareEncoder = &PublicForwardMessage {}
_ bin .BareDecoder = &PublicForwardMessage {}
_ PublicForwardClass = &PublicForwardMessage {}
)
func (p *PublicForwardMessage ) Zero () bool {
if p == nil {
return true
}
if !(p .Message == nil ) {
return false
}
return true
}
func (p *PublicForwardMessage ) String () string {
if p == nil {
return "PublicForwardMessage(nil)"
}
type Alias PublicForwardMessage
return fmt .Sprintf ("PublicForwardMessage%+v" , Alias (*p ))
}
func (p *PublicForwardMessage ) FillFrom (from interface {
GetMessage () (value MessageClass )
}) {
p .Message = from .GetMessage ()
}
func (*PublicForwardMessage ) TypeID () uint32 {
return PublicForwardMessageTypeID
}
func (*PublicForwardMessage ) TypeName () string {
return "publicForwardMessage"
}
func (p *PublicForwardMessage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "publicForwardMessage" ,
ID : PublicForwardMessageTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Message" ,
SchemaName : "message" ,
},
}
return typ
}
func (p *PublicForwardMessage ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode publicForwardMessage#1f2bf4a as nil" )
}
b .PutID (PublicForwardMessageTypeID )
return p .EncodeBare (b )
}
func (p *PublicForwardMessage ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode publicForwardMessage#1f2bf4a as nil" )
}
if p .Message == nil {
return fmt .Errorf ("unable to encode publicForwardMessage#1f2bf4a: field message is nil" )
}
if err := p .Message .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode publicForwardMessage#1f2bf4a: field message: %w" , err )
}
return nil
}
func (p *PublicForwardMessage ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode publicForwardMessage#1f2bf4a to nil" )
}
if err := b .ConsumeID (PublicForwardMessageTypeID ); err != nil {
return fmt .Errorf ("unable to decode publicForwardMessage#1f2bf4a: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PublicForwardMessage ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode publicForwardMessage#1f2bf4a to nil" )
}
{
value , err := DecodeMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode publicForwardMessage#1f2bf4a: field message: %w" , err )
}
p .Message = value
}
return nil
}
func (p *PublicForwardMessage ) GetMessage () (value MessageClass ) {
if p == nil {
return
}
return p .Message
}
type PublicForwardStory struct {
Peer PeerClass
Story StoryItemClass
}
const PublicForwardStoryTypeID = 0xedf3add0
func (p PublicForwardStory ) construct () PublicForwardClass { return &p }
var (
_ bin .Encoder = &PublicForwardStory {}
_ bin .Decoder = &PublicForwardStory {}
_ bin .BareEncoder = &PublicForwardStory {}
_ bin .BareDecoder = &PublicForwardStory {}
_ PublicForwardClass = &PublicForwardStory {}
)
func (p *PublicForwardStory ) Zero () bool {
if p == nil {
return true
}
if !(p .Peer == nil ) {
return false
}
if !(p .Story == nil ) {
return false
}
return true
}
func (p *PublicForwardStory ) String () string {
if p == nil {
return "PublicForwardStory(nil)"
}
type Alias PublicForwardStory
return fmt .Sprintf ("PublicForwardStory%+v" , Alias (*p ))
}
func (p *PublicForwardStory ) FillFrom (from interface {
GetPeer () (value PeerClass )
GetStory () (value StoryItemClass )
}) {
p .Peer = from .GetPeer ()
p .Story = from .GetStory ()
}
func (*PublicForwardStory ) TypeID () uint32 {
return PublicForwardStoryTypeID
}
func (*PublicForwardStory ) TypeName () string {
return "publicForwardStory"
}
func (p *PublicForwardStory ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "publicForwardStory" ,
ID : PublicForwardStoryTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Story" ,
SchemaName : "story" ,
},
}
return typ
}
func (p *PublicForwardStory ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode publicForwardStory#edf3add0 as nil" )
}
b .PutID (PublicForwardStoryTypeID )
return p .EncodeBare (b )
}
func (p *PublicForwardStory ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode publicForwardStory#edf3add0 as nil" )
}
if p .Peer == nil {
return fmt .Errorf ("unable to encode publicForwardStory#edf3add0: field peer is nil" )
}
if err := p .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode publicForwardStory#edf3add0: field peer: %w" , err )
}
if p .Story == nil {
return fmt .Errorf ("unable to encode publicForwardStory#edf3add0: field story is nil" )
}
if err := p .Story .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode publicForwardStory#edf3add0: field story: %w" , err )
}
return nil
}
func (p *PublicForwardStory ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode publicForwardStory#edf3add0 to nil" )
}
if err := b .ConsumeID (PublicForwardStoryTypeID ); err != nil {
return fmt .Errorf ("unable to decode publicForwardStory#edf3add0: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PublicForwardStory ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode publicForwardStory#edf3add0 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode publicForwardStory#edf3add0: field peer: %w" , err )
}
p .Peer = value
}
{
value , err := DecodeStoryItem (b )
if err != nil {
return fmt .Errorf ("unable to decode publicForwardStory#edf3add0: field story: %w" , err )
}
p .Story = value
}
return nil
}
func (p *PublicForwardStory ) GetPeer () (value PeerClass ) {
if p == nil {
return
}
return p .Peer
}
func (p *PublicForwardStory ) GetStory () (value StoryItemClass ) {
if p == nil {
return
}
return p .Story
}
const PublicForwardClassName = "PublicForward"
type PublicForwardClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PublicForwardClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodePublicForward (buf *bin .Buffer ) (PublicForwardClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PublicForwardMessageTypeID :
v := PublicForwardMessage {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PublicForwardClass: %w" , err )
}
return &v , nil
case PublicForwardStoryTypeID :
v := PublicForwardStory {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PublicForwardClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PublicForwardClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PublicForwardBox struct {
PublicForward PublicForwardClass
}
func (b *PublicForwardBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PublicForwardBox to nil" )
}
v , err := DecodePublicForward (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .PublicForward = v
return nil
}
func (b *PublicForwardBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .PublicForward == nil {
return fmt .Errorf ("unable to encode PublicForwardClass as nil" )
}
return b .PublicForward .Encode (buf )
}
The pages are generated with Golds v0.6.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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .