7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
228 lines
5.5 KiB
Go
Generated
228 lines
5.5 KiB
Go
Generated
// 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{}
|
|
)
|
|
|
|
// FoundAffiliateProgram represents TL type `foundAffiliateProgram#c6636286`.
|
|
type FoundAffiliateProgram struct {
|
|
// User identifier of the bot created the program
|
|
BotUserID int64
|
|
// Information about the affiliate program
|
|
Info AffiliateProgramInfo
|
|
}
|
|
|
|
// FoundAffiliateProgramTypeID is TL type id of FoundAffiliateProgram.
|
|
const FoundAffiliateProgramTypeID = 0xc6636286
|
|
|
|
// Ensuring interfaces in compile-time for FoundAffiliateProgram.
|
|
var (
|
|
_ bin.Encoder = &FoundAffiliateProgram{}
|
|
_ bin.Decoder = &FoundAffiliateProgram{}
|
|
_ bin.BareEncoder = &FoundAffiliateProgram{}
|
|
_ bin.BareDecoder = &FoundAffiliateProgram{}
|
|
)
|
|
|
|
func (f *FoundAffiliateProgram) Zero() bool {
|
|
if f == nil {
|
|
return true
|
|
}
|
|
if !(f.BotUserID == 0) {
|
|
return false
|
|
}
|
|
if !(f.Info.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (f *FoundAffiliateProgram) String() string {
|
|
if f == nil {
|
|
return "FoundAffiliateProgram(nil)"
|
|
}
|
|
type Alias FoundAffiliateProgram
|
|
return fmt.Sprintf("FoundAffiliateProgram%+v", Alias(*f))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*FoundAffiliateProgram) TypeID() uint32 {
|
|
return FoundAffiliateProgramTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*FoundAffiliateProgram) TypeName() string {
|
|
return "foundAffiliateProgram"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (f *FoundAffiliateProgram) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "foundAffiliateProgram",
|
|
ID: FoundAffiliateProgramTypeID,
|
|
}
|
|
if f == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BotUserID",
|
|
SchemaName: "bot_user_id",
|
|
},
|
|
{
|
|
Name: "Info",
|
|
SchemaName: "info",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (f *FoundAffiliateProgram) Encode(b *bin.Buffer) error {
|
|
if f == nil {
|
|
return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil")
|
|
}
|
|
b.PutID(FoundAffiliateProgramTypeID)
|
|
return f.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (f *FoundAffiliateProgram) EncodeBare(b *bin.Buffer) error {
|
|
if f == nil {
|
|
return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil")
|
|
}
|
|
b.PutInt53(f.BotUserID)
|
|
if err := f.Info.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode foundAffiliateProgram#c6636286: field info: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (f *FoundAffiliateProgram) Decode(b *bin.Buffer) error {
|
|
if f == nil {
|
|
return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil")
|
|
}
|
|
if err := b.ConsumeID(FoundAffiliateProgramTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: %w", err)
|
|
}
|
|
return f.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (f *FoundAffiliateProgram) DecodeBare(b *bin.Buffer) error {
|
|
if f == nil {
|
|
return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field bot_user_id: %w", err)
|
|
}
|
|
f.BotUserID = value
|
|
}
|
|
{
|
|
if err := f.Info.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field info: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (f *FoundAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if f == nil {
|
|
return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("foundAffiliateProgram")
|
|
b.Comma()
|
|
b.FieldStart("bot_user_id")
|
|
b.PutInt53(f.BotUserID)
|
|
b.Comma()
|
|
b.FieldStart("info")
|
|
if err := f.Info.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode foundAffiliateProgram#c6636286: field info: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (f *FoundAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if f == nil {
|
|
return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("foundAffiliateProgram"); err != nil {
|
|
return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: %w", err)
|
|
}
|
|
case "bot_user_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field bot_user_id: %w", err)
|
|
}
|
|
f.BotUserID = value
|
|
case "info":
|
|
if err := f.Info.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field info: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetBotUserID returns value of BotUserID field.
|
|
func (f *FoundAffiliateProgram) GetBotUserID() (value int64) {
|
|
if f == nil {
|
|
return
|
|
}
|
|
return f.BotUserID
|
|
}
|
|
|
|
// GetInfo returns value of Info field.
|
|
func (f *FoundAffiliateProgram) GetInfo() (value AffiliateProgramInfo) {
|
|
if f == nil {
|
|
return
|
|
}
|
|
return f.Info
|
|
}
|