216 lines
4.4 KiB
Go
Generated
216 lines
4.4 KiB
Go
Generated
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/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{}
|
|
)
|
|
|
|
// AuctionBidLevel represents TL type `auctionBidLevel#310240cc`.
|
|
//
|
|
// See https://core.telegram.org/constructor/auctionBidLevel for reference.
|
|
type AuctionBidLevel struct {
|
|
// Pos field of AuctionBidLevel.
|
|
Pos int
|
|
// Amount field of AuctionBidLevel.
|
|
Amount int64
|
|
// Date field of AuctionBidLevel.
|
|
Date int
|
|
}
|
|
|
|
// AuctionBidLevelTypeID is TL type id of AuctionBidLevel.
|
|
const AuctionBidLevelTypeID = 0x310240cc
|
|
|
|
// Ensuring interfaces in compile-time for AuctionBidLevel.
|
|
var (
|
|
_ bin.Encoder = &AuctionBidLevel{}
|
|
_ bin.Decoder = &AuctionBidLevel{}
|
|
_ bin.BareEncoder = &AuctionBidLevel{}
|
|
_ bin.BareDecoder = &AuctionBidLevel{}
|
|
)
|
|
|
|
func (a *AuctionBidLevel) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.Pos == 0) {
|
|
return false
|
|
}
|
|
if !(a.Amount == 0) {
|
|
return false
|
|
}
|
|
if !(a.Date == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuctionBidLevel) String() string {
|
|
if a == nil {
|
|
return "AuctionBidLevel(nil)"
|
|
}
|
|
type Alias AuctionBidLevel
|
|
return fmt.Sprintf("AuctionBidLevel%+v", Alias(*a))
|
|
}
|
|
|
|
// FillFrom fills AuctionBidLevel from given interface.
|
|
func (a *AuctionBidLevel) FillFrom(from interface {
|
|
GetPos() (value int)
|
|
GetAmount() (value int64)
|
|
GetDate() (value int)
|
|
}) {
|
|
a.Pos = from.GetPos()
|
|
a.Amount = from.GetAmount()
|
|
a.Date = from.GetDate()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuctionBidLevel) TypeID() uint32 {
|
|
return AuctionBidLevelTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuctionBidLevel) TypeName() string {
|
|
return "auctionBidLevel"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuctionBidLevel) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "auctionBidLevel",
|
|
ID: AuctionBidLevelTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pos",
|
|
SchemaName: "pos",
|
|
},
|
|
{
|
|
Name: "Amount",
|
|
SchemaName: "amount",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuctionBidLevel) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode auctionBidLevel#310240cc as nil")
|
|
}
|
|
b.PutID(AuctionBidLevelTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuctionBidLevel) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode auctionBidLevel#310240cc as nil")
|
|
}
|
|
b.PutInt(a.Pos)
|
|
b.PutLong(a.Amount)
|
|
b.PutInt(a.Date)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuctionBidLevel) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode auctionBidLevel#310240cc to nil")
|
|
}
|
|
if err := b.ConsumeID(AuctionBidLevelTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode auctionBidLevel#310240cc: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuctionBidLevel) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode auctionBidLevel#310240cc to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode auctionBidLevel#310240cc: field pos: %w", err)
|
|
}
|
|
a.Pos = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode auctionBidLevel#310240cc: field amount: %w", err)
|
|
}
|
|
a.Amount = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode auctionBidLevel#310240cc: field date: %w", err)
|
|
}
|
|
a.Date = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPos returns value of Pos field.
|
|
func (a *AuctionBidLevel) GetPos() (value int) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.Pos
|
|
}
|
|
|
|
// GetAmount returns value of Amount field.
|
|
func (a *AuctionBidLevel) GetAmount() (value int64) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.Amount
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (a *AuctionBidLevel) GetDate() (value int) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.Date
|
|
}
|