// 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{})// MyBoost represents TL type `myBoost#c448415c`.// Contains information about a single boost slot »¹.//// Links:// 1. https://core.telegram.org/api/boost//// See https://core.telegram.org/constructor/myBoost for reference.typeMyBooststruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// Boost slot ID »¹ // // Links: // 1) https://core.telegram.org/api/boostSlotint// If set, indicates this slot is currently occupied, i.e. we are boosting¹ this peer. // Note that we can assign multiple boost slots to the same peer. // // Links: // 1) https://core.telegram.org/api/boost // // Use SetPeer and GetPeer helpers.PeerPeerClass// When (unixtime) we started boosting the peer, 0 otherwise.Dateint// Indicates the (unixtime) expiration date of the boost in peer (0 if peer is not set).Expiresint// If peer is set, indicates the (unixtime) date after which this boost can be reassigned // to another channel. // // Use SetCooldownUntilDate and GetCooldownUntilDate helpers.CooldownUntilDateint}// MyBoostTypeID is TL type id of MyBoost.constMyBoostTypeID = 0xc448415c// Ensuring interfaces in compile-time for MyBoost.var ( _ bin.Encoder = &MyBoost{} _ bin.Decoder = &MyBoost{} _ bin.BareEncoder = &MyBoost{} _ bin.BareDecoder = &MyBoost{})func ( *MyBoost) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.Slot == 0) {returnfalse }if !(.Peer == nil) {returnfalse }if !(.Date == 0) {returnfalse }if !(.Expires == 0) {returnfalse }if !(.CooldownUntilDate == 0) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *MyBoost) () string {if == nil {return"MyBoost(nil)" }typeMyBoostreturnfmt.Sprintf("MyBoost%+v", (*))}// FillFrom fills MyBoost from given interface.func ( *MyBoost) ( interface { () ( int) () ( PeerClass, bool) () ( int) () ( int) () ( int, bool)}) { .Slot = .()if , := .(); { .Peer = } .Date = .() .Expires = .()if , := .(); { .CooldownUntilDate = }}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*MyBoost) () uint32 {returnMyBoostTypeID}// TypeName returns name of type in TL schema.func (*MyBoost) () string {return"myBoost"}// TypeInfo returns info about TL type.func ( *MyBoost) () tdp.Type { := tdp.Type{Name: "myBoost",ID: MyBoostTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Slot",SchemaName: "slot", }, {Name: "Peer",SchemaName: "peer",Null: !.Flags.Has(0), }, {Name: "Date",SchemaName: "date", }, {Name: "Expires",SchemaName: "expires", }, {Name: "CooldownUntilDate",SchemaName: "cooldown_until_date",Null: !.Flags.Has(1), }, }return}// SetFlags sets flags for non-zero fields.func ( *MyBoost) () {if !(.Peer == nil) { .Flags.Set(0) }if !(.CooldownUntilDate == 0) { .Flags.Set(1) }}// Encode implements bin.Encoder.func ( *MyBoost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode myBoost#c448415c as nil") } .PutID(MyBoostTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *MyBoost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode myBoost#c448415c as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode myBoost#c448415c: field flags: %w", ) } .PutInt(.Slot)if .Flags.Has(0) {if .Peer == nil {returnfmt.Errorf("unable to encode myBoost#c448415c: field peer is nil") }if := .Peer.Encode(); != nil {returnfmt.Errorf("unable to encode myBoost#c448415c: field peer: %w", ) } } .PutInt(.Date) .PutInt(.Expires)if .Flags.Has(1) { .PutInt(.CooldownUntilDate) }returnnil}// Decode implements bin.Decoder.func ( *MyBoost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode myBoost#c448415c to nil") }if := .ConsumeID(MyBoostTypeID); != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *MyBoost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode myBoost#c448415c to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: field flags: %w", ) } } { , := .Int()if != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: field slot: %w", ) } .Slot = }if .Flags.Has(0) { , := DecodePeer()if != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: field peer: %w", ) } .Peer = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: field date: %w", ) } .Date = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: field expires: %w", ) } .Expires = }if .Flags.Has(1) { , := .Int()if != nil {returnfmt.Errorf("unable to decode myBoost#c448415c: field cooldown_until_date: %w", ) } .CooldownUntilDate = }returnnil}// GetSlot returns value of Slot field.func ( *MyBoost) () ( int) {if == nil {return }return .Slot}// SetPeer sets value of Peer conditional field.func ( *MyBoost) ( PeerClass) { .Flags.Set(0) .Peer = }// GetPeer returns value of Peer conditional field and// boolean which is true if field was set.func ( *MyBoost) () ( PeerClass, bool) {if == nil {return }if !.Flags.Has(0) {return , false }return .Peer, true}// GetDate returns value of Date field.func ( *MyBoost) () ( int) {if == nil {return }return .Date}// GetExpires returns value of Expires field.func ( *MyBoost) () ( int) {if == nil {return }return .Expires}// SetCooldownUntilDate sets value of CooldownUntilDate conditional field.func ( *MyBoost) ( int) { .Flags.Set(1) .CooldownUntilDate = }// GetCooldownUntilDate returns value of CooldownUntilDate conditional field and// boolean which is true if field was set.func ( *MyBoost) () ( int, bool) {if == nil {return }if !.Flags.Has(1) {return , false }return .CooldownUntilDate, true}
The pages are generated with Goldsv0.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.