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 InputBusinessIntro struct {
Flags bin .Fields
Title string
Description string
Sticker InputDocumentClass
}
const InputBusinessIntroTypeID = 0x9c469cd
var (
_ bin .Encoder = &InputBusinessIntro {}
_ bin .Decoder = &InputBusinessIntro {}
_ bin .BareEncoder = &InputBusinessIntro {}
_ bin .BareDecoder = &InputBusinessIntro {}
)
func (i *InputBusinessIntro ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Title == "" ) {
return false
}
if !(i .Description == "" ) {
return false
}
if !(i .Sticker == nil ) {
return false
}
return true
}
func (i *InputBusinessIntro ) String () string {
if i == nil {
return "InputBusinessIntro(nil)"
}
type Alias InputBusinessIntro
return fmt .Sprintf ("InputBusinessIntro%+v" , Alias (*i ))
}
func (i *InputBusinessIntro ) FillFrom (from interface {
GetTitle () (value string )
GetDescription () (value string )
GetSticker () (value InputDocumentClass , ok bool )
}) {
i .Title = from .GetTitle ()
i .Description = from .GetDescription ()
if val , ok := from .GetSticker (); ok {
i .Sticker = val
}
}
func (*InputBusinessIntro ) TypeID () uint32 {
return InputBusinessIntroTypeID
}
func (*InputBusinessIntro ) TypeName () string {
return "inputBusinessIntro"
}
func (i *InputBusinessIntro ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputBusinessIntro" ,
ID : InputBusinessIntroTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Description" ,
SchemaName : "description" ,
},
{
Name : "Sticker" ,
SchemaName : "sticker" ,
Null : !i .Flags .Has (0 ),
},
}
return typ
}
func (i *InputBusinessIntro ) SetFlags () {
if !(i .Sticker == nil ) {
i .Flags .Set (0 )
}
}
func (i *InputBusinessIntro ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBusinessIntro#9c469cd as nil" )
}
b .PutID (InputBusinessIntroTypeID )
return i .EncodeBare (b )
}
func (i *InputBusinessIntro ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBusinessIntro#9c469cd as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBusinessIntro#9c469cd: field flags: %w" , err )
}
b .PutString (i .Title )
b .PutString (i .Description )
if i .Flags .Has (0 ) {
if i .Sticker == nil {
return fmt .Errorf ("unable to encode inputBusinessIntro#9c469cd: field sticker is nil" )
}
if err := i .Sticker .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBusinessIntro#9c469cd: field sticker: %w" , err )
}
}
return nil
}
func (i *InputBusinessIntro ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBusinessIntro#9c469cd to nil" )
}
if err := b .ConsumeID (InputBusinessIntroTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputBusinessIntro#9c469cd: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputBusinessIntro ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBusinessIntro#9c469cd to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputBusinessIntro#9c469cd: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBusinessIntro#9c469cd: field title: %w" , err )
}
i .Title = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBusinessIntro#9c469cd: field description: %w" , err )
}
i .Description = value
}
if i .Flags .Has (0 ) {
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBusinessIntro#9c469cd: field sticker: %w" , err )
}
i .Sticker = value
}
return nil
}
func (i *InputBusinessIntro ) GetTitle () (value string ) {
if i == nil {
return
}
return i .Title
}
func (i *InputBusinessIntro ) GetDescription () (value string ) {
if i == nil {
return
}
return i .Description
}
func (i *InputBusinessIntro ) SetSticker (value InputDocumentClass ) {
i .Flags .Set (0 )
i .Sticker = value
}
func (i *InputBusinessIntro ) GetSticker () (value InputDocumentClass , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .Sticker , true
}
func (i *InputBusinessIntro ) GetStickerAsNotEmpty () (*InputDocument , bool ) {
if value , ok := i .GetSticker (); ok {
return value .AsNotEmpty ()
}
return nil , false
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .