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 SecureCredentialsEncrypted struct {
Data []byte
Hash []byte
Secret []byte
}
const SecureCredentialsEncryptedTypeID = 0x33f0ea47
var (
_ bin .Encoder = &SecureCredentialsEncrypted {}
_ bin .Decoder = &SecureCredentialsEncrypted {}
_ bin .BareEncoder = &SecureCredentialsEncrypted {}
_ bin .BareDecoder = &SecureCredentialsEncrypted {}
)
func (s *SecureCredentialsEncrypted ) Zero () bool {
if s == nil {
return true
}
if !(s .Data == nil ) {
return false
}
if !(s .Hash == nil ) {
return false
}
if !(s .Secret == nil ) {
return false
}
return true
}
func (s *SecureCredentialsEncrypted ) String () string {
if s == nil {
return "SecureCredentialsEncrypted(nil)"
}
type Alias SecureCredentialsEncrypted
return fmt .Sprintf ("SecureCredentialsEncrypted%+v" , Alias (*s ))
}
func (s *SecureCredentialsEncrypted ) FillFrom (from interface {
GetData () (value []byte )
GetHash () (value []byte )
GetSecret () (value []byte )
}) {
s .Data = from .GetData ()
s .Hash = from .GetHash ()
s .Secret = from .GetSecret ()
}
func (*SecureCredentialsEncrypted ) TypeID () uint32 {
return SecureCredentialsEncryptedTypeID
}
func (*SecureCredentialsEncrypted ) TypeName () string {
return "secureCredentialsEncrypted"
}
func (s *SecureCredentialsEncrypted ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "secureCredentialsEncrypted" ,
ID : SecureCredentialsEncryptedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Data" ,
SchemaName : "data" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Secret" ,
SchemaName : "secret" ,
},
}
return typ
}
func (s *SecureCredentialsEncrypted ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode secureCredentialsEncrypted#33f0ea47 as nil" )
}
b .PutID (SecureCredentialsEncryptedTypeID )
return s .EncodeBare (b )
}
func (s *SecureCredentialsEncrypted ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode secureCredentialsEncrypted#33f0ea47 as nil" )
}
b .PutBytes (s .Data )
b .PutBytes (s .Hash )
b .PutBytes (s .Secret )
return nil
}
func (s *SecureCredentialsEncrypted ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode secureCredentialsEncrypted#33f0ea47 to nil" )
}
if err := b .ConsumeID (SecureCredentialsEncryptedTypeID ); err != nil {
return fmt .Errorf ("unable to decode secureCredentialsEncrypted#33f0ea47: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SecureCredentialsEncrypted ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode secureCredentialsEncrypted#33f0ea47 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode secureCredentialsEncrypted#33f0ea47: field data: %w" , err )
}
s .Data = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode secureCredentialsEncrypted#33f0ea47: field hash: %w" , err )
}
s .Hash = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode secureCredentialsEncrypted#33f0ea47: field secret: %w" , err )
}
s .Secret = value
}
return nil
}
func (s *SecureCredentialsEncrypted ) GetData () (value []byte ) {
if s == nil {
return
}
return s .Data
}
func (s *SecureCredentialsEncrypted ) GetHash () (value []byte ) {
if s == nil {
return
}
return s .Hash
}
func (s *SecureCredentialsEncrypted ) GetSecret () (value []byte ) {
if s == nil {
return
}
return s .Secret
}
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 .