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 AccountSentEmailCode struct {
EmailPattern string
Length int
}
const AccountSentEmailCodeTypeID = 0x811f854f
var (
_ bin .Encoder = &AccountSentEmailCode {}
_ bin .Decoder = &AccountSentEmailCode {}
_ bin .BareEncoder = &AccountSentEmailCode {}
_ bin .BareDecoder = &AccountSentEmailCode {}
)
func (s *AccountSentEmailCode ) Zero () bool {
if s == nil {
return true
}
if !(s .EmailPattern == "" ) {
return false
}
if !(s .Length == 0 ) {
return false
}
return true
}
func (s *AccountSentEmailCode ) String () string {
if s == nil {
return "AccountSentEmailCode(nil)"
}
type Alias AccountSentEmailCode
return fmt .Sprintf ("AccountSentEmailCode%+v" , Alias (*s ))
}
func (s *AccountSentEmailCode ) FillFrom (from interface {
GetEmailPattern () (value string )
GetLength () (value int )
}) {
s .EmailPattern = from .GetEmailPattern ()
s .Length = from .GetLength ()
}
func (*AccountSentEmailCode ) TypeID () uint32 {
return AccountSentEmailCodeTypeID
}
func (*AccountSentEmailCode ) TypeName () string {
return "account.sentEmailCode"
}
func (s *AccountSentEmailCode ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.sentEmailCode" ,
ID : AccountSentEmailCodeTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "EmailPattern" ,
SchemaName : "email_pattern" ,
},
{
Name : "Length" ,
SchemaName : "length" ,
},
}
return typ
}
func (s *AccountSentEmailCode ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.sentEmailCode#811f854f as nil" )
}
b .PutID (AccountSentEmailCodeTypeID )
return s .EncodeBare (b )
}
func (s *AccountSentEmailCode ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.sentEmailCode#811f854f as nil" )
}
b .PutString (s .EmailPattern )
b .PutInt (s .Length )
return nil
}
func (s *AccountSentEmailCode ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.sentEmailCode#811f854f to nil" )
}
if err := b .ConsumeID (AccountSentEmailCodeTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.sentEmailCode#811f854f: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSentEmailCode ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.sentEmailCode#811f854f to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.sentEmailCode#811f854f: field email_pattern: %w" , err )
}
s .EmailPattern = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode account.sentEmailCode#811f854f: field length: %w" , err )
}
s .Length = value
}
return nil
}
func (s *AccountSentEmailCode ) GetEmailPattern () (value string ) {
if s == nil {
return
}
return s .EmailPattern
}
func (s *AccountSentEmailCode ) GetLength () (value int ) {
if s == nil {
return
}
return s .Length
}
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 .