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 InlineBotSwitchPM struct {
Text string
StartParam string
}
const InlineBotSwitchPMTypeID = 0x3c20629f
var (
_ bin .Encoder = &InlineBotSwitchPM {}
_ bin .Decoder = &InlineBotSwitchPM {}
_ bin .BareEncoder = &InlineBotSwitchPM {}
_ bin .BareDecoder = &InlineBotSwitchPM {}
)
func (i *InlineBotSwitchPM ) Zero () bool {
if i == nil {
return true
}
if !(i .Text == "" ) {
return false
}
if !(i .StartParam == "" ) {
return false
}
return true
}
func (i *InlineBotSwitchPM ) String () string {
if i == nil {
return "InlineBotSwitchPM(nil)"
}
type Alias InlineBotSwitchPM
return fmt .Sprintf ("InlineBotSwitchPM%+v" , Alias (*i ))
}
func (i *InlineBotSwitchPM ) FillFrom (from interface {
GetText () (value string )
GetStartParam () (value string )
}) {
i .Text = from .GetText ()
i .StartParam = from .GetStartParam ()
}
func (*InlineBotSwitchPM ) TypeID () uint32 {
return InlineBotSwitchPMTypeID
}
func (*InlineBotSwitchPM ) TypeName () string {
return "inlineBotSwitchPM"
}
func (i *InlineBotSwitchPM ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inlineBotSwitchPM" ,
ID : InlineBotSwitchPMTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "StartParam" ,
SchemaName : "start_param" ,
},
}
return typ
}
func (i *InlineBotSwitchPM ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inlineBotSwitchPM#3c20629f as nil" )
}
b .PutID (InlineBotSwitchPMTypeID )
return i .EncodeBare (b )
}
func (i *InlineBotSwitchPM ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inlineBotSwitchPM#3c20629f as nil" )
}
b .PutString (i .Text )
b .PutString (i .StartParam )
return nil
}
func (i *InlineBotSwitchPM ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inlineBotSwitchPM#3c20629f to nil" )
}
if err := b .ConsumeID (InlineBotSwitchPMTypeID ); err != nil {
return fmt .Errorf ("unable to decode inlineBotSwitchPM#3c20629f: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InlineBotSwitchPM ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inlineBotSwitchPM#3c20629f to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inlineBotSwitchPM#3c20629f: field text: %w" , err )
}
i .Text = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inlineBotSwitchPM#3c20629f: field start_param: %w" , err )
}
i .StartParam = value
}
return nil
}
func (i *InlineBotSwitchPM ) GetText () (value string ) {
if i == nil {
return
}
return i .Text
}
func (i *InlineBotSwitchPM ) GetStartParam () (value string ) {
if i == nil {
return
}
return i .StartParam
}
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 .