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 AccountSendVerifyEmailCodeRequest struct {
Purpose EmailVerifyPurposeClass
Email string
}
const AccountSendVerifyEmailCodeRequestTypeID = 0x98e037bb
var (
_ bin .Encoder = &AccountSendVerifyEmailCodeRequest {}
_ bin .Decoder = &AccountSendVerifyEmailCodeRequest {}
_ bin .BareEncoder = &AccountSendVerifyEmailCodeRequest {}
_ bin .BareDecoder = &AccountSendVerifyEmailCodeRequest {}
)
func (s *AccountSendVerifyEmailCodeRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Purpose == nil ) {
return false
}
if !(s .Email == "" ) {
return false
}
return true
}
func (s *AccountSendVerifyEmailCodeRequest ) String () string {
if s == nil {
return "AccountSendVerifyEmailCodeRequest(nil)"
}
type Alias AccountSendVerifyEmailCodeRequest
return fmt .Sprintf ("AccountSendVerifyEmailCodeRequest%+v" , Alias (*s ))
}
func (s *AccountSendVerifyEmailCodeRequest ) FillFrom (from interface {
GetPurpose () (value EmailVerifyPurposeClass )
GetEmail () (value string )
}) {
s .Purpose = from .GetPurpose ()
s .Email = from .GetEmail ()
}
func (*AccountSendVerifyEmailCodeRequest ) TypeID () uint32 {
return AccountSendVerifyEmailCodeRequestTypeID
}
func (*AccountSendVerifyEmailCodeRequest ) TypeName () string {
return "account.sendVerifyEmailCode"
}
func (s *AccountSendVerifyEmailCodeRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.sendVerifyEmailCode" ,
ID : AccountSendVerifyEmailCodeRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Purpose" ,
SchemaName : "purpose" ,
},
{
Name : "Email" ,
SchemaName : "email" ,
},
}
return typ
}
func (s *AccountSendVerifyEmailCodeRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.sendVerifyEmailCode#98e037bb as nil" )
}
b .PutID (AccountSendVerifyEmailCodeRequestTypeID )
return s .EncodeBare (b )
}
func (s *AccountSendVerifyEmailCodeRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.sendVerifyEmailCode#98e037bb as nil" )
}
if s .Purpose == nil {
return fmt .Errorf ("unable to encode account.sendVerifyEmailCode#98e037bb: field purpose is nil" )
}
if err := s .Purpose .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.sendVerifyEmailCode#98e037bb: field purpose: %w" , err )
}
b .PutString (s .Email )
return nil
}
func (s *AccountSendVerifyEmailCodeRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.sendVerifyEmailCode#98e037bb to nil" )
}
if err := b .ConsumeID (AccountSendVerifyEmailCodeRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.sendVerifyEmailCode#98e037bb: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSendVerifyEmailCodeRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.sendVerifyEmailCode#98e037bb to nil" )
}
{
value , err := DecodeEmailVerifyPurpose (b )
if err != nil {
return fmt .Errorf ("unable to decode account.sendVerifyEmailCode#98e037bb: field purpose: %w" , err )
}
s .Purpose = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.sendVerifyEmailCode#98e037bb: field email: %w" , err )
}
s .Email = value
}
return nil
}
func (s *AccountSendVerifyEmailCodeRequest ) GetPurpose () (value EmailVerifyPurposeClass ) {
if s == nil {
return
}
return s .Purpose
}
func (s *AccountSendVerifyEmailCodeRequest ) GetEmail () (value string ) {
if s == nil {
return
}
return s .Email
}
func (c *Client ) AccountSendVerifyEmailCode (ctx context .Context , request *AccountSendVerifyEmailCodeRequest ) (*AccountSentEmailCode , error ) {
var result AccountSentEmailCode
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .