// Code generated by gotdgen, DO NOT EDIT. package tdapi import ( "context" "errors" "fmt" "sort" "strings" "go.uber.org/multierr" "go.mau.fi/mautrix-telegram/pkg/gotd/bin" "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" "go.mau.fi/mautrix-telegram/pkg/gotd/tgerr" ) // 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{} ) // UserPrivacySettingShowStatus represents TL type `userPrivacySettingShowStatus#6f0884fe`. type UserPrivacySettingShowStatus struct { } // UserPrivacySettingShowStatusTypeID is TL type id of UserPrivacySettingShowStatus. const UserPrivacySettingShowStatusTypeID = 0x6f0884fe // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingShowStatus) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingShowStatus. var ( _ bin.Encoder = &UserPrivacySettingShowStatus{} _ bin.Decoder = &UserPrivacySettingShowStatus{} _ bin.BareEncoder = &UserPrivacySettingShowStatus{} _ bin.BareDecoder = &UserPrivacySettingShowStatus{} _ UserPrivacySettingClass = &UserPrivacySettingShowStatus{} ) func (u *UserPrivacySettingShowStatus) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingShowStatus) String() string { if u == nil { return "UserPrivacySettingShowStatus(nil)" } type Alias UserPrivacySettingShowStatus return fmt.Sprintf("UserPrivacySettingShowStatus%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingShowStatus) TypeID() uint32 { return UserPrivacySettingShowStatusTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingShowStatus) TypeName() string { return "userPrivacySettingShowStatus" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingShowStatus) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingShowStatus", ID: UserPrivacySettingShowStatusTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingShowStatus) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowStatus#6f0884fe as nil") } b.PutID(UserPrivacySettingShowStatusTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingShowStatus) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowStatus#6f0884fe as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingShowStatus) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowStatus#6f0884fe to nil") } if err := b.ConsumeID(UserPrivacySettingShowStatusTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowStatus#6f0884fe: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingShowStatus) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowStatus#6f0884fe to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingShowStatus) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowStatus#6f0884fe as nil") } b.ObjStart() b.PutID("userPrivacySettingShowStatus") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingShowStatus) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowStatus#6f0884fe to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingShowStatus"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowStatus#6f0884fe: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingShowProfilePhoto represents TL type `userPrivacySettingShowProfilePhoto#53f3c9f5`. type UserPrivacySettingShowProfilePhoto struct { } // UserPrivacySettingShowProfilePhotoTypeID is TL type id of UserPrivacySettingShowProfilePhoto. const UserPrivacySettingShowProfilePhotoTypeID = 0x53f3c9f5 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingShowProfilePhoto) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingShowProfilePhoto. var ( _ bin.Encoder = &UserPrivacySettingShowProfilePhoto{} _ bin.Decoder = &UserPrivacySettingShowProfilePhoto{} _ bin.BareEncoder = &UserPrivacySettingShowProfilePhoto{} _ bin.BareDecoder = &UserPrivacySettingShowProfilePhoto{} _ UserPrivacySettingClass = &UserPrivacySettingShowProfilePhoto{} ) func (u *UserPrivacySettingShowProfilePhoto) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingShowProfilePhoto) String() string { if u == nil { return "UserPrivacySettingShowProfilePhoto(nil)" } type Alias UserPrivacySettingShowProfilePhoto return fmt.Sprintf("UserPrivacySettingShowProfilePhoto%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingShowProfilePhoto) TypeID() uint32 { return UserPrivacySettingShowProfilePhotoTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingShowProfilePhoto) TypeName() string { return "userPrivacySettingShowProfilePhoto" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingShowProfilePhoto) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingShowProfilePhoto", ID: UserPrivacySettingShowProfilePhotoTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingShowProfilePhoto) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowProfilePhoto#53f3c9f5 as nil") } b.PutID(UserPrivacySettingShowProfilePhotoTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingShowProfilePhoto) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowProfilePhoto#53f3c9f5 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingShowProfilePhoto) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowProfilePhoto#53f3c9f5 to nil") } if err := b.ConsumeID(UserPrivacySettingShowProfilePhotoTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowProfilePhoto#53f3c9f5: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingShowProfilePhoto) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowProfilePhoto#53f3c9f5 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingShowProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowProfilePhoto#53f3c9f5 as nil") } b.ObjStart() b.PutID("userPrivacySettingShowProfilePhoto") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingShowProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowProfilePhoto#53f3c9f5 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingShowProfilePhoto"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowProfilePhoto#53f3c9f5: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingShowLinkInForwardedMessages represents TL type `userPrivacySettingShowLinkInForwardedMessages#2353b6e6`. type UserPrivacySettingShowLinkInForwardedMessages struct { } // UserPrivacySettingShowLinkInForwardedMessagesTypeID is TL type id of UserPrivacySettingShowLinkInForwardedMessages. const UserPrivacySettingShowLinkInForwardedMessagesTypeID = 0x2353b6e6 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingShowLinkInForwardedMessages) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingShowLinkInForwardedMessages. var ( _ bin.Encoder = &UserPrivacySettingShowLinkInForwardedMessages{} _ bin.Decoder = &UserPrivacySettingShowLinkInForwardedMessages{} _ bin.BareEncoder = &UserPrivacySettingShowLinkInForwardedMessages{} _ bin.BareDecoder = &UserPrivacySettingShowLinkInForwardedMessages{} _ UserPrivacySettingClass = &UserPrivacySettingShowLinkInForwardedMessages{} ) func (u *UserPrivacySettingShowLinkInForwardedMessages) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingShowLinkInForwardedMessages) String() string { if u == nil { return "UserPrivacySettingShowLinkInForwardedMessages(nil)" } type Alias UserPrivacySettingShowLinkInForwardedMessages return fmt.Sprintf("UserPrivacySettingShowLinkInForwardedMessages%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingShowLinkInForwardedMessages) TypeID() uint32 { return UserPrivacySettingShowLinkInForwardedMessagesTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingShowLinkInForwardedMessages) TypeName() string { return "userPrivacySettingShowLinkInForwardedMessages" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingShowLinkInForwardedMessages) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingShowLinkInForwardedMessages", ID: UserPrivacySettingShowLinkInForwardedMessagesTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingShowLinkInForwardedMessages) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 as nil") } b.PutID(UserPrivacySettingShowLinkInForwardedMessagesTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingShowLinkInForwardedMessages) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingShowLinkInForwardedMessages) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 to nil") } if err := b.ConsumeID(UserPrivacySettingShowLinkInForwardedMessagesTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingShowLinkInForwardedMessages) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingShowLinkInForwardedMessages) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 as nil") } b.ObjStart() b.PutID("userPrivacySettingShowLinkInForwardedMessages") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingShowLinkInForwardedMessages) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingShowLinkInForwardedMessages"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingShowPhoneNumber represents TL type `userPrivacySettingShowPhoneNumber#d0d1a229`. type UserPrivacySettingShowPhoneNumber struct { } // UserPrivacySettingShowPhoneNumberTypeID is TL type id of UserPrivacySettingShowPhoneNumber. const UserPrivacySettingShowPhoneNumberTypeID = 0xd0d1a229 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingShowPhoneNumber) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingShowPhoneNumber. var ( _ bin.Encoder = &UserPrivacySettingShowPhoneNumber{} _ bin.Decoder = &UserPrivacySettingShowPhoneNumber{} _ bin.BareEncoder = &UserPrivacySettingShowPhoneNumber{} _ bin.BareDecoder = &UserPrivacySettingShowPhoneNumber{} _ UserPrivacySettingClass = &UserPrivacySettingShowPhoneNumber{} ) func (u *UserPrivacySettingShowPhoneNumber) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingShowPhoneNumber) String() string { if u == nil { return "UserPrivacySettingShowPhoneNumber(nil)" } type Alias UserPrivacySettingShowPhoneNumber return fmt.Sprintf("UserPrivacySettingShowPhoneNumber%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingShowPhoneNumber) TypeID() uint32 { return UserPrivacySettingShowPhoneNumberTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingShowPhoneNumber) TypeName() string { return "userPrivacySettingShowPhoneNumber" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingShowPhoneNumber) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingShowPhoneNumber", ID: UserPrivacySettingShowPhoneNumberTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingShowPhoneNumber) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowPhoneNumber#d0d1a229 as nil") } b.PutID(UserPrivacySettingShowPhoneNumberTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingShowPhoneNumber) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowPhoneNumber#d0d1a229 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingShowPhoneNumber) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowPhoneNumber#d0d1a229 to nil") } if err := b.ConsumeID(UserPrivacySettingShowPhoneNumberTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowPhoneNumber#d0d1a229: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingShowPhoneNumber) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowPhoneNumber#d0d1a229 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingShowPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowPhoneNumber#d0d1a229 as nil") } b.ObjStart() b.PutID("userPrivacySettingShowPhoneNumber") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingShowPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowPhoneNumber#d0d1a229 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingShowPhoneNumber"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowPhoneNumber#d0d1a229: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingShowBio represents TL type `userPrivacySettingShowBio#39382761`. type UserPrivacySettingShowBio struct { } // UserPrivacySettingShowBioTypeID is TL type id of UserPrivacySettingShowBio. const UserPrivacySettingShowBioTypeID = 0x39382761 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingShowBio) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingShowBio. var ( _ bin.Encoder = &UserPrivacySettingShowBio{} _ bin.Decoder = &UserPrivacySettingShowBio{} _ bin.BareEncoder = &UserPrivacySettingShowBio{} _ bin.BareDecoder = &UserPrivacySettingShowBio{} _ UserPrivacySettingClass = &UserPrivacySettingShowBio{} ) func (u *UserPrivacySettingShowBio) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingShowBio) String() string { if u == nil { return "UserPrivacySettingShowBio(nil)" } type Alias UserPrivacySettingShowBio return fmt.Sprintf("UserPrivacySettingShowBio%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingShowBio) TypeID() uint32 { return UserPrivacySettingShowBioTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingShowBio) TypeName() string { return "userPrivacySettingShowBio" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingShowBio) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingShowBio", ID: UserPrivacySettingShowBioTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingShowBio) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowBio#39382761 as nil") } b.PutID(UserPrivacySettingShowBioTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingShowBio) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowBio#39382761 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingShowBio) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowBio#39382761 to nil") } if err := b.ConsumeID(UserPrivacySettingShowBioTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowBio#39382761: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingShowBio) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowBio#39382761 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingShowBio) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowBio#39382761 as nil") } b.ObjStart() b.PutID("userPrivacySettingShowBio") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingShowBio) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowBio#39382761 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingShowBio"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowBio#39382761: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingShowBirthdate represents TL type `userPrivacySettingShowBirthdate#4596b4df`. type UserPrivacySettingShowBirthdate struct { } // UserPrivacySettingShowBirthdateTypeID is TL type id of UserPrivacySettingShowBirthdate. const UserPrivacySettingShowBirthdateTypeID = 0x4596b4df // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingShowBirthdate) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingShowBirthdate. var ( _ bin.Encoder = &UserPrivacySettingShowBirthdate{} _ bin.Decoder = &UserPrivacySettingShowBirthdate{} _ bin.BareEncoder = &UserPrivacySettingShowBirthdate{} _ bin.BareDecoder = &UserPrivacySettingShowBirthdate{} _ UserPrivacySettingClass = &UserPrivacySettingShowBirthdate{} ) func (u *UserPrivacySettingShowBirthdate) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingShowBirthdate) String() string { if u == nil { return "UserPrivacySettingShowBirthdate(nil)" } type Alias UserPrivacySettingShowBirthdate return fmt.Sprintf("UserPrivacySettingShowBirthdate%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingShowBirthdate) TypeID() uint32 { return UserPrivacySettingShowBirthdateTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingShowBirthdate) TypeName() string { return "userPrivacySettingShowBirthdate" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingShowBirthdate) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingShowBirthdate", ID: UserPrivacySettingShowBirthdateTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingShowBirthdate) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowBirthdate#4596b4df as nil") } b.PutID(UserPrivacySettingShowBirthdateTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingShowBirthdate) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowBirthdate#4596b4df as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingShowBirthdate) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowBirthdate#4596b4df to nil") } if err := b.ConsumeID(UserPrivacySettingShowBirthdateTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowBirthdate#4596b4df: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingShowBirthdate) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowBirthdate#4596b4df to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingShowBirthdate) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingShowBirthdate#4596b4df as nil") } b.ObjStart() b.PutID("userPrivacySettingShowBirthdate") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingShowBirthdate) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingShowBirthdate#4596b4df to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingShowBirthdate"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingShowBirthdate#4596b4df: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAllowChatInvites represents TL type `userPrivacySettingAllowChatInvites#4bcc1d27`. type UserPrivacySettingAllowChatInvites struct { } // UserPrivacySettingAllowChatInvitesTypeID is TL type id of UserPrivacySettingAllowChatInvites. const UserPrivacySettingAllowChatInvitesTypeID = 0x4bcc1d27 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAllowChatInvites) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAllowChatInvites. var ( _ bin.Encoder = &UserPrivacySettingAllowChatInvites{} _ bin.Decoder = &UserPrivacySettingAllowChatInvites{} _ bin.BareEncoder = &UserPrivacySettingAllowChatInvites{} _ bin.BareDecoder = &UserPrivacySettingAllowChatInvites{} _ UserPrivacySettingClass = &UserPrivacySettingAllowChatInvites{} ) func (u *UserPrivacySettingAllowChatInvites) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAllowChatInvites) String() string { if u == nil { return "UserPrivacySettingAllowChatInvites(nil)" } type Alias UserPrivacySettingAllowChatInvites return fmt.Sprintf("UserPrivacySettingAllowChatInvites%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAllowChatInvites) TypeID() uint32 { return UserPrivacySettingAllowChatInvitesTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAllowChatInvites) TypeName() string { return "userPrivacySettingAllowChatInvites" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAllowChatInvites) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAllowChatInvites", ID: UserPrivacySettingAllowChatInvitesTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAllowChatInvites) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowChatInvites#4bcc1d27 as nil") } b.PutID(UserPrivacySettingAllowChatInvitesTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAllowChatInvites) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowChatInvites#4bcc1d27 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAllowChatInvites) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowChatInvites#4bcc1d27 to nil") } if err := b.ConsumeID(UserPrivacySettingAllowChatInvitesTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowChatInvites#4bcc1d27: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAllowChatInvites) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowChatInvites#4bcc1d27 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAllowChatInvites) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowChatInvites#4bcc1d27 as nil") } b.ObjStart() b.PutID("userPrivacySettingAllowChatInvites") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAllowChatInvites) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowChatInvites#4bcc1d27 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAllowChatInvites"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowChatInvites#4bcc1d27: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAllowCalls represents TL type `userPrivacySettingAllowCalls#c9f0c705`. type UserPrivacySettingAllowCalls struct { } // UserPrivacySettingAllowCallsTypeID is TL type id of UserPrivacySettingAllowCalls. const UserPrivacySettingAllowCallsTypeID = 0xc9f0c705 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAllowCalls) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAllowCalls. var ( _ bin.Encoder = &UserPrivacySettingAllowCalls{} _ bin.Decoder = &UserPrivacySettingAllowCalls{} _ bin.BareEncoder = &UserPrivacySettingAllowCalls{} _ bin.BareDecoder = &UserPrivacySettingAllowCalls{} _ UserPrivacySettingClass = &UserPrivacySettingAllowCalls{} ) func (u *UserPrivacySettingAllowCalls) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAllowCalls) String() string { if u == nil { return "UserPrivacySettingAllowCalls(nil)" } type Alias UserPrivacySettingAllowCalls return fmt.Sprintf("UserPrivacySettingAllowCalls%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAllowCalls) TypeID() uint32 { return UserPrivacySettingAllowCallsTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAllowCalls) TypeName() string { return "userPrivacySettingAllowCalls" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAllowCalls) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAllowCalls", ID: UserPrivacySettingAllowCallsTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAllowCalls) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowCalls#c9f0c705 as nil") } b.PutID(UserPrivacySettingAllowCallsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAllowCalls) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowCalls#c9f0c705 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAllowCalls) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowCalls#c9f0c705 to nil") } if err := b.ConsumeID(UserPrivacySettingAllowCallsTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowCalls#c9f0c705: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAllowCalls) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowCalls#c9f0c705 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAllowCalls) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowCalls#c9f0c705 as nil") } b.ObjStart() b.PutID("userPrivacySettingAllowCalls") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAllowCalls) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowCalls#c9f0c705 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAllowCalls"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowCalls#c9f0c705: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAllowPeerToPeerCalls represents TL type `userPrivacySettingAllowPeerToPeerCalls#1502b940`. type UserPrivacySettingAllowPeerToPeerCalls struct { } // UserPrivacySettingAllowPeerToPeerCallsTypeID is TL type id of UserPrivacySettingAllowPeerToPeerCalls. const UserPrivacySettingAllowPeerToPeerCallsTypeID = 0x1502b940 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAllowPeerToPeerCalls) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAllowPeerToPeerCalls. var ( _ bin.Encoder = &UserPrivacySettingAllowPeerToPeerCalls{} _ bin.Decoder = &UserPrivacySettingAllowPeerToPeerCalls{} _ bin.BareEncoder = &UserPrivacySettingAllowPeerToPeerCalls{} _ bin.BareDecoder = &UserPrivacySettingAllowPeerToPeerCalls{} _ UserPrivacySettingClass = &UserPrivacySettingAllowPeerToPeerCalls{} ) func (u *UserPrivacySettingAllowPeerToPeerCalls) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAllowPeerToPeerCalls) String() string { if u == nil { return "UserPrivacySettingAllowPeerToPeerCalls(nil)" } type Alias UserPrivacySettingAllowPeerToPeerCalls return fmt.Sprintf("UserPrivacySettingAllowPeerToPeerCalls%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAllowPeerToPeerCalls) TypeID() uint32 { return UserPrivacySettingAllowPeerToPeerCallsTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAllowPeerToPeerCalls) TypeName() string { return "userPrivacySettingAllowPeerToPeerCalls" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAllowPeerToPeerCalls) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAllowPeerToPeerCalls", ID: UserPrivacySettingAllowPeerToPeerCallsTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAllowPeerToPeerCalls) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowPeerToPeerCalls#1502b940 as nil") } b.PutID(UserPrivacySettingAllowPeerToPeerCallsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAllowPeerToPeerCalls) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowPeerToPeerCalls#1502b940 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAllowPeerToPeerCalls) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowPeerToPeerCalls#1502b940 to nil") } if err := b.ConsumeID(UserPrivacySettingAllowPeerToPeerCallsTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowPeerToPeerCalls#1502b940: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAllowPeerToPeerCalls) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowPeerToPeerCalls#1502b940 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAllowPeerToPeerCalls) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowPeerToPeerCalls#1502b940 as nil") } b.ObjStart() b.PutID("userPrivacySettingAllowPeerToPeerCalls") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAllowPeerToPeerCalls) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowPeerToPeerCalls#1502b940 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAllowPeerToPeerCalls"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowPeerToPeerCalls#1502b940: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAllowFindingByPhoneNumber represents TL type `userPrivacySettingAllowFindingByPhoneNumber#91ee6d51`. type UserPrivacySettingAllowFindingByPhoneNumber struct { } // UserPrivacySettingAllowFindingByPhoneNumberTypeID is TL type id of UserPrivacySettingAllowFindingByPhoneNumber. const UserPrivacySettingAllowFindingByPhoneNumberTypeID = 0x91ee6d51 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAllowFindingByPhoneNumber) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAllowFindingByPhoneNumber. var ( _ bin.Encoder = &UserPrivacySettingAllowFindingByPhoneNumber{} _ bin.Decoder = &UserPrivacySettingAllowFindingByPhoneNumber{} _ bin.BareEncoder = &UserPrivacySettingAllowFindingByPhoneNumber{} _ bin.BareDecoder = &UserPrivacySettingAllowFindingByPhoneNumber{} _ UserPrivacySettingClass = &UserPrivacySettingAllowFindingByPhoneNumber{} ) func (u *UserPrivacySettingAllowFindingByPhoneNumber) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAllowFindingByPhoneNumber) String() string { if u == nil { return "UserPrivacySettingAllowFindingByPhoneNumber(nil)" } type Alias UserPrivacySettingAllowFindingByPhoneNumber return fmt.Sprintf("UserPrivacySettingAllowFindingByPhoneNumber%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAllowFindingByPhoneNumber) TypeID() uint32 { return UserPrivacySettingAllowFindingByPhoneNumberTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAllowFindingByPhoneNumber) TypeName() string { return "userPrivacySettingAllowFindingByPhoneNumber" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAllowFindingByPhoneNumber) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAllowFindingByPhoneNumber", ID: UserPrivacySettingAllowFindingByPhoneNumberTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAllowFindingByPhoneNumber) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 as nil") } b.PutID(UserPrivacySettingAllowFindingByPhoneNumberTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAllowFindingByPhoneNumber) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAllowFindingByPhoneNumber) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 to nil") } if err := b.ConsumeID(UserPrivacySettingAllowFindingByPhoneNumberTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAllowFindingByPhoneNumber) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAllowFindingByPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 as nil") } b.ObjStart() b.PutID("userPrivacySettingAllowFindingByPhoneNumber") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAllowFindingByPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAllowFindingByPhoneNumber"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages represents TL type `userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c`. type UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages struct { } // UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID is TL type id of UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages. const UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID = 0x14272e3c // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages. var ( _ bin.Encoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} _ bin.Decoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} _ bin.BareEncoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} _ bin.BareDecoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} _ UserPrivacySettingClass = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} ) func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) String() string { if u == nil { return "UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(nil)" } type Alias UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages return fmt.Sprintf("UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) TypeID() uint32 { return UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) TypeName() string { return "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages", ID: UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c as nil") } b.PutID(UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c to nil") } if err := b.ConsumeID(UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c as nil") } b.ObjStart() b.PutID("userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAutosaveGifts represents TL type `userPrivacySettingAutosaveGifts#709a69cd`. type UserPrivacySettingAutosaveGifts struct { } // UserPrivacySettingAutosaveGiftsTypeID is TL type id of UserPrivacySettingAutosaveGifts. const UserPrivacySettingAutosaveGiftsTypeID = 0x709a69cd // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAutosaveGifts) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAutosaveGifts. var ( _ bin.Encoder = &UserPrivacySettingAutosaveGifts{} _ bin.Decoder = &UserPrivacySettingAutosaveGifts{} _ bin.BareEncoder = &UserPrivacySettingAutosaveGifts{} _ bin.BareDecoder = &UserPrivacySettingAutosaveGifts{} _ UserPrivacySettingClass = &UserPrivacySettingAutosaveGifts{} ) func (u *UserPrivacySettingAutosaveGifts) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAutosaveGifts) String() string { if u == nil { return "UserPrivacySettingAutosaveGifts(nil)" } type Alias UserPrivacySettingAutosaveGifts return fmt.Sprintf("UserPrivacySettingAutosaveGifts%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAutosaveGifts) TypeID() uint32 { return UserPrivacySettingAutosaveGiftsTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAutosaveGifts) TypeName() string { return "userPrivacySettingAutosaveGifts" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAutosaveGifts) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAutosaveGifts", ID: UserPrivacySettingAutosaveGiftsTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAutosaveGifts) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAutosaveGifts#709a69cd as nil") } b.PutID(UserPrivacySettingAutosaveGiftsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAutosaveGifts) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAutosaveGifts#709a69cd as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAutosaveGifts) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAutosaveGifts#709a69cd to nil") } if err := b.ConsumeID(UserPrivacySettingAutosaveGiftsTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAutosaveGifts#709a69cd: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAutosaveGifts) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAutosaveGifts#709a69cd to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAutosaveGifts) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAutosaveGifts#709a69cd as nil") } b.ObjStart() b.PutID("userPrivacySettingAutosaveGifts") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAutosaveGifts) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAutosaveGifts#709a69cd to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAutosaveGifts"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAutosaveGifts#709a69cd: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingAllowUnpaidMessages represents TL type `userPrivacySettingAllowUnpaidMessages#553cd8e7`. type UserPrivacySettingAllowUnpaidMessages struct { } // UserPrivacySettingAllowUnpaidMessagesTypeID is TL type id of UserPrivacySettingAllowUnpaidMessages. const UserPrivacySettingAllowUnpaidMessagesTypeID = 0x553cd8e7 // construct implements constructor of UserPrivacySettingClass. func (u UserPrivacySettingAllowUnpaidMessages) construct() UserPrivacySettingClass { return &u } // Ensuring interfaces in compile-time for UserPrivacySettingAllowUnpaidMessages. var ( _ bin.Encoder = &UserPrivacySettingAllowUnpaidMessages{} _ bin.Decoder = &UserPrivacySettingAllowUnpaidMessages{} _ bin.BareEncoder = &UserPrivacySettingAllowUnpaidMessages{} _ bin.BareDecoder = &UserPrivacySettingAllowUnpaidMessages{} _ UserPrivacySettingClass = &UserPrivacySettingAllowUnpaidMessages{} ) func (u *UserPrivacySettingAllowUnpaidMessages) Zero() bool { if u == nil { return true } return true } // String implements fmt.Stringer. func (u *UserPrivacySettingAllowUnpaidMessages) String() string { if u == nil { return "UserPrivacySettingAllowUnpaidMessages(nil)" } type Alias UserPrivacySettingAllowUnpaidMessages return fmt.Sprintf("UserPrivacySettingAllowUnpaidMessages%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*UserPrivacySettingAllowUnpaidMessages) TypeID() uint32 { return UserPrivacySettingAllowUnpaidMessagesTypeID } // TypeName returns name of type in TL schema. func (*UserPrivacySettingAllowUnpaidMessages) TypeName() string { return "userPrivacySettingAllowUnpaidMessages" } // TypeInfo returns info about TL type. func (u *UserPrivacySettingAllowUnpaidMessages) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "userPrivacySettingAllowUnpaidMessages", ID: UserPrivacySettingAllowUnpaidMessagesTypeID, } if u == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (u *UserPrivacySettingAllowUnpaidMessages) Encode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowUnpaidMessages#553cd8e7 as nil") } b.PutID(UserPrivacySettingAllowUnpaidMessagesTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (u *UserPrivacySettingAllowUnpaidMessages) EncodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowUnpaidMessages#553cd8e7 as nil") } return nil } // Decode implements bin.Decoder. func (u *UserPrivacySettingAllowUnpaidMessages) Decode(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowUnpaidMessages#553cd8e7 to nil") } if err := b.ConsumeID(UserPrivacySettingAllowUnpaidMessagesTypeID); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowUnpaidMessages#553cd8e7: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (u *UserPrivacySettingAllowUnpaidMessages) DecodeBare(b *bin.Buffer) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowUnpaidMessages#553cd8e7 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserPrivacySettingAllowUnpaidMessages) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { return fmt.Errorf("can't encode userPrivacySettingAllowUnpaidMessages#553cd8e7 as nil") } b.ObjStart() b.PutID("userPrivacySettingAllowUnpaidMessages") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserPrivacySettingAllowUnpaidMessages) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { return fmt.Errorf("can't decode userPrivacySettingAllowUnpaidMessages#553cd8e7 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userPrivacySettingAllowUnpaidMessages"); err != nil { return fmt.Errorf("unable to decode userPrivacySettingAllowUnpaidMessages#553cd8e7: %w", err) } default: return b.Skip() } return nil }) } // UserPrivacySettingClassName is schema name of UserPrivacySettingClass. const UserPrivacySettingClassName = "UserPrivacySetting" // UserPrivacySettingClass represents UserPrivacySetting generic type. // // Example: // // g, err := tdapi.DecodeUserPrivacySetting(buf) // if err != nil { // panic(err) // } // switch v := g.(type) { // case *tdapi.UserPrivacySettingShowStatus: // userPrivacySettingShowStatus#6f0884fe // case *tdapi.UserPrivacySettingShowProfilePhoto: // userPrivacySettingShowProfilePhoto#53f3c9f5 // case *tdapi.UserPrivacySettingShowLinkInForwardedMessages: // userPrivacySettingShowLinkInForwardedMessages#2353b6e6 // case *tdapi.UserPrivacySettingShowPhoneNumber: // userPrivacySettingShowPhoneNumber#d0d1a229 // case *tdapi.UserPrivacySettingShowBio: // userPrivacySettingShowBio#39382761 // case *tdapi.UserPrivacySettingShowBirthdate: // userPrivacySettingShowBirthdate#4596b4df // case *tdapi.UserPrivacySettingAllowChatInvites: // userPrivacySettingAllowChatInvites#4bcc1d27 // case *tdapi.UserPrivacySettingAllowCalls: // userPrivacySettingAllowCalls#c9f0c705 // case *tdapi.UserPrivacySettingAllowPeerToPeerCalls: // userPrivacySettingAllowPeerToPeerCalls#1502b940 // case *tdapi.UserPrivacySettingAllowFindingByPhoneNumber: // userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 // case *tdapi.UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: // userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c // case *tdapi.UserPrivacySettingAutosaveGifts: // userPrivacySettingAutosaveGifts#709a69cd // case *tdapi.UserPrivacySettingAllowUnpaidMessages: // userPrivacySettingAllowUnpaidMessages#553cd8e7 // default: panic(v) // } type UserPrivacySettingClass interface { bin.Encoder bin.Decoder bin.BareEncoder bin.BareDecoder construct() UserPrivacySettingClass // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. TypeID() uint32 // TypeName returns name of type in TL schema. TypeName() string // String implements fmt.Stringer. String() string // Zero returns true if current object has a zero value. Zero() bool EncodeTDLibJSON(b tdjson.Encoder) error DecodeTDLibJSON(b tdjson.Decoder) error } // DecodeUserPrivacySetting implements binary de-serialization for UserPrivacySettingClass. func DecodeUserPrivacySetting(buf *bin.Buffer) (UserPrivacySettingClass, error) { id, err := buf.PeekID() if err != nil { return nil, err } switch id { case UserPrivacySettingShowStatusTypeID: // Decoding userPrivacySettingShowStatus#6f0884fe. v := UserPrivacySettingShowStatus{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingShowProfilePhotoTypeID: // Decoding userPrivacySettingShowProfilePhoto#53f3c9f5. v := UserPrivacySettingShowProfilePhoto{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingShowLinkInForwardedMessagesTypeID: // Decoding userPrivacySettingShowLinkInForwardedMessages#2353b6e6. v := UserPrivacySettingShowLinkInForwardedMessages{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingShowPhoneNumberTypeID: // Decoding userPrivacySettingShowPhoneNumber#d0d1a229. v := UserPrivacySettingShowPhoneNumber{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingShowBioTypeID: // Decoding userPrivacySettingShowBio#39382761. v := UserPrivacySettingShowBio{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingShowBirthdateTypeID: // Decoding userPrivacySettingShowBirthdate#4596b4df. v := UserPrivacySettingShowBirthdate{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAllowChatInvitesTypeID: // Decoding userPrivacySettingAllowChatInvites#4bcc1d27. v := UserPrivacySettingAllowChatInvites{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAllowCallsTypeID: // Decoding userPrivacySettingAllowCalls#c9f0c705. v := UserPrivacySettingAllowCalls{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAllowPeerToPeerCallsTypeID: // Decoding userPrivacySettingAllowPeerToPeerCalls#1502b940. v := UserPrivacySettingAllowPeerToPeerCalls{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAllowFindingByPhoneNumberTypeID: // Decoding userPrivacySettingAllowFindingByPhoneNumber#91ee6d51. v := UserPrivacySettingAllowFindingByPhoneNumber{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID: // Decoding userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c. v := UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAutosaveGiftsTypeID: // Decoding userPrivacySettingAutosaveGifts#709a69cd. v := UserPrivacySettingAutosaveGifts{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case UserPrivacySettingAllowUnpaidMessagesTypeID: // Decoding userPrivacySettingAllowUnpaidMessages#553cd8e7. v := UserPrivacySettingAllowUnpaidMessages{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil default: return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", bin.NewUnexpectedID(id)) } } // DecodeTDLibJSONUserPrivacySetting implements binary de-serialization for UserPrivacySettingClass. func DecodeTDLibJSONUserPrivacySetting(buf tdjson.Decoder) (UserPrivacySettingClass, error) { id, err := buf.FindTypeID() if err != nil { return nil, err } switch id { case "userPrivacySettingShowStatus": // Decoding userPrivacySettingShowStatus#6f0884fe. v := UserPrivacySettingShowStatus{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingShowProfilePhoto": // Decoding userPrivacySettingShowProfilePhoto#53f3c9f5. v := UserPrivacySettingShowProfilePhoto{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingShowLinkInForwardedMessages": // Decoding userPrivacySettingShowLinkInForwardedMessages#2353b6e6. v := UserPrivacySettingShowLinkInForwardedMessages{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingShowPhoneNumber": // Decoding userPrivacySettingShowPhoneNumber#d0d1a229. v := UserPrivacySettingShowPhoneNumber{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingShowBio": // Decoding userPrivacySettingShowBio#39382761. v := UserPrivacySettingShowBio{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingShowBirthdate": // Decoding userPrivacySettingShowBirthdate#4596b4df. v := UserPrivacySettingShowBirthdate{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAllowChatInvites": // Decoding userPrivacySettingAllowChatInvites#4bcc1d27. v := UserPrivacySettingAllowChatInvites{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAllowCalls": // Decoding userPrivacySettingAllowCalls#c9f0c705. v := UserPrivacySettingAllowCalls{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAllowPeerToPeerCalls": // Decoding userPrivacySettingAllowPeerToPeerCalls#1502b940. v := UserPrivacySettingAllowPeerToPeerCalls{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAllowFindingByPhoneNumber": // Decoding userPrivacySettingAllowFindingByPhoneNumber#91ee6d51. v := UserPrivacySettingAllowFindingByPhoneNumber{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages": // Decoding userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c. v := UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAutosaveGifts": // Decoding userPrivacySettingAutosaveGifts#709a69cd. v := UserPrivacySettingAutosaveGifts{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil case "userPrivacySettingAllowUnpaidMessages": // Decoding userPrivacySettingAllowUnpaidMessages#553cd8e7. v := UserPrivacySettingAllowUnpaidMessages{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) } return &v, nil default: return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", tdjson.NewUnexpectedID(id)) } } // UserPrivacySetting boxes the UserPrivacySettingClass providing a helper. type UserPrivacySettingBox struct { UserPrivacySetting UserPrivacySettingClass } // Decode implements bin.Decoder for UserPrivacySettingBox. func (b *UserPrivacySettingBox) Decode(buf *bin.Buffer) error { if b == nil { return fmt.Errorf("unable to decode UserPrivacySettingBox to nil") } v, err := DecodeUserPrivacySetting(buf) if err != nil { return fmt.Errorf("unable to decode boxed value: %w", err) } b.UserPrivacySetting = v return nil } // Encode implements bin.Encode for UserPrivacySettingBox. func (b *UserPrivacySettingBox) Encode(buf *bin.Buffer) error { if b == nil || b.UserPrivacySetting == nil { return fmt.Errorf("unable to encode UserPrivacySettingClass as nil") } return b.UserPrivacySetting.Encode(buf) } // DecodeTDLibJSON implements bin.Decoder for UserPrivacySettingBox. func (b *UserPrivacySettingBox) DecodeTDLibJSON(buf tdjson.Decoder) error { if b == nil { return fmt.Errorf("unable to decode UserPrivacySettingBox to nil") } v, err := DecodeTDLibJSONUserPrivacySetting(buf) if err != nil { return fmt.Errorf("unable to decode boxed value: %w", err) } b.UserPrivacySetting = v return nil } // EncodeTDLibJSON implements bin.Encode for UserPrivacySettingBox. func (b *UserPrivacySettingBox) EncodeTDLibJSON(buf tdjson.Encoder) error { if b == nil || b.UserPrivacySetting == nil { return fmt.Errorf("unable to encode UserPrivacySettingClass as nil") } return b.UserPrivacySetting.EncodeTDLibJSON(buf) }