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 UsersSetSecureValueErrorsRequest struct {
ID InputUserClass
Errors []SecureValueErrorClass
}
const UsersSetSecureValueErrorsRequestTypeID = 0x90c894b5
var (
_ bin .Encoder = &UsersSetSecureValueErrorsRequest {}
_ bin .Decoder = &UsersSetSecureValueErrorsRequest {}
_ bin .BareEncoder = &UsersSetSecureValueErrorsRequest {}
_ bin .BareDecoder = &UsersSetSecureValueErrorsRequest {}
)
func (s *UsersSetSecureValueErrorsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .ID == nil ) {
return false
}
if !(s .Errors == nil ) {
return false
}
return true
}
func (s *UsersSetSecureValueErrorsRequest ) String () string {
if s == nil {
return "UsersSetSecureValueErrorsRequest(nil)"
}
type Alias UsersSetSecureValueErrorsRequest
return fmt .Sprintf ("UsersSetSecureValueErrorsRequest%+v" , Alias (*s ))
}
func (s *UsersSetSecureValueErrorsRequest ) FillFrom (from interface {
GetID () (value InputUserClass )
GetErrors () (value []SecureValueErrorClass )
}) {
s .ID = from .GetID ()
s .Errors = from .GetErrors ()
}
func (*UsersSetSecureValueErrorsRequest ) TypeID () uint32 {
return UsersSetSecureValueErrorsRequestTypeID
}
func (*UsersSetSecureValueErrorsRequest ) TypeName () string {
return "users.setSecureValueErrors"
}
func (s *UsersSetSecureValueErrorsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "users.setSecureValueErrors" ,
ID : UsersSetSecureValueErrorsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Errors" ,
SchemaName : "errors" ,
},
}
return typ
}
func (s *UsersSetSecureValueErrorsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode users.setSecureValueErrors#90c894b5 as nil" )
}
b .PutID (UsersSetSecureValueErrorsRequestTypeID )
return s .EncodeBare (b )
}
func (s *UsersSetSecureValueErrorsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode users.setSecureValueErrors#90c894b5 as nil" )
}
if s .ID == nil {
return fmt .Errorf ("unable to encode users.setSecureValueErrors#90c894b5: field id is nil" )
}
if err := s .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode users.setSecureValueErrors#90c894b5: field id: %w" , err )
}
b .PutVectorHeader (len (s .Errors ))
for idx , v := range s .Errors {
if v == nil {
return fmt .Errorf ("unable to encode users.setSecureValueErrors#90c894b5: field errors element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode users.setSecureValueErrors#90c894b5: field errors element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *UsersSetSecureValueErrorsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode users.setSecureValueErrors#90c894b5 to nil" )
}
if err := b .ConsumeID (UsersSetSecureValueErrorsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode users.setSecureValueErrors#90c894b5: %w" , err )
}
return s .DecodeBare (b )
}
func (s *UsersSetSecureValueErrorsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode users.setSecureValueErrors#90c894b5 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode users.setSecureValueErrors#90c894b5: field id: %w" , err )
}
s .ID = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode users.setSecureValueErrors#90c894b5: field errors: %w" , err )
}
if headerLen > 0 {
s .Errors = make ([]SecureValueErrorClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeSecureValueError (b )
if err != nil {
return fmt .Errorf ("unable to decode users.setSecureValueErrors#90c894b5: field errors: %w" , err )
}
s .Errors = append (s .Errors , value )
}
}
return nil
}
func (s *UsersSetSecureValueErrorsRequest ) GetID () (value InputUserClass ) {
if s == nil {
return
}
return s .ID
}
func (s *UsersSetSecureValueErrorsRequest ) GetErrors () (value []SecureValueErrorClass ) {
if s == nil {
return
}
return s .Errors
}
func (s *UsersSetSecureValueErrorsRequest ) MapErrors () (value SecureValueErrorClassArray ) {
return SecureValueErrorClassArray (s .Errors )
}
func (c *Client ) UsersSetSecureValueErrors (ctx context .Context , request *UsersSetSecureValueErrorsRequest ) (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 .