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 AccountResetAuthorizationRequest struct {
Hash int64
}
const AccountResetAuthorizationRequestTypeID = 0xdf77f3bc
var (
_ bin .Encoder = &AccountResetAuthorizationRequest {}
_ bin .Decoder = &AccountResetAuthorizationRequest {}
_ bin .BareEncoder = &AccountResetAuthorizationRequest {}
_ bin .BareDecoder = &AccountResetAuthorizationRequest {}
)
func (r *AccountResetAuthorizationRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Hash == 0 ) {
return false
}
return true
}
func (r *AccountResetAuthorizationRequest ) String () string {
if r == nil {
return "AccountResetAuthorizationRequest(nil)"
}
type Alias AccountResetAuthorizationRequest
return fmt .Sprintf ("AccountResetAuthorizationRequest%+v" , Alias (*r ))
}
func (r *AccountResetAuthorizationRequest ) FillFrom (from interface {
GetHash () (value int64 )
}) {
r .Hash = from .GetHash ()
}
func (*AccountResetAuthorizationRequest ) TypeID () uint32 {
return AccountResetAuthorizationRequestTypeID
}
func (*AccountResetAuthorizationRequest ) TypeName () string {
return "account.resetAuthorization"
}
func (r *AccountResetAuthorizationRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.resetAuthorization" ,
ID : AccountResetAuthorizationRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (r *AccountResetAuthorizationRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetAuthorization#df77f3bc as nil" )
}
b .PutID (AccountResetAuthorizationRequestTypeID )
return r .EncodeBare (b )
}
func (r *AccountResetAuthorizationRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetAuthorization#df77f3bc as nil" )
}
b .PutLong (r .Hash )
return nil
}
func (r *AccountResetAuthorizationRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetAuthorization#df77f3bc to nil" )
}
if err := b .ConsumeID (AccountResetAuthorizationRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.resetAuthorization#df77f3bc: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AccountResetAuthorizationRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetAuthorization#df77f3bc to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.resetAuthorization#df77f3bc: field hash: %w" , err )
}
r .Hash = value
}
return nil
}
func (r *AccountResetAuthorizationRequest ) GetHash () (value int64 ) {
if r == nil {
return
}
return r .Hash
}
func (c *Client ) AccountResetAuthorization (ctx context .Context , hash int64 ) (bool , error ) {
var result BoolBox
request := &AccountResetAuthorizationRequest {
Hash : hash ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .