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 AccountSaveSecureValueRequest struct {
Value InputSecureValue
SecureSecretID int64
}
const AccountSaveSecureValueRequestTypeID = 0x899fe31d
var (
_ bin .Encoder = &AccountSaveSecureValueRequest {}
_ bin .Decoder = &AccountSaveSecureValueRequest {}
_ bin .BareEncoder = &AccountSaveSecureValueRequest {}
_ bin .BareDecoder = &AccountSaveSecureValueRequest {}
)
func (s *AccountSaveSecureValueRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Value .Zero ()) {
return false
}
if !(s .SecureSecretID == 0 ) {
return false
}
return true
}
func (s *AccountSaveSecureValueRequest ) String () string {
if s == nil {
return "AccountSaveSecureValueRequest(nil)"
}
type Alias AccountSaveSecureValueRequest
return fmt .Sprintf ("AccountSaveSecureValueRequest%+v" , Alias (*s ))
}
func (s *AccountSaveSecureValueRequest ) FillFrom (from interface {
GetValue () (value InputSecureValue )
GetSecureSecretID () (value int64 )
}) {
s .Value = from .GetValue ()
s .SecureSecretID = from .GetSecureSecretID ()
}
func (*AccountSaveSecureValueRequest ) TypeID () uint32 {
return AccountSaveSecureValueRequestTypeID
}
func (*AccountSaveSecureValueRequest ) TypeName () string {
return "account.saveSecureValue"
}
func (s *AccountSaveSecureValueRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.saveSecureValue" ,
ID : AccountSaveSecureValueRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Value" ,
SchemaName : "value" ,
},
{
Name : "SecureSecretID" ,
SchemaName : "secure_secret_id" ,
},
}
return typ
}
func (s *AccountSaveSecureValueRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.saveSecureValue#899fe31d as nil" )
}
b .PutID (AccountSaveSecureValueRequestTypeID )
return s .EncodeBare (b )
}
func (s *AccountSaveSecureValueRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.saveSecureValue#899fe31d as nil" )
}
if err := s .Value .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.saveSecureValue#899fe31d: field value: %w" , err )
}
b .PutLong (s .SecureSecretID )
return nil
}
func (s *AccountSaveSecureValueRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.saveSecureValue#899fe31d to nil" )
}
if err := b .ConsumeID (AccountSaveSecureValueRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.saveSecureValue#899fe31d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSaveSecureValueRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.saveSecureValue#899fe31d to nil" )
}
{
if err := s .Value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.saveSecureValue#899fe31d: field value: %w" , err )
}
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.saveSecureValue#899fe31d: field secure_secret_id: %w" , err )
}
s .SecureSecretID = value
}
return nil
}
func (s *AccountSaveSecureValueRequest ) GetValue () (value InputSecureValue ) {
if s == nil {
return
}
return s .Value
}
func (s *AccountSaveSecureValueRequest ) GetSecureSecretID () (value int64 ) {
if s == nil {
return
}
return s .SecureSecretID
}
func (c *Client ) AccountSaveSecureValue (ctx context .Context , request *AccountSaveSecureValueRequest ) (*SecureValue , error ) {
var result SecureValue
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .