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
297 lines
8.4 KiB
Go
Generated
297 lines
8.4 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{}
|
|
)
|
|
|
|
// BotVerificationParameters represents TL type `botVerificationParameters#d4dca55f`.
|
|
type BotVerificationParameters struct {
|
|
// Identifier of the custom emoji that is used as the verification sign
|
|
IconCustomEmojiID int64
|
|
// Name of the organization that provides verification
|
|
OrganizationName string
|
|
// Default custom description of verification reason to be used as placeholder in
|
|
// setMessageSenderBotVerification; may be null if none
|
|
DefaultCustomDescription FormattedText
|
|
// True, if the bot is allowed to provide custom description for verified entities
|
|
CanSetCustomDescription bool
|
|
}
|
|
|
|
// BotVerificationParametersTypeID is TL type id of BotVerificationParameters.
|
|
const BotVerificationParametersTypeID = 0xd4dca55f
|
|
|
|
// Ensuring interfaces in compile-time for BotVerificationParameters.
|
|
var (
|
|
_ bin.Encoder = &BotVerificationParameters{}
|
|
_ bin.Decoder = &BotVerificationParameters{}
|
|
_ bin.BareEncoder = &BotVerificationParameters{}
|
|
_ bin.BareDecoder = &BotVerificationParameters{}
|
|
)
|
|
|
|
func (b *BotVerificationParameters) Zero() bool {
|
|
if b == nil {
|
|
return true
|
|
}
|
|
if !(b.IconCustomEmojiID == 0) {
|
|
return false
|
|
}
|
|
if !(b.OrganizationName == "") {
|
|
return false
|
|
}
|
|
if !(b.DefaultCustomDescription.Zero()) {
|
|
return false
|
|
}
|
|
if !(b.CanSetCustomDescription == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (b *BotVerificationParameters) String() string {
|
|
if b == nil {
|
|
return "BotVerificationParameters(nil)"
|
|
}
|
|
type Alias BotVerificationParameters
|
|
return fmt.Sprintf("BotVerificationParameters%+v", Alias(*b))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*BotVerificationParameters) TypeID() uint32 {
|
|
return BotVerificationParametersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*BotVerificationParameters) TypeName() string {
|
|
return "botVerificationParameters"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (b *BotVerificationParameters) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "botVerificationParameters",
|
|
ID: BotVerificationParametersTypeID,
|
|
}
|
|
if b == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "IconCustomEmojiID",
|
|
SchemaName: "icon_custom_emoji_id",
|
|
},
|
|
{
|
|
Name: "OrganizationName",
|
|
SchemaName: "organization_name",
|
|
},
|
|
{
|
|
Name: "DefaultCustomDescription",
|
|
SchemaName: "default_custom_description",
|
|
},
|
|
{
|
|
Name: "CanSetCustomDescription",
|
|
SchemaName: "can_set_custom_description",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (b *BotVerificationParameters) Encode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil")
|
|
}
|
|
buf.PutID(BotVerificationParametersTypeID)
|
|
return b.EncodeBare(buf)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (b *BotVerificationParameters) EncodeBare(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil")
|
|
}
|
|
buf.PutLong(b.IconCustomEmojiID)
|
|
buf.PutString(b.OrganizationName)
|
|
if err := b.DefaultCustomDescription.Encode(buf); err != nil {
|
|
return fmt.Errorf("unable to encode botVerificationParameters#d4dca55f: field default_custom_description: %w", err)
|
|
}
|
|
buf.PutBool(b.CanSetCustomDescription)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (b *BotVerificationParameters) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil")
|
|
}
|
|
if err := buf.ConsumeID(BotVerificationParametersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: %w", err)
|
|
}
|
|
return b.DecodeBare(buf)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (b *BotVerificationParameters) DecodeBare(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil")
|
|
}
|
|
{
|
|
value, err := buf.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field icon_custom_emoji_id: %w", err)
|
|
}
|
|
b.IconCustomEmojiID = value
|
|
}
|
|
{
|
|
value, err := buf.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field organization_name: %w", err)
|
|
}
|
|
b.OrganizationName = value
|
|
}
|
|
{
|
|
if err := b.DefaultCustomDescription.Decode(buf); err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field default_custom_description: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := buf.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field can_set_custom_description: %w", err)
|
|
}
|
|
b.CanSetCustomDescription = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (b *BotVerificationParameters) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil")
|
|
}
|
|
buf.ObjStart()
|
|
buf.PutID("botVerificationParameters")
|
|
buf.Comma()
|
|
buf.FieldStart("icon_custom_emoji_id")
|
|
buf.PutLong(b.IconCustomEmojiID)
|
|
buf.Comma()
|
|
buf.FieldStart("organization_name")
|
|
buf.PutString(b.OrganizationName)
|
|
buf.Comma()
|
|
buf.FieldStart("default_custom_description")
|
|
if err := b.DefaultCustomDescription.EncodeTDLibJSON(buf); err != nil {
|
|
return fmt.Errorf("unable to encode botVerificationParameters#d4dca55f: field default_custom_description: %w", err)
|
|
}
|
|
buf.Comma()
|
|
buf.FieldStart("can_set_custom_description")
|
|
buf.PutBool(b.CanSetCustomDescription)
|
|
buf.Comma()
|
|
buf.StripComma()
|
|
buf.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (b *BotVerificationParameters) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil")
|
|
}
|
|
|
|
return buf.Obj(func(buf tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := buf.ConsumeID("botVerificationParameters"); err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: %w", err)
|
|
}
|
|
case "icon_custom_emoji_id":
|
|
value, err := buf.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field icon_custom_emoji_id: %w", err)
|
|
}
|
|
b.IconCustomEmojiID = value
|
|
case "organization_name":
|
|
value, err := buf.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field organization_name: %w", err)
|
|
}
|
|
b.OrganizationName = value
|
|
case "default_custom_description":
|
|
if err := b.DefaultCustomDescription.DecodeTDLibJSON(buf); err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field default_custom_description: %w", err)
|
|
}
|
|
case "can_set_custom_description":
|
|
value, err := buf.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field can_set_custom_description: %w", err)
|
|
}
|
|
b.CanSetCustomDescription = value
|
|
default:
|
|
return buf.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetIconCustomEmojiID returns value of IconCustomEmojiID field.
|
|
func (b *BotVerificationParameters) GetIconCustomEmojiID() (value int64) {
|
|
if b == nil {
|
|
return
|
|
}
|
|
return b.IconCustomEmojiID
|
|
}
|
|
|
|
// GetOrganizationName returns value of OrganizationName field.
|
|
func (b *BotVerificationParameters) GetOrganizationName() (value string) {
|
|
if b == nil {
|
|
return
|
|
}
|
|
return b.OrganizationName
|
|
}
|
|
|
|
// GetDefaultCustomDescription returns value of DefaultCustomDescription field.
|
|
func (b *BotVerificationParameters) GetDefaultCustomDescription() (value FormattedText) {
|
|
if b == nil {
|
|
return
|
|
}
|
|
return b.DefaultCustomDescription
|
|
}
|
|
|
|
// GetCanSetCustomDescription returns value of CanSetCustomDescription field.
|
|
func (b *BotVerificationParameters) GetCanSetCustomDescription() (value bool) {
|
|
if b == nil {
|
|
return
|
|
}
|
|
return b.CanSetCustomDescription
|
|
}
|