// 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{} ) // AutosaveSettingsScopePrivateChats represents TL type `autosaveSettingsScopePrivateChats#5329797f`. type AutosaveSettingsScopePrivateChats struct { } // AutosaveSettingsScopePrivateChatsTypeID is TL type id of AutosaveSettingsScopePrivateChats. const AutosaveSettingsScopePrivateChatsTypeID = 0x5329797f // construct implements constructor of AutosaveSettingsScopeClass. func (a AutosaveSettingsScopePrivateChats) construct() AutosaveSettingsScopeClass { return &a } // Ensuring interfaces in compile-time for AutosaveSettingsScopePrivateChats. var ( _ bin.Encoder = &AutosaveSettingsScopePrivateChats{} _ bin.Decoder = &AutosaveSettingsScopePrivateChats{} _ bin.BareEncoder = &AutosaveSettingsScopePrivateChats{} _ bin.BareDecoder = &AutosaveSettingsScopePrivateChats{} _ AutosaveSettingsScopeClass = &AutosaveSettingsScopePrivateChats{} ) func (a *AutosaveSettingsScopePrivateChats) Zero() bool { if a == nil { return true } return true } // String implements fmt.Stringer. func (a *AutosaveSettingsScopePrivateChats) String() string { if a == nil { return "AutosaveSettingsScopePrivateChats(nil)" } type Alias AutosaveSettingsScopePrivateChats return fmt.Sprintf("AutosaveSettingsScopePrivateChats%+v", Alias(*a)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*AutosaveSettingsScopePrivateChats) TypeID() uint32 { return AutosaveSettingsScopePrivateChatsTypeID } // TypeName returns name of type in TL schema. func (*AutosaveSettingsScopePrivateChats) TypeName() string { return "autosaveSettingsScopePrivateChats" } // TypeInfo returns info about TL type. func (a *AutosaveSettingsScopePrivateChats) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "autosaveSettingsScopePrivateChats", ID: AutosaveSettingsScopePrivateChatsTypeID, } if a == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (a *AutosaveSettingsScopePrivateChats) Encode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopePrivateChats#5329797f as nil") } b.PutID(AutosaveSettingsScopePrivateChatsTypeID) return a.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (a *AutosaveSettingsScopePrivateChats) EncodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopePrivateChats#5329797f as nil") } return nil } // Decode implements bin.Decoder. func (a *AutosaveSettingsScopePrivateChats) Decode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopePrivateChats#5329797f to nil") } if err := b.ConsumeID(AutosaveSettingsScopePrivateChatsTypeID); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopePrivateChats#5329797f: %w", err) } return a.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (a *AutosaveSettingsScopePrivateChats) DecodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopePrivateChats#5329797f to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AutosaveSettingsScopePrivateChats) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopePrivateChats#5329797f as nil") } b.ObjStart() b.PutID("autosaveSettingsScopePrivateChats") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AutosaveSettingsScopePrivateChats) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopePrivateChats#5329797f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("autosaveSettingsScopePrivateChats"); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopePrivateChats#5329797f: %w", err) } default: return b.Skip() } return nil }) } // AutosaveSettingsScopeGroupChats represents TL type `autosaveSettingsScopeGroupChats#32e00e4e`. type AutosaveSettingsScopeGroupChats struct { } // AutosaveSettingsScopeGroupChatsTypeID is TL type id of AutosaveSettingsScopeGroupChats. const AutosaveSettingsScopeGroupChatsTypeID = 0x32e00e4e // construct implements constructor of AutosaveSettingsScopeClass. func (a AutosaveSettingsScopeGroupChats) construct() AutosaveSettingsScopeClass { return &a } // Ensuring interfaces in compile-time for AutosaveSettingsScopeGroupChats. var ( _ bin.Encoder = &AutosaveSettingsScopeGroupChats{} _ bin.Decoder = &AutosaveSettingsScopeGroupChats{} _ bin.BareEncoder = &AutosaveSettingsScopeGroupChats{} _ bin.BareDecoder = &AutosaveSettingsScopeGroupChats{} _ AutosaveSettingsScopeClass = &AutosaveSettingsScopeGroupChats{} ) func (a *AutosaveSettingsScopeGroupChats) Zero() bool { if a == nil { return true } return true } // String implements fmt.Stringer. func (a *AutosaveSettingsScopeGroupChats) String() string { if a == nil { return "AutosaveSettingsScopeGroupChats(nil)" } type Alias AutosaveSettingsScopeGroupChats return fmt.Sprintf("AutosaveSettingsScopeGroupChats%+v", Alias(*a)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*AutosaveSettingsScopeGroupChats) TypeID() uint32 { return AutosaveSettingsScopeGroupChatsTypeID } // TypeName returns name of type in TL schema. func (*AutosaveSettingsScopeGroupChats) TypeName() string { return "autosaveSettingsScopeGroupChats" } // TypeInfo returns info about TL type. func (a *AutosaveSettingsScopeGroupChats) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "autosaveSettingsScopeGroupChats", ID: AutosaveSettingsScopeGroupChatsTypeID, } if a == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (a *AutosaveSettingsScopeGroupChats) Encode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeGroupChats#32e00e4e as nil") } b.PutID(AutosaveSettingsScopeGroupChatsTypeID) return a.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (a *AutosaveSettingsScopeGroupChats) EncodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeGroupChats#32e00e4e as nil") } return nil } // Decode implements bin.Decoder. func (a *AutosaveSettingsScopeGroupChats) Decode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeGroupChats#32e00e4e to nil") } if err := b.ConsumeID(AutosaveSettingsScopeGroupChatsTypeID); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeGroupChats#32e00e4e: %w", err) } return a.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (a *AutosaveSettingsScopeGroupChats) DecodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeGroupChats#32e00e4e to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AutosaveSettingsScopeGroupChats) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeGroupChats#32e00e4e as nil") } b.ObjStart() b.PutID("autosaveSettingsScopeGroupChats") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AutosaveSettingsScopeGroupChats) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeGroupChats#32e00e4e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("autosaveSettingsScopeGroupChats"); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeGroupChats#32e00e4e: %w", err) } default: return b.Skip() } return nil }) } // AutosaveSettingsScopeChannelChats represents TL type `autosaveSettingsScopeChannelChats#e2391fd1`. type AutosaveSettingsScopeChannelChats struct { } // AutosaveSettingsScopeChannelChatsTypeID is TL type id of AutosaveSettingsScopeChannelChats. const AutosaveSettingsScopeChannelChatsTypeID = 0xe2391fd1 // construct implements constructor of AutosaveSettingsScopeClass. func (a AutosaveSettingsScopeChannelChats) construct() AutosaveSettingsScopeClass { return &a } // Ensuring interfaces in compile-time for AutosaveSettingsScopeChannelChats. var ( _ bin.Encoder = &AutosaveSettingsScopeChannelChats{} _ bin.Decoder = &AutosaveSettingsScopeChannelChats{} _ bin.BareEncoder = &AutosaveSettingsScopeChannelChats{} _ bin.BareDecoder = &AutosaveSettingsScopeChannelChats{} _ AutosaveSettingsScopeClass = &AutosaveSettingsScopeChannelChats{} ) func (a *AutosaveSettingsScopeChannelChats) Zero() bool { if a == nil { return true } return true } // String implements fmt.Stringer. func (a *AutosaveSettingsScopeChannelChats) String() string { if a == nil { return "AutosaveSettingsScopeChannelChats(nil)" } type Alias AutosaveSettingsScopeChannelChats return fmt.Sprintf("AutosaveSettingsScopeChannelChats%+v", Alias(*a)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*AutosaveSettingsScopeChannelChats) TypeID() uint32 { return AutosaveSettingsScopeChannelChatsTypeID } // TypeName returns name of type in TL schema. func (*AutosaveSettingsScopeChannelChats) TypeName() string { return "autosaveSettingsScopeChannelChats" } // TypeInfo returns info about TL type. func (a *AutosaveSettingsScopeChannelChats) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "autosaveSettingsScopeChannelChats", ID: AutosaveSettingsScopeChannelChatsTypeID, } if a == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (a *AutosaveSettingsScopeChannelChats) Encode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeChannelChats#e2391fd1 as nil") } b.PutID(AutosaveSettingsScopeChannelChatsTypeID) return a.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (a *AutosaveSettingsScopeChannelChats) EncodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeChannelChats#e2391fd1 as nil") } return nil } // Decode implements bin.Decoder. func (a *AutosaveSettingsScopeChannelChats) Decode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeChannelChats#e2391fd1 to nil") } if err := b.ConsumeID(AutosaveSettingsScopeChannelChatsTypeID); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeChannelChats#e2391fd1: %w", err) } return a.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (a *AutosaveSettingsScopeChannelChats) DecodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeChannelChats#e2391fd1 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AutosaveSettingsScopeChannelChats) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeChannelChats#e2391fd1 as nil") } b.ObjStart() b.PutID("autosaveSettingsScopeChannelChats") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AutosaveSettingsScopeChannelChats) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeChannelChats#e2391fd1 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("autosaveSettingsScopeChannelChats"); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeChannelChats#e2391fd1: %w", err) } default: return b.Skip() } return nil }) } // AutosaveSettingsScopeChat represents TL type `autosaveSettingsScopeChat#9eb5c2e9`. type AutosaveSettingsScopeChat struct { // Chat identifier ChatID int64 } // AutosaveSettingsScopeChatTypeID is TL type id of AutosaveSettingsScopeChat. const AutosaveSettingsScopeChatTypeID = 0x9eb5c2e9 // construct implements constructor of AutosaveSettingsScopeClass. func (a AutosaveSettingsScopeChat) construct() AutosaveSettingsScopeClass { return &a } // Ensuring interfaces in compile-time for AutosaveSettingsScopeChat. var ( _ bin.Encoder = &AutosaveSettingsScopeChat{} _ bin.Decoder = &AutosaveSettingsScopeChat{} _ bin.BareEncoder = &AutosaveSettingsScopeChat{} _ bin.BareDecoder = &AutosaveSettingsScopeChat{} _ AutosaveSettingsScopeClass = &AutosaveSettingsScopeChat{} ) func (a *AutosaveSettingsScopeChat) Zero() bool { if a == nil { return true } if !(a.ChatID == 0) { return false } return true } // String implements fmt.Stringer. func (a *AutosaveSettingsScopeChat) String() string { if a == nil { return "AutosaveSettingsScopeChat(nil)" } type Alias AutosaveSettingsScopeChat return fmt.Sprintf("AutosaveSettingsScopeChat%+v", Alias(*a)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*AutosaveSettingsScopeChat) TypeID() uint32 { return AutosaveSettingsScopeChatTypeID } // TypeName returns name of type in TL schema. func (*AutosaveSettingsScopeChat) TypeName() string { return "autosaveSettingsScopeChat" } // TypeInfo returns info about TL type. func (a *AutosaveSettingsScopeChat) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "autosaveSettingsScopeChat", ID: AutosaveSettingsScopeChatTypeID, } if a == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{ { Name: "ChatID", SchemaName: "chat_id", }, } return typ } // Encode implements bin.Encoder. func (a *AutosaveSettingsScopeChat) Encode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeChat#9eb5c2e9 as nil") } b.PutID(AutosaveSettingsScopeChatTypeID) return a.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (a *AutosaveSettingsScopeChat) EncodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeChat#9eb5c2e9 as nil") } b.PutInt53(a.ChatID) return nil } // Decode implements bin.Decoder. func (a *AutosaveSettingsScopeChat) Decode(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeChat#9eb5c2e9 to nil") } if err := b.ConsumeID(AutosaveSettingsScopeChatTypeID); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: %w", err) } return a.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (a *AutosaveSettingsScopeChat) DecodeBare(b *bin.Buffer) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeChat#9eb5c2e9 to nil") } { value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: field chat_id: %w", err) } a.ChatID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AutosaveSettingsScopeChat) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { return fmt.Errorf("can't encode autosaveSettingsScopeChat#9eb5c2e9 as nil") } b.ObjStart() b.PutID("autosaveSettingsScopeChat") b.Comma() b.FieldStart("chat_id") b.PutInt53(a.ChatID) b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AutosaveSettingsScopeChat) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { return fmt.Errorf("can't decode autosaveSettingsScopeChat#9eb5c2e9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("autosaveSettingsScopeChat"); err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: field chat_id: %w", err) } a.ChatID = value default: return b.Skip() } return nil }) } // GetChatID returns value of ChatID field. func (a *AutosaveSettingsScopeChat) GetChatID() (value int64) { if a == nil { return } return a.ChatID } // AutosaveSettingsScopeClassName is schema name of AutosaveSettingsScopeClass. const AutosaveSettingsScopeClassName = "AutosaveSettingsScope" // AutosaveSettingsScopeClass represents AutosaveSettingsScope generic type. // // Example: // // g, err := tdapi.DecodeAutosaveSettingsScope(buf) // if err != nil { // panic(err) // } // switch v := g.(type) { // case *tdapi.AutosaveSettingsScopePrivateChats: // autosaveSettingsScopePrivateChats#5329797f // case *tdapi.AutosaveSettingsScopeGroupChats: // autosaveSettingsScopeGroupChats#32e00e4e // case *tdapi.AutosaveSettingsScopeChannelChats: // autosaveSettingsScopeChannelChats#e2391fd1 // case *tdapi.AutosaveSettingsScopeChat: // autosaveSettingsScopeChat#9eb5c2e9 // default: panic(v) // } type AutosaveSettingsScopeClass interface { bin.Encoder bin.Decoder bin.BareEncoder bin.BareDecoder construct() AutosaveSettingsScopeClass // 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 } // DecodeAutosaveSettingsScope implements binary de-serialization for AutosaveSettingsScopeClass. func DecodeAutosaveSettingsScope(buf *bin.Buffer) (AutosaveSettingsScopeClass, error) { id, err := buf.PeekID() if err != nil { return nil, err } switch id { case AutosaveSettingsScopePrivateChatsTypeID: // Decoding autosaveSettingsScopePrivateChats#5329797f. v := AutosaveSettingsScopePrivateChats{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil case AutosaveSettingsScopeGroupChatsTypeID: // Decoding autosaveSettingsScopeGroupChats#32e00e4e. v := AutosaveSettingsScopeGroupChats{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil case AutosaveSettingsScopeChannelChatsTypeID: // Decoding autosaveSettingsScopeChannelChats#e2391fd1. v := AutosaveSettingsScopeChannelChats{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil case AutosaveSettingsScopeChatTypeID: // Decoding autosaveSettingsScopeChat#9eb5c2e9. v := AutosaveSettingsScopeChat{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil default: return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", bin.NewUnexpectedID(id)) } } // DecodeTDLibJSONAutosaveSettingsScope implements binary de-serialization for AutosaveSettingsScopeClass. func DecodeTDLibJSONAutosaveSettingsScope(buf tdjson.Decoder) (AutosaveSettingsScopeClass, error) { id, err := buf.FindTypeID() if err != nil { return nil, err } switch id { case "autosaveSettingsScopePrivateChats": // Decoding autosaveSettingsScopePrivateChats#5329797f. v := AutosaveSettingsScopePrivateChats{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil case "autosaveSettingsScopeGroupChats": // Decoding autosaveSettingsScopeGroupChats#32e00e4e. v := AutosaveSettingsScopeGroupChats{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil case "autosaveSettingsScopeChannelChats": // Decoding autosaveSettingsScopeChannelChats#e2391fd1. v := AutosaveSettingsScopeChannelChats{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil case "autosaveSettingsScopeChat": // Decoding autosaveSettingsScopeChat#9eb5c2e9. v := AutosaveSettingsScopeChat{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) } return &v, nil default: return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", tdjson.NewUnexpectedID(id)) } } // AutosaveSettingsScope boxes the AutosaveSettingsScopeClass providing a helper. type AutosaveSettingsScopeBox struct { AutosaveSettingsScope AutosaveSettingsScopeClass } // Decode implements bin.Decoder for AutosaveSettingsScopeBox. func (b *AutosaveSettingsScopeBox) Decode(buf *bin.Buffer) error { if b == nil { return fmt.Errorf("unable to decode AutosaveSettingsScopeBox to nil") } v, err := DecodeAutosaveSettingsScope(buf) if err != nil { return fmt.Errorf("unable to decode boxed value: %w", err) } b.AutosaveSettingsScope = v return nil } // Encode implements bin.Encode for AutosaveSettingsScopeBox. func (b *AutosaveSettingsScopeBox) Encode(buf *bin.Buffer) error { if b == nil || b.AutosaveSettingsScope == nil { return fmt.Errorf("unable to encode AutosaveSettingsScopeClass as nil") } return b.AutosaveSettingsScope.Encode(buf) } // DecodeTDLibJSON implements bin.Decoder for AutosaveSettingsScopeBox. func (b *AutosaveSettingsScopeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { if b == nil { return fmt.Errorf("unable to decode AutosaveSettingsScopeBox to nil") } v, err := DecodeTDLibJSONAutosaveSettingsScope(buf) if err != nil { return fmt.Errorf("unable to decode boxed value: %w", err) } b.AutosaveSettingsScope = v return nil } // EncodeTDLibJSON implements bin.Encode for AutosaveSettingsScopeBox. func (b *AutosaveSettingsScopeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { if b == nil || b.AutosaveSettingsScope == nil { return fmt.Errorf("unable to encode AutosaveSettingsScopeClass as nil") } return b.AutosaveSettingsScope.EncodeTDLibJSON(buf) }