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 AuthBindTempAuthKeyRequest struct {
PermAuthKeyID int64
Nonce int64
ExpiresAt int
EncryptedMessage []byte
}
const AuthBindTempAuthKeyRequestTypeID = 0xcdd42a05
var (
_ bin .Encoder = &AuthBindTempAuthKeyRequest {}
_ bin .Decoder = &AuthBindTempAuthKeyRequest {}
_ bin .BareEncoder = &AuthBindTempAuthKeyRequest {}
_ bin .BareDecoder = &AuthBindTempAuthKeyRequest {}
)
func (b *AuthBindTempAuthKeyRequest ) Zero () bool {
if b == nil {
return true
}
if !(b .PermAuthKeyID == 0 ) {
return false
}
if !(b .Nonce == 0 ) {
return false
}
if !(b .ExpiresAt == 0 ) {
return false
}
if !(b .EncryptedMessage == nil ) {
return false
}
return true
}
func (b *AuthBindTempAuthKeyRequest ) String () string {
if b == nil {
return "AuthBindTempAuthKeyRequest(nil)"
}
type Alias AuthBindTempAuthKeyRequest
return fmt .Sprintf ("AuthBindTempAuthKeyRequest%+v" , Alias (*b ))
}
func (b *AuthBindTempAuthKeyRequest ) FillFrom (from interface {
GetPermAuthKeyID () (value int64 )
GetNonce () (value int64 )
GetExpiresAt () (value int )
GetEncryptedMessage () (value []byte )
}) {
b .PermAuthKeyID = from .GetPermAuthKeyID ()
b .Nonce = from .GetNonce ()
b .ExpiresAt = from .GetExpiresAt ()
b .EncryptedMessage = from .GetEncryptedMessage ()
}
func (*AuthBindTempAuthKeyRequest ) TypeID () uint32 {
return AuthBindTempAuthKeyRequestTypeID
}
func (*AuthBindTempAuthKeyRequest ) TypeName () string {
return "auth.bindTempAuthKey"
}
func (b *AuthBindTempAuthKeyRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.bindTempAuthKey" ,
ID : AuthBindTempAuthKeyRequestTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PermAuthKeyID" ,
SchemaName : "perm_auth_key_id" ,
},
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ExpiresAt" ,
SchemaName : "expires_at" ,
},
{
Name : "EncryptedMessage" ,
SchemaName : "encrypted_message" ,
},
}
return typ
}
func (b *AuthBindTempAuthKeyRequest ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode auth.bindTempAuthKey#cdd42a05 as nil" )
}
buf .PutID (AuthBindTempAuthKeyRequestTypeID )
return b .EncodeBare (buf )
}
func (b *AuthBindTempAuthKeyRequest ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode auth.bindTempAuthKey#cdd42a05 as nil" )
}
buf .PutLong (b .PermAuthKeyID )
buf .PutLong (b .Nonce )
buf .PutInt (b .ExpiresAt )
buf .PutBytes (b .EncryptedMessage )
return nil
}
func (b *AuthBindTempAuthKeyRequest ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode auth.bindTempAuthKey#cdd42a05 to nil" )
}
if err := buf .ConsumeID (AuthBindTempAuthKeyRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.bindTempAuthKey#cdd42a05: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *AuthBindTempAuthKeyRequest ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode auth.bindTempAuthKey#cdd42a05 to nil" )
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode auth.bindTempAuthKey#cdd42a05: field perm_auth_key_id: %w" , err )
}
b .PermAuthKeyID = value
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode auth.bindTempAuthKey#cdd42a05: field nonce: %w" , err )
}
b .Nonce = value
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode auth.bindTempAuthKey#cdd42a05: field expires_at: %w" , err )
}
b .ExpiresAt = value
}
{
value , err := buf .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode auth.bindTempAuthKey#cdd42a05: field encrypted_message: %w" , err )
}
b .EncryptedMessage = value
}
return nil
}
func (b *AuthBindTempAuthKeyRequest ) GetPermAuthKeyID () (value int64 ) {
if b == nil {
return
}
return b .PermAuthKeyID
}
func (b *AuthBindTempAuthKeyRequest ) GetNonce () (value int64 ) {
if b == nil {
return
}
return b .Nonce
}
func (b *AuthBindTempAuthKeyRequest ) GetExpiresAt () (value int ) {
if b == nil {
return
}
return b .ExpiresAt
}
func (b *AuthBindTempAuthKeyRequest ) GetEncryptedMessage () (value []byte ) {
if b == nil {
return
}
return b .EncryptedMessage
}
func (c *Client ) AuthBindTempAuthKey (ctx context .Context , request *AuthBindTempAuthKeyRequest ) (bool , error ) {
var result BoolBox
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 .