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 LangPackString struct {
Key string
Value string
}
const LangPackStringTypeID = 0xcad181f6
func (l LangPackString ) construct () LangPackStringClass { return &l }
var (
_ bin .Encoder = &LangPackString {}
_ bin .Decoder = &LangPackString {}
_ bin .BareEncoder = &LangPackString {}
_ bin .BareDecoder = &LangPackString {}
_ LangPackStringClass = &LangPackString {}
)
func (l *LangPackString ) Zero () bool {
if l == nil {
return true
}
if !(l .Key == "" ) {
return false
}
if !(l .Value == "" ) {
return false
}
return true
}
func (l *LangPackString ) String () string {
if l == nil {
return "LangPackString(nil)"
}
type Alias LangPackString
return fmt .Sprintf ("LangPackString%+v" , Alias (*l ))
}
func (l *LangPackString ) FillFrom (from interface {
GetKey () (value string )
GetValue () (value string )
}) {
l .Key = from .GetKey ()
l .Value = from .GetValue ()
}
func (*LangPackString ) TypeID () uint32 {
return LangPackStringTypeID
}
func (*LangPackString ) TypeName () string {
return "langPackString"
}
func (l *LangPackString ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "langPackString" ,
ID : LangPackStringTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Key" ,
SchemaName : "key" ,
},
{
Name : "Value" ,
SchemaName : "value" ,
},
}
return typ
}
func (l *LangPackString ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode langPackString#cad181f6 as nil" )
}
b .PutID (LangPackStringTypeID )
return l .EncodeBare (b )
}
func (l *LangPackString ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode langPackString#cad181f6 as nil" )
}
b .PutString (l .Key )
b .PutString (l .Value )
return nil
}
func (l *LangPackString ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode langPackString#cad181f6 to nil" )
}
if err := b .ConsumeID (LangPackStringTypeID ); err != nil {
return fmt .Errorf ("unable to decode langPackString#cad181f6: %w" , err )
}
return l .DecodeBare (b )
}
func (l *LangPackString ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode langPackString#cad181f6 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackString#cad181f6: field key: %w" , err )
}
l .Key = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackString#cad181f6: field value: %w" , err )
}
l .Value = value
}
return nil
}
func (l *LangPackString ) GetKey () (value string ) {
if l == nil {
return
}
return l .Key
}
func (l *LangPackString ) GetValue () (value string ) {
if l == nil {
return
}
return l .Value
}
type LangPackStringPluralized struct {
Flags bin .Fields
Key string
ZeroValue string
OneValue string
TwoValue string
FewValue string
ManyValue string
OtherValue string
}
const LangPackStringPluralizedTypeID = 0x6c47ac9f
func (l LangPackStringPluralized ) construct () LangPackStringClass { return &l }
var (
_ bin .Encoder = &LangPackStringPluralized {}
_ bin .Decoder = &LangPackStringPluralized {}
_ bin .BareEncoder = &LangPackStringPluralized {}
_ bin .BareDecoder = &LangPackStringPluralized {}
_ LangPackStringClass = &LangPackStringPluralized {}
)
func (l *LangPackStringPluralized ) Zero () bool {
if l == nil {
return true
}
if !(l .Flags .Zero ()) {
return false
}
if !(l .Key == "" ) {
return false
}
if !(l .ZeroValue == "" ) {
return false
}
if !(l .OneValue == "" ) {
return false
}
if !(l .TwoValue == "" ) {
return false
}
if !(l .FewValue == "" ) {
return false
}
if !(l .ManyValue == "" ) {
return false
}
if !(l .OtherValue == "" ) {
return false
}
return true
}
func (l *LangPackStringPluralized ) String () string {
if l == nil {
return "LangPackStringPluralized(nil)"
}
type Alias LangPackStringPluralized
return fmt .Sprintf ("LangPackStringPluralized%+v" , Alias (*l ))
}
func (l *LangPackStringPluralized ) FillFrom (from interface {
GetKey () (value string )
GetZeroValue () (value string , ok bool )
GetOneValue () (value string , ok bool )
GetTwoValue () (value string , ok bool )
GetFewValue () (value string , ok bool )
GetManyValue () (value string , ok bool )
GetOtherValue () (value string )
}) {
l .Key = from .GetKey ()
if val , ok := from .GetZeroValue (); ok {
l .ZeroValue = val
}
if val , ok := from .GetOneValue (); ok {
l .OneValue = val
}
if val , ok := from .GetTwoValue (); ok {
l .TwoValue = val
}
if val , ok := from .GetFewValue (); ok {
l .FewValue = val
}
if val , ok := from .GetManyValue (); ok {
l .ManyValue = val
}
l .OtherValue = from .GetOtherValue ()
}
func (*LangPackStringPluralized ) TypeID () uint32 {
return LangPackStringPluralizedTypeID
}
func (*LangPackStringPluralized ) TypeName () string {
return "langPackStringPluralized"
}
func (l *LangPackStringPluralized ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "langPackStringPluralized" ,
ID : LangPackStringPluralizedTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Key" ,
SchemaName : "key" ,
},
{
Name : "ZeroValue" ,
SchemaName : "zero_value" ,
Null : !l .Flags .Has (0 ),
},
{
Name : "OneValue" ,
SchemaName : "one_value" ,
Null : !l .Flags .Has (1 ),
},
{
Name : "TwoValue" ,
SchemaName : "two_value" ,
Null : !l .Flags .Has (2 ),
},
{
Name : "FewValue" ,
SchemaName : "few_value" ,
Null : !l .Flags .Has (3 ),
},
{
Name : "ManyValue" ,
SchemaName : "many_value" ,
Null : !l .Flags .Has (4 ),
},
{
Name : "OtherValue" ,
SchemaName : "other_value" ,
},
}
return typ
}
func (l *LangPackStringPluralized ) SetFlags () {
if !(l .ZeroValue == "" ) {
l .Flags .Set (0 )
}
if !(l .OneValue == "" ) {
l .Flags .Set (1 )
}
if !(l .TwoValue == "" ) {
l .Flags .Set (2 )
}
if !(l .FewValue == "" ) {
l .Flags .Set (3 )
}
if !(l .ManyValue == "" ) {
l .Flags .Set (4 )
}
}
func (l *LangPackStringPluralized ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode langPackStringPluralized#6c47ac9f as nil" )
}
b .PutID (LangPackStringPluralizedTypeID )
return l .EncodeBare (b )
}
func (l *LangPackStringPluralized ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode langPackStringPluralized#6c47ac9f as nil" )
}
l .SetFlags ()
if err := l .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode langPackStringPluralized#6c47ac9f: field flags: %w" , err )
}
b .PutString (l .Key )
if l .Flags .Has (0 ) {
b .PutString (l .ZeroValue )
}
if l .Flags .Has (1 ) {
b .PutString (l .OneValue )
}
if l .Flags .Has (2 ) {
b .PutString (l .TwoValue )
}
if l .Flags .Has (3 ) {
b .PutString (l .FewValue )
}
if l .Flags .Has (4 ) {
b .PutString (l .ManyValue )
}
b .PutString (l .OtherValue )
return nil
}
func (l *LangPackStringPluralized ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode langPackStringPluralized#6c47ac9f to nil" )
}
if err := b .ConsumeID (LangPackStringPluralizedTypeID ); err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: %w" , err )
}
return l .DecodeBare (b )
}
func (l *LangPackStringPluralized ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode langPackStringPluralized#6c47ac9f to nil" )
}
{
if err := l .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field key: %w" , err )
}
l .Key = value
}
if l .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field zero_value: %w" , err )
}
l .ZeroValue = value
}
if l .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field one_value: %w" , err )
}
l .OneValue = value
}
if l .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field two_value: %w" , err )
}
l .TwoValue = value
}
if l .Flags .Has (3 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field few_value: %w" , err )
}
l .FewValue = value
}
if l .Flags .Has (4 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field many_value: %w" , err )
}
l .ManyValue = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringPluralized#6c47ac9f: field other_value: %w" , err )
}
l .OtherValue = value
}
return nil
}
func (l *LangPackStringPluralized ) GetKey () (value string ) {
if l == nil {
return
}
return l .Key
}
func (l *LangPackStringPluralized ) SetZeroValue (value string ) {
l .Flags .Set (0 )
l .ZeroValue = value
}
func (l *LangPackStringPluralized ) GetZeroValue () (value string , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (0 ) {
return value , false
}
return l .ZeroValue , true
}
func (l *LangPackStringPluralized ) SetOneValue (value string ) {
l .Flags .Set (1 )
l .OneValue = value
}
func (l *LangPackStringPluralized ) GetOneValue () (value string , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (1 ) {
return value , false
}
return l .OneValue , true
}
func (l *LangPackStringPluralized ) SetTwoValue (value string ) {
l .Flags .Set (2 )
l .TwoValue = value
}
func (l *LangPackStringPluralized ) GetTwoValue () (value string , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (2 ) {
return value , false
}
return l .TwoValue , true
}
func (l *LangPackStringPluralized ) SetFewValue (value string ) {
l .Flags .Set (3 )
l .FewValue = value
}
func (l *LangPackStringPluralized ) GetFewValue () (value string , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (3 ) {
return value , false
}
return l .FewValue , true
}
func (l *LangPackStringPluralized ) SetManyValue (value string ) {
l .Flags .Set (4 )
l .ManyValue = value
}
func (l *LangPackStringPluralized ) GetManyValue () (value string , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (4 ) {
return value , false
}
return l .ManyValue , true
}
func (l *LangPackStringPluralized ) GetOtherValue () (value string ) {
if l == nil {
return
}
return l .OtherValue
}
type LangPackStringDeleted struct {
Key string
}
const LangPackStringDeletedTypeID = 0x2979eeb2
func (l LangPackStringDeleted ) construct () LangPackStringClass { return &l }
var (
_ bin .Encoder = &LangPackStringDeleted {}
_ bin .Decoder = &LangPackStringDeleted {}
_ bin .BareEncoder = &LangPackStringDeleted {}
_ bin .BareDecoder = &LangPackStringDeleted {}
_ LangPackStringClass = &LangPackStringDeleted {}
)
func (l *LangPackStringDeleted ) Zero () bool {
if l == nil {
return true
}
if !(l .Key == "" ) {
return false
}
return true
}
func (l *LangPackStringDeleted ) String () string {
if l == nil {
return "LangPackStringDeleted(nil)"
}
type Alias LangPackStringDeleted
return fmt .Sprintf ("LangPackStringDeleted%+v" , Alias (*l ))
}
func (l *LangPackStringDeleted ) FillFrom (from interface {
GetKey () (value string )
}) {
l .Key = from .GetKey ()
}
func (*LangPackStringDeleted ) TypeID () uint32 {
return LangPackStringDeletedTypeID
}
func (*LangPackStringDeleted ) TypeName () string {
return "langPackStringDeleted"
}
func (l *LangPackStringDeleted ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "langPackStringDeleted" ,
ID : LangPackStringDeletedTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Key" ,
SchemaName : "key" ,
},
}
return typ
}
func (l *LangPackStringDeleted ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode langPackStringDeleted#2979eeb2 as nil" )
}
b .PutID (LangPackStringDeletedTypeID )
return l .EncodeBare (b )
}
func (l *LangPackStringDeleted ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode langPackStringDeleted#2979eeb2 as nil" )
}
b .PutString (l .Key )
return nil
}
func (l *LangPackStringDeleted ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode langPackStringDeleted#2979eeb2 to nil" )
}
if err := b .ConsumeID (LangPackStringDeletedTypeID ); err != nil {
return fmt .Errorf ("unable to decode langPackStringDeleted#2979eeb2: %w" , err )
}
return l .DecodeBare (b )
}
func (l *LangPackStringDeleted ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode langPackStringDeleted#2979eeb2 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langPackStringDeleted#2979eeb2: field key: %w" , err )
}
l .Key = value
}
return nil
}
func (l *LangPackStringDeleted ) GetKey () (value string ) {
if l == nil {
return
}
return l .Key
}
const LangPackStringClassName = "LangPackString"
type LangPackStringClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () LangPackStringClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetKey () (value string )
}
func DecodeLangPackString (buf *bin .Buffer ) (LangPackStringClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case LangPackStringTypeID :
v := LangPackString {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode LangPackStringClass: %w" , err )
}
return &v , nil
case LangPackStringPluralizedTypeID :
v := LangPackStringPluralized {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode LangPackStringClass: %w" , err )
}
return &v , nil
case LangPackStringDeletedTypeID :
v := LangPackStringDeleted {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode LangPackStringClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode LangPackStringClass: %w" , bin .NewUnexpectedID (id ))
}
}
type LangPackStringBox struct {
LangPackString LangPackStringClass
}
func (b *LangPackStringBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode LangPackStringBox to nil" )
}
v , err := DecodeLangPackString (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .LangPackString = v
return nil
}
func (b *LangPackStringBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .LangPackString == nil {
return fmt .Errorf ("unable to encode LangPackStringClass as nil" )
}
return b .LangPackString .Encode (buf )
}
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 .