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