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 AccountVerifyEmailRequest struct {
Purpose EmailVerifyPurposeClass
Verification EmailVerificationClass
}
const AccountVerifyEmailRequestTypeID = 0x32da4cf
var (
_ bin .Encoder = &AccountVerifyEmailRequest {}
_ bin .Decoder = &AccountVerifyEmailRequest {}
_ bin .BareEncoder = &AccountVerifyEmailRequest {}
_ bin .BareDecoder = &AccountVerifyEmailRequest {}
)
func (v *AccountVerifyEmailRequest ) Zero () bool {
if v == nil {
return true
}
if !(v .Purpose == nil ) {
return false
}
if !(v .Verification == nil ) {
return false
}
return true
}
func (v *AccountVerifyEmailRequest ) String () string {
if v == nil {
return "AccountVerifyEmailRequest(nil)"
}
type Alias AccountVerifyEmailRequest
return fmt .Sprintf ("AccountVerifyEmailRequest%+v" , Alias (*v ))
}
func (v *AccountVerifyEmailRequest ) FillFrom (from interface {
GetPurpose () (value EmailVerifyPurposeClass )
GetVerification () (value EmailVerificationClass )
}) {
v .Purpose = from .GetPurpose ()
v .Verification = from .GetVerification ()
}
func (*AccountVerifyEmailRequest ) TypeID () uint32 {
return AccountVerifyEmailRequestTypeID
}
func (*AccountVerifyEmailRequest ) TypeName () string {
return "account.verifyEmail"
}
func (v *AccountVerifyEmailRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.verifyEmail" ,
ID : AccountVerifyEmailRequestTypeID ,
}
if v == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Purpose" ,
SchemaName : "purpose" ,
},
{
Name : "Verification" ,
SchemaName : "verification" ,
},
}
return typ
}
func (v *AccountVerifyEmailRequest ) Encode (b *bin .Buffer ) error {
if v == nil {
return fmt .Errorf ("can't encode account.verifyEmail#32da4cf as nil" )
}
b .PutID (AccountVerifyEmailRequestTypeID )
return v .EncodeBare (b )
}
func (v *AccountVerifyEmailRequest ) EncodeBare (b *bin .Buffer ) error {
if v == nil {
return fmt .Errorf ("can't encode account.verifyEmail#32da4cf as nil" )
}
if v .Purpose == nil {
return fmt .Errorf ("unable to encode account.verifyEmail#32da4cf: field purpose is nil" )
}
if err := v .Purpose .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.verifyEmail#32da4cf: field purpose: %w" , err )
}
if v .Verification == nil {
return fmt .Errorf ("unable to encode account.verifyEmail#32da4cf: field verification is nil" )
}
if err := v .Verification .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.verifyEmail#32da4cf: field verification: %w" , err )
}
return nil
}
func (v *AccountVerifyEmailRequest ) Decode (b *bin .Buffer ) error {
if v == nil {
return fmt .Errorf ("can't decode account.verifyEmail#32da4cf to nil" )
}
if err := b .ConsumeID (AccountVerifyEmailRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.verifyEmail#32da4cf: %w" , err )
}
return v .DecodeBare (b )
}
func (v *AccountVerifyEmailRequest ) DecodeBare (b *bin .Buffer ) error {
if v == nil {
return fmt .Errorf ("can't decode account.verifyEmail#32da4cf to nil" )
}
{
value , err := DecodeEmailVerifyPurpose (b )
if err != nil {
return fmt .Errorf ("unable to decode account.verifyEmail#32da4cf: field purpose: %w" , err )
}
v .Purpose = value
}
{
value , err := DecodeEmailVerification (b )
if err != nil {
return fmt .Errorf ("unable to decode account.verifyEmail#32da4cf: field verification: %w" , err )
}
v .Verification = value
}
return nil
}
func (v *AccountVerifyEmailRequest ) GetPurpose () (value EmailVerifyPurposeClass ) {
if v == nil {
return
}
return v .Purpose
}
func (v *AccountVerifyEmailRequest ) GetVerification () (value EmailVerificationClass ) {
if v == nil {
return
}
return v .Verification
}
func (c *Client ) AccountVerifyEmail (ctx context .Context , request *AccountVerifyEmailRequest ) (AccountEmailVerifiedClass , error ) {
var result AccountEmailVerifiedBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .EmailVerified , 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 .