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 AccountEmailVerified struct {
Email string
}
const AccountEmailVerifiedTypeID = 0x2b96cd1b
func (e AccountEmailVerified ) construct () AccountEmailVerifiedClass { return &e }
var (
_ bin .Encoder = &AccountEmailVerified {}
_ bin .Decoder = &AccountEmailVerified {}
_ bin .BareEncoder = &AccountEmailVerified {}
_ bin .BareDecoder = &AccountEmailVerified {}
_ AccountEmailVerifiedClass = &AccountEmailVerified {}
)
func (e *AccountEmailVerified ) Zero () bool {
if e == nil {
return true
}
if !(e .Email == "" ) {
return false
}
return true
}
func (e *AccountEmailVerified ) String () string {
if e == nil {
return "AccountEmailVerified(nil)"
}
type Alias AccountEmailVerified
return fmt .Sprintf ("AccountEmailVerified%+v" , Alias (*e ))
}
func (e *AccountEmailVerified ) FillFrom (from interface {
GetEmail () (value string )
}) {
e .Email = from .GetEmail ()
}
func (*AccountEmailVerified ) TypeID () uint32 {
return AccountEmailVerifiedTypeID
}
func (*AccountEmailVerified ) TypeName () string {
return "account.emailVerified"
}
func (e *AccountEmailVerified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.emailVerified" ,
ID : AccountEmailVerifiedTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Email" ,
SchemaName : "email" ,
},
}
return typ
}
func (e *AccountEmailVerified ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emailVerified#2b96cd1b as nil" )
}
b .PutID (AccountEmailVerifiedTypeID )
return e .EncodeBare (b )
}
func (e *AccountEmailVerified ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emailVerified#2b96cd1b as nil" )
}
b .PutString (e .Email )
return nil
}
func (e *AccountEmailVerified ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emailVerified#2b96cd1b to nil" )
}
if err := b .ConsumeID (AccountEmailVerifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.emailVerified#2b96cd1b: %w" , err )
}
return e .DecodeBare (b )
}
func (e *AccountEmailVerified ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emailVerified#2b96cd1b to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.emailVerified#2b96cd1b: field email: %w" , err )
}
e .Email = value
}
return nil
}
func (e *AccountEmailVerified ) GetEmail () (value string ) {
if e == nil {
return
}
return e .Email
}
type AccountEmailVerifiedLogin struct {
Email string
SentCode AuthSentCodeClass
}
const AccountEmailVerifiedLoginTypeID = 0xe1bb0d61
func (e AccountEmailVerifiedLogin ) construct () AccountEmailVerifiedClass { return &e }
var (
_ bin .Encoder = &AccountEmailVerifiedLogin {}
_ bin .Decoder = &AccountEmailVerifiedLogin {}
_ bin .BareEncoder = &AccountEmailVerifiedLogin {}
_ bin .BareDecoder = &AccountEmailVerifiedLogin {}
_ AccountEmailVerifiedClass = &AccountEmailVerifiedLogin {}
)
func (e *AccountEmailVerifiedLogin ) Zero () bool {
if e == nil {
return true
}
if !(e .Email == "" ) {
return false
}
if !(e .SentCode == nil ) {
return false
}
return true
}
func (e *AccountEmailVerifiedLogin ) String () string {
if e == nil {
return "AccountEmailVerifiedLogin(nil)"
}
type Alias AccountEmailVerifiedLogin
return fmt .Sprintf ("AccountEmailVerifiedLogin%+v" , Alias (*e ))
}
func (e *AccountEmailVerifiedLogin ) FillFrom (from interface {
GetEmail () (value string )
GetSentCode () (value AuthSentCodeClass )
}) {
e .Email = from .GetEmail ()
e .SentCode = from .GetSentCode ()
}
func (*AccountEmailVerifiedLogin ) TypeID () uint32 {
return AccountEmailVerifiedLoginTypeID
}
func (*AccountEmailVerifiedLogin ) TypeName () string {
return "account.emailVerifiedLogin"
}
func (e *AccountEmailVerifiedLogin ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.emailVerifiedLogin" ,
ID : AccountEmailVerifiedLoginTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Email" ,
SchemaName : "email" ,
},
{
Name : "SentCode" ,
SchemaName : "sent_code" ,
},
}
return typ
}
func (e *AccountEmailVerifiedLogin ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emailVerifiedLogin#e1bb0d61 as nil" )
}
b .PutID (AccountEmailVerifiedLoginTypeID )
return e .EncodeBare (b )
}
func (e *AccountEmailVerifiedLogin ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emailVerifiedLogin#e1bb0d61 as nil" )
}
b .PutString (e .Email )
if e .SentCode == nil {
return fmt .Errorf ("unable to encode account.emailVerifiedLogin#e1bb0d61: field sent_code is nil" )
}
if err := e .SentCode .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.emailVerifiedLogin#e1bb0d61: field sent_code: %w" , err )
}
return nil
}
func (e *AccountEmailVerifiedLogin ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emailVerifiedLogin#e1bb0d61 to nil" )
}
if err := b .ConsumeID (AccountEmailVerifiedLoginTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.emailVerifiedLogin#e1bb0d61: %w" , err )
}
return e .DecodeBare (b )
}
func (e *AccountEmailVerifiedLogin ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emailVerifiedLogin#e1bb0d61 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.emailVerifiedLogin#e1bb0d61: field email: %w" , err )
}
e .Email = value
}
{
value , err := DecodeAuthSentCode (b )
if err != nil {
return fmt .Errorf ("unable to decode account.emailVerifiedLogin#e1bb0d61: field sent_code: %w" , err )
}
e .SentCode = value
}
return nil
}
func (e *AccountEmailVerifiedLogin ) GetEmail () (value string ) {
if e == nil {
return
}
return e .Email
}
func (e *AccountEmailVerifiedLogin ) GetSentCode () (value AuthSentCodeClass ) {
if e == nil {
return
}
return e .SentCode
}
const AccountEmailVerifiedClassName = "account.EmailVerified"
type AccountEmailVerifiedClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () AccountEmailVerifiedClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetEmail () (value string )
}
func DecodeAccountEmailVerified (buf *bin .Buffer ) (AccountEmailVerifiedClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case AccountEmailVerifiedTypeID :
v := AccountEmailVerified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountEmailVerifiedClass: %w" , err )
}
return &v , nil
case AccountEmailVerifiedLoginTypeID :
v := AccountEmailVerifiedLogin {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountEmailVerifiedClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode AccountEmailVerifiedClass: %w" , bin .NewUnexpectedID (id ))
}
}
type AccountEmailVerifiedBox struct {
EmailVerified AccountEmailVerifiedClass
}
func (b *AccountEmailVerifiedBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode AccountEmailVerifiedBox to nil" )
}
v , err := DecodeAccountEmailVerified (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .EmailVerified = v
return nil
}
func (b *AccountEmailVerifiedBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .EmailVerified == nil {
return fmt .Errorf ("unable to encode AccountEmailVerifiedClass as nil" )
}
return b .EmailVerified .Encode (buf )
}
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 .