Files
mautrix-telegram/pkg/gotd/tg/tl_star_gift_background_gen.go
T
2026-03-03 15:13:10 +02:00

216 lines
4.8 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{}
)
// StarGiftBackground represents TL type `starGiftBackground#aff56398`.
//
// See https://core.telegram.org/constructor/starGiftBackground for reference.
type StarGiftBackground struct {
// CenterColor field of StarGiftBackground.
CenterColor int
// EdgeColor field of StarGiftBackground.
EdgeColor int
// TextColor field of StarGiftBackground.
TextColor int
}
// StarGiftBackgroundTypeID is TL type id of StarGiftBackground.
const StarGiftBackgroundTypeID = 0xaff56398
// Ensuring interfaces in compile-time for StarGiftBackground.
var (
_ bin.Encoder = &StarGiftBackground{}
_ bin.Decoder = &StarGiftBackground{}
_ bin.BareEncoder = &StarGiftBackground{}
_ bin.BareDecoder = &StarGiftBackground{}
)
func (s *StarGiftBackground) Zero() bool {
if s == nil {
return true
}
if !(s.CenterColor == 0) {
return false
}
if !(s.EdgeColor == 0) {
return false
}
if !(s.TextColor == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (s *StarGiftBackground) String() string {
if s == nil {
return "StarGiftBackground(nil)"
}
type Alias StarGiftBackground
return fmt.Sprintf("StarGiftBackground%+v", Alias(*s))
}
// FillFrom fills StarGiftBackground from given interface.
func (s *StarGiftBackground) FillFrom(from interface {
GetCenterColor() (value int)
GetEdgeColor() (value int)
GetTextColor() (value int)
}) {
s.CenterColor = from.GetCenterColor()
s.EdgeColor = from.GetEdgeColor()
s.TextColor = from.GetTextColor()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*StarGiftBackground) TypeID() uint32 {
return StarGiftBackgroundTypeID
}
// TypeName returns name of type in TL schema.
func (*StarGiftBackground) TypeName() string {
return "starGiftBackground"
}
// TypeInfo returns info about TL type.
func (s *StarGiftBackground) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "starGiftBackground",
ID: StarGiftBackgroundTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "CenterColor",
SchemaName: "center_color",
},
{
Name: "EdgeColor",
SchemaName: "edge_color",
},
{
Name: "TextColor",
SchemaName: "text_color",
},
}
return typ
}
// Encode implements bin.Encoder.
func (s *StarGiftBackground) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil")
}
b.PutID(StarGiftBackgroundTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *StarGiftBackground) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil")
}
b.PutInt(s.CenterColor)
b.PutInt(s.EdgeColor)
b.PutInt(s.TextColor)
return nil
}
// Decode implements bin.Decoder.
func (s *StarGiftBackground) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil")
}
if err := b.ConsumeID(StarGiftBackgroundTypeID); err != nil {
return fmt.Errorf("unable to decode starGiftBackground#aff56398: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *StarGiftBackground) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil")
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode starGiftBackground#aff56398: field center_color: %w", err)
}
s.CenterColor = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode starGiftBackground#aff56398: field edge_color: %w", err)
}
s.EdgeColor = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode starGiftBackground#aff56398: field text_color: %w", err)
}
s.TextColor = value
}
return nil
}
// GetCenterColor returns value of CenterColor field.
func (s *StarGiftBackground) GetCenterColor() (value int) {
if s == nil {
return
}
return s.CenterColor
}
// GetEdgeColor returns value of EdgeColor field.
func (s *StarGiftBackground) GetEdgeColor() (value int) {
if s == nil {
return
}
return s.EdgeColor
}
// GetTextColor returns value of TextColor field.
func (s *StarGiftBackground) GetTextColor() (value int) {
if s == nil {
return
}
return s.TextColor
}