// 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{})// Passkey represents TL type `passkey#98613ebf`.// Human-readable info about a passkey associated to an account, returned when creating a// passkey »¹ or listing passkeys »².//// Links:// 1. https://core.telegram.org/api/passkeys#creating-a-passkey// 2. https://core.telegram.org/api/passkeys#list-passkeys//// See https://core.telegram.org/constructor/passkey for reference.typePasskeystruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// Unique passkey ID, usable for example in account.deletePasskey¹. // // Links: // 1) https://core.telegram.org/method/account.deletePasskeyIDstring// Human-readable passkey nameNamestring// Creation date of the passkeyDateint// ID of the custom emoji¹ used as icon for the software or password manager that // created the passkey // // Links: // 1) https://core.telegram.org/api/custom-emoji // // Use SetSoftwareEmojiID and GetSoftwareEmojiID helpers.SoftwareEmojiIDint64// Date when the passkey was last used to log in // // Use SetLastUsageDate and GetLastUsageDate helpers.LastUsageDateint}// PasskeyTypeID is TL type id of Passkey.constPasskeyTypeID = 0x98613ebf// Ensuring interfaces in compile-time for Passkey.var ( _ bin.Encoder = &Passkey{} _ bin.Decoder = &Passkey{} _ bin.BareEncoder = &Passkey{} _ bin.BareDecoder = &Passkey{})func ( *Passkey) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.ID == "") {returnfalse }if !(.Name == "") {returnfalse }if !(.Date == 0) {returnfalse }if !(.SoftwareEmojiID == 0) {returnfalse }if !(.LastUsageDate == 0) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *Passkey) () string {if == nil {return"Passkey(nil)" }typePasskeyreturnfmt.Sprintf("Passkey%+v", (*))}// FillFrom fills Passkey from given interface.func ( *Passkey) ( interface { () ( string) () ( string) () ( int) () ( int64, bool) () ( int, bool)}) { .ID = .() .Name = .() .Date = .()if , := .(); { .SoftwareEmojiID = }if , := .(); { .LastUsageDate = }}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*Passkey) () uint32 {returnPasskeyTypeID}// TypeName returns name of type in TL schema.func (*Passkey) () string {return"passkey"}// TypeInfo returns info about TL type.func ( *Passkey) () tdp.Type { := tdp.Type{Name: "passkey",ID: PasskeyTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "ID",SchemaName: "id", }, {Name: "Name",SchemaName: "name", }, {Name: "Date",SchemaName: "date", }, {Name: "SoftwareEmojiID",SchemaName: "software_emoji_id",Null: !.Flags.Has(0), }, {Name: "LastUsageDate",SchemaName: "last_usage_date",Null: !.Flags.Has(1), }, }return}// SetFlags sets flags for non-zero fields.func ( *Passkey) () {if !(.SoftwareEmojiID == 0) { .Flags.Set(0) }if !(.LastUsageDate == 0) { .Flags.Set(1) }}// Encode implements bin.Encoder.func ( *Passkey) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode passkey#98613ebf as nil") } .PutID(PasskeyTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *Passkey) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode passkey#98613ebf as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode passkey#98613ebf: field flags: %w", ) } .PutString(.ID) .PutString(.Name) .PutInt(.Date)if .Flags.Has(0) { .PutLong(.SoftwareEmojiID) }if .Flags.Has(1) { .PutInt(.LastUsageDate) }returnnil}// Decode implements bin.Decoder.func ( *Passkey) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode passkey#98613ebf to nil") }if := .ConsumeID(PasskeyTypeID); != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *Passkey) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode passkey#98613ebf to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: field flags: %w", ) } } { , := .String()if != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: field id: %w", ) } .ID = } { , := .String()if != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: field name: %w", ) } .Name = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: field date: %w", ) } .Date = }if .Flags.Has(0) { , := .Long()if != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: field software_emoji_id: %w", ) } .SoftwareEmojiID = }if .Flags.Has(1) { , := .Int()if != nil {returnfmt.Errorf("unable to decode passkey#98613ebf: field last_usage_date: %w", ) } .LastUsageDate = }returnnil}// GetID returns value of ID field.func ( *Passkey) () ( string) {if == nil {return }return .ID}// GetName returns value of Name field.func ( *Passkey) () ( string) {if == nil {return }return .Name}// GetDate returns value of Date field.func ( *Passkey) () ( int) {if == nil {return }return .Date}// SetSoftwareEmojiID sets value of SoftwareEmojiID conditional field.func ( *Passkey) ( int64) { .Flags.Set(0) .SoftwareEmojiID = }// GetSoftwareEmojiID returns value of SoftwareEmojiID conditional field and// boolean which is true if field was set.func ( *Passkey) () ( int64, bool) {if == nil {return }if !.Flags.Has(0) {return , false }return .SoftwareEmojiID, true}// SetLastUsageDate sets value of LastUsageDate conditional field.func ( *Passkey) ( int) { .Flags.Set(1) .LastUsageDate = }// GetLastUsageDate returns value of LastUsageDate conditional field and// boolean which is true if field was set.func ( *Passkey) () ( int, bool) {if == nil {return }if !.Flags.Has(1) {return , false }return .LastUsageDate, true}
The pages are generated with Goldsv0.8.4. (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.