Files
mautrix-telegram/pkg/gotd/tdapi/tl_giveaway_participant_status_gen.go
T
2025-06-27 20:03:37 -07:00

979 lines
31 KiB
Go

// Code generated by gotdgen, DO NOT EDIT.
package tdapi
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{}
)
// GiveawayParticipantStatusEligible represents TL type `giveawayParticipantStatusEligible#122ade97`.
type GiveawayParticipantStatusEligible struct {
}
// GiveawayParticipantStatusEligibleTypeID is TL type id of GiveawayParticipantStatusEligible.
const GiveawayParticipantStatusEligibleTypeID = 0x122ade97
// construct implements constructor of GiveawayParticipantStatusClass.
func (g GiveawayParticipantStatusEligible) construct() GiveawayParticipantStatusClass { return &g }
// Ensuring interfaces in compile-time for GiveawayParticipantStatusEligible.
var (
_ bin.Encoder = &GiveawayParticipantStatusEligible{}
_ bin.Decoder = &GiveawayParticipantStatusEligible{}
_ bin.BareEncoder = &GiveawayParticipantStatusEligible{}
_ bin.BareDecoder = &GiveawayParticipantStatusEligible{}
_ GiveawayParticipantStatusClass = &GiveawayParticipantStatusEligible{}
)
func (g *GiveawayParticipantStatusEligible) Zero() bool {
if g == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (g *GiveawayParticipantStatusEligible) String() string {
if g == nil {
return "GiveawayParticipantStatusEligible(nil)"
}
type Alias GiveawayParticipantStatusEligible
return fmt.Sprintf("GiveawayParticipantStatusEligible%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GiveawayParticipantStatusEligible) TypeID() uint32 {
return GiveawayParticipantStatusEligibleTypeID
}
// TypeName returns name of type in TL schema.
func (*GiveawayParticipantStatusEligible) TypeName() string {
return "giveawayParticipantStatusEligible"
}
// TypeInfo returns info about TL type.
func (g *GiveawayParticipantStatusEligible) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "giveawayParticipantStatusEligible",
ID: GiveawayParticipantStatusEligibleTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (g *GiveawayParticipantStatusEligible) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil")
}
b.PutID(GiveawayParticipantStatusEligibleTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GiveawayParticipantStatusEligible) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (g *GiveawayParticipantStatusEligible) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil")
}
if err := b.ConsumeID(GiveawayParticipantStatusEligibleTypeID); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusEligible#122ade97: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GiveawayParticipantStatusEligible) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GiveawayParticipantStatusEligible) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil")
}
b.ObjStart()
b.PutID("giveawayParticipantStatusEligible")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GiveawayParticipantStatusEligible) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("giveawayParticipantStatusEligible"); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusEligible#122ade97: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// GiveawayParticipantStatusParticipating represents TL type `giveawayParticipantStatusParticipating#1d53e36f`.
type GiveawayParticipantStatusParticipating struct {
}
// GiveawayParticipantStatusParticipatingTypeID is TL type id of GiveawayParticipantStatusParticipating.
const GiveawayParticipantStatusParticipatingTypeID = 0x1d53e36f
// construct implements constructor of GiveawayParticipantStatusClass.
func (g GiveawayParticipantStatusParticipating) construct() GiveawayParticipantStatusClass { return &g }
// Ensuring interfaces in compile-time for GiveawayParticipantStatusParticipating.
var (
_ bin.Encoder = &GiveawayParticipantStatusParticipating{}
_ bin.Decoder = &GiveawayParticipantStatusParticipating{}
_ bin.BareEncoder = &GiveawayParticipantStatusParticipating{}
_ bin.BareDecoder = &GiveawayParticipantStatusParticipating{}
_ GiveawayParticipantStatusClass = &GiveawayParticipantStatusParticipating{}
)
func (g *GiveawayParticipantStatusParticipating) Zero() bool {
if g == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (g *GiveawayParticipantStatusParticipating) String() string {
if g == nil {
return "GiveawayParticipantStatusParticipating(nil)"
}
type Alias GiveawayParticipantStatusParticipating
return fmt.Sprintf("GiveawayParticipantStatusParticipating%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GiveawayParticipantStatusParticipating) TypeID() uint32 {
return GiveawayParticipantStatusParticipatingTypeID
}
// TypeName returns name of type in TL schema.
func (*GiveawayParticipantStatusParticipating) TypeName() string {
return "giveawayParticipantStatusParticipating"
}
// TypeInfo returns info about TL type.
func (g *GiveawayParticipantStatusParticipating) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "giveawayParticipantStatusParticipating",
ID: GiveawayParticipantStatusParticipatingTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (g *GiveawayParticipantStatusParticipating) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil")
}
b.PutID(GiveawayParticipantStatusParticipatingTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GiveawayParticipantStatusParticipating) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (g *GiveawayParticipantStatusParticipating) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil")
}
if err := b.ConsumeID(GiveawayParticipantStatusParticipatingTypeID); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusParticipating#1d53e36f: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GiveawayParticipantStatusParticipating) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GiveawayParticipantStatusParticipating) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil")
}
b.ObjStart()
b.PutID("giveawayParticipantStatusParticipating")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GiveawayParticipantStatusParticipating) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("giveawayParticipantStatusParticipating"); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusParticipating#1d53e36f: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// GiveawayParticipantStatusAlreadyWasMember represents TL type `giveawayParticipantStatusAlreadyWasMember#11f9b5a0`.
type GiveawayParticipantStatusAlreadyWasMember struct {
// Point in time (Unix timestamp) when the user joined the chat
JoinedChatDate int32
}
// GiveawayParticipantStatusAlreadyWasMemberTypeID is TL type id of GiveawayParticipantStatusAlreadyWasMember.
const GiveawayParticipantStatusAlreadyWasMemberTypeID = 0x11f9b5a0
// construct implements constructor of GiveawayParticipantStatusClass.
func (g GiveawayParticipantStatusAlreadyWasMember) construct() GiveawayParticipantStatusClass {
return &g
}
// Ensuring interfaces in compile-time for GiveawayParticipantStatusAlreadyWasMember.
var (
_ bin.Encoder = &GiveawayParticipantStatusAlreadyWasMember{}
_ bin.Decoder = &GiveawayParticipantStatusAlreadyWasMember{}
_ bin.BareEncoder = &GiveawayParticipantStatusAlreadyWasMember{}
_ bin.BareDecoder = &GiveawayParticipantStatusAlreadyWasMember{}
_ GiveawayParticipantStatusClass = &GiveawayParticipantStatusAlreadyWasMember{}
)
func (g *GiveawayParticipantStatusAlreadyWasMember) Zero() bool {
if g == nil {
return true
}
if !(g.JoinedChatDate == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (g *GiveawayParticipantStatusAlreadyWasMember) String() string {
if g == nil {
return "GiveawayParticipantStatusAlreadyWasMember(nil)"
}
type Alias GiveawayParticipantStatusAlreadyWasMember
return fmt.Sprintf("GiveawayParticipantStatusAlreadyWasMember%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GiveawayParticipantStatusAlreadyWasMember) TypeID() uint32 {
return GiveawayParticipantStatusAlreadyWasMemberTypeID
}
// TypeName returns name of type in TL schema.
func (*GiveawayParticipantStatusAlreadyWasMember) TypeName() string {
return "giveawayParticipantStatusAlreadyWasMember"
}
// TypeInfo returns info about TL type.
func (g *GiveawayParticipantStatusAlreadyWasMember) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "giveawayParticipantStatusAlreadyWasMember",
ID: GiveawayParticipantStatusAlreadyWasMemberTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "JoinedChatDate",
SchemaName: "joined_chat_date",
},
}
return typ
}
// Encode implements bin.Encoder.
func (g *GiveawayParticipantStatusAlreadyWasMember) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil")
}
b.PutID(GiveawayParticipantStatusAlreadyWasMemberTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GiveawayParticipantStatusAlreadyWasMember) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil")
}
b.PutInt32(g.JoinedChatDate)
return nil
}
// Decode implements bin.Decoder.
func (g *GiveawayParticipantStatusAlreadyWasMember) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil")
}
if err := b.ConsumeID(GiveawayParticipantStatusAlreadyWasMemberTypeID); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GiveawayParticipantStatusAlreadyWasMember) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil")
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: field joined_chat_date: %w", err)
}
g.JoinedChatDate = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GiveawayParticipantStatusAlreadyWasMember) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil")
}
b.ObjStart()
b.PutID("giveawayParticipantStatusAlreadyWasMember")
b.Comma()
b.FieldStart("joined_chat_date")
b.PutInt32(g.JoinedChatDate)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GiveawayParticipantStatusAlreadyWasMember) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("giveawayParticipantStatusAlreadyWasMember"); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: %w", err)
}
case "joined_chat_date":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: field joined_chat_date: %w", err)
}
g.JoinedChatDate = value
default:
return b.Skip()
}
return nil
})
}
// GetJoinedChatDate returns value of JoinedChatDate field.
func (g *GiveawayParticipantStatusAlreadyWasMember) GetJoinedChatDate() (value int32) {
if g == nil {
return
}
return g.JoinedChatDate
}
// GiveawayParticipantStatusAdministrator represents TL type `giveawayParticipantStatusAdministrator#c84b3a75`.
type GiveawayParticipantStatusAdministrator struct {
// Identifier of the chat administered by the user
ChatID int64
}
// GiveawayParticipantStatusAdministratorTypeID is TL type id of GiveawayParticipantStatusAdministrator.
const GiveawayParticipantStatusAdministratorTypeID = 0xc84b3a75
// construct implements constructor of GiveawayParticipantStatusClass.
func (g GiveawayParticipantStatusAdministrator) construct() GiveawayParticipantStatusClass { return &g }
// Ensuring interfaces in compile-time for GiveawayParticipantStatusAdministrator.
var (
_ bin.Encoder = &GiveawayParticipantStatusAdministrator{}
_ bin.Decoder = &GiveawayParticipantStatusAdministrator{}
_ bin.BareEncoder = &GiveawayParticipantStatusAdministrator{}
_ bin.BareDecoder = &GiveawayParticipantStatusAdministrator{}
_ GiveawayParticipantStatusClass = &GiveawayParticipantStatusAdministrator{}
)
func (g *GiveawayParticipantStatusAdministrator) Zero() bool {
if g == nil {
return true
}
if !(g.ChatID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (g *GiveawayParticipantStatusAdministrator) String() string {
if g == nil {
return "GiveawayParticipantStatusAdministrator(nil)"
}
type Alias GiveawayParticipantStatusAdministrator
return fmt.Sprintf("GiveawayParticipantStatusAdministrator%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GiveawayParticipantStatusAdministrator) TypeID() uint32 {
return GiveawayParticipantStatusAdministratorTypeID
}
// TypeName returns name of type in TL schema.
func (*GiveawayParticipantStatusAdministrator) TypeName() string {
return "giveawayParticipantStatusAdministrator"
}
// TypeInfo returns info about TL type.
func (g *GiveawayParticipantStatusAdministrator) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "giveawayParticipantStatusAdministrator",
ID: GiveawayParticipantStatusAdministratorTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ChatID",
SchemaName: "chat_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (g *GiveawayParticipantStatusAdministrator) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil")
}
b.PutID(GiveawayParticipantStatusAdministratorTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GiveawayParticipantStatusAdministrator) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil")
}
b.PutInt53(g.ChatID)
return nil
}
// Decode implements bin.Decoder.
func (g *GiveawayParticipantStatusAdministrator) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil")
}
if err := b.ConsumeID(GiveawayParticipantStatusAdministratorTypeID); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GiveawayParticipantStatusAdministrator) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil")
}
{
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: field chat_id: %w", err)
}
g.ChatID = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GiveawayParticipantStatusAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil")
}
b.ObjStart()
b.PutID("giveawayParticipantStatusAdministrator")
b.Comma()
b.FieldStart("chat_id")
b.PutInt53(g.ChatID)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GiveawayParticipantStatusAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("giveawayParticipantStatusAdministrator"); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: %w", err)
}
case "chat_id":
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: field chat_id: %w", err)
}
g.ChatID = value
default:
return b.Skip()
}
return nil
})
}
// GetChatID returns value of ChatID field.
func (g *GiveawayParticipantStatusAdministrator) GetChatID() (value int64) {
if g == nil {
return
}
return g.ChatID
}
// GiveawayParticipantStatusDisallowedCountry represents TL type `giveawayParticipantStatusDisallowedCountry#700b645b`.
type GiveawayParticipantStatusDisallowedCountry struct {
// A two-letter ISO 3166-1 alpha-2 country code of the user's country
UserCountryCode string
}
// GiveawayParticipantStatusDisallowedCountryTypeID is TL type id of GiveawayParticipantStatusDisallowedCountry.
const GiveawayParticipantStatusDisallowedCountryTypeID = 0x700b645b
// construct implements constructor of GiveawayParticipantStatusClass.
func (g GiveawayParticipantStatusDisallowedCountry) construct() GiveawayParticipantStatusClass {
return &g
}
// Ensuring interfaces in compile-time for GiveawayParticipantStatusDisallowedCountry.
var (
_ bin.Encoder = &GiveawayParticipantStatusDisallowedCountry{}
_ bin.Decoder = &GiveawayParticipantStatusDisallowedCountry{}
_ bin.BareEncoder = &GiveawayParticipantStatusDisallowedCountry{}
_ bin.BareDecoder = &GiveawayParticipantStatusDisallowedCountry{}
_ GiveawayParticipantStatusClass = &GiveawayParticipantStatusDisallowedCountry{}
)
func (g *GiveawayParticipantStatusDisallowedCountry) Zero() bool {
if g == nil {
return true
}
if !(g.UserCountryCode == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (g *GiveawayParticipantStatusDisallowedCountry) String() string {
if g == nil {
return "GiveawayParticipantStatusDisallowedCountry(nil)"
}
type Alias GiveawayParticipantStatusDisallowedCountry
return fmt.Sprintf("GiveawayParticipantStatusDisallowedCountry%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GiveawayParticipantStatusDisallowedCountry) TypeID() uint32 {
return GiveawayParticipantStatusDisallowedCountryTypeID
}
// TypeName returns name of type in TL schema.
func (*GiveawayParticipantStatusDisallowedCountry) TypeName() string {
return "giveawayParticipantStatusDisallowedCountry"
}
// TypeInfo returns info about TL type.
func (g *GiveawayParticipantStatusDisallowedCountry) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "giveawayParticipantStatusDisallowedCountry",
ID: GiveawayParticipantStatusDisallowedCountryTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "UserCountryCode",
SchemaName: "user_country_code",
},
}
return typ
}
// Encode implements bin.Encoder.
func (g *GiveawayParticipantStatusDisallowedCountry) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil")
}
b.PutID(GiveawayParticipantStatusDisallowedCountryTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GiveawayParticipantStatusDisallowedCountry) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil")
}
b.PutString(g.UserCountryCode)
return nil
}
// Decode implements bin.Decoder.
func (g *GiveawayParticipantStatusDisallowedCountry) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil")
}
if err := b.ConsumeID(GiveawayParticipantStatusDisallowedCountryTypeID); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GiveawayParticipantStatusDisallowedCountry) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: field user_country_code: %w", err)
}
g.UserCountryCode = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GiveawayParticipantStatusDisallowedCountry) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil")
}
b.ObjStart()
b.PutID("giveawayParticipantStatusDisallowedCountry")
b.Comma()
b.FieldStart("user_country_code")
b.PutString(g.UserCountryCode)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GiveawayParticipantStatusDisallowedCountry) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("giveawayParticipantStatusDisallowedCountry"); err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: %w", err)
}
case "user_country_code":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: field user_country_code: %w", err)
}
g.UserCountryCode = value
default:
return b.Skip()
}
return nil
})
}
// GetUserCountryCode returns value of UserCountryCode field.
func (g *GiveawayParticipantStatusDisallowedCountry) GetUserCountryCode() (value string) {
if g == nil {
return
}
return g.UserCountryCode
}
// GiveawayParticipantStatusClassName is schema name of GiveawayParticipantStatusClass.
const GiveawayParticipantStatusClassName = "GiveawayParticipantStatus"
// GiveawayParticipantStatusClass represents GiveawayParticipantStatus generic type.
//
// Example:
//
// g, err := tdapi.DecodeGiveawayParticipantStatus(buf)
// if err != nil {
// panic(err)
// }
// switch v := g.(type) {
// case *tdapi.GiveawayParticipantStatusEligible: // giveawayParticipantStatusEligible#122ade97
// case *tdapi.GiveawayParticipantStatusParticipating: // giveawayParticipantStatusParticipating#1d53e36f
// case *tdapi.GiveawayParticipantStatusAlreadyWasMember: // giveawayParticipantStatusAlreadyWasMember#11f9b5a0
// case *tdapi.GiveawayParticipantStatusAdministrator: // giveawayParticipantStatusAdministrator#c84b3a75
// case *tdapi.GiveawayParticipantStatusDisallowedCountry: // giveawayParticipantStatusDisallowedCountry#700b645b
// default: panic(v)
// }
type GiveawayParticipantStatusClass interface {
bin.Encoder
bin.Decoder
bin.BareEncoder
bin.BareDecoder
construct() GiveawayParticipantStatusClass
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
TypeID() uint32
// TypeName returns name of type in TL schema.
TypeName() string
// String implements fmt.Stringer.
String() string
// Zero returns true if current object has a zero value.
Zero() bool
EncodeTDLibJSON(b tdjson.Encoder) error
DecodeTDLibJSON(b tdjson.Decoder) error
}
// DecodeGiveawayParticipantStatus implements binary de-serialization for GiveawayParticipantStatusClass.
func DecodeGiveawayParticipantStatus(buf *bin.Buffer) (GiveawayParticipantStatusClass, error) {
id, err := buf.PeekID()
if err != nil {
return nil, err
}
switch id {
case GiveawayParticipantStatusEligibleTypeID:
// Decoding giveawayParticipantStatusEligible#122ade97.
v := GiveawayParticipantStatusEligible{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case GiveawayParticipantStatusParticipatingTypeID:
// Decoding giveawayParticipantStatusParticipating#1d53e36f.
v := GiveawayParticipantStatusParticipating{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case GiveawayParticipantStatusAlreadyWasMemberTypeID:
// Decoding giveawayParticipantStatusAlreadyWasMember#11f9b5a0.
v := GiveawayParticipantStatusAlreadyWasMember{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case GiveawayParticipantStatusAdministratorTypeID:
// Decoding giveawayParticipantStatusAdministrator#c84b3a75.
v := GiveawayParticipantStatusAdministrator{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case GiveawayParticipantStatusDisallowedCountryTypeID:
// Decoding giveawayParticipantStatusDisallowedCountry#700b645b.
v := GiveawayParticipantStatusDisallowedCountry{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
default:
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", bin.NewUnexpectedID(id))
}
}
// DecodeTDLibJSONGiveawayParticipantStatus implements binary de-serialization for GiveawayParticipantStatusClass.
func DecodeTDLibJSONGiveawayParticipantStatus(buf tdjson.Decoder) (GiveawayParticipantStatusClass, error) {
id, err := buf.FindTypeID()
if err != nil {
return nil, err
}
switch id {
case "giveawayParticipantStatusEligible":
// Decoding giveawayParticipantStatusEligible#122ade97.
v := GiveawayParticipantStatusEligible{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case "giveawayParticipantStatusParticipating":
// Decoding giveawayParticipantStatusParticipating#1d53e36f.
v := GiveawayParticipantStatusParticipating{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case "giveawayParticipantStatusAlreadyWasMember":
// Decoding giveawayParticipantStatusAlreadyWasMember#11f9b5a0.
v := GiveawayParticipantStatusAlreadyWasMember{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case "giveawayParticipantStatusAdministrator":
// Decoding giveawayParticipantStatusAdministrator#c84b3a75.
v := GiveawayParticipantStatusAdministrator{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
case "giveawayParticipantStatusDisallowedCountry":
// Decoding giveawayParticipantStatusDisallowedCountry#700b645b.
v := GiveawayParticipantStatusDisallowedCountry{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err)
}
return &v, nil
default:
return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", tdjson.NewUnexpectedID(id))
}
}
// GiveawayParticipantStatus boxes the GiveawayParticipantStatusClass providing a helper.
type GiveawayParticipantStatusBox struct {
GiveawayParticipantStatus GiveawayParticipantStatusClass
}
// Decode implements bin.Decoder for GiveawayParticipantStatusBox.
func (b *GiveawayParticipantStatusBox) Decode(buf *bin.Buffer) error {
if b == nil {
return fmt.Errorf("unable to decode GiveawayParticipantStatusBox to nil")
}
v, err := DecodeGiveawayParticipantStatus(buf)
if err != nil {
return fmt.Errorf("unable to decode boxed value: %w", err)
}
b.GiveawayParticipantStatus = v
return nil
}
// Encode implements bin.Encode for GiveawayParticipantStatusBox.
func (b *GiveawayParticipantStatusBox) Encode(buf *bin.Buffer) error {
if b == nil || b.GiveawayParticipantStatus == nil {
return fmt.Errorf("unable to encode GiveawayParticipantStatusClass as nil")
}
return b.GiveawayParticipantStatus.Encode(buf)
}
// DecodeTDLibJSON implements bin.Decoder for GiveawayParticipantStatusBox.
func (b *GiveawayParticipantStatusBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
if b == nil {
return fmt.Errorf("unable to decode GiveawayParticipantStatusBox to nil")
}
v, err := DecodeTDLibJSONGiveawayParticipantStatus(buf)
if err != nil {
return fmt.Errorf("unable to decode boxed value: %w", err)
}
b.GiveawayParticipantStatus = v
return nil
}
// EncodeTDLibJSON implements bin.Encode for GiveawayParticipantStatusBox.
func (b *GiveawayParticipantStatusBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
if b == nil || b.GiveawayParticipantStatus == nil {
return fmt.Errorf("unable to encode GiveawayParticipantStatusClass as nil")
}
return b.GiveawayParticipantStatus.EncodeTDLibJSON(buf)
}