You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
2.5 KiB
133 lines
2.5 KiB
3 years ago
|
// Code generated by gotdgen, DO NOT EDIT.
|
||
|
|
||
|
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"
|
||
|
)
|
||
|
|
||
|
// No-op definition for keeping imports.
|
||
|
var (
|
||
|
_ = bin.Buffer{}
|
||
|
_ = context.Background()
|
||
|
_ = fmt.Stringer(nil)
|
||
|
_ = strings.Builder{}
|
||
|
_ = errors.Is
|
||
|
_ = multierr.AppendInto
|
||
|
_ = sort.Ints
|
||
|
_ = tdp.Format
|
||
|
_ = tgerr.Error{}
|
||
|
_ = tdjson.Encoder{}
|
||
|
)
|
||
|
|
||
|
// True represents TL type `true#3fedd339`.
|
||
|
// See predefined identifiers¹.
|
||
|
//
|
||
|
// Links:
|
||
|
// 1) https://core.telegram.org/mtproto/TL-formal#predefined-identifiers
|
||
|
//
|
||
|
// See https://core.telegram.org/constructor/true for reference.
|
||
|
type True struct {
|
||
|
}
|
||
|
|
||
|
// TrueTypeID is TL type id of True.
|
||
|
const TrueTypeID = 0x3fedd339
|
||
|
|
||
|
// Ensuring interfaces in compile-time for True.
|
||
|
var (
|
||
|
_ bin.Encoder = &True{}
|
||
|
_ bin.Decoder = &True{}
|
||
|
_ bin.BareEncoder = &True{}
|
||
|
_ bin.BareDecoder = &True{}
|
||
|
)
|
||
|
|
||
|
func (t *True) Zero() bool {
|
||
|
if t == nil {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// String implements fmt.Stringer.
|
||
|
func (t *True) String() string {
|
||
|
if t == nil {
|
||
|
return "True(nil)"
|
||
|
}
|
||
|
type Alias True
|
||
|
return fmt.Sprintf("True%+v", Alias(*t))
|
||
|
}
|
||
|
|
||
|
// TypeID returns type id in TL schema.
|
||
|
//
|
||
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||
|
func (*True) TypeID() uint32 {
|
||
|
return TrueTypeID
|
||
|
}
|
||
|
|
||
|
// TypeName returns name of type in TL schema.
|
||
|
func (*True) TypeName() string {
|
||
|
return "true"
|
||
|
}
|
||
|
|
||
|
// TypeInfo returns info about TL type.
|
||
|
func (t *True) TypeInfo() tdp.Type {
|
||
|
typ := tdp.Type{
|
||
|
Name: "true",
|
||
|
ID: TrueTypeID,
|
||
|
}
|
||
|
if t == nil {
|
||
|
typ.Null = true
|
||
|
return typ
|
||
|
}
|
||
|
typ.Fields = []tdp.Field{}
|
||
|
return typ
|
||
|
}
|
||
|
|
||
|
// Encode implements bin.Encoder.
|
||
|
func (t *True) Encode(b *bin.Buffer) error {
|
||
|
if t == nil {
|
||
|
return fmt.Errorf("can't encode true#3fedd339 as nil")
|
||
|
}
|
||
|
b.PutID(TrueTypeID)
|
||
|
return t.EncodeBare(b)
|
||
|
}
|
||
|
|
||
|
// EncodeBare implements bin.BareEncoder.
|
||
|
func (t *True) EncodeBare(b *bin.Buffer) error {
|
||
|
if t == nil {
|
||
|
return fmt.Errorf("can't encode true#3fedd339 as nil")
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Decode implements bin.Decoder.
|
||
|
func (t *True) Decode(b *bin.Buffer) error {
|
||
|
if t == nil {
|
||
|
return fmt.Errorf("can't decode true#3fedd339 to nil")
|
||
|
}
|
||
|
if err := b.ConsumeID(TrueTypeID); err != nil {
|
||
|
return fmt.Errorf("unable to decode true#3fedd339: %w", err)
|
||
|
}
|
||
|
return t.DecodeBare(b)
|
||
|
}
|
||
|
|
||
|
// DecodeBare implements bin.BareDecoder.
|
||
|
func (t *True) DecodeBare(b *bin.Buffer) error {
|
||
|
if t == nil {
|
||
|
return fmt.Errorf("can't decode true#3fedd339 to nil")
|
||
|
}
|
||
|
return nil
|
||
|
}
|