package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type Dialog struct {
Flags bin .Fields
Pinned bool
UnreadMark bool
ViewForumAsMessages bool
Peer PeerClass
TopMessage int
ReadInboxMaxID int
ReadOutboxMaxID int
UnreadCount int
UnreadMentionsCount int
UnreadReactionsCount int
NotifySettings PeerNotifySettings
Pts int
Draft DraftMessageClass
FolderID int
TTLPeriod int
}
const DialogTypeID = 0xd58a08c6
func (d Dialog ) construct () DialogClass { return &d }
var (
_ bin .Encoder = &Dialog {}
_ bin .Decoder = &Dialog {}
_ bin .BareEncoder = &Dialog {}
_ bin .BareDecoder = &Dialog {}
_ DialogClass = &Dialog {}
)
func (d *Dialog ) Zero () bool {
if d == nil {
return true
}
if !(d .Flags .Zero ()) {
return false
}
if !(d .Pinned == false ) {
return false
}
if !(d .UnreadMark == false ) {
return false
}
if !(d .ViewForumAsMessages == false ) {
return false
}
if !(d .Peer == nil ) {
return false
}
if !(d .TopMessage == 0 ) {
return false
}
if !(d .ReadInboxMaxID == 0 ) {
return false
}
if !(d .ReadOutboxMaxID == 0 ) {
return false
}
if !(d .UnreadCount == 0 ) {
return false
}
if !(d .UnreadMentionsCount == 0 ) {
return false
}
if !(d .UnreadReactionsCount == 0 ) {
return false
}
if !(d .NotifySettings .Zero ()) {
return false
}
if !(d .Pts == 0 ) {
return false
}
if !(d .Draft == nil ) {
return false
}
if !(d .FolderID == 0 ) {
return false
}
if !(d .TTLPeriod == 0 ) {
return false
}
return true
}
func (d *Dialog ) String () string {
if d == nil {
return "Dialog(nil)"
}
type Alias Dialog
return fmt .Sprintf ("Dialog%+v" , Alias (*d ))
}
func (d *Dialog ) FillFrom (from interface {
GetPinned () (value bool )
GetUnreadMark () (value bool )
GetViewForumAsMessages () (value bool )
GetPeer () (value PeerClass )
GetTopMessage () (value int )
GetReadInboxMaxID () (value int )
GetReadOutboxMaxID () (value int )
GetUnreadCount () (value int )
GetUnreadMentionsCount () (value int )
GetUnreadReactionsCount () (value int )
GetNotifySettings () (value PeerNotifySettings )
GetPts () (value int , ok bool )
GetDraft () (value DraftMessageClass , ok bool )
GetFolderID () (value int , ok bool )
GetTTLPeriod () (value int , ok bool )
}) {
d .Pinned = from .GetPinned ()
d .UnreadMark = from .GetUnreadMark ()
d .ViewForumAsMessages = from .GetViewForumAsMessages ()
d .Peer = from .GetPeer ()
d .TopMessage = from .GetTopMessage ()
d .ReadInboxMaxID = from .GetReadInboxMaxID ()
d .ReadOutboxMaxID = from .GetReadOutboxMaxID ()
d .UnreadCount = from .GetUnreadCount ()
d .UnreadMentionsCount = from .GetUnreadMentionsCount ()
d .UnreadReactionsCount = from .GetUnreadReactionsCount ()
d .NotifySettings = from .GetNotifySettings ()
if val , ok := from .GetPts (); ok {
d .Pts = val
}
if val , ok := from .GetDraft (); ok {
d .Draft = val
}
if val , ok := from .GetFolderID (); ok {
d .FolderID = val
}
if val , ok := from .GetTTLPeriod (); ok {
d .TTLPeriod = val
}
}
func (*Dialog ) TypeID () uint32 {
return DialogTypeID
}
func (*Dialog ) TypeName () string {
return "dialog"
}
func (d *Dialog ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "dialog" ,
ID : DialogTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pinned" ,
SchemaName : "pinned" ,
Null : !d .Flags .Has (2 ),
},
{
Name : "UnreadMark" ,
SchemaName : "unread_mark" ,
Null : !d .Flags .Has (3 ),
},
{
Name : "ViewForumAsMessages" ,
SchemaName : "view_forum_as_messages" ,
Null : !d .Flags .Has (6 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "TopMessage" ,
SchemaName : "top_message" ,
},
{
Name : "ReadInboxMaxID" ,
SchemaName : "read_inbox_max_id" ,
},
{
Name : "ReadOutboxMaxID" ,
SchemaName : "read_outbox_max_id" ,
},
{
Name : "UnreadCount" ,
SchemaName : "unread_count" ,
},
{
Name : "UnreadMentionsCount" ,
SchemaName : "unread_mentions_count" ,
},
{
Name : "UnreadReactionsCount" ,
SchemaName : "unread_reactions_count" ,
},
{
Name : "NotifySettings" ,
SchemaName : "notify_settings" ,
},
{
Name : "Pts" ,
SchemaName : "pts" ,
Null : !d .Flags .Has (0 ),
},
{
Name : "Draft" ,
SchemaName : "draft" ,
Null : !d .Flags .Has (1 ),
},
{
Name : "FolderID" ,
SchemaName : "folder_id" ,
Null : !d .Flags .Has (4 ),
},
{
Name : "TTLPeriod" ,
SchemaName : "ttl_period" ,
Null : !d .Flags .Has (5 ),
},
}
return typ
}
func (d *Dialog ) SetFlags () {
if !(d .Pinned == false ) {
d .Flags .Set (2 )
}
if !(d .UnreadMark == false ) {
d .Flags .Set (3 )
}
if !(d .ViewForumAsMessages == false ) {
d .Flags .Set (6 )
}
if !(d .Pts == 0 ) {
d .Flags .Set (0 )
}
if !(d .Draft == nil ) {
d .Flags .Set (1 )
}
if !(d .FolderID == 0 ) {
d .Flags .Set (4 )
}
if !(d .TTLPeriod == 0 ) {
d .Flags .Set (5 )
}
}
func (d *Dialog ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode dialog#d58a08c6 as nil" )
}
b .PutID (DialogTypeID )
return d .EncodeBare (b )
}
func (d *Dialog ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode dialog#d58a08c6 as nil" )
}
d .SetFlags ()
if err := d .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialog#d58a08c6: field flags: %w" , err )
}
if d .Peer == nil {
return fmt .Errorf ("unable to encode dialog#d58a08c6: field peer is nil" )
}
if err := d .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialog#d58a08c6: field peer: %w" , err )
}
b .PutInt (d .TopMessage )
b .PutInt (d .ReadInboxMaxID )
b .PutInt (d .ReadOutboxMaxID )
b .PutInt (d .UnreadCount )
b .PutInt (d .UnreadMentionsCount )
b .PutInt (d .UnreadReactionsCount )
if err := d .NotifySettings .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialog#d58a08c6: field notify_settings: %w" , err )
}
if d .Flags .Has (0 ) {
b .PutInt (d .Pts )
}
if d .Flags .Has (1 ) {
if d .Draft == nil {
return fmt .Errorf ("unable to encode dialog#d58a08c6: field draft is nil" )
}
if err := d .Draft .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialog#d58a08c6: field draft: %w" , err )
}
}
if d .Flags .Has (4 ) {
b .PutInt (d .FolderID )
}
if d .Flags .Has (5 ) {
b .PutInt (d .TTLPeriod )
}
return nil
}
func (d *Dialog ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode dialog#d58a08c6 to nil" )
}
if err := b .ConsumeID (DialogTypeID ); err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: %w" , err )
}
return d .DecodeBare (b )
}
func (d *Dialog ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode dialog#d58a08c6 to nil" )
}
{
if err := d .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field flags: %w" , err )
}
}
d .Pinned = d .Flags .Has (2 )
d .UnreadMark = d .Flags .Has (3 )
d .ViewForumAsMessages = d .Flags .Has (6 )
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field peer: %w" , err )
}
d .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field top_message: %w" , err )
}
d .TopMessage = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field read_inbox_max_id: %w" , err )
}
d .ReadInboxMaxID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field read_outbox_max_id: %w" , err )
}
d .ReadOutboxMaxID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field unread_count: %w" , err )
}
d .UnreadCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field unread_mentions_count: %w" , err )
}
d .UnreadMentionsCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field unread_reactions_count: %w" , err )
}
d .UnreadReactionsCount = value
}
{
if err := d .NotifySettings .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field notify_settings: %w" , err )
}
}
if d .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field pts: %w" , err )
}
d .Pts = value
}
if d .Flags .Has (1 ) {
value , err := DecodeDraftMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field draft: %w" , err )
}
d .Draft = value
}
if d .Flags .Has (4 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field folder_id: %w" , err )
}
d .FolderID = value
}
if d .Flags .Has (5 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialog#d58a08c6: field ttl_period: %w" , err )
}
d .TTLPeriod = value
}
return nil
}
func (d *Dialog ) SetPinned (value bool ) {
if value {
d .Flags .Set (2 )
d .Pinned = true
} else {
d .Flags .Unset (2 )
d .Pinned = false
}
}
func (d *Dialog ) GetPinned () (value bool ) {
if d == nil {
return
}
return d .Flags .Has (2 )
}
func (d *Dialog ) SetUnreadMark (value bool ) {
if value {
d .Flags .Set (3 )
d .UnreadMark = true
} else {
d .Flags .Unset (3 )
d .UnreadMark = false
}
}
func (d *Dialog ) GetUnreadMark () (value bool ) {
if d == nil {
return
}
return d .Flags .Has (3 )
}
func (d *Dialog ) SetViewForumAsMessages (value bool ) {
if value {
d .Flags .Set (6 )
d .ViewForumAsMessages = true
} else {
d .Flags .Unset (6 )
d .ViewForumAsMessages = false
}
}
func (d *Dialog ) GetViewForumAsMessages () (value bool ) {
if d == nil {
return
}
return d .Flags .Has (6 )
}
func (d *Dialog ) GetPeer () (value PeerClass ) {
if d == nil {
return
}
return d .Peer
}
func (d *Dialog ) GetTopMessage () (value int ) {
if d == nil {
return
}
return d .TopMessage
}
func (d *Dialog ) GetReadInboxMaxID () (value int ) {
if d == nil {
return
}
return d .ReadInboxMaxID
}
func (d *Dialog ) GetReadOutboxMaxID () (value int ) {
if d == nil {
return
}
return d .ReadOutboxMaxID
}
func (d *Dialog ) GetUnreadCount () (value int ) {
if d == nil {
return
}
return d .UnreadCount
}
func (d *Dialog ) GetUnreadMentionsCount () (value int ) {
if d == nil {
return
}
return d .UnreadMentionsCount
}
func (d *Dialog ) GetUnreadReactionsCount () (value int ) {
if d == nil {
return
}
return d .UnreadReactionsCount
}
func (d *Dialog ) GetNotifySettings () (value PeerNotifySettings ) {
if d == nil {
return
}
return d .NotifySettings
}
func (d *Dialog ) SetPts (value int ) {
d .Flags .Set (0 )
d .Pts = value
}
func (d *Dialog ) GetPts () (value int , ok bool ) {
if d == nil {
return
}
if !d .Flags .Has (0 ) {
return value , false
}
return d .Pts , true
}
func (d *Dialog ) SetDraft (value DraftMessageClass ) {
d .Flags .Set (1 )
d .Draft = value
}
func (d *Dialog ) GetDraft () (value DraftMessageClass , ok bool ) {
if d == nil {
return
}
if !d .Flags .Has (1 ) {
return value , false
}
return d .Draft , true
}
func (d *Dialog ) SetFolderID (value int ) {
d .Flags .Set (4 )
d .FolderID = value
}
func (d *Dialog ) GetFolderID () (value int , ok bool ) {
if d == nil {
return
}
if !d .Flags .Has (4 ) {
return value , false
}
return d .FolderID , true
}
func (d *Dialog ) SetTTLPeriod (value int ) {
d .Flags .Set (5 )
d .TTLPeriod = value
}
func (d *Dialog ) GetTTLPeriod () (value int , ok bool ) {
if d == nil {
return
}
if !d .Flags .Has (5 ) {
return value , false
}
return d .TTLPeriod , true
}
type DialogFolder struct {
Flags bin .Fields
Pinned bool
Folder Folder
Peer PeerClass
TopMessage int
UnreadMutedPeersCount int
UnreadUnmutedPeersCount int
UnreadMutedMessagesCount int
UnreadUnmutedMessagesCount int
}
const DialogFolderTypeID = 0x71bd134c
func (d DialogFolder ) construct () DialogClass { return &d }
var (
_ bin .Encoder = &DialogFolder {}
_ bin .Decoder = &DialogFolder {}
_ bin .BareEncoder = &DialogFolder {}
_ bin .BareDecoder = &DialogFolder {}
_ DialogClass = &DialogFolder {}
)
func (d *DialogFolder ) Zero () bool {
if d == nil {
return true
}
if !(d .Flags .Zero ()) {
return false
}
if !(d .Pinned == false ) {
return false
}
if !(d .Folder .Zero ()) {
return false
}
if !(d .Peer == nil ) {
return false
}
if !(d .TopMessage == 0 ) {
return false
}
if !(d .UnreadMutedPeersCount == 0 ) {
return false
}
if !(d .UnreadUnmutedPeersCount == 0 ) {
return false
}
if !(d .UnreadMutedMessagesCount == 0 ) {
return false
}
if !(d .UnreadUnmutedMessagesCount == 0 ) {
return false
}
return true
}
func (d *DialogFolder ) String () string {
if d == nil {
return "DialogFolder(nil)"
}
type Alias DialogFolder
return fmt .Sprintf ("DialogFolder%+v" , Alias (*d ))
}
func (d *DialogFolder ) FillFrom (from interface {
GetPinned () (value bool )
GetFolder () (value Folder )
GetPeer () (value PeerClass )
GetTopMessage () (value int )
GetUnreadMutedPeersCount () (value int )
GetUnreadUnmutedPeersCount () (value int )
GetUnreadMutedMessagesCount () (value int )
GetUnreadUnmutedMessagesCount () (value int )
}) {
d .Pinned = from .GetPinned ()
d .Folder = from .GetFolder ()
d .Peer = from .GetPeer ()
d .TopMessage = from .GetTopMessage ()
d .UnreadMutedPeersCount = from .GetUnreadMutedPeersCount ()
d .UnreadUnmutedPeersCount = from .GetUnreadUnmutedPeersCount ()
d .UnreadMutedMessagesCount = from .GetUnreadMutedMessagesCount ()
d .UnreadUnmutedMessagesCount = from .GetUnreadUnmutedMessagesCount ()
}
func (*DialogFolder ) TypeID () uint32 {
return DialogFolderTypeID
}
func (*DialogFolder ) TypeName () string {
return "dialogFolder"
}
func (d *DialogFolder ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "dialogFolder" ,
ID : DialogFolderTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pinned" ,
SchemaName : "pinned" ,
Null : !d .Flags .Has (2 ),
},
{
Name : "Folder" ,
SchemaName : "folder" ,
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "TopMessage" ,
SchemaName : "top_message" ,
},
{
Name : "UnreadMutedPeersCount" ,
SchemaName : "unread_muted_peers_count" ,
},
{
Name : "UnreadUnmutedPeersCount" ,
SchemaName : "unread_unmuted_peers_count" ,
},
{
Name : "UnreadMutedMessagesCount" ,
SchemaName : "unread_muted_messages_count" ,
},
{
Name : "UnreadUnmutedMessagesCount" ,
SchemaName : "unread_unmuted_messages_count" ,
},
}
return typ
}
func (d *DialogFolder ) SetFlags () {
if !(d .Pinned == false ) {
d .Flags .Set (2 )
}
}
func (d *DialogFolder ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode dialogFolder#71bd134c as nil" )
}
b .PutID (DialogFolderTypeID )
return d .EncodeBare (b )
}
func (d *DialogFolder ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode dialogFolder#71bd134c as nil" )
}
d .SetFlags ()
if err := d .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialogFolder#71bd134c: field flags: %w" , err )
}
if err := d .Folder .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialogFolder#71bd134c: field folder: %w" , err )
}
if d .Peer == nil {
return fmt .Errorf ("unable to encode dialogFolder#71bd134c: field peer is nil" )
}
if err := d .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode dialogFolder#71bd134c: field peer: %w" , err )
}
b .PutInt (d .TopMessage )
b .PutInt (d .UnreadMutedPeersCount )
b .PutInt (d .UnreadUnmutedPeersCount )
b .PutInt (d .UnreadMutedMessagesCount )
b .PutInt (d .UnreadUnmutedMessagesCount )
return nil
}
func (d *DialogFolder ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode dialogFolder#71bd134c to nil" )
}
if err := b .ConsumeID (DialogFolderTypeID ); err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: %w" , err )
}
return d .DecodeBare (b )
}
func (d *DialogFolder ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode dialogFolder#71bd134c to nil" )
}
{
if err := d .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field flags: %w" , err )
}
}
d .Pinned = d .Flags .Has (2 )
{
if err := d .Folder .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field folder: %w" , err )
}
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field peer: %w" , err )
}
d .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field top_message: %w" , err )
}
d .TopMessage = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field unread_muted_peers_count: %w" , err )
}
d .UnreadMutedPeersCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field unread_unmuted_peers_count: %w" , err )
}
d .UnreadUnmutedPeersCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field unread_muted_messages_count: %w" , err )
}
d .UnreadMutedMessagesCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode dialogFolder#71bd134c: field unread_unmuted_messages_count: %w" , err )
}
d .UnreadUnmutedMessagesCount = value
}
return nil
}
func (d *DialogFolder ) SetPinned (value bool ) {
if value {
d .Flags .Set (2 )
d .Pinned = true
} else {
d .Flags .Unset (2 )
d .Pinned = false
}
}
func (d *DialogFolder ) GetPinned () (value bool ) {
if d == nil {
return
}
return d .Flags .Has (2 )
}
func (d *DialogFolder ) GetFolder () (value Folder ) {
if d == nil {
return
}
return d .Folder
}
func (d *DialogFolder ) GetPeer () (value PeerClass ) {
if d == nil {
return
}
return d .Peer
}
func (d *DialogFolder ) GetTopMessage () (value int ) {
if d == nil {
return
}
return d .TopMessage
}
func (d *DialogFolder ) GetUnreadMutedPeersCount () (value int ) {
if d == nil {
return
}
return d .UnreadMutedPeersCount
}
func (d *DialogFolder ) GetUnreadUnmutedPeersCount () (value int ) {
if d == nil {
return
}
return d .UnreadUnmutedPeersCount
}
func (d *DialogFolder ) GetUnreadMutedMessagesCount () (value int ) {
if d == nil {
return
}
return d .UnreadMutedMessagesCount
}
func (d *DialogFolder ) GetUnreadUnmutedMessagesCount () (value int ) {
if d == nil {
return
}
return d .UnreadUnmutedMessagesCount
}
const DialogClassName = "Dialog"
type DialogClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () DialogClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetPinned () (value bool )
GetPeer () (value PeerClass )
GetTopMessage () (value int )
}
func (d *Dialog ) AsInputDialogPeerFolder () *InputDialogPeerFolder {
value := new (InputDialogPeerFolder )
if fieldValue , ok := d .GetFolderID (); ok {
value .FolderID = fieldValue
}
return value
}
func DecodeDialog (buf *bin .Buffer ) (DialogClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case DialogTypeID :
v := Dialog {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode DialogClass: %w" , err )
}
return &v , nil
case DialogFolderTypeID :
v := DialogFolder {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode DialogClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode DialogClass: %w" , bin .NewUnexpectedID (id ))
}
}
type DialogBox struct {
Dialog DialogClass
}
func (b *DialogBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode DialogBox to nil" )
}
v , err := DecodeDialog (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .Dialog = v
return nil
}
func (b *DialogBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .Dialog == nil {
return fmt .Errorf ("unable to encode DialogClass as nil" )
}
return b .Dialog .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .