// Code generated by gotdgen, DO NOT EDIT.package tgimport ()// No-op definition for keeping imports.var ( _ = bin.Buffer{} _ = context.Background() _ = fmt.Stringer(nil) _ = strings.Builder{} _ = errors.Is _ = multierr.AppendInto _ = sort.Ints _ = tdp.Format _ = tgerr.Error{} _ = tdjson.Encoder{})// RecentStory represents TL type `recentStory#711d692d`.// Summary of a peer's active stories »¹, embedded in user².stories_max_id and// channel³.stories_max_id and returned by stories.getPeerMaxIDs⁴.//// Links:// 1. https://core.telegram.org/api/stories#recent-story-summaries// 2. https://core.telegram.org/constructor/user// 3. https://core.telegram.org/constructor/channel// 4. https://core.telegram.org/method/stories.getPeerMaxIDs//// See https://core.telegram.org/constructor/recentStory for reference.typeRecentStorystruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// Whether the peer is currently broadcasting a live story »¹. // // Links: // 1) https://core.telegram.org/api/stories#live-storiesLivebool// If live is set, ID of the peer's active live story »¹; otherwise, ID of the peer's // maximum active story. // // Links: // 1) https://core.telegram.org/api/stories#live-stories // // Use SetMaxID and GetMaxID helpers.MaxIDint}// RecentStoryTypeID is TL type id of RecentStory.constRecentStoryTypeID = 0x711d692d// Ensuring interfaces in compile-time for RecentStory.var ( _ bin.Encoder = &RecentStory{} _ bin.Decoder = &RecentStory{} _ bin.BareEncoder = &RecentStory{} _ bin.BareDecoder = &RecentStory{})func ( *RecentStory) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.Live == false) {returnfalse }if !(.MaxID == 0) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *RecentStory) () string {if == nil {return"RecentStory(nil)" }typeRecentStoryreturnfmt.Sprintf("RecentStory%+v", (*))}// FillFrom fills RecentStory from given interface.func ( *RecentStory) ( interface { () ( bool) () ( int, bool)}) { .Live = .()if , := .(); { .MaxID = }}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*RecentStory) () uint32 {returnRecentStoryTypeID}// TypeName returns name of type in TL schema.func (*RecentStory) () string {return"recentStory"}// TypeInfo returns info about TL type.func ( *RecentStory) () tdp.Type { := tdp.Type{Name: "recentStory",ID: RecentStoryTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Live",SchemaName: "live",Null: !.Flags.Has(0), }, {Name: "MaxID",SchemaName: "max_id",Null: !.Flags.Has(1), }, }return}// SetFlags sets flags for non-zero fields.func ( *RecentStory) () {if !(.Live == false) { .Flags.Set(0) }if !(.MaxID == 0) { .Flags.Set(1) }}// Encode implements bin.Encoder.func ( *RecentStory) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode recentStory#711d692d as nil") } .PutID(RecentStoryTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *RecentStory) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode recentStory#711d692d as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode recentStory#711d692d: field flags: %w", ) }if .Flags.Has(1) { .PutInt(.MaxID) }returnnil}// Decode implements bin.Decoder.func ( *RecentStory) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode recentStory#711d692d to nil") }if := .ConsumeID(RecentStoryTypeID); != nil {returnfmt.Errorf("unable to decode recentStory#711d692d: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *RecentStory) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode recentStory#711d692d to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode recentStory#711d692d: field flags: %w", ) } } .Live = .Flags.Has(0)if .Flags.Has(1) { , := .Int()if != nil {returnfmt.Errorf("unable to decode recentStory#711d692d: field max_id: %w", ) } .MaxID = }returnnil}// SetLive sets value of Live conditional field.func ( *RecentStory) ( bool) {if { .Flags.Set(0) .Live = true } else { .Flags.Unset(0) .Live = false }}// GetLive returns value of Live conditional field.func ( *RecentStory) () ( bool) {if == nil {return }return .Flags.Has(0)}// SetMaxID sets value of MaxID conditional field.func ( *RecentStory) ( int) { .Flags.Set(1) .MaxID = }// GetMaxID returns value of MaxID conditional field and// boolean which is true if field was set.func ( *RecentStory) () ( int, bool) {if == nil {return }if !.Flags.Has(1) {return , false }return .MaxID, true}
The pages are generated with Goldsv0.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.