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 JoinChatBotResultApproved struct {
}
const JoinChatBotResultApprovedTypeID = 0xae152a69
func (j JoinChatBotResultApproved ) construct () JoinChatBotResultClass { return &j }
var (
_ bin .Encoder = &JoinChatBotResultApproved {}
_ bin .Decoder = &JoinChatBotResultApproved {}
_ bin .BareEncoder = &JoinChatBotResultApproved {}
_ bin .BareDecoder = &JoinChatBotResultApproved {}
_ JoinChatBotResultClass = &JoinChatBotResultApproved {}
)
func (j *JoinChatBotResultApproved ) Zero () bool {
if j == nil {
return true
}
return true
}
func (j *JoinChatBotResultApproved ) String () string {
if j == nil {
return "JoinChatBotResultApproved(nil)"
}
type Alias JoinChatBotResultApproved
return fmt .Sprintf ("JoinChatBotResultApproved%+v" , Alias (*j ))
}
func (*JoinChatBotResultApproved ) TypeID () uint32 {
return JoinChatBotResultApprovedTypeID
}
func (*JoinChatBotResultApproved ) TypeName () string {
return "joinChatBotResultApproved"
}
func (j *JoinChatBotResultApproved ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "joinChatBotResultApproved" ,
ID : JoinChatBotResultApprovedTypeID ,
}
if j == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (j *JoinChatBotResultApproved ) Encode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultApproved#ae152a69 as nil" )
}
b .PutID (JoinChatBotResultApprovedTypeID )
return j .EncodeBare (b )
}
func (j *JoinChatBotResultApproved ) EncodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultApproved#ae152a69 as nil" )
}
return nil
}
func (j *JoinChatBotResultApproved ) Decode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultApproved#ae152a69 to nil" )
}
if err := b .ConsumeID (JoinChatBotResultApprovedTypeID ); err != nil {
return fmt .Errorf ("unable to decode joinChatBotResultApproved#ae152a69: %w" , err )
}
return j .DecodeBare (b )
}
func (j *JoinChatBotResultApproved ) DecodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultApproved#ae152a69 to nil" )
}
return nil
}
type JoinChatBotResultDeclined struct {
}
const JoinChatBotResultDeclinedTypeID = 0xefa0194
func (j JoinChatBotResultDeclined ) construct () JoinChatBotResultClass { return &j }
var (
_ bin .Encoder = &JoinChatBotResultDeclined {}
_ bin .Decoder = &JoinChatBotResultDeclined {}
_ bin .BareEncoder = &JoinChatBotResultDeclined {}
_ bin .BareDecoder = &JoinChatBotResultDeclined {}
_ JoinChatBotResultClass = &JoinChatBotResultDeclined {}
)
func (j *JoinChatBotResultDeclined ) Zero () bool {
if j == nil {
return true
}
return true
}
func (j *JoinChatBotResultDeclined ) String () string {
if j == nil {
return "JoinChatBotResultDeclined(nil)"
}
type Alias JoinChatBotResultDeclined
return fmt .Sprintf ("JoinChatBotResultDeclined%+v" , Alias (*j ))
}
func (*JoinChatBotResultDeclined ) TypeID () uint32 {
return JoinChatBotResultDeclinedTypeID
}
func (*JoinChatBotResultDeclined ) TypeName () string {
return "joinChatBotResultDeclined"
}
func (j *JoinChatBotResultDeclined ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "joinChatBotResultDeclined" ,
ID : JoinChatBotResultDeclinedTypeID ,
}
if j == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (j *JoinChatBotResultDeclined ) Encode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultDeclined#efa0194 as nil" )
}
b .PutID (JoinChatBotResultDeclinedTypeID )
return j .EncodeBare (b )
}
func (j *JoinChatBotResultDeclined ) EncodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultDeclined#efa0194 as nil" )
}
return nil
}
func (j *JoinChatBotResultDeclined ) Decode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultDeclined#efa0194 to nil" )
}
if err := b .ConsumeID (JoinChatBotResultDeclinedTypeID ); err != nil {
return fmt .Errorf ("unable to decode joinChatBotResultDeclined#efa0194: %w" , err )
}
return j .DecodeBare (b )
}
func (j *JoinChatBotResultDeclined ) DecodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultDeclined#efa0194 to nil" )
}
return nil
}
type JoinChatBotResultQueued struct {
}
const JoinChatBotResultQueuedTypeID = 0x98a3a840
func (j JoinChatBotResultQueued ) construct () JoinChatBotResultClass { return &j }
var (
_ bin .Encoder = &JoinChatBotResultQueued {}
_ bin .Decoder = &JoinChatBotResultQueued {}
_ bin .BareEncoder = &JoinChatBotResultQueued {}
_ bin .BareDecoder = &JoinChatBotResultQueued {}
_ JoinChatBotResultClass = &JoinChatBotResultQueued {}
)
func (j *JoinChatBotResultQueued ) Zero () bool {
if j == nil {
return true
}
return true
}
func (j *JoinChatBotResultQueued ) String () string {
if j == nil {
return "JoinChatBotResultQueued(nil)"
}
type Alias JoinChatBotResultQueued
return fmt .Sprintf ("JoinChatBotResultQueued%+v" , Alias (*j ))
}
func (*JoinChatBotResultQueued ) TypeID () uint32 {
return JoinChatBotResultQueuedTypeID
}
func (*JoinChatBotResultQueued ) TypeName () string {
return "joinChatBotResultQueued"
}
func (j *JoinChatBotResultQueued ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "joinChatBotResultQueued" ,
ID : JoinChatBotResultQueuedTypeID ,
}
if j == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (j *JoinChatBotResultQueued ) Encode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultQueued#98a3a840 as nil" )
}
b .PutID (JoinChatBotResultQueuedTypeID )
return j .EncodeBare (b )
}
func (j *JoinChatBotResultQueued ) EncodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultQueued#98a3a840 as nil" )
}
return nil
}
func (j *JoinChatBotResultQueued ) Decode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultQueued#98a3a840 to nil" )
}
if err := b .ConsumeID (JoinChatBotResultQueuedTypeID ); err != nil {
return fmt .Errorf ("unable to decode joinChatBotResultQueued#98a3a840: %w" , err )
}
return j .DecodeBare (b )
}
func (j *JoinChatBotResultQueued ) DecodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultQueued#98a3a840 to nil" )
}
return nil
}
type JoinChatBotResultWebView struct {
URL string
}
const JoinChatBotResultWebViewTypeID = 0xd6e3b813
func (j JoinChatBotResultWebView ) construct () JoinChatBotResultClass { return &j }
var (
_ bin .Encoder = &JoinChatBotResultWebView {}
_ bin .Decoder = &JoinChatBotResultWebView {}
_ bin .BareEncoder = &JoinChatBotResultWebView {}
_ bin .BareDecoder = &JoinChatBotResultWebView {}
_ JoinChatBotResultClass = &JoinChatBotResultWebView {}
)
func (j *JoinChatBotResultWebView ) Zero () bool {
if j == nil {
return true
}
if !(j .URL == "" ) {
return false
}
return true
}
func (j *JoinChatBotResultWebView ) String () string {
if j == nil {
return "JoinChatBotResultWebView(nil)"
}
type Alias JoinChatBotResultWebView
return fmt .Sprintf ("JoinChatBotResultWebView%+v" , Alias (*j ))
}
func (j *JoinChatBotResultWebView ) FillFrom (from interface {
GetURL () (value string )
}) {
j .URL = from .GetURL ()
}
func (*JoinChatBotResultWebView ) TypeID () uint32 {
return JoinChatBotResultWebViewTypeID
}
func (*JoinChatBotResultWebView ) TypeName () string {
return "joinChatBotResultWebView"
}
func (j *JoinChatBotResultWebView ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "joinChatBotResultWebView" ,
ID : JoinChatBotResultWebViewTypeID ,
}
if j == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (j *JoinChatBotResultWebView ) Encode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultWebView#d6e3b813 as nil" )
}
b .PutID (JoinChatBotResultWebViewTypeID )
return j .EncodeBare (b )
}
func (j *JoinChatBotResultWebView ) EncodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't encode joinChatBotResultWebView#d6e3b813 as nil" )
}
b .PutString (j .URL )
return nil
}
func (j *JoinChatBotResultWebView ) Decode (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultWebView#d6e3b813 to nil" )
}
if err := b .ConsumeID (JoinChatBotResultWebViewTypeID ); err != nil {
return fmt .Errorf ("unable to decode joinChatBotResultWebView#d6e3b813: %w" , err )
}
return j .DecodeBare (b )
}
func (j *JoinChatBotResultWebView ) DecodeBare (b *bin .Buffer ) error {
if j == nil {
return fmt .Errorf ("can't decode joinChatBotResultWebView#d6e3b813 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode joinChatBotResultWebView#d6e3b813: field url: %w" , err )
}
j .URL = value
}
return nil
}
func (j *JoinChatBotResultWebView ) GetURL () (value string ) {
if j == nil {
return
}
return j .URL
}
const JoinChatBotResultClassName = "JoinChatBotResult"
type JoinChatBotResultClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () JoinChatBotResultClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeJoinChatBotResult (buf *bin .Buffer ) (JoinChatBotResultClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case JoinChatBotResultApprovedTypeID :
v := JoinChatBotResultApproved {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode JoinChatBotResultClass: %w" , err )
}
return &v , nil
case JoinChatBotResultDeclinedTypeID :
v := JoinChatBotResultDeclined {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode JoinChatBotResultClass: %w" , err )
}
return &v , nil
case JoinChatBotResultQueuedTypeID :
v := JoinChatBotResultQueued {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode JoinChatBotResultClass: %w" , err )
}
return &v , nil
case JoinChatBotResultWebViewTypeID :
v := JoinChatBotResultWebView {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode JoinChatBotResultClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode JoinChatBotResultClass: %w" , bin .NewUnexpectedID (id ))
}
}
type JoinChatBotResultBox struct {
JoinChatBotResult JoinChatBotResultClass
}
func (b *JoinChatBotResultBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode JoinChatBotResultBox to nil" )
}
v , err := DecodeJoinChatBotResult (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .JoinChatBotResult = v
return nil
}
func (b *JoinChatBotResultBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .JoinChatBotResult == nil {
return fmt .Errorf ("unable to encode JoinChatBotResultClass as nil" )
}
return b .JoinChatBotResult .Encode (buf )
}
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 .