// 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{})// Boost represents TL type `boost#2a1c8c71`.// Info about one or more boosts¹ applied by a specific user.//// Links:// 1. https://core.telegram.org/api/boost//// See https://core.telegram.org/constructor/boost for reference.typeBooststruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// Whether this boost was applied because the channel directly gifted a subscription to // the user¹. // // Links: // 1) https://core.telegram.org/api/giveawaysGiftbool// Whether this boost was applied because the user was chosen in a giveaway started by // the channel¹. // // Links: // 1) https://core.telegram.org/api/giveawaysGiveawaybool// If set, the user hasn't yet invoked payments.applyGiftCode¹ to claim a subscription // gifted directly or in a giveaway by the channel². // // Links: // 1) https://core.telegram.org/method/payments.applyGiftCode // 2) https://core.telegram.org/api/giveawaysUnclaimedbool// Unique ID for this set of boosts.IDstring// ID of the user that applied the boost. // // Use SetUserID and GetUserID helpers.UserIDint64// The message ID of the giveaway¹ // // Links: // 1) https://core.telegram.org/api/giveaways // // Use SetGiveawayMsgID and GetGiveawayMsgID helpers.GiveawayMsgIDint// When was the boost appliedDateint// When does the boost expireExpiresint// The created Telegram Premium gift code, only set if either gift or giveaway are set // AND it is either a gift code for the currently logged in user or if it was already // claimed. // // Use SetUsedGiftSlug and GetUsedGiftSlug helpers.UsedGiftSlugstring// If set, this boost counts as multiplier boosts, otherwise it counts as a single boost. // // Use SetMultiplier and GetMultiplier helpers.Multiplierint}// BoostTypeID is TL type id of Boost.constBoostTypeID = 0x2a1c8c71// Ensuring interfaces in compile-time for Boost.var ( _ bin.Encoder = &Boost{} _ bin.Decoder = &Boost{} _ bin.BareEncoder = &Boost{} _ bin.BareDecoder = &Boost{})func ( *Boost) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.Gift == false) {returnfalse }if !(.Giveaway == false) {returnfalse }if !(.Unclaimed == false) {returnfalse }if !(.ID == "") {returnfalse }if !(.UserID == 0) {returnfalse }if !(.GiveawayMsgID == 0) {returnfalse }if !(.Date == 0) {returnfalse }if !(.Expires == 0) {returnfalse }if !(.UsedGiftSlug == "") {returnfalse }if !(.Multiplier == 0) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *Boost) () string {if == nil {return"Boost(nil)" }typeBoostreturnfmt.Sprintf("Boost%+v", (*))}// FillFrom fills Boost from given interface.func ( *Boost) ( interface { () ( bool) () ( bool) () ( bool) () ( string) () ( int64, bool) () ( int, bool) () ( int) () ( int) () ( string, bool) () ( int, bool)}) { .Gift = .() .Giveaway = .() .Unclaimed = .() .ID = .()if , := .(); { .UserID = }if , := .(); { .GiveawayMsgID = } .Date = .() .Expires = .()if , := .(); { .UsedGiftSlug = }if , := .(); { .Multiplier = }}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*Boost) () uint32 {returnBoostTypeID}// TypeName returns name of type in TL schema.func (*Boost) () string {return"boost"}// TypeInfo returns info about TL type.func ( *Boost) () tdp.Type { := tdp.Type{Name: "boost",ID: BoostTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Gift",SchemaName: "gift",Null: !.Flags.Has(1), }, {Name: "Giveaway",SchemaName: "giveaway",Null: !.Flags.Has(2), }, {Name: "Unclaimed",SchemaName: "unclaimed",Null: !.Flags.Has(3), }, {Name: "ID",SchemaName: "id", }, {Name: "UserID",SchemaName: "user_id",Null: !.Flags.Has(0), }, {Name: "GiveawayMsgID",SchemaName: "giveaway_msg_id",Null: !.Flags.Has(2), }, {Name: "Date",SchemaName: "date", }, {Name: "Expires",SchemaName: "expires", }, {Name: "UsedGiftSlug",SchemaName: "used_gift_slug",Null: !.Flags.Has(4), }, {Name: "Multiplier",SchemaName: "multiplier",Null: !.Flags.Has(5), }, }return}// SetFlags sets flags for non-zero fields.func ( *Boost) () {if !(.Gift == false) { .Flags.Set(1) }if !(.Giveaway == false) { .Flags.Set(2) }if !(.Unclaimed == false) { .Flags.Set(3) }if !(.UserID == 0) { .Flags.Set(0) }if !(.GiveawayMsgID == 0) { .Flags.Set(2) }if !(.UsedGiftSlug == "") { .Flags.Set(4) }if !(.Multiplier == 0) { .Flags.Set(5) }}// Encode implements bin.Encoder.func ( *Boost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode boost#2a1c8c71 as nil") } .PutID(BoostTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *Boost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode boost#2a1c8c71 as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode boost#2a1c8c71: field flags: %w", ) } .PutString(.ID)if .Flags.Has(0) { .PutLong(.UserID) }if .Flags.Has(2) { .PutInt(.GiveawayMsgID) } .PutInt(.Date) .PutInt(.Expires)if .Flags.Has(4) { .PutString(.UsedGiftSlug) }if .Flags.Has(5) { .PutInt(.Multiplier) }returnnil}// Decode implements bin.Decoder.func ( *Boost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode boost#2a1c8c71 to nil") }if := .ConsumeID(BoostTypeID); != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *Boost) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode boost#2a1c8c71 to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field flags: %w", ) } } .Gift = .Flags.Has(1) .Giveaway = .Flags.Has(2) .Unclaimed = .Flags.Has(3) { , := .String()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field id: %w", ) } .ID = }if .Flags.Has(0) { , := .Long()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field user_id: %w", ) } .UserID = }if .Flags.Has(2) { , := .Int()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field giveaway_msg_id: %w", ) } .GiveawayMsgID = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field date: %w", ) } .Date = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field expires: %w", ) } .Expires = }if .Flags.Has(4) { , := .String()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field used_gift_slug: %w", ) } .UsedGiftSlug = }if .Flags.Has(5) { , := .Int()if != nil {returnfmt.Errorf("unable to decode boost#2a1c8c71: field multiplier: %w", ) } .Multiplier = }returnnil}// SetGift sets value of Gift conditional field.func ( *Boost) ( bool) {if { .Flags.Set(1) .Gift = true } else { .Flags.Unset(1) .Gift = false }}// GetGift returns value of Gift conditional field.func ( *Boost) () ( bool) {if == nil {return }return .Flags.Has(1)}// SetGiveaway sets value of Giveaway conditional field.func ( *Boost) ( bool) {if { .Flags.Set(2) .Giveaway = true } else { .Flags.Unset(2) .Giveaway = false }}// GetGiveaway returns value of Giveaway conditional field.func ( *Boost) () ( bool) {if == nil {return }return .Flags.Has(2)}// SetUnclaimed sets value of Unclaimed conditional field.func ( *Boost) ( bool) {if { .Flags.Set(3) .Unclaimed = true } else { .Flags.Unset(3) .Unclaimed = false }}// GetUnclaimed returns value of Unclaimed conditional field.func ( *Boost) () ( bool) {if == nil {return }return .Flags.Has(3)}// GetID returns value of ID field.func ( *Boost) () ( string) {if == nil {return }return .ID}// SetUserID sets value of UserID conditional field.func ( *Boost) ( int64) { .Flags.Set(0) .UserID = }// GetUserID returns value of UserID conditional field and// boolean which is true if field was set.func ( *Boost) () ( int64, bool) {if == nil {return }if !.Flags.Has(0) {return , false }return .UserID, true}// SetGiveawayMsgID sets value of GiveawayMsgID conditional field.func ( *Boost) ( int) { .Flags.Set(2) .GiveawayMsgID = }// GetGiveawayMsgID returns value of GiveawayMsgID conditional field and// boolean which is true if field was set.func ( *Boost) () ( int, bool) {if == nil {return }if !.Flags.Has(2) {return , false }return .GiveawayMsgID, true}// GetDate returns value of Date field.func ( *Boost) () ( int) {if == nil {return }return .Date}// GetExpires returns value of Expires field.func ( *Boost) () ( int) {if == nil {return }return .Expires}// SetUsedGiftSlug sets value of UsedGiftSlug conditional field.func ( *Boost) ( string) { .Flags.Set(4) .UsedGiftSlug = }// GetUsedGiftSlug returns value of UsedGiftSlug conditional field and// boolean which is true if field was set.func ( *Boost) () ( string, bool) {if == nil {return }if !.Flags.Has(4) {return , false }return .UsedGiftSlug, true}// SetMultiplier sets value of Multiplier conditional field.func ( *Boost) ( int) { .Flags.Set(5) .Multiplier = }// GetMultiplier returns value of Multiplier conditional field and// boolean which is true if field was set.func ( *Boost) () ( int, bool) {if == nil {return }if !.Flags.Has(5) {return , false }return .Multiplier, 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.