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 StoryItemDeleted struct {
ID int
}
const StoryItemDeletedTypeID = 0x51e6ee4f
func (s StoryItemDeleted ) construct () StoryItemClass { return &s }
var (
_ bin .Encoder = &StoryItemDeleted {}
_ bin .Decoder = &StoryItemDeleted {}
_ bin .BareEncoder = &StoryItemDeleted {}
_ bin .BareDecoder = &StoryItemDeleted {}
_ StoryItemClass = &StoryItemDeleted {}
)
func (s *StoryItemDeleted ) Zero () bool {
if s == nil {
return true
}
if !(s .ID == 0 ) {
return false
}
return true
}
func (s *StoryItemDeleted ) String () string {
if s == nil {
return "StoryItemDeleted(nil)"
}
type Alias StoryItemDeleted
return fmt .Sprintf ("StoryItemDeleted%+v" , Alias (*s ))
}
func (s *StoryItemDeleted ) FillFrom (from interface {
GetID () (value int )
}) {
s .ID = from .GetID ()
}
func (*StoryItemDeleted ) TypeID () uint32 {
return StoryItemDeletedTypeID
}
func (*StoryItemDeleted ) TypeName () string {
return "storyItemDeleted"
}
func (s *StoryItemDeleted ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storyItemDeleted" ,
ID : StoryItemDeletedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (s *StoryItemDeleted ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode storyItemDeleted#51e6ee4f as nil" )
}
b .PutID (StoryItemDeletedTypeID )
return s .EncodeBare (b )
}
func (s *StoryItemDeleted ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode storyItemDeleted#51e6ee4f as nil" )
}
b .PutInt (s .ID )
return nil
}
func (s *StoryItemDeleted ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode storyItemDeleted#51e6ee4f to nil" )
}
if err := b .ConsumeID (StoryItemDeletedTypeID ); err != nil {
return fmt .Errorf ("unable to decode storyItemDeleted#51e6ee4f: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StoryItemDeleted ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode storyItemDeleted#51e6ee4f to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItemDeleted#51e6ee4f: field id: %w" , err )
}
s .ID = value
}
return nil
}
func (s *StoryItemDeleted ) GetID () (value int ) {
if s == nil {
return
}
return s .ID
}
type StoryItemSkipped struct {
Flags bin .Fields
CloseFriends bool
ID int
Date int
ExpireDate int
}
const StoryItemSkippedTypeID = 0xffadc913
func (s StoryItemSkipped ) construct () StoryItemClass { return &s }
var (
_ bin .Encoder = &StoryItemSkipped {}
_ bin .Decoder = &StoryItemSkipped {}
_ bin .BareEncoder = &StoryItemSkipped {}
_ bin .BareDecoder = &StoryItemSkipped {}
_ StoryItemClass = &StoryItemSkipped {}
)
func (s *StoryItemSkipped ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .CloseFriends == false ) {
return false
}
if !(s .ID == 0 ) {
return false
}
if !(s .Date == 0 ) {
return false
}
if !(s .ExpireDate == 0 ) {
return false
}
return true
}
func (s *StoryItemSkipped ) String () string {
if s == nil {
return "StoryItemSkipped(nil)"
}
type Alias StoryItemSkipped
return fmt .Sprintf ("StoryItemSkipped%+v" , Alias (*s ))
}
func (s *StoryItemSkipped ) FillFrom (from interface {
GetCloseFriends () (value bool )
GetID () (value int )
GetDate () (value int )
GetExpireDate () (value int )
}) {
s .CloseFriends = from .GetCloseFriends ()
s .ID = from .GetID ()
s .Date = from .GetDate ()
s .ExpireDate = from .GetExpireDate ()
}
func (*StoryItemSkipped ) TypeID () uint32 {
return StoryItemSkippedTypeID
}
func (*StoryItemSkipped ) TypeName () string {
return "storyItemSkipped"
}
func (s *StoryItemSkipped ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storyItemSkipped" ,
ID : StoryItemSkippedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "CloseFriends" ,
SchemaName : "close_friends" ,
Null : !s .Flags .Has (8 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "ExpireDate" ,
SchemaName : "expire_date" ,
},
}
return typ
}
func (s *StoryItemSkipped ) SetFlags () {
if !(s .CloseFriends == false ) {
s .Flags .Set (8 )
}
}
func (s *StoryItemSkipped ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode storyItemSkipped#ffadc913 as nil" )
}
b .PutID (StoryItemSkippedTypeID )
return s .EncodeBare (b )
}
func (s *StoryItemSkipped ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode storyItemSkipped#ffadc913 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItemSkipped#ffadc913: field flags: %w" , err )
}
b .PutInt (s .ID )
b .PutInt (s .Date )
b .PutInt (s .ExpireDate )
return nil
}
func (s *StoryItemSkipped ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode storyItemSkipped#ffadc913 to nil" )
}
if err := b .ConsumeID (StoryItemSkippedTypeID ); err != nil {
return fmt .Errorf ("unable to decode storyItemSkipped#ffadc913: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StoryItemSkipped ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode storyItemSkipped#ffadc913 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode storyItemSkipped#ffadc913: field flags: %w" , err )
}
}
s .CloseFriends = s .Flags .Has (8 )
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItemSkipped#ffadc913: field id: %w" , err )
}
s .ID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItemSkipped#ffadc913: field date: %w" , err )
}
s .Date = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItemSkipped#ffadc913: field expire_date: %w" , err )
}
s .ExpireDate = value
}
return nil
}
func (s *StoryItemSkipped ) SetCloseFriends (value bool ) {
if value {
s .Flags .Set (8 )
s .CloseFriends = true
} else {
s .Flags .Unset (8 )
s .CloseFriends = false
}
}
func (s *StoryItemSkipped ) GetCloseFriends () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (8 )
}
func (s *StoryItemSkipped ) GetID () (value int ) {
if s == nil {
return
}
return s .ID
}
func (s *StoryItemSkipped ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *StoryItemSkipped ) GetExpireDate () (value int ) {
if s == nil {
return
}
return s .ExpireDate
}
type StoryItem struct {
Flags bin .Fields
Pinned bool
Public bool
CloseFriends bool
Min bool
Noforwards bool
Edited bool
Contacts bool
SelectedContacts bool
Out bool
ID int
Date int
FwdFrom StoryFwdHeader
ExpireDate int
Caption string
Entities []MessageEntityClass
Media MessageMediaClass
MediaAreas []MediaAreaClass
Privacy []PrivacyRuleClass
Views StoryViews
SentReaction ReactionClass
}
const StoryItemTypeID = 0xaf6365a1
func (s StoryItem ) construct () StoryItemClass { return &s }
var (
_ bin .Encoder = &StoryItem {}
_ bin .Decoder = &StoryItem {}
_ bin .BareEncoder = &StoryItem {}
_ bin .BareDecoder = &StoryItem {}
_ StoryItemClass = &StoryItem {}
)
func (s *StoryItem ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .Pinned == false ) {
return false
}
if !(s .Public == false ) {
return false
}
if !(s .CloseFriends == false ) {
return false
}
if !(s .Min == false ) {
return false
}
if !(s .Noforwards == false ) {
return false
}
if !(s .Edited == false ) {
return false
}
if !(s .Contacts == false ) {
return false
}
if !(s .SelectedContacts == false ) {
return false
}
if !(s .Out == false ) {
return false
}
if !(s .ID == 0 ) {
return false
}
if !(s .Date == 0 ) {
return false
}
if !(s .FwdFrom .Zero ()) {
return false
}
if !(s .ExpireDate == 0 ) {
return false
}
if !(s .Caption == "" ) {
return false
}
if !(s .Entities == nil ) {
return false
}
if !(s .Media == nil ) {
return false
}
if !(s .MediaAreas == nil ) {
return false
}
if !(s .Privacy == nil ) {
return false
}
if !(s .Views .Zero ()) {
return false
}
if !(s .SentReaction == nil ) {
return false
}
return true
}
func (s *StoryItem ) String () string {
if s == nil {
return "StoryItem(nil)"
}
type Alias StoryItem
return fmt .Sprintf ("StoryItem%+v" , Alias (*s ))
}
func (s *StoryItem ) FillFrom (from interface {
GetPinned () (value bool )
GetPublic () (value bool )
GetCloseFriends () (value bool )
GetMin () (value bool )
GetNoforwards () (value bool )
GetEdited () (value bool )
GetContacts () (value bool )
GetSelectedContacts () (value bool )
GetOut () (value bool )
GetID () (value int )
GetDate () (value int )
GetFwdFrom () (value StoryFwdHeader , ok bool )
GetExpireDate () (value int )
GetCaption () (value string , ok bool )
GetEntities () (value []MessageEntityClass , ok bool )
GetMedia () (value MessageMediaClass )
GetMediaAreas () (value []MediaAreaClass , ok bool )
GetPrivacy () (value []PrivacyRuleClass , ok bool )
GetViews () (value StoryViews , ok bool )
GetSentReaction () (value ReactionClass , ok bool )
}) {
s .Pinned = from .GetPinned ()
s .Public = from .GetPublic ()
s .CloseFriends = from .GetCloseFriends ()
s .Min = from .GetMin ()
s .Noforwards = from .GetNoforwards ()
s .Edited = from .GetEdited ()
s .Contacts = from .GetContacts ()
s .SelectedContacts = from .GetSelectedContacts ()
s .Out = from .GetOut ()
s .ID = from .GetID ()
s .Date = from .GetDate ()
if val , ok := from .GetFwdFrom (); ok {
s .FwdFrom = val
}
s .ExpireDate = from .GetExpireDate ()
if val , ok := from .GetCaption (); ok {
s .Caption = val
}
if val , ok := from .GetEntities (); ok {
s .Entities = val
}
s .Media = from .GetMedia ()
if val , ok := from .GetMediaAreas (); ok {
s .MediaAreas = val
}
if val , ok := from .GetPrivacy (); ok {
s .Privacy = val
}
if val , ok := from .GetViews (); ok {
s .Views = val
}
if val , ok := from .GetSentReaction (); ok {
s .SentReaction = val
}
}
func (*StoryItem ) TypeID () uint32 {
return StoryItemTypeID
}
func (*StoryItem ) TypeName () string {
return "storyItem"
}
func (s *StoryItem ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storyItem" ,
ID : StoryItemTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pinned" ,
SchemaName : "pinned" ,
Null : !s .Flags .Has (5 ),
},
{
Name : "Public" ,
SchemaName : "public" ,
Null : !s .Flags .Has (7 ),
},
{
Name : "CloseFriends" ,
SchemaName : "close_friends" ,
Null : !s .Flags .Has (8 ),
},
{
Name : "Min" ,
SchemaName : "min" ,
Null : !s .Flags .Has (9 ),
},
{
Name : "Noforwards" ,
SchemaName : "noforwards" ,
Null : !s .Flags .Has (10 ),
},
{
Name : "Edited" ,
SchemaName : "edited" ,
Null : !s .Flags .Has (11 ),
},
{
Name : "Contacts" ,
SchemaName : "contacts" ,
Null : !s .Flags .Has (12 ),
},
{
Name : "SelectedContacts" ,
SchemaName : "selected_contacts" ,
Null : !s .Flags .Has (13 ),
},
{
Name : "Out" ,
SchemaName : "out" ,
Null : !s .Flags .Has (16 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "FwdFrom" ,
SchemaName : "fwd_from" ,
Null : !s .Flags .Has (17 ),
},
{
Name : "ExpireDate" ,
SchemaName : "expire_date" ,
},
{
Name : "Caption" ,
SchemaName : "caption" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "Entities" ,
SchemaName : "entities" ,
Null : !s .Flags .Has (1 ),
},
{
Name : "Media" ,
SchemaName : "media" ,
},
{
Name : "MediaAreas" ,
SchemaName : "media_areas" ,
Null : !s .Flags .Has (14 ),
},
{
Name : "Privacy" ,
SchemaName : "privacy" ,
Null : !s .Flags .Has (2 ),
},
{
Name : "Views" ,
SchemaName : "views" ,
Null : !s .Flags .Has (3 ),
},
{
Name : "SentReaction" ,
SchemaName : "sent_reaction" ,
Null : !s .Flags .Has (15 ),
},
}
return typ
}
func (s *StoryItem ) SetFlags () {
if !(s .Pinned == false ) {
s .Flags .Set (5 )
}
if !(s .Public == false ) {
s .Flags .Set (7 )
}
if !(s .CloseFriends == false ) {
s .Flags .Set (8 )
}
if !(s .Min == false ) {
s .Flags .Set (9 )
}
if !(s .Noforwards == false ) {
s .Flags .Set (10 )
}
if !(s .Edited == false ) {
s .Flags .Set (11 )
}
if !(s .Contacts == false ) {
s .Flags .Set (12 )
}
if !(s .SelectedContacts == false ) {
s .Flags .Set (13 )
}
if !(s .Out == false ) {
s .Flags .Set (16 )
}
if !(s .FwdFrom .Zero ()) {
s .Flags .Set (17 )
}
if !(s .Caption == "" ) {
s .Flags .Set (0 )
}
if !(s .Entities == nil ) {
s .Flags .Set (1 )
}
if !(s .MediaAreas == nil ) {
s .Flags .Set (14 )
}
if !(s .Privacy == nil ) {
s .Flags .Set (2 )
}
if !(s .Views .Zero ()) {
s .Flags .Set (3 )
}
if !(s .SentReaction == nil ) {
s .Flags .Set (15 )
}
}
func (s *StoryItem ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode storyItem#af6365a1 as nil" )
}
b .PutID (StoryItemTypeID )
return s .EncodeBare (b )
}
func (s *StoryItem ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode storyItem#af6365a1 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field flags: %w" , err )
}
b .PutInt (s .ID )
b .PutInt (s .Date )
if s .Flags .Has (17 ) {
if err := s .FwdFrom .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field fwd_from: %w" , err )
}
}
b .PutInt (s .ExpireDate )
if s .Flags .Has (0 ) {
b .PutString (s .Caption )
}
if s .Flags .Has (1 ) {
b .PutVectorHeader (len (s .Entities ))
for idx , v := range s .Entities {
if v == nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field entities element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field entities element with index %d: %w" , idx , err )
}
}
}
if s .Media == nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field media is nil" )
}
if err := s .Media .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field media: %w" , err )
}
if s .Flags .Has (14 ) {
b .PutVectorHeader (len (s .MediaAreas ))
for idx , v := range s .MediaAreas {
if v == nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field media_areas element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field media_areas element with index %d: %w" , idx , err )
}
}
}
if s .Flags .Has (2 ) {
b .PutVectorHeader (len (s .Privacy ))
for idx , v := range s .Privacy {
if v == nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field privacy element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field privacy element with index %d: %w" , idx , err )
}
}
}
if s .Flags .Has (3 ) {
if err := s .Views .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field views: %w" , err )
}
}
if s .Flags .Has (15 ) {
if s .SentReaction == nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field sent_reaction is nil" )
}
if err := s .SentReaction .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode storyItem#af6365a1: field sent_reaction: %w" , err )
}
}
return nil
}
func (s *StoryItem ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode storyItem#af6365a1 to nil" )
}
if err := b .ConsumeID (StoryItemTypeID ); err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StoryItem ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode storyItem#af6365a1 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field flags: %w" , err )
}
}
s .Pinned = s .Flags .Has (5 )
s .Public = s .Flags .Has (7 )
s .CloseFriends = s .Flags .Has (8 )
s .Min = s .Flags .Has (9 )
s .Noforwards = s .Flags .Has (10 )
s .Edited = s .Flags .Has (11 )
s .Contacts = s .Flags .Has (12 )
s .SelectedContacts = s .Flags .Has (13 )
s .Out = s .Flags .Has (16 )
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field id: %w" , err )
}
s .ID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field date: %w" , err )
}
s .Date = value
}
if s .Flags .Has (17 ) {
if err := s .FwdFrom .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field fwd_from: %w" , err )
}
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field expire_date: %w" , err )
}
s .ExpireDate = value
}
if s .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field caption: %w" , err )
}
s .Caption = value
}
if s .Flags .Has (1 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field entities: %w" , err )
}
if headerLen > 0 {
s .Entities = make ([]MessageEntityClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessageEntity (b )
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field entities: %w" , err )
}
s .Entities = append (s .Entities , value )
}
}
{
value , err := DecodeMessageMedia (b )
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field media: %w" , err )
}
s .Media = value
}
if s .Flags .Has (14 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field media_areas: %w" , err )
}
if headerLen > 0 {
s .MediaAreas = make ([]MediaAreaClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMediaArea (b )
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field media_areas: %w" , err )
}
s .MediaAreas = append (s .MediaAreas , value )
}
}
if s .Flags .Has (2 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field privacy: %w" , err )
}
if headerLen > 0 {
s .Privacy = make ([]PrivacyRuleClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodePrivacyRule (b )
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field privacy: %w" , err )
}
s .Privacy = append (s .Privacy , value )
}
}
if s .Flags .Has (3 ) {
if err := s .Views .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field views: %w" , err )
}
}
if s .Flags .Has (15 ) {
value , err := DecodeReaction (b )
if err != nil {
return fmt .Errorf ("unable to decode storyItem#af6365a1: field sent_reaction: %w" , err )
}
s .SentReaction = value
}
return nil
}
func (s *StoryItem ) SetPinned (value bool ) {
if value {
s .Flags .Set (5 )
s .Pinned = true
} else {
s .Flags .Unset (5 )
s .Pinned = false
}
}
func (s *StoryItem ) GetPinned () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (5 )
}
func (s *StoryItem ) SetPublic (value bool ) {
if value {
s .Flags .Set (7 )
s .Public = true
} else {
s .Flags .Unset (7 )
s .Public = false
}
}
func (s *StoryItem ) GetPublic () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (7 )
}
func (s *StoryItem ) SetCloseFriends (value bool ) {
if value {
s .Flags .Set (8 )
s .CloseFriends = true
} else {
s .Flags .Unset (8 )
s .CloseFriends = false
}
}
func (s *StoryItem ) GetCloseFriends () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (8 )
}
func (s *StoryItem ) SetMin (value bool ) {
if value {
s .Flags .Set (9 )
s .Min = true
} else {
s .Flags .Unset (9 )
s .Min = false
}
}
func (s *StoryItem ) GetMin () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (9 )
}
func (s *StoryItem ) SetNoforwards (value bool ) {
if value {
s .Flags .Set (10 )
s .Noforwards = true
} else {
s .Flags .Unset (10 )
s .Noforwards = false
}
}
func (s *StoryItem ) GetNoforwards () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (10 )
}
func (s *StoryItem ) SetEdited (value bool ) {
if value {
s .Flags .Set (11 )
s .Edited = true
} else {
s .Flags .Unset (11 )
s .Edited = false
}
}
func (s *StoryItem ) GetEdited () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (11 )
}
func (s *StoryItem ) SetContacts (value bool ) {
if value {
s .Flags .Set (12 )
s .Contacts = true
} else {
s .Flags .Unset (12 )
s .Contacts = false
}
}
func (s *StoryItem ) GetContacts () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (12 )
}
func (s *StoryItem ) SetSelectedContacts (value bool ) {
if value {
s .Flags .Set (13 )
s .SelectedContacts = true
} else {
s .Flags .Unset (13 )
s .SelectedContacts = false
}
}
func (s *StoryItem ) GetSelectedContacts () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (13 )
}
func (s *StoryItem ) SetOut (value bool ) {
if value {
s .Flags .Set (16 )
s .Out = true
} else {
s .Flags .Unset (16 )
s .Out = false
}
}
func (s *StoryItem ) GetOut () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (16 )
}
func (s *StoryItem ) GetID () (value int ) {
if s == nil {
return
}
return s .ID
}
func (s *StoryItem ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *StoryItem ) SetFwdFrom (value StoryFwdHeader ) {
s .Flags .Set (17 )
s .FwdFrom = value
}
func (s *StoryItem ) GetFwdFrom () (value StoryFwdHeader , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (17 ) {
return value , false
}
return s .FwdFrom , true
}
func (s *StoryItem ) GetExpireDate () (value int ) {
if s == nil {
return
}
return s .ExpireDate
}
func (s *StoryItem ) SetCaption (value string ) {
s .Flags .Set (0 )
s .Caption = value
}
func (s *StoryItem ) GetCaption () (value string , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (0 ) {
return value , false
}
return s .Caption , true
}
func (s *StoryItem ) SetEntities (value []MessageEntityClass ) {
s .Flags .Set (1 )
s .Entities = value
}
func (s *StoryItem ) GetEntities () (value []MessageEntityClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (1 ) {
return value , false
}
return s .Entities , true
}
func (s *StoryItem ) GetMedia () (value MessageMediaClass ) {
if s == nil {
return
}
return s .Media
}
func (s *StoryItem ) SetMediaAreas (value []MediaAreaClass ) {
s .Flags .Set (14 )
s .MediaAreas = value
}
func (s *StoryItem ) GetMediaAreas () (value []MediaAreaClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (14 ) {
return value , false
}
return s .MediaAreas , true
}
func (s *StoryItem ) SetPrivacy (value []PrivacyRuleClass ) {
s .Flags .Set (2 )
s .Privacy = value
}
func (s *StoryItem ) GetPrivacy () (value []PrivacyRuleClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (2 ) {
return value , false
}
return s .Privacy , true
}
func (s *StoryItem ) SetViews (value StoryViews ) {
s .Flags .Set (3 )
s .Views = value
}
func (s *StoryItem ) GetViews () (value StoryViews , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (3 ) {
return value , false
}
return s .Views , true
}
func (s *StoryItem ) SetSentReaction (value ReactionClass ) {
s .Flags .Set (15 )
s .SentReaction = value
}
func (s *StoryItem ) GetSentReaction () (value ReactionClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (15 ) {
return value , false
}
return s .SentReaction , true
}
func (s *StoryItem ) MapEntities () (value MessageEntityClassArray , ok bool ) {
if !s .Flags .Has (1 ) {
return value , false
}
return MessageEntityClassArray (s .Entities ), true
}
func (s *StoryItem ) MapMediaAreas () (value MediaAreaClassArray , ok bool ) {
if !s .Flags .Has (14 ) {
return value , false
}
return MediaAreaClassArray (s .MediaAreas ), true
}
func (s *StoryItem ) MapPrivacy () (value PrivacyRuleClassArray , ok bool ) {
if !s .Flags .Has (2 ) {
return value , false
}
return PrivacyRuleClassArray (s .Privacy ), true
}
const StoryItemClassName = "StoryItem"
type StoryItemClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () StoryItemClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value int )
}
func DecodeStoryItem (buf *bin .Buffer ) (StoryItemClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case StoryItemDeletedTypeID :
v := StoryItemDeleted {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StoryItemClass: %w" , err )
}
return &v , nil
case StoryItemSkippedTypeID :
v := StoryItemSkipped {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StoryItemClass: %w" , err )
}
return &v , nil
case StoryItemTypeID :
v := StoryItem {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StoryItemClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode StoryItemClass: %w" , bin .NewUnexpectedID (id ))
}
}
type StoryItemBox struct {
StoryItem StoryItemClass
}
func (b *StoryItemBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode StoryItemBox to nil" )
}
v , err := DecodeStoryItem (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .StoryItem = v
return nil
}
func (b *StoryItemBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .StoryItem == nil {
return fmt .Errorf ("unable to encode StoryItemClass as nil" )
}
return b .StoryItem .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 .