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 MessagesBotApp struct {
Flags bin .Fields
Inactive bool
RequestWriteAccess bool
HasSettings bool
App BotAppClass
}
const MessagesBotAppTypeID = 0xeb50adf5
var (
_ bin .Encoder = &MessagesBotApp {}
_ bin .Decoder = &MessagesBotApp {}
_ bin .BareEncoder = &MessagesBotApp {}
_ bin .BareDecoder = &MessagesBotApp {}
)
func (b *MessagesBotApp ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .Inactive == false ) {
return false
}
if !(b .RequestWriteAccess == false ) {
return false
}
if !(b .HasSettings == false ) {
return false
}
if !(b .App == nil ) {
return false
}
return true
}
func (b *MessagesBotApp ) String () string {
if b == nil {
return "MessagesBotApp(nil)"
}
type Alias MessagesBotApp
return fmt .Sprintf ("MessagesBotApp%+v" , Alias (*b ))
}
func (b *MessagesBotApp ) FillFrom (from interface {
GetInactive () (value bool )
GetRequestWriteAccess () (value bool )
GetHasSettings () (value bool )
GetApp () (value BotAppClass )
}) {
b .Inactive = from .GetInactive ()
b .RequestWriteAccess = from .GetRequestWriteAccess ()
b .HasSettings = from .GetHasSettings ()
b .App = from .GetApp ()
}
func (*MessagesBotApp ) TypeID () uint32 {
return MessagesBotAppTypeID
}
func (*MessagesBotApp ) TypeName () string {
return "messages.botApp"
}
func (b *MessagesBotApp ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.botApp" ,
ID : MessagesBotAppTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Inactive" ,
SchemaName : "inactive" ,
Null : !b .Flags .Has (0 ),
},
{
Name : "RequestWriteAccess" ,
SchemaName : "request_write_access" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "HasSettings" ,
SchemaName : "has_settings" ,
Null : !b .Flags .Has (2 ),
},
{
Name : "App" ,
SchemaName : "app" ,
},
}
return typ
}
func (b *MessagesBotApp ) SetFlags () {
if !(b .Inactive == false ) {
b .Flags .Set (0 )
}
if !(b .RequestWriteAccess == false ) {
b .Flags .Set (1 )
}
if !(b .HasSettings == false ) {
b .Flags .Set (2 )
}
}
func (b *MessagesBotApp ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode messages.botApp#eb50adf5 as nil" )
}
buf .PutID (MessagesBotAppTypeID )
return b .EncodeBare (buf )
}
func (b *MessagesBotApp ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode messages.botApp#eb50adf5 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode messages.botApp#eb50adf5: field flags: %w" , err )
}
if b .App == nil {
return fmt .Errorf ("unable to encode messages.botApp#eb50adf5: field app is nil" )
}
if err := b .App .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode messages.botApp#eb50adf5: field app: %w" , err )
}
return nil
}
func (b *MessagesBotApp ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode messages.botApp#eb50adf5 to nil" )
}
if err := buf .ConsumeID (MessagesBotAppTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.botApp#eb50adf5: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *MessagesBotApp ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode messages.botApp#eb50adf5 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode messages.botApp#eb50adf5: field flags: %w" , err )
}
}
b .Inactive = b .Flags .Has (0 )
b .RequestWriteAccess = b .Flags .Has (1 )
b .HasSettings = b .Flags .Has (2 )
{
value , err := DecodeBotApp (buf )
if err != nil {
return fmt .Errorf ("unable to decode messages.botApp#eb50adf5: field app: %w" , err )
}
b .App = value
}
return nil
}
func (b *MessagesBotApp ) SetInactive (value bool ) {
if value {
b .Flags .Set (0 )
b .Inactive = true
} else {
b .Flags .Unset (0 )
b .Inactive = false
}
}
func (b *MessagesBotApp ) GetInactive () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (0 )
}
func (b *MessagesBotApp ) SetRequestWriteAccess (value bool ) {
if value {
b .Flags .Set (1 )
b .RequestWriteAccess = true
} else {
b .Flags .Unset (1 )
b .RequestWriteAccess = false
}
}
func (b *MessagesBotApp ) GetRequestWriteAccess () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (1 )
}
func (b *MessagesBotApp ) SetHasSettings (value bool ) {
if value {
b .Flags .Set (2 )
b .HasSettings = true
} else {
b .Flags .Unset (2 )
b .HasSettings = false
}
}
func (b *MessagesBotApp ) GetHasSettings () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (2 )
}
func (b *MessagesBotApp ) GetApp () (value BotAppClass ) {
if b == nil {
return
}
return b .App
}
func (b *MessagesBotApp ) GetAppAsModified () (*BotApp , bool ) {
return b .App .AsModified ()
}
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 .