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 AccountAutoDownloadSettings struct {
Low AutoDownloadSettings
Medium AutoDownloadSettings
High AutoDownloadSettings
}
const AccountAutoDownloadSettingsTypeID = 0x63cacf26
var (
_ bin .Encoder = &AccountAutoDownloadSettings {}
_ bin .Decoder = &AccountAutoDownloadSettings {}
_ bin .BareEncoder = &AccountAutoDownloadSettings {}
_ bin .BareDecoder = &AccountAutoDownloadSettings {}
)
func (a *AccountAutoDownloadSettings ) Zero () bool {
if a == nil {
return true
}
if !(a .Low .Zero ()) {
return false
}
if !(a .Medium .Zero ()) {
return false
}
if !(a .High .Zero ()) {
return false
}
return true
}
func (a *AccountAutoDownloadSettings ) String () string {
if a == nil {
return "AccountAutoDownloadSettings(nil)"
}
type Alias AccountAutoDownloadSettings
return fmt .Sprintf ("AccountAutoDownloadSettings%+v" , Alias (*a ))
}
func (a *AccountAutoDownloadSettings ) FillFrom (from interface {
GetLow () (value AutoDownloadSettings )
GetMedium () (value AutoDownloadSettings )
GetHigh () (value AutoDownloadSettings )
}) {
a .Low = from .GetLow ()
a .Medium = from .GetMedium ()
a .High = from .GetHigh ()
}
func (*AccountAutoDownloadSettings ) TypeID () uint32 {
return AccountAutoDownloadSettingsTypeID
}
func (*AccountAutoDownloadSettings ) TypeName () string {
return "account.autoDownloadSettings"
}
func (a *AccountAutoDownloadSettings ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.autoDownloadSettings" ,
ID : AccountAutoDownloadSettingsTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Low" ,
SchemaName : "low" ,
},
{
Name : "Medium" ,
SchemaName : "medium" ,
},
{
Name : "High" ,
SchemaName : "high" ,
},
}
return typ
}
func (a *AccountAutoDownloadSettings ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode account.autoDownloadSettings#63cacf26 as nil" )
}
b .PutID (AccountAutoDownloadSettingsTypeID )
return a .EncodeBare (b )
}
func (a *AccountAutoDownloadSettings ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode account.autoDownloadSettings#63cacf26 as nil" )
}
if err := a .Low .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.autoDownloadSettings#63cacf26: field low: %w" , err )
}
if err := a .Medium .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.autoDownloadSettings#63cacf26: field medium: %w" , err )
}
if err := a .High .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.autoDownloadSettings#63cacf26: field high: %w" , err )
}
return nil
}
func (a *AccountAutoDownloadSettings ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode account.autoDownloadSettings#63cacf26 to nil" )
}
if err := b .ConsumeID (AccountAutoDownloadSettingsTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.autoDownloadSettings#63cacf26: %w" , err )
}
return a .DecodeBare (b )
}
func (a *AccountAutoDownloadSettings ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode account.autoDownloadSettings#63cacf26 to nil" )
}
{
if err := a .Low .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.autoDownloadSettings#63cacf26: field low: %w" , err )
}
}
{
if err := a .Medium .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.autoDownloadSettings#63cacf26: field medium: %w" , err )
}
}
{
if err := a .High .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.autoDownloadSettings#63cacf26: field high: %w" , err )
}
}
return nil
}
func (a *AccountAutoDownloadSettings ) GetLow () (value AutoDownloadSettings ) {
if a == nil {
return
}
return a .Low
}
func (a *AccountAutoDownloadSettings ) GetMedium () (value AutoDownloadSettings ) {
if a == nil {
return
}
return a .Medium
}
func (a *AccountAutoDownloadSettings ) GetHigh () (value AutoDownloadSettings ) {
if a == nil {
return
}
return a .High
}
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 .