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 MessagesHistoryImportParsed struct {
Flags bin .Fields
Pm bool
Group bool
Title string
}
const MessagesHistoryImportParsedTypeID = 0x5e0fb7b9
var (
_ bin .Encoder = &MessagesHistoryImportParsed {}
_ bin .Decoder = &MessagesHistoryImportParsed {}
_ bin .BareEncoder = &MessagesHistoryImportParsed {}
_ bin .BareDecoder = &MessagesHistoryImportParsed {}
)
func (h *MessagesHistoryImportParsed ) Zero () bool {
if h == nil {
return true
}
if !(h .Flags .Zero ()) {
return false
}
if !(h .Pm == false ) {
return false
}
if !(h .Group == false ) {
return false
}
if !(h .Title == "" ) {
return false
}
return true
}
func (h *MessagesHistoryImportParsed ) String () string {
if h == nil {
return "MessagesHistoryImportParsed(nil)"
}
type Alias MessagesHistoryImportParsed
return fmt .Sprintf ("MessagesHistoryImportParsed%+v" , Alias (*h ))
}
func (h *MessagesHistoryImportParsed ) FillFrom (from interface {
GetPm () (value bool )
GetGroup () (value bool )
GetTitle () (value string , ok bool )
}) {
h .Pm = from .GetPm ()
h .Group = from .GetGroup ()
if val , ok := from .GetTitle (); ok {
h .Title = val
}
}
func (*MessagesHistoryImportParsed ) TypeID () uint32 {
return MessagesHistoryImportParsedTypeID
}
func (*MessagesHistoryImportParsed ) TypeName () string {
return "messages.historyImportParsed"
}
func (h *MessagesHistoryImportParsed ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.historyImportParsed" ,
ID : MessagesHistoryImportParsedTypeID ,
}
if h == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pm" ,
SchemaName : "pm" ,
Null : !h .Flags .Has (0 ),
},
{
Name : "Group" ,
SchemaName : "group" ,
Null : !h .Flags .Has (1 ),
},
{
Name : "Title" ,
SchemaName : "title" ,
Null : !h .Flags .Has (2 ),
},
}
return typ
}
func (h *MessagesHistoryImportParsed ) SetFlags () {
if !(h .Pm == false ) {
h .Flags .Set (0 )
}
if !(h .Group == false ) {
h .Flags .Set (1 )
}
if !(h .Title == "" ) {
h .Flags .Set (2 )
}
}
func (h *MessagesHistoryImportParsed ) Encode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode messages.historyImportParsed#5e0fb7b9 as nil" )
}
b .PutID (MessagesHistoryImportParsedTypeID )
return h .EncodeBare (b )
}
func (h *MessagesHistoryImportParsed ) EncodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode messages.historyImportParsed#5e0fb7b9 as nil" )
}
h .SetFlags ()
if err := h .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.historyImportParsed#5e0fb7b9: field flags: %w" , err )
}
if h .Flags .Has (2 ) {
b .PutString (h .Title )
}
return nil
}
func (h *MessagesHistoryImportParsed ) Decode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode messages.historyImportParsed#5e0fb7b9 to nil" )
}
if err := b .ConsumeID (MessagesHistoryImportParsedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.historyImportParsed#5e0fb7b9: %w" , err )
}
return h .DecodeBare (b )
}
func (h *MessagesHistoryImportParsed ) DecodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode messages.historyImportParsed#5e0fb7b9 to nil" )
}
{
if err := h .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.historyImportParsed#5e0fb7b9: field flags: %w" , err )
}
}
h .Pm = h .Flags .Has (0 )
h .Group = h .Flags .Has (1 )
if h .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.historyImportParsed#5e0fb7b9: field title: %w" , err )
}
h .Title = value
}
return nil
}
func (h *MessagesHistoryImportParsed ) SetPm (value bool ) {
if value {
h .Flags .Set (0 )
h .Pm = true
} else {
h .Flags .Unset (0 )
h .Pm = false
}
}
func (h *MessagesHistoryImportParsed ) GetPm () (value bool ) {
if h == nil {
return
}
return h .Flags .Has (0 )
}
func (h *MessagesHistoryImportParsed ) SetGroup (value bool ) {
if value {
h .Flags .Set (1 )
h .Group = true
} else {
h .Flags .Unset (1 )
h .Group = false
}
}
func (h *MessagesHistoryImportParsed ) GetGroup () (value bool ) {
if h == nil {
return
}
return h .Flags .Has (1 )
}
func (h *MessagesHistoryImportParsed ) SetTitle (value string ) {
h .Flags .Set (2 )
h .Title = value
}
func (h *MessagesHistoryImportParsed ) GetTitle () (value string , ok bool ) {
if h == nil {
return
}
if !h .Flags .Has (2 ) {
return value , false
}
return h .Title , true
}
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 .